summaryrefslogtreecommitdiff
path: root/instr-daemon.c
diff options
context:
space:
mode:
authorroot <root@avtech.domain.avtechpulse.com>1970-01-01 09:00:47 +0900
committerroot <root@avtech.domain.avtechpulse.com>1970-01-01 09:00:47 +0900
commit73440e1fa3bf25bfff2ef625dd891883fb926c76 (patch)
tree60caeec35bd6d14377c0a62c6a5f1e98a318effa /instr-daemon.c
parentb69ba4a8be5b0410c9d93537be4824658904040e (diff)
verify power fail after 25 ms delay to stop OLO-reset surge glitches
Diffstat (limited to 'instr-daemon.c')
-rw-r--r--instr-daemon.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/instr-daemon.c b/instr-daemon.c
index 19536d3..e8d9897 100644
--- a/instr-daemon.c
+++ b/instr-daemon.c
@@ -355,7 +355,17 @@ static gboolean finish_boot (void)
static gboolean periodic_poll (void)
{
- if (globals.HWDetect.beaglebone && bus_getpin (POWER_FAIL)) {
+ gboolean power_fail;
+
+ power_fail = (globals.HWDetect.beaglebone && bus_getpin (POWER_FAIL));
+
+ if (power_fail) {
+ // verify after a short delay (25 ms), to ignore short power glitches
+ g_usleep (25e3);
+ power_fail = (globals.HWDetect.beaglebone && bus_getpin (POWER_FAIL));
+ }
+
+ if (power_fail) {
globals.Sys.shutdown_started = TRUE;