From 8b7ef47aad5920d23760265e21f297c182c51bd4 Mon Sep 17 00:00:00 2001 From: Mikayla Fischler Date: Wed, 4 May 2022 10:00:21 -0400 Subject: [PATCH] removed references to alarms and now sends status on shutdown --- reactor-plc/startup.lua | 12 ++++++++++-- reactor-plc/threads.lua | 4 ---- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/reactor-plc/startup.lua b/reactor-plc/startup.lua index 66dc3b2..21c8372 100644 --- a/reactor-plc/startup.lua +++ b/reactor-plc/startup.lua @@ -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") diff --git a/reactor-plc/threads.lua b/reactor-plc/threads.lua index ee23710..4ba1ba5 100644 --- a/reactor-plc/threads.lua +++ b/reactor-plc/threads.lua @@ -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