diff options
author | root <root@avtech.domain.avtechpulse.com> | 2000-01-01 00:00:33 +0900 |
---|---|---|
committer | root <root@avtech.domain.avtechpulse.com> | 2000-01-01 00:00:33 +0900 |
commit | 31185b1857685bf4bd7638a24ed19bf1c500ebf1 (patch) | |
tree | 8b0bf52d6a16f7d3782de1fc0c1451d24bba4400 /instr-daemon.c | |
parent | 6856fcdadacf36c0d2a595956fa0756b7f1e3817 (diff) |
try to turn output off on power fail
Diffstat (limited to 'instr-daemon.c')
-rw-r--r-- | instr-daemon.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/instr-daemon.c b/instr-daemon.c index 1612e9b..38ea23e 100644 --- a/instr-daemon.c +++ b/instr-daemon.c @@ -392,19 +392,23 @@ static gboolean periodic_poll (void) { gboolean power_fail; - // TODO - remove Olimex qualification once ethernet-enabled carrier board is available - power_fail = globals.HWDetect.has_gpio && bus_getpin (POWER_FAIL); + power_fail = 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.has_gpio && bus_getpin (POWER_FAIL)); + power_fail = bus_getpin (POWER_FAIL); } if (power_fail) { globals.Sys.shutdown_started = TRUE; + int i; + for (i=0;i<max_channels;i++) { + Set_Output_State(i,output_off); + } + while (globals.Sys.flash_write_in_progress) { g_usleep(1000); } |