From f4be6519e84704b5f87e780b22e300b14eb21201 Mon Sep 17 00:00:00 2001 From: Mikayla Fischler Date: Mon, 26 Aug 2024 20:30:30 -0400 Subject: [PATCH] refactoring and removed unused set_waste_ack --- coordinator/coordinator.lua | 6 +++--- coordinator/iocontrol.lua | 1 - coordinator/process.lua | 6 +++--- supervisor/facility.lua | 2 +- supervisor/session/coordinator.lua | 2 +- 5 files changed, 8 insertions(+), 9 deletions(-) diff --git a/coordinator/coordinator.lua b/coordinator/coordinator.lua index e6c7671..7d5ce0f 100644 --- a/coordinator/coordinator.lua +++ b/coordinator/coordinator.lua @@ -386,7 +386,7 @@ function coordinator.comms(version, nic, sv_watchdog) end -- send the auto process control configuration with a start command - ---@param auto_cfg coord_auto_config configuration + ---@param auto_cfg sys_auto_config configuration function public.send_auto_start(auto_cfg) _send_sv(PROTOCOL.SCADA_CRDN, CRDN_TYPE.FAC_CMD, { FAC_COMMAND.START, auto_cfg.mode, auto_cfg.burn_target, auto_cfg.charge_target, auto_cfg.gen_target, auto_cfg.limits @@ -632,11 +632,11 @@ function coordinator.comms(version, nic, sv_watchdog) elseif cmd == UNIT_COMMAND.SET_BURN then unit.set_burn_ack(ack) elseif cmd == UNIT_COMMAND.SET_WASTE then - unit.set_waste_ack(ack) + -- updated by unit updates elseif cmd == UNIT_COMMAND.ACK_ALL_ALARMS then unit.ack_alarms_ack(ack) elseif cmd == UNIT_COMMAND.SET_GROUP then - -- UI will be updated to display current group if changed successfully + -- updated by unit updates else log.debug(util.c("received unit command ack with unknown command ", cmd)) end diff --git a/coordinator/iocontrol.lua b/coordinator/iocontrol.lua index 7444ef7..636a8b7 100644 --- a/coordinator/iocontrol.lua +++ b/coordinator/iocontrol.lua @@ -200,7 +200,6 @@ function iocontrol.init(conf, comms, temp_scale, energy_scale) reset_rps_ack = __generic_ack, ack_alarms_ack = __generic_ack, set_burn_ack = __generic_ack, - set_waste_ack = __generic_ack, alarm_callbacks = { c_breach = { ack = function () ack(1) end, reset = function () reset(1) end }, diff --git a/coordinator/process.lua b/coordinator/process.lua index 0615e30..277b83f 100644 --- a/coordinator/process.lua +++ b/coordinator/process.lua @@ -19,9 +19,9 @@ local process = {} local self = { io = nil, ---@type ioctl comms = nil, ---@type coord_comms - ---@class coord_control_states + ---@class sys_control_states control_states = { - ---@class coord_auto_config + ---@class sys_auto_config process = { mode = PROCESS.INACTIVE, burn_target = 0.0, @@ -55,7 +55,7 @@ function process.init(iocontrol, coord_comms) end local ctrl_states = settings.get("ControlStates", {}) - local config = ctrl_states.process ---@type coord_auto_config + local config = ctrl_states.process ---@type sys_auto_config -- facility auto control configuration if type(config) == "table" then diff --git a/supervisor/facility.lua b/supervisor/facility.lua index e25c8c8..88486bc 100644 --- a/supervisor/facility.lua +++ b/supervisor/facility.lua @@ -379,7 +379,7 @@ function facility.new(config) function public.auto_stop() self.mode = PROCESS.INACTIVE end -- set automatic control configuration and start the process - ---@param auto_cfg coord_auto_config configuration + ---@param auto_cfg sys_auto_config configuration ---@return table response ready state (successfully started) and current configuration (after updating) function public.auto_start(auto_cfg) local charge_scaler = 1000000 -- convert MFE to FE diff --git a/supervisor/session/coordinator.lua b/supervisor/session/coordinator.lua index 99aa027..4d0dcd6 100644 --- a/supervisor/session/coordinator.lua +++ b/supervisor/session/coordinator.lua @@ -245,7 +245,7 @@ function coordinator.new_session(id, s_addr, i_seq_num, in_queue, out_queue, tim _send(CRDN_TYPE.FAC_CMD, { cmd, true }) elseif cmd == FAC_COMMAND.START then if pkt.length == 6 then - ---@type coord_auto_config + ---@type sys_auto_config local config = { mode = pkt.data[2], burn_target = pkt.data[3],