refactoring and removed unused set_waste_ack

This commit is contained in:
Mikayla Fischler 2024-08-26 20:30:30 -04:00
parent 6b20445446
commit f4be6519e8
5 changed files with 8 additions and 9 deletions

View File

@ -386,7 +386,7 @@ function coordinator.comms(version, nic, sv_watchdog)
end end
-- send the auto process control configuration with a start command -- 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) function public.send_auto_start(auto_cfg)
_send_sv(PROTOCOL.SCADA_CRDN, CRDN_TYPE.FAC_CMD, { _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 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 elseif cmd == UNIT_COMMAND.SET_BURN then
unit.set_burn_ack(ack) unit.set_burn_ack(ack)
elseif cmd == UNIT_COMMAND.SET_WASTE then elseif cmd == UNIT_COMMAND.SET_WASTE then
unit.set_waste_ack(ack) -- updated by unit updates
elseif cmd == UNIT_COMMAND.ACK_ALL_ALARMS then elseif cmd == UNIT_COMMAND.ACK_ALL_ALARMS then
unit.ack_alarms_ack(ack) unit.ack_alarms_ack(ack)
elseif cmd == UNIT_COMMAND.SET_GROUP then elseif cmd == UNIT_COMMAND.SET_GROUP then
-- UI will be updated to display current group if changed successfully -- updated by unit updates
else else
log.debug(util.c("received unit command ack with unknown command ", cmd)) log.debug(util.c("received unit command ack with unknown command ", cmd))
end end

View File

@ -200,7 +200,6 @@ function iocontrol.init(conf, comms, temp_scale, energy_scale)
reset_rps_ack = __generic_ack, reset_rps_ack = __generic_ack,
ack_alarms_ack = __generic_ack, ack_alarms_ack = __generic_ack,
set_burn_ack = __generic_ack, set_burn_ack = __generic_ack,
set_waste_ack = __generic_ack,
alarm_callbacks = { alarm_callbacks = {
c_breach = { ack = function () ack(1) end, reset = function () reset(1) end }, c_breach = { ack = function () ack(1) end, reset = function () reset(1) end },

View File

@ -19,9 +19,9 @@ local process = {}
local self = { local self = {
io = nil, ---@type ioctl io = nil, ---@type ioctl
comms = nil, ---@type coord_comms comms = nil, ---@type coord_comms
---@class coord_control_states ---@class sys_control_states
control_states = { control_states = {
---@class coord_auto_config ---@class sys_auto_config
process = { process = {
mode = PROCESS.INACTIVE, mode = PROCESS.INACTIVE,
burn_target = 0.0, burn_target = 0.0,
@ -55,7 +55,7 @@ function process.init(iocontrol, coord_comms)
end end
local ctrl_states = settings.get("ControlStates", {}) 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 -- facility auto control configuration
if type(config) == "table" then if type(config) == "table" then

View File

@ -379,7 +379,7 @@ function facility.new(config)
function public.auto_stop() self.mode = PROCESS.INACTIVE end function public.auto_stop() self.mode = PROCESS.INACTIVE end
-- set automatic control configuration and start the process -- 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) ---@return table response ready state (successfully started) and current configuration (after updating)
function public.auto_start(auto_cfg) function public.auto_start(auto_cfg)
local charge_scaler = 1000000 -- convert MFE to FE local charge_scaler = 1000000 -- convert MFE to FE

View File

@ -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 }) _send(CRDN_TYPE.FAC_CMD, { cmd, true })
elseif cmd == FAC_COMMAND.START then elseif cmd == FAC_COMMAND.START then
if pkt.length == 6 then if pkt.length == 6 then
---@type coord_auto_config ---@type sys_auto_config
local config = { local config = {
mode = pkt.data[2], mode = pkt.data[2],
burn_target = pkt.data[3], burn_target = pkt.data[3],