Compare commits
6 Commits
643-multi-
...
647-update
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
db1b90df90 | ||
|
|
ebfdec2294 | ||
|
|
68ae061ed3 | ||
|
|
7f951a985b | ||
|
|
965fa0c7d1 | ||
|
|
99742c621a |
@@ -33,6 +33,15 @@ local HIGH_RTT = 1500 -- 3.33x as long as expected w/ 0 ping
|
|||||||
|
|
||||||
local iocontrol = {}
|
local iocontrol = {}
|
||||||
|
|
||||||
|
local _ioctl = {
|
||||||
|
-- connection states for status evaluation
|
||||||
|
wd_modem = true,
|
||||||
|
wl_modem = true,
|
||||||
|
speaker = true,
|
||||||
|
monitor_states = {},
|
||||||
|
coroutines = {}
|
||||||
|
}
|
||||||
|
|
||||||
---@class ioctl
|
---@class ioctl
|
||||||
local io = {
|
local io = {
|
||||||
---@class ioctl_front_panel
|
---@class ioctl_front_panel
|
||||||
@@ -279,6 +288,15 @@ end
|
|||||||
|
|
||||||
--#region Front Panel PSIL
|
--#region Front Panel PSIL
|
||||||
|
|
||||||
|
-- evaluate and publish system health status
|
||||||
|
local function fp_eval_status()
|
||||||
|
local ok = _ioctl.wd_modem and _ioctl.wl_modem and _ioctl.speaker
|
||||||
|
for _, v in pairs(_ioctl.monitor_states) do ok = ok and v end
|
||||||
|
for _, v in pairs(_ioctl.coroutines) do ok = ok and v end
|
||||||
|
|
||||||
|
io.fp.ps.publish("status", ok)
|
||||||
|
end
|
||||||
|
|
||||||
-- toggle heartbeat indicator
|
-- toggle heartbeat indicator
|
||||||
function iocontrol.heartbeat() io.fp.ps.toggle("heartbeat") end
|
function iocontrol.heartbeat() io.fp.ps.toggle("heartbeat") end
|
||||||
|
|
||||||
@@ -292,15 +310,30 @@ end
|
|||||||
|
|
||||||
-- report presence of the wired comms modem
|
-- report presence of the wired comms modem
|
||||||
---@param has_modem boolean
|
---@param has_modem boolean
|
||||||
function iocontrol.fp_has_wd_modem(has_modem) io.fp.ps.publish("has_wd_modem", has_modem) end
|
function iocontrol.fp_has_wd_modem(has_modem)
|
||||||
|
io.fp.ps.publish("has_wd_modem", has_modem)
|
||||||
|
|
||||||
|
_ioctl.wd_modem = has_modem
|
||||||
|
fp_eval_status()
|
||||||
|
end
|
||||||
|
|
||||||
-- report presence of the wireless comms modem
|
-- report presence of the wireless comms modem
|
||||||
---@param has_modem boolean
|
---@param has_modem boolean
|
||||||
function iocontrol.fp_has_wl_modem(has_modem) io.fp.ps.publish("has_wl_modem", has_modem) end
|
function iocontrol.fp_has_wl_modem(has_modem)
|
||||||
|
io.fp.ps.publish("has_wl_modem", has_modem)
|
||||||
|
|
||||||
|
_ioctl.wl_modem = has_modem
|
||||||
|
fp_eval_status()
|
||||||
|
end
|
||||||
|
|
||||||
-- report presence of the speaker
|
-- report presence of the speaker
|
||||||
---@param has_speaker boolean
|
---@param has_speaker boolean
|
||||||
function iocontrol.fp_has_speaker(has_speaker) io.fp.ps.publish("has_speaker", has_speaker) end
|
function iocontrol.fp_has_speaker(has_speaker)
|
||||||
|
io.fp.ps.publish("has_speaker", has_speaker)
|
||||||
|
|
||||||
|
_ioctl.speaker = has_speaker
|
||||||
|
fp_eval_status()
|
||||||
|
end
|
||||||
|
|
||||||
-- report supervisor link state
|
-- report supervisor link state
|
||||||
---@param state integer
|
---@param state integer
|
||||||
@@ -322,6 +355,9 @@ function iocontrol.fp_monitor_state(id, connected)
|
|||||||
|
|
||||||
if name ~= nil then
|
if name ~= nil then
|
||||||
io.fp.ps.publish(name, connected)
|
io.fp.ps.publish(name, connected)
|
||||||
|
|
||||||
|
_ioctl.monitor_states[name] = connected ~= 1
|
||||||
|
fp_eval_status()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -329,7 +365,12 @@ end
|
|||||||
---@param thread string thread name
|
---@param thread string thread name
|
||||||
---@param ok boolean thread state
|
---@param ok boolean thread state
|
||||||
function iocontrol.fp_rt_status(thread, ok)
|
function iocontrol.fp_rt_status(thread, ok)
|
||||||
io.fp.ps.publish(util.c("routine__", thread), ok)
|
local name = util.c("routine__", thread)
|
||||||
|
|
||||||
|
io.fp.ps.publish(name, ok)
|
||||||
|
|
||||||
|
_ioctl.coroutines[name] = ok
|
||||||
|
fp_eval_status()
|
||||||
end
|
end
|
||||||
|
|
||||||
-- report PKT firmware version and PKT session connection state
|
-- report PKT firmware version and PKT session connection state
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ local renderer = require("coordinator.renderer")
|
|||||||
local sounder = require("coordinator.sounder")
|
local sounder = require("coordinator.sounder")
|
||||||
local threads = require("coordinator.threads")
|
local threads = require("coordinator.threads")
|
||||||
|
|
||||||
local COORDINATOR_VERSION = "v1.7.0"
|
local COORDINATOR_VERSION = "v1.7.1"
|
||||||
|
|
||||||
local CHUNK_LOAD_DELAY_S = 30.0
|
local CHUNK_LOAD_DELAY_S = 30.0
|
||||||
|
|
||||||
|
|||||||
@@ -59,9 +59,9 @@ local function init(panel, config)
|
|||||||
|
|
||||||
local status = LED{parent=system,label="STATUS",colors=cpair(colors.green,colors.red)}
|
local status = LED{parent=system,label="STATUS",colors=cpair(colors.green,colors.red)}
|
||||||
local heartbeat = LED{parent=system,label="HEARTBEAT",colors=led_grn}
|
local heartbeat = LED{parent=system,label="HEARTBEAT",colors=led_grn}
|
||||||
status.update(true)
|
|
||||||
system.line_break()
|
system.line_break()
|
||||||
|
|
||||||
|
status.register(ps, "status", status.update)
|
||||||
heartbeat.register(ps, "heartbeat", heartbeat.update)
|
heartbeat.register(ps, "heartbeat", heartbeat.update)
|
||||||
|
|
||||||
if config.WirelessModem and config.WiredModem then
|
if config.WirelessModem and config.WiredModem then
|
||||||
|
|||||||
@@ -515,13 +515,12 @@ doc("fp_crd_rtt", "RTT", "Each connection has a round trip time, or RTT. Since t
|
|||||||
list(DOC_LIST_TYPE.BULLET, { "green: <=1000ms", "yellow: <=1500ms ", "red: >1500ms" })
|
list(DOC_LIST_TYPE.BULLET, { "green: <=1000ms", "yellow: <=1500ms ", "red: >1500ms" })
|
||||||
sect("CRD Tab")
|
sect("CRD Tab")
|
||||||
text("This tab includes information about the Coordinator, partially covered by 'Common Items'.")
|
text("This tab includes information about the Coordinator, partially covered by 'Common Items'.")
|
||||||
|
doc("fp_crd_spkr", "SPEAKER", "This indicates if the speaker is connected.")
|
||||||
doc("fp_crd_rt_main", "RT MAIN", "This indicates that the device's main loop co-routine is running.")
|
doc("fp_crd_rt_main", "RT MAIN", "This indicates that the device's main loop co-routine is running.")
|
||||||
doc("fp_crd_rt_render", "RT RENDER", "This indicates that the Coordinator graphics renderer co-routine is running.")
|
doc("fp_crd_rt_render", "RT RENDER", "This indicates that the Coordinator graphics renderer co-routine is running.")
|
||||||
doc("fp_crd_spkr", "SPEAKER", "This indicates if the speaker is connected.")
|
doc("fp_crd_mon_main", "MAIN MONITOR", "The connection status of the main display monitor.")
|
||||||
list(DOC_LIST_TYPE.LED, { "Disconnected", "Display View Unloaded", "Display View Loaded" }, { colors.gray, colors.red, colors.green })
|
doc("fp_crd_mon_flow", "FLOW MONITOR", "The connection status of the coolant and waste flow display monitor.")
|
||||||
doc("fp_crd_mon_main", "MAIN DISPLAY", "The connection status of the main display monitor.")
|
doc("fp_crd_mon_unit", "UNIT X MONITOR", "The connection status of the monitor associated with a given unit.")
|
||||||
doc("fp_crd_mon_flow", "FLOW DISPLAY", "The connection status of the coolant and waste flow display monitor.")
|
|
||||||
doc("fp_crd_mon_unit", "UNIT X DISPLAY", "The connection status of the monitor associated with a given unit.")
|
|
||||||
sect("API Tab")
|
sect("API Tab")
|
||||||
text("This tab lists connected pocket computers. Refer to the Supervisor PKT tab documentation for details on fields.")
|
text("This tab lists connected pocket computers. Refer to the Supervisor PKT tab documentation for details on fields.")
|
||||||
|
|
||||||
|
|||||||
@@ -7,8 +7,6 @@ local network = require("scada-common.network")
|
|||||||
local ppm = require("scada-common.ppm")
|
local ppm = require("scada-common.ppm")
|
||||||
local util = require("scada-common.util")
|
local util = require("scada-common.util")
|
||||||
|
|
||||||
local databus = require("reactor-plc.databus")
|
|
||||||
|
|
||||||
local println = util.println
|
local println = util.println
|
||||||
|
|
||||||
---@class plc_backplane
|
---@class plc_backplane
|
||||||
@@ -120,16 +118,6 @@ function backplane.init(config, __shared_memory)
|
|||||||
plc_state.reactor_formed = false
|
plc_state.reactor_formed = false
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- detect and warn about multiple reactors
|
|
||||||
if #ppm.get_all_devices("fissionReactorLogicAdapter") > 1 then
|
|
||||||
println("startup> !! DANGER !! more than one reactor was detected! do not share reactor connections between multiple PLCs! they may not all be protected and used as configured")
|
|
||||||
|
|
||||||
log.warning("BKPLN: !! DANGER !! more than one reactor was detected on startup!")
|
|
||||||
log.warning("BKPLN: do NOT share reactor connections between multiple PLCs! they may not all be protected and used as configured")
|
|
||||||
|
|
||||||
databus.tx_multi_reactor(true)
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
-- get the active NIC
|
-- get the active NIC
|
||||||
@@ -151,15 +139,7 @@ function backplane.attach(iface, type, device, print_no_fp)
|
|||||||
local sys = _bp.smem.plc_sys
|
local sys = _bp.smem.plc_sys
|
||||||
|
|
||||||
if type ~= nil and device ~= nil then
|
if type ~= nil and device ~= nil then
|
||||||
if type == "fissionReactorLogicAdapter" then
|
if state.no_reactor and (type == "fissionReactorLogicAdapter") then
|
||||||
if not state.no_reactor then
|
|
||||||
log.warning("BKPLN: !! DANGER !! an additional reactor (" .. iface .. ") was connected and will not be used!")
|
|
||||||
log.warning("BKPLN: do NOT share reactor connections between multiple PLCs! they may not all be protected and used as configured")
|
|
||||||
|
|
||||||
databus.tx_multi_reactor(true)
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
-- reconnected reactor
|
-- reconnected reactor
|
||||||
log.info("BKPLN: REACTOR LINK_UP " .. iface)
|
log.info("BKPLN: REACTOR LINK_UP " .. iface)
|
||||||
|
|
||||||
@@ -270,17 +250,6 @@ function backplane.detach(iface, type, device, print_no_fp)
|
|||||||
|
|
||||||
state.no_reactor = true
|
state.no_reactor = true
|
||||||
state.degraded = true
|
state.degraded = true
|
||||||
|
|
||||||
-- clear this tentatively, so then if there is >1, that will be reported in backplane.attach in the following if statement
|
|
||||||
databus.tx_multi_reactor(false)
|
|
||||||
|
|
||||||
-- try to find another reactor (this should not work unless multiple were incorrectly connected)
|
|
||||||
local reactor, r_iface = ppm.get_fission_reactor()
|
|
||||||
if reactor and r_iface then
|
|
||||||
log.info("BKPLN: found another fission reactor logic adapter")
|
|
||||||
|
|
||||||
backplane.attach(r_iface, type, reactor, print_no_fp)
|
|
||||||
end
|
|
||||||
elseif _bp.smem.networked and type == "modem" then
|
elseif _bp.smem.networked and type == "modem" then
|
||||||
---@cast device Modem
|
---@cast device Modem
|
||||||
|
|
||||||
|
|||||||
@@ -141,7 +141,6 @@ local function self_check()
|
|||||||
self.self_check_msg("> check fission reactor formed...")
|
self.self_check_msg("> check fission reactor formed...")
|
||||||
-- this consumes events, but that is fine here
|
-- this consumes events, but that is fine here
|
||||||
self.self_check_msg(nil, reactor and reactor.isFormed(), "ensure the fission reactor multiblock is formed")
|
self.self_check_msg(nil, reactor and reactor.isFormed(), "ensure the fission reactor multiblock is formed")
|
||||||
self.self_check_msg("> check for no more than one reactor...", #ppm.get_all_devices("fissionReactorLogicAdapter") <= 1, "there MUST be no more than one reactor connected, as a PLC uses the first one it finds, which may not always be the same one")
|
|
||||||
|
|
||||||
self.self_check_msg("> check configuration...", valid_cfg, "go through Configure System and apply settings to set any missing settings and repair any corrupted ones")
|
self.self_check_msg("> check configuration...", valid_cfg, "go through Configure System and apply settings to set any missing settings and repair any corrupted ones")
|
||||||
|
|
||||||
|
|||||||
@@ -11,11 +11,22 @@ local databus = {}
|
|||||||
-- databus PSIL
|
-- databus PSIL
|
||||||
databus.ps = psil.create()
|
databus.ps = psil.create()
|
||||||
|
|
||||||
local dbus_iface = {
|
local _dbus = {
|
||||||
rps_scram = function () log.debug("DBUS: unset rps_scram() called") end,
|
rps_scram = function () log.debug("DBUS: unset rps_scram() called") end,
|
||||||
rps_reset = function () log.debug("DBUS: unset rps_reset() called") end
|
rps_reset = function () log.debug("DBUS: unset rps_reset() called") end,
|
||||||
|
|
||||||
|
degraded = false,
|
||||||
|
coroutines = {}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
-- evaluate and publish system health status
|
||||||
|
local function eval_status()
|
||||||
|
local ok = not _dbus.degraded
|
||||||
|
for _, v in pairs(_dbus.coroutines) do ok = ok and v end
|
||||||
|
|
||||||
|
databus.ps.publish("status", ok)
|
||||||
|
end
|
||||||
|
|
||||||
-- call to toggle heartbeat signal
|
-- call to toggle heartbeat signal
|
||||||
function databus.heartbeat() databus.ps.toggle("heartbeat") end
|
function databus.heartbeat() databus.ps.toggle("heartbeat") end
|
||||||
|
|
||||||
@@ -23,15 +34,15 @@ function databus.heartbeat() databus.ps.toggle("heartbeat") end
|
|||||||
---@param scram function reactor SCRAM function
|
---@param scram function reactor SCRAM function
|
||||||
---@param reset function RPS reset function
|
---@param reset function RPS reset function
|
||||||
function databus.link_rps(scram, reset)
|
function databus.link_rps(scram, reset)
|
||||||
dbus_iface.rps_scram = scram
|
_dbus.rps_scram = scram
|
||||||
dbus_iface.rps_reset = reset
|
_dbus.rps_reset = reset
|
||||||
end
|
end
|
||||||
|
|
||||||
-- transmit a command to the RPS to SCRAM
|
-- transmit a command to the RPS to SCRAM
|
||||||
function databus.rps_scram() dbus_iface.rps_scram() end
|
function databus.rps_scram() _dbus.rps_scram() end
|
||||||
|
|
||||||
-- transmit a command to the RPS to reset
|
-- transmit a command to the RPS to reset
|
||||||
function databus.rps_reset() dbus_iface.rps_reset() end
|
function databus.rps_reset() _dbus.rps_reset() end
|
||||||
|
|
||||||
-- transmit firmware versions
|
-- transmit firmware versions
|
||||||
---@param plc_v string PLC version
|
---@param plc_v string PLC version
|
||||||
@@ -50,23 +61,24 @@ end
|
|||||||
-- transmit hardware status
|
-- transmit hardware status
|
||||||
---@param plc_state plc_state
|
---@param plc_state plc_state
|
||||||
function databus.tx_hw_status(plc_state)
|
function databus.tx_hw_status(plc_state)
|
||||||
databus.ps.publish("degraded", plc_state.degraded)
|
|
||||||
databus.ps.publish("reactor_dev_state", util.trinary(plc_state.no_reactor, 1, util.trinary(plc_state.reactor_formed, 3, 2)))
|
databus.ps.publish("reactor_dev_state", util.trinary(plc_state.no_reactor, 1, util.trinary(plc_state.reactor_formed, 3, 2)))
|
||||||
databus.ps.publish("has_wd_modem", plc_state.wd_modem)
|
databus.ps.publish("has_wd_modem", plc_state.wd_modem)
|
||||||
databus.ps.publish("has_wl_modem", plc_state.wl_modem)
|
databus.ps.publish("has_wl_modem", plc_state.wl_modem)
|
||||||
end
|
|
||||||
|
|
||||||
-- transmiti f the reactor dangerously has multiple fission reactor logic adapters
|
_dbus.degraded = plc_state.degraded
|
||||||
---@param multi boolean has multiple reactors
|
eval_status()
|
||||||
function databus.tx_multi_reactor(multi)
|
|
||||||
databus.ps.publish("has_multi_reactor", multi)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
-- transmit thread (routine) statuses
|
-- transmit thread (routine) statuses
|
||||||
---@param thread string thread name
|
---@param thread string thread name
|
||||||
---@param ok boolean thread state
|
---@param ok boolean thread state
|
||||||
function databus.tx_rt_status(thread, ok)
|
function databus.tx_rt_status(thread, ok)
|
||||||
databus.ps.publish(util.c("routine__", thread), ok)
|
local name = util.c("routine__", thread)
|
||||||
|
|
||||||
|
databus.ps.publish(name, ok)
|
||||||
|
|
||||||
|
_dbus.coroutines[name] = ok
|
||||||
|
eval_status()
|
||||||
end
|
end
|
||||||
|
|
||||||
-- transmit supervisor link state
|
-- transmit supervisor link state
|
||||||
|
|||||||
@@ -2,7 +2,6 @@
|
|||||||
-- Reactor PLC Front Panel GUI
|
-- Reactor PLC Front Panel GUI
|
||||||
--
|
--
|
||||||
|
|
||||||
local tcd = require("scada-common.tcd")
|
|
||||||
local types = require("scada-common.types")
|
local types = require("scada-common.types")
|
||||||
local util = require("scada-common.util")
|
local util = require("scada-common.util")
|
||||||
|
|
||||||
@@ -51,11 +50,11 @@ local function init(panel, config)
|
|||||||
|
|
||||||
local system = Div{parent=panel,width=14,height=18,x=2,y=3}
|
local system = Div{parent=panel,width=14,height=18,x=2,y=3}
|
||||||
|
|
||||||
local degraded = LED{parent=system,label="STATUS",colors=cpair(colors.red,colors.green)}
|
local sys_status = LED{parent=system,label="STATUS",colors=cpair(colors.green,colors.red)}
|
||||||
local heartbeat = LED{parent=system,label="HEARTBEAT",colors=ind_grn}
|
local heartbeat = LED{parent=system,label="HEARTBEAT",colors=ind_grn}
|
||||||
system.line_break()
|
system.line_break()
|
||||||
|
|
||||||
degraded.register(databus.ps, "degraded", degraded.update)
|
sys_status.register(databus.ps, "status", sys_status.update)
|
||||||
heartbeat.register(databus.ps, "heartbeat", heartbeat.update)
|
heartbeat.register(databus.ps, "heartbeat", heartbeat.update)
|
||||||
|
|
||||||
local reactor = LEDPair{parent=system,label="REACTOR",off=colors.red,c1=colors.yellow,c2=colors.green}
|
local reactor = LEDPair{parent=system,label="REACTOR",off=colors.red,c1=colors.yellow,c2=colors.green}
|
||||||
@@ -162,34 +161,6 @@ local function init(panel, config)
|
|||||||
TextBox{parent=hw_labels,text="NT v"..databus.ps.get("comms_version"),fg_bg=s_hi_box}
|
TextBox{parent=hw_labels,text="NT v"..databus.ps.get("comms_version"),fg_bg=s_hi_box}
|
||||||
TextBox{parent=hw_labels,text="SN "..comp_id.."-PLC",fg_bg=s_hi_box}
|
TextBox{parent=hw_labels,text="SN "..comp_id.."-PLC",fg_bg=s_hi_box}
|
||||||
|
|
||||||
-- warning about multiple reactors connected
|
|
||||||
|
|
||||||
local warn_strings = { "!! DANGER !!\n>1 REACTOR\nLOGIC ADAPTER", "REMOVE\nALL BUT ONE\nLOGIC ADAPTER" }
|
|
||||||
local multi_warn = TextBox{parent=status,text=warn_strings[1],width=status.get_width()-2,alignment=ALIGN.CENTER,fg_bg=cpair(colors.yellow,colors.red),hidden=true}
|
|
||||||
|
|
||||||
local warn_toggle = true
|
|
||||||
local function flash_warn()
|
|
||||||
multi_warn.recolor(util.trinary(warn_toggle, colors.black, colors.yellow))
|
|
||||||
multi_warn.set_value(util.trinary(warn_toggle, warn_strings[2], warn_strings[1]))
|
|
||||||
warn_toggle = not warn_toggle
|
|
||||||
|
|
||||||
if databus.ps.get("has_multi_reactor") then tcd.dispatch_unique(2, flash_warn) end
|
|
||||||
end
|
|
||||||
|
|
||||||
multi_warn.register(databus.ps, "has_multi_reactor", function (v)
|
|
||||||
if v then
|
|
||||||
multi_warn.show(true)
|
|
||||||
|
|
||||||
warn_toggle = false
|
|
||||||
flash_warn()
|
|
||||||
|
|
||||||
tcd.dispatch_unique(2, flash_warn)
|
|
||||||
else
|
|
||||||
tcd.abort(flash_warn)
|
|
||||||
multi_warn.hide(true)
|
|
||||||
end
|
|
||||||
end)
|
|
||||||
|
|
||||||
--
|
--
|
||||||
-- rps list
|
-- rps list
|
||||||
--
|
--
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ local plc = require("reactor-plc.plc")
|
|||||||
local renderer = require("reactor-plc.renderer")
|
local renderer = require("reactor-plc.renderer")
|
||||||
local threads = require("reactor-plc.threads")
|
local threads = require("reactor-plc.threads")
|
||||||
|
|
||||||
local R_PLC_VERSION = "v1.10.1"
|
local R_PLC_VERSION = "v1.10.2"
|
||||||
|
|
||||||
local println = util.println
|
local println = util.println
|
||||||
local println_ts = util.println_ts
|
local println_ts = util.println_ts
|
||||||
|
|||||||
@@ -7,6 +7,20 @@ local util = require("scada-common.util")
|
|||||||
|
|
||||||
local databus = {}
|
local databus = {}
|
||||||
|
|
||||||
|
local _dbus = {
|
||||||
|
wd_modem = true,
|
||||||
|
wl_modem = true,
|
||||||
|
coroutines = {}
|
||||||
|
}
|
||||||
|
|
||||||
|
-- evaluate and publish system health status
|
||||||
|
local function eval_status()
|
||||||
|
local ok = _dbus.wd_modem and _dbus.wl_modem
|
||||||
|
for _, v in pairs(_dbus.coroutines) do ok = ok and v end
|
||||||
|
|
||||||
|
databus.ps.publish("status", ok)
|
||||||
|
end
|
||||||
|
|
||||||
-- databus PSIL
|
-- databus PSIL
|
||||||
databus.ps = psil.create()
|
databus.ps = psil.create()
|
||||||
|
|
||||||
@@ -35,12 +49,18 @@ end
|
|||||||
---@param has_modem boolean
|
---@param has_modem boolean
|
||||||
function databus.tx_hw_wd_modem(has_modem)
|
function databus.tx_hw_wd_modem(has_modem)
|
||||||
databus.ps.publish("has_wd_modem", has_modem)
|
databus.ps.publish("has_wd_modem", has_modem)
|
||||||
|
|
||||||
|
_dbus.wd_modem = has_modem
|
||||||
|
eval_status()
|
||||||
end
|
end
|
||||||
|
|
||||||
-- transmit hardware status for the wireless comms modem
|
-- transmit hardware status for the wireless comms modem
|
||||||
---@param has_modem boolean
|
---@param has_modem boolean
|
||||||
function databus.tx_hw_wl_modem(has_modem)
|
function databus.tx_hw_wl_modem(has_modem)
|
||||||
databus.ps.publish("has_wl_modem", has_modem)
|
databus.ps.publish("has_wl_modem", has_modem)
|
||||||
|
|
||||||
|
_dbus.wl_modem = has_modem
|
||||||
|
eval_status()
|
||||||
end
|
end
|
||||||
|
|
||||||
-- transmit the number of speakers connected
|
-- transmit the number of speakers connected
|
||||||
@@ -67,7 +87,12 @@ end
|
|||||||
---@param thread string thread name
|
---@param thread string thread name
|
||||||
---@param ok boolean thread state
|
---@param ok boolean thread state
|
||||||
function databus.tx_rt_status(thread, ok)
|
function databus.tx_rt_status(thread, ok)
|
||||||
databus.ps.publish(util.c("routine__", thread), ok)
|
local name = util.c("routine__", thread)
|
||||||
|
|
||||||
|
databus.ps.publish(name, ok)
|
||||||
|
|
||||||
|
_dbus.coroutines[name] = ok
|
||||||
|
eval_status()
|
||||||
end
|
end
|
||||||
|
|
||||||
-- transmit supervisor link state
|
-- transmit supervisor link state
|
||||||
|
|||||||
@@ -51,11 +51,11 @@ local function init(panel, config, units)
|
|||||||
|
|
||||||
local system = Div{parent=panel,width=14,height=term_h-5,x=2,y=3}
|
local system = Div{parent=panel,width=14,height=term_h-5,x=2,y=3}
|
||||||
|
|
||||||
local on = LED{parent=system,label="STATUS",colors=cpair(colors.green,colors.red)}
|
local status = LED{parent=system,label="STATUS",colors=cpair(colors.green,colors.red)}
|
||||||
local heartbeat = LED{parent=system,label="HEARTBEAT",colors=ind_grn}
|
local heartbeat = LED{parent=system,label="HEARTBEAT",colors=ind_grn}
|
||||||
on.update(true)
|
|
||||||
system.line_break()
|
system.line_break()
|
||||||
|
|
||||||
|
status.register(databus.ps, "status", status.update)
|
||||||
heartbeat.register(databus.ps, "heartbeat", heartbeat.update)
|
heartbeat.register(databus.ps, "heartbeat", heartbeat.update)
|
||||||
|
|
||||||
if config.WirelessModem and config.WiredModem then
|
if config.WirelessModem and config.WiredModem then
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ local rtu = require("rtu.rtu")
|
|||||||
local threads = require("rtu.threads")
|
local threads = require("rtu.threads")
|
||||||
local uinit = require("rtu.uinit")
|
local uinit = require("rtu.uinit")
|
||||||
|
|
||||||
local RTU_VERSION = "v1.13.0"
|
local RTU_VERSION = "v1.13.1"
|
||||||
|
|
||||||
local println = util.println
|
local println = util.println
|
||||||
local println_ts = util.println_ts
|
local println_ts = util.println_ts
|
||||||
|
|||||||
@@ -425,27 +425,26 @@ end
|
|||||||
|
|
||||||
-- get a mounted peripheral by type (if multiple, returns the first)
|
-- get a mounted peripheral by type (if multiple, returns the first)
|
||||||
---@nodiscard
|
---@nodiscard
|
||||||
---@param type string type name
|
---@param name string type name
|
||||||
---@return table|nil device, string|nil iface device and interface
|
---@return table|nil device function table
|
||||||
function ppm.get_device(type)
|
function ppm.get_device(name)
|
||||||
local device, d_iface = nil, nil
|
local device = nil
|
||||||
|
|
||||||
for iface, data in pairs(_ppm.mounts) do
|
for _, data in pairs(_ppm.mounts) do
|
||||||
if data.type == type then
|
if data.type == name then
|
||||||
device = data.dev
|
device = data.dev
|
||||||
d_iface = iface
|
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
return device, d_iface
|
return device
|
||||||
end
|
end
|
||||||
|
|
||||||
-- SPECIFIC DEVICE ACCESSORS --
|
-- SPECIFIC DEVICE ACCESSORS --
|
||||||
|
|
||||||
-- get the fission reactor (if multiple, returns the first)
|
-- get the fission reactor (if multiple, returns the first)
|
||||||
---@nodiscard
|
---@nodiscard
|
||||||
---@return table|nil reactor, string|nil iface reactor and interface
|
---@return table|nil reactor function table
|
||||||
function ppm.get_fission_reactor() return ppm.get_device("fissionReactorLogicAdapter") end
|
function ppm.get_fission_reactor() return ppm.get_device("fissionReactorLogicAdapter") end
|
||||||
|
|
||||||
-- get a modem by name
|
-- get a modem by name
|
||||||
@@ -471,8 +470,8 @@ function ppm.get_wireless_modem()
|
|||||||
|
|
||||||
for iface, device in pairs(_ppm.mounts) do
|
for iface, device in pairs(_ppm.mounts) do
|
||||||
if device.type == "modem" and (emulated_env or device.dev.isWireless()) then
|
if device.type == "modem" and (emulated_env or device.dev.isWireless()) then
|
||||||
w_modem = device.dev
|
|
||||||
w_iface = iface
|
w_iface = iface
|
||||||
|
w_modem = device.dev
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ local t_pack = table.pack
|
|||||||
local util = {}
|
local util = {}
|
||||||
|
|
||||||
-- scada-common version
|
-- scada-common version
|
||||||
util.version = "1.6.1"
|
util.version = "1.6.0"
|
||||||
|
|
||||||
util.TICK_TIME_S = 0.05
|
util.TICK_TIME_S = 0.05
|
||||||
util.TICK_TIME_MS = 50
|
util.TICK_TIME_MS = 50
|
||||||
|
|||||||
@@ -10,6 +10,16 @@ local pgi = require("supervisor.panel.pgi")
|
|||||||
|
|
||||||
local databus = {}
|
local databus = {}
|
||||||
|
|
||||||
|
local _dbus = {
|
||||||
|
wd_modem = true,
|
||||||
|
wl_modem = true
|
||||||
|
}
|
||||||
|
|
||||||
|
-- evaluate and publish system health status
|
||||||
|
local function eval_status()
|
||||||
|
databus.ps.publish("status", _dbus.wd_modem and _dbus.wl_modem)
|
||||||
|
end
|
||||||
|
|
||||||
-- databus PSIL
|
-- databus PSIL
|
||||||
databus.ps = psil.create()
|
databus.ps = psil.create()
|
||||||
|
|
||||||
@@ -28,12 +38,18 @@ end
|
|||||||
---@param has_modem boolean
|
---@param has_modem boolean
|
||||||
function databus.tx_hw_wd_modem(has_modem)
|
function databus.tx_hw_wd_modem(has_modem)
|
||||||
databus.ps.publish("has_wd_modem", has_modem)
|
databus.ps.publish("has_wd_modem", has_modem)
|
||||||
|
|
||||||
|
_dbus.wd_modem = has_modem
|
||||||
|
eval_status()
|
||||||
end
|
end
|
||||||
|
|
||||||
-- transmit hardware status for the wireless comms modem
|
-- transmit hardware status for the wireless comms modem
|
||||||
---@param has_modem boolean
|
---@param has_modem boolean
|
||||||
function databus.tx_hw_wl_modem(has_modem)
|
function databus.tx_hw_wl_modem(has_modem)
|
||||||
databus.ps.publish("has_wl_modem", has_modem)
|
databus.ps.publish("has_wl_modem", has_modem)
|
||||||
|
|
||||||
|
_dbus.wl_modem = has_modem
|
||||||
|
eval_status()
|
||||||
end
|
end
|
||||||
|
|
||||||
-- transmit PLC firmware version and session connection state
|
-- transmit PLC firmware version and session connection state
|
||||||
|
|||||||
@@ -58,11 +58,11 @@ local function init(panel, config)
|
|||||||
|
|
||||||
local system = Div{parent=main_page,width=18,height=17,x=2,y=2}
|
local system = Div{parent=main_page,width=18,height=17,x=2,y=2}
|
||||||
|
|
||||||
local on = LED{parent=system,label="STATUS",colors=cpair(colors.green,colors.red)}
|
local status = LED{parent=system,label="STATUS",colors=cpair(colors.green,colors.red)}
|
||||||
local heartbeat = LED{parent=system,label="HEARTBEAT",colors=ind_grn}
|
local heartbeat = LED{parent=system,label="HEARTBEAT",colors=ind_grn}
|
||||||
on.update(true)
|
|
||||||
system.line_break()
|
system.line_break()
|
||||||
|
|
||||||
|
status.register(databus.ps, "status", status.update)
|
||||||
heartbeat.register(databus.ps, "heartbeat", heartbeat.update)
|
heartbeat.register(databus.ps, "heartbeat", heartbeat.update)
|
||||||
|
|
||||||
if config.WirelessModem and config.WiredModem then
|
if config.WirelessModem and config.WiredModem then
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ local supervisor = require("supervisor.supervisor")
|
|||||||
|
|
||||||
local svsessions = require("supervisor.session.svsessions")
|
local svsessions = require("supervisor.session.svsessions")
|
||||||
|
|
||||||
local SUPERVISOR_VERSION = "v1.8.0"
|
local SUPERVISOR_VERSION = "v1.8.1"
|
||||||
|
|
||||||
local println = util.println
|
local println = util.println
|
||||||
local println_ts = util.println_ts
|
local println_ts = util.println_ts
|
||||||
|
|||||||
Reference in New Issue
Block a user