From 73440e1fa3bf25bfff2ef625dd891883fb926c76 Mon Sep 17 00:00:00 2001 From: root Date: Thu, 1 Jan 1970 09:00:47 +0900 Subject: verify power fail after 25 ms delay to stop OLO-reset surge glitches --- instr-daemon.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'instr-daemon.c') 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; -- cgit