review fixes

This commit is contained in:
Mikayla
2025-11-07 23:19:14 +00:00
parent 50dedaa7c8
commit 2ecb662b0a
11 changed files with 46 additions and 42 deletions

View File

@@ -36,7 +36,8 @@ local changes = {
{ "v1.2.12", { "Added main UI theme", "Added front panel UI theme", "Added color accessibility modes" } },
{ "v1.3.3", { "Added standard with black off state color mode", "Added blue indicator color modes" } },
{ "v1.5.1", { "Added energy scale options" } },
{ "v1.6.13", { "Added option for Po/Pu pellet green/cyan pairing" } }
{ "v1.6.13", { "Added option for Po/Pu pellet green/cyan pairing" } },
{ "v1.7.0", { "Added support for wired communications modems" } }
}
---@class crd_configurator

View File

@@ -193,7 +193,7 @@ function coordinator.comms(version, nic, wl_nic, sv_watchdog)
apisessions.init(wl_nic, config)
end
-- PRIVATE FUNCTIONS --
--#region PRIVATE FUNCTIONS --
-- send a packet to the supervisor
---@param msg_type MGMT_TYPE|CRDN_TYPE
@@ -245,7 +245,9 @@ function coordinator.comms(version, nic, wl_nic, sv_watchdog)
_send_sv(PROTOCOL.SCADA_MGMT, MGMT_TYPE.KEEP_ALIVE, { srv_time, util.time() })
end
-- PUBLIC FUNCTIONS --
--#endregion
--#region PUBLIC FUNCTIONS --
---@class coord_comms
local public = {}
@@ -734,6 +736,8 @@ function coordinator.comms(version, nic, wl_nic, sv_watchdog)
---@nodiscard
function public.is_linked() return self.sv_linked end
--#endregion
return public
end

View File

@@ -290,11 +290,11 @@ end
-- toggle heartbeat indicator
function iocontrol.heartbeat() io.fp.ps.toggle("heartbeat") end
-- report presence of the wired modem
-- report presence of the wired comms modem
---@param has_modem boolean
function iocontrol.fp_has_wd_modem(has_modem) io.fp.ps.publish("has_wd_modem", has_modem) end
-- report presence of the wireless modem
-- report presence of the wireless comms modem
---@param has_modem boolean
function iocontrol.fp_has_wl_modem(has_modem) io.fp.ps.publish("has_wl_modem", has_modem) end
@@ -308,7 +308,7 @@ function iocontrol.fp_link_state(state) io.fp.ps.publish("link_state", state) en
-- report monitor connection state
---@param id string|integer unit ID for unit monitor, "main" for main monitor, or "flow" for flow monitor
---@param connected 1|2|3 1 for disconnected, 2 for connected but no view (may not fit), 3 for connected with view shown
---@param connected 1|2|3 1 for disconnected, 2 for connected but no view (may not fit), 3 for connected with view rendered
function iocontrol.fp_monitor_state(id, connected)
local name = nil

View File

@@ -3,7 +3,7 @@
--
local log = require("scada-common.log")
local ppm = require("scada-common.ppm")
local ppm = require("scada-common.ppm")
local tcd = require("scada-common.tcd")
local util = require("scada-common.util")
@@ -35,7 +35,7 @@ local changes = {
{ "v1.6.15", { "Added front panel UI theme", "Added color accessibility modes" } },
{ "v1.7.3", { "Added standard with black off state color mode", "Added blue indicator color modes" } },
{ "v1.8.21", { "Added option to invert emergency coolant redstone control" } },
{ "v1.9.1", { "Added support for wired communications modems" } }
{ "v1.10.0", { "Added support for wired communications modems" } }
}
---@class plc_configurator

View File

@@ -33,7 +33,7 @@ function databus.rps_scram() dbus_iface.rps_scram() end
-- transmit a command to the RPS to reset
function databus.rps_reset() dbus_iface.rps_reset() end
-- transmit firmware versions across the bus
-- transmit firmware versions
---@param plc_v string PLC version
---@param comms_v string comms version
function databus.tx_versions(plc_v, comms_v)
@@ -41,13 +41,13 @@ function databus.tx_versions(plc_v, comms_v)
databus.ps.publish("comms_version", comms_v)
end
-- transmit unit ID across the bus
-- transmit unit ID
---@param id integer unit ID
function databus.tx_id(id)
databus.ps.publish("unit_id", id)
end
-- transmit hardware status across the bus
-- transmit hardware status
---@param plc_state plc_state
function databus.tx_hw_status(plc_state)
databus.ps.publish("degraded", plc_state.degraded)
@@ -63,19 +63,19 @@ function databus.tx_rt_status(thread, ok)
databus.ps.publish(util.c("routine__", thread), ok)
end
-- transmit supervisor link state across the bus
-- transmit supervisor link state
---@param state integer
function databus.tx_link_state(state)
databus.ps.publish("link_state", state)
end
-- transmit reactor enable state across the bus
-- transmit reactor enable state
---@param active any reactor active
function databus.tx_reactor_state(active)
databus.ps.publish("reactor_active", active == true)
end
-- transmit RPS data across the bus
-- transmit RPS data
---@param tripped boolean RPS tripped
---@param status boolean[] RPS status
---@param emer_cool_active boolean RPS activated the emergency coolant

View File

@@ -19,7 +19,7 @@ local plc = require("reactor-plc.plc")
local renderer = require("reactor-plc.renderer")
local threads = require("reactor-plc.threads")
local R_PLC_VERSION = "v1.9.1"
local R_PLC_VERSION = "v1.10.0"
local println = util.println
local println_ts = util.println_ts

View File

@@ -23,7 +23,7 @@ databus.RTU_HW_STATE = RTU_HW_STATE
-- call to toggle heartbeat signal
function databus.heartbeat() databus.ps.toggle("heartbeat") end
-- transmit firmware versions across the bus
-- transmit firmware versions
---@param rtu_v string RTU version
---@param comms_v string comms version
function databus.tx_versions(rtu_v, comms_v)
@@ -31,32 +31,32 @@ function databus.tx_versions(rtu_v, comms_v)
databus.ps.publish("comms_version", comms_v)
end
-- transmit hardware status for the wireless comms modem connection state
---@param has_modem boolean
function databus.tx_hw_wl_modem(has_modem)
databus.ps.publish("has_wl_modem", has_modem)
end
-- transmit hardware status for the wired comms modem connection state
-- transmit hardware status for the wired comms modem
---@param has_modem boolean
function databus.tx_hw_wd_modem(has_modem)
databus.ps.publish("has_wd_modem", has_modem)
end
-- transmit hardware status for the wireless comms modem
---@param has_modem boolean
function databus.tx_hw_wl_modem(has_modem)
databus.ps.publish("has_wl_modem", has_modem)
end
-- transmit the number of speakers connected
---@param count integer
function databus.tx_hw_spkr_count(count)
databus.ps.publish("speaker_count", count)
end
-- transmit unit hardware type across the bus
-- transmit unit hardware type
---@param uid integer unit ID
---@param type RTU_UNIT_TYPE
function databus.tx_unit_hw_type(uid, type)
databus.ps.publish("unit_type_" .. uid, type)
end
-- transmit unit hardware status across the bus
-- transmit unit hardware status
---@param uid integer unit ID
---@param status RTU_HW_STATE
function databus.tx_unit_hw_status(uid, status)
@@ -70,7 +70,7 @@ function databus.tx_rt_status(thread, ok)
databus.ps.publish(util.c("routine__", thread), ok)
end
-- transmit supervisor link state across the bus
-- transmit supervisor link state
---@param state integer
function databus.tx_link_state(state)
databus.ps.publish("link_state", state)

View File

@@ -397,7 +397,6 @@ function rtu.comms(version, nic, conn_watchdog)
s_pkt.make(self.sv_addr, self.seq_num, PROTOCOL.MODBUS_TCP, m_pkt.raw_sendable())
---@diagnostic disable-next-line: need-check-nil
nic.transmit(config.SVR_Channel, config.RTU_Channel, s_pkt)
self.seq_num = self.seq_num + 1
end
@@ -430,8 +429,6 @@ function rtu.comms(version, nic, conn_watchdog)
---@param distance integer
---@return modbus_frame|mgmt_frame|nil packet
function public.parse_packet(side, sender, reply_to, message, distance)
-- unreachable if there isn't a nic
---@diagnostic disable-next-line: need-check-nil
local s_pkt = nic.receive(side, sender, reply_to, message, distance)
local pkt = nil

View File

@@ -118,7 +118,7 @@ local function main()
-- modem and speaker initialization
if not backplane.init(config, __shared_memory) then return end
log.debug("boot> running uinit()")
log.debug("startup> running uinit()")
if uinit(config, __shared_memory) then
-- start UI

View File

@@ -16,7 +16,7 @@ databus.ps = psil.create()
-- call to toggle heartbeat signal
function databus.heartbeat() databus.ps.toggle("heartbeat") end
-- transmit firmware versions across the bus
-- transmit firmware versions
---@param sv_v string supervisor version
---@param comms_v string comms version
function databus.tx_versions(sv_v, comms_v)
@@ -24,18 +24,18 @@ function databus.tx_versions(sv_v, comms_v)
databus.ps.publish("comms_version", comms_v)
end
-- transmit hardware status for the wireless comms modem connection state
---@param has_modem boolean
function databus.tx_hw_wl_modem(has_modem)
databus.ps.publish("has_wl_modem", has_modem)
end
-- transmit hardware status for the wired comms modem connection state
-- transmit hardware status for the wired comms modem
---@param has_modem boolean
function databus.tx_hw_wd_modem(has_modem)
databus.ps.publish("has_wd_modem", has_modem)
end
-- transmit hardware status for the wireless comms modem
---@param has_modem boolean
function databus.tx_hw_wl_modem(has_modem)
databus.ps.publish("has_wl_modem", has_modem)
end
-- transmit PLC firmware version and session connection state
---@param reactor_id integer reactor unit ID
---@param fw string firmware version

View File

@@ -104,11 +104,11 @@ function supervisor.load_config()
cfv.assert((config.WiredModem == false) or (type(config.WiredModem) == "string"))
cfv.assert((config.WirelessModem == true) or (type(config.WiredModem) == "string"))
cfv.assert_type_num(config.PLC_Listen)
cfv.assert_type_int(config.PLC_Listen)
cfv.assert_range(config.PLC_Listen, 0, 2)
cfv.assert_type_num(config.RTU_Listen)
cfv.assert_type_int(config.RTU_Listen)
cfv.assert_range(config.RTU_Listen, 0, 2)
cfv.assert_type_num(config.CRD_Listen)
cfv.assert_type_int(config.CRD_Listen)
cfv.assert_range(config.CRD_Listen, 0, 2)
cfv.assert_type_bool(config.PocketEnabled)
@@ -398,6 +398,8 @@ function supervisor.comms(_version, fp_ok, facility)
if nic then
s_pkt = nic.receive(side, sender, reply_to, message, distance)
else
log.error("parse_packet(" .. side .. "): received a packet from an interface without a nic?")
end
if s_pkt then
@@ -418,7 +420,7 @@ function supervisor.comms(_version, fp_ok, facility)
local crdn_pkt = comms.crdn_packet()
if crdn_pkt.decode(s_pkt) then pkt = crdn_pkt.get() end
else
log.debug("receive[" .. side .. "] attempted parse of illegal packet type " .. s_pkt.protocol(), true)
log.debug("parse_packet(" .. side .. "): attempted parse of illegal packet type " .. s_pkt.protocol(), true)
end
end