removed references to alarms and now sends status on shutdown

This commit is contained in:
Mikayla Fischler 2022-05-04 10:00:21 -04:00
parent e253a7b4ff
commit 8b7ef47aad
2 changed files with 10 additions and 6 deletions

View File

@ -13,7 +13,7 @@ os.loadAPI("config.lua")
os.loadAPI("plc.lua")
os.loadAPI("threads.lua")
local R_PLC_VERSION = "alpha-v0.5.1"
local R_PLC_VERSION = "alpha-v0.5.2"
local print = util.print
local println = util.println
@ -145,11 +145,19 @@ if __shared_memory.networked then
-- run threads
parallel.waitForAll(main_thread.exec, iss_thread.exec, comms_thread_tx.exec, comms_thread_rx.exec, sp_ctrl_thread.exec)
if plc_state.init_ok then
-- send status one last time after ISS shutdown
plc_comms.send_status(plc_state.degraded)
plc_comms.send_iss_status()
-- close connection
plc_comms.close(conn_watchdog)
end
else
-- run threads, excluding comms
parallel.waitForAll(main_thread.exec, iss_thread.exec)
end
-- send an alarm: plc_comms.send_alarm(ALARMS.PLC_SHUTDOWN) ?
println_ts("exited")
log._info("exited")

View File

@ -92,7 +92,6 @@ function thread__main(smem, init)
log._error("reactor disconnected!")
plc_state.no_reactor = true
plc_state.degraded = true
-- send an alarm: plc_comms.send_alarm(ALARMS.PLC_PERI_DC) ?
elseif networked and device.type == "modem" then
-- we only care if this is our wireless modem
if device.dev == plc_dev.modem then
@ -170,8 +169,6 @@ function thread__main(smem, init)
-- check for termination request
if event == "terminate" or ppm.should_terminate() then
log._info("terminate requested, main thread exiting")
-- close connection
plc_comms.close(conn_watchdog)
-- iss handles reactor shutdown
plc_state.shutdown = true
break
@ -293,7 +290,6 @@ function thread__iss(smem)
println_ts("reactor disabled")
log._info("iss thread reactor SCRAM OK")
else
-- send an alarm: plc_comms.send_alarm(ALARMS.PLC_LOST_CONTROL) ?
println_ts("exiting, reactor failed to disable")
log._error("iss thread failed to SCRAM reactor on exit")
end