minor formatting update
This commit is contained in:
1 parent
e4e0d92857
commit
f9d527d3f3
1 file changed
+12
-4
@@ -101,8 +101,8 @@ void flagdump(int flags)
|
|||||||
|
|
||||||
int readline()
|
int readline()
|
||||||
{
|
{
|
||||||
static int count = 0;
|
static int count = 0;
|
||||||
static int state = U_OK;
|
static int state = U_OK;
|
||||||
static int lastnextstate = U_OK;
|
static int lastnextstate = U_OK;
|
||||||
int nextstate;
|
int nextstate;
|
||||||
|
|
||||||
@@ -118,9 +118,13 @@ int readline()
|
|||||||
if ( (flags & POWER_GOOD_BITS) != POWER_GOOD_BITS )
|
if ( (flags & POWER_GOOD_BITS) != POWER_GOOD_BITS )
|
||||||
{
|
{
|
||||||
if ( (flags & BATT_GOOD_BITS) != BATT_GOOD_BITS )
|
if ( (flags & BATT_GOOD_BITS) != BATT_GOOD_BITS )
|
||||||
|
{
|
||||||
nextstate = U_LOW;
|
nextstate = U_LOW;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
nextstate = U_FAIL;
|
nextstate = U_FAIL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// count the time we've been in this new state
|
// count the time we've been in this new state
|
||||||
@@ -132,7 +136,9 @@ int readline()
|
|||||||
{
|
{
|
||||||
// keep this from overflowing
|
// keep this from overflowing
|
||||||
if ( count <= DEBOUNCE_TIME )
|
if ( count <= DEBOUNCE_TIME )
|
||||||
|
{
|
||||||
count += POLL_INTERVAL;
|
count += POLL_INTERVAL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
lastnextstate = nextstate;
|
lastnextstate = nextstate;
|
||||||
|
|
||||||
@@ -150,7 +156,9 @@ void term()
|
|||||||
syslog(LOG_NOTICE,"caught signal.");
|
syslog(LOG_NOTICE,"caught signal.");
|
||||||
init();
|
init();
|
||||||
if ( fd != -1 )
|
if ( fd != -1 )
|
||||||
|
{
|
||||||
close(fd);
|
close(fd);
|
||||||
|
}
|
||||||
syslog(LOG_NOTICE,"terminated.");
|
syslog(LOG_NOTICE,"terminated.");
|
||||||
exit(EXIT_SUCCESS);
|
exit(EXIT_SUCCESS);
|
||||||
}
|
}
|
||||||
@@ -233,7 +241,9 @@ int main(int argc,char** argv)
|
|||||||
{
|
{
|
||||||
// warn if we just got the signal!
|
// warn if we just got the signal!
|
||||||
if ( laststate != U_LOW )
|
if ( laststate != U_LOW )
|
||||||
|
{
|
||||||
lowmessage();
|
lowmessage();
|
||||||
|
}
|
||||||
|
|
||||||
// set kill signal
|
// set kill signal
|
||||||
if ( killtime == 0 )
|
if ( killtime == 0 )
|
||||||
@@ -289,5 +299,3 @@ int main(int argc,char** argv)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Reference in new issue
Block a user