From 3b2fb0028515a475850e6df46c9a2aa7dd947dfa Mon Sep 17 00:00:00 2001 From: Mikayla Fischler Date: Sun, 9 Feb 2025 13:37:22 -0500 Subject: [PATCH] cleanup --- coordinator/startup.lua | 2 +- supervisor/facility.lua | 4 ++-- supervisor/session/coordinator.lua | 10 +++++----- supervisor/session/svsessions.lua | 3 +-- supervisor/supervisor.lua | 5 ++++- 5 files changed, 13 insertions(+), 11 deletions(-) diff --git a/coordinator/startup.lua b/coordinator/startup.lua index d3413e3..a7209e8 100644 --- a/coordinator/startup.lua +++ b/coordinator/startup.lua @@ -19,7 +19,7 @@ local renderer = require("coordinator.renderer") local sounder = require("coordinator.sounder") local threads = require("coordinator.threads") -local COORDINATOR_VERSION = "v1.6.4" +local COORDINATOR_VERSION = "v1.6.5" local CHUNK_LOAD_DELAY_S = 30.0 diff --git a/supervisor/facility.lua b/supervisor/facility.lua index 70b7ad0..a4fb432 100644 --- a/supervisor/facility.lua +++ b/supervisor/facility.lua @@ -79,7 +79,7 @@ function facility.new(config) io_ctl = nil, ---@type rs_controller -- process control recovery = RCV_STATE.INACTIVE, ---@type RECOVERY_STATE - recovery_boot_state = nil, ---@type sv_control_state|nil + recovery_boot_state = nil, ---@type sv_boot_state|nil last_unit_states = {}, ---@type boolean[] units_ready = false, mode = PROCESS.INACTIVE, ---@type PROCESS @@ -403,7 +403,7 @@ function facility.new(config) end -- initialize startup recovery - ---@param state sv_control_state|nil + ---@param state sv_boot_state|nil function public.startup_recovery_init(state) if self.recovery == RCV_STATE.INACTIVE and state then self.recovery_boot_state = state diff --git a/supervisor/session/coordinator.lua b/supervisor/session/coordinator.lua index a606ada..aeabc72 100644 --- a/supervisor/session/coordinator.lua +++ b/supervisor/session/coordinator.lua @@ -240,11 +240,11 @@ function coordinator.new_session(id, s_addr, i_seq_num, in_queue, out_queue, tim ---@type start_auto_config local config = { - mode = pkt.data[1], ---@type PROCESS - burn_target = pkt.data[2], ---@type number - charge_target = pkt.data[3], ---@type number - gen_target = pkt.data[4], ---@type number - limits = pkt.data[5] ---@type number[] + mode = pkt.data[1], + burn_target = pkt.data[2], + charge_target = pkt.data[3], + gen_target = pkt.data[4], + limits = pkt.data[5] } facility.startup_recovery_start(config) diff --git a/supervisor/session/svsessions.lua b/supervisor/session/svsessions.lua index 59d8e70..087fe19 100644 --- a/supervisor/session/svsessions.lua +++ b/supervisor/session/svsessions.lua @@ -392,9 +392,8 @@ function svsessions.init(nic, fp_ok, config, facility) conns.tanks[1] = true end - self.dev_dbg.connected.units[i] = conns - self.plc_ini_reset[i] = true + self.dev_dbg.connected.units[i] = conns end end diff --git a/supervisor/supervisor.lua b/supervisor/supervisor.lua index 4df3bc5..47ee6d2 100644 --- a/supervisor/supervisor.lua +++ b/supervisor/supervisor.lua @@ -19,11 +19,14 @@ local config = {} supervisor.config = config +-- control state from last unexpected shutdown +supervisor.boot_state = nil ---@type sv_boot_state|nil + -- load the supervisor configuration and startup state function supervisor.load_config() if not settings.load("/supervisor.settings") then return false end - ---@class sv_control_state + ---@class sv_boot_state local boot_state = { mode = settings.get("LastProcessState"), ---@type PROCESS unit_states = settings.get("LastUnitStates") ---@type boolean[]