mirror of
https://github.com/MikaylaFischler/cc-mek-scada.git
synced 2024-08-30 18:22:34 +00:00
#247 renamed tcallbackdsp to tcd and added handler to RTU
This commit is contained in:
parent
2427561dc5
commit
8d248408d4
@ -4,23 +4,23 @@
|
||||
|
||||
require("/initenv").init_env()
|
||||
|
||||
local crash = require("scada-common.crash")
|
||||
local log = require("scada-common.log")
|
||||
local ppm = require("scada-common.ppm")
|
||||
local tcallbackdsp = require("scada-common.tcallbackdsp")
|
||||
local util = require("scada-common.util")
|
||||
local crash = require("scada-common.crash")
|
||||
local log = require("scada-common.log")
|
||||
local ppm = require("scada-common.ppm")
|
||||
local tcd = require("scada-common.tcd")
|
||||
local util = require("scada-common.util")
|
||||
|
||||
local core = require("graphics.core")
|
||||
local core = require("graphics.core")
|
||||
|
||||
local config = require("coordinator.config")
|
||||
local coordinator = require("coordinator.coordinator")
|
||||
local iocontrol = require("coordinator.iocontrol")
|
||||
local renderer = require("coordinator.renderer")
|
||||
local sounder = require("coordinator.sounder")
|
||||
local config = require("coordinator.config")
|
||||
local coordinator = require("coordinator.coordinator")
|
||||
local iocontrol = require("coordinator.iocontrol")
|
||||
local renderer = require("coordinator.renderer")
|
||||
local sounder = require("coordinator.sounder")
|
||||
|
||||
local apisessions = require("coordinator.session.apisessions")
|
||||
local apisessions = require("coordinator.session.apisessions")
|
||||
|
||||
local COORDINATOR_VERSION = "v0.15.6"
|
||||
local COORDINATOR_VERSION = "v0.15.7"
|
||||
|
||||
local println = util.println
|
||||
local println_ts = util.println_ts
|
||||
@ -334,7 +334,7 @@ local function main()
|
||||
apisessions.check_all_watchdogs(param1)
|
||||
|
||||
-- notify timer callback dispatcher
|
||||
tcallbackdsp.handle(param1)
|
||||
tcd.handle(param1)
|
||||
end
|
||||
elseif event == "modem_message" then
|
||||
-- got a packet
|
||||
|
@ -1,4 +1,4 @@
|
||||
local tcd = require("scada-common.tcallbackdsp")
|
||||
local tcd = require("scada-common.tcd")
|
||||
local util = require("scada-common.util")
|
||||
|
||||
local iocontrol = require("coordinator.iocontrol")
|
||||
|
@ -1,6 +1,6 @@
|
||||
-- Loading/Waiting Animation Graphics Element
|
||||
|
||||
local tcd = require("scada-common.tcallbackdsp")
|
||||
local tcd = require("scada-common.tcd")
|
||||
|
||||
local element = require("graphics.element")
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
-- Hazard-bordered Button Graphics Element
|
||||
|
||||
local tcd = require("scada-common.tcallbackdsp")
|
||||
local tcd = require("scada-common.tcd")
|
||||
local util = require("scada-common.util")
|
||||
|
||||
local core = require("graphics.core")
|
||||
|
@ -1,6 +1,6 @@
|
||||
-- Button Graphics Element
|
||||
|
||||
local tcd = require("scada-common.tcallbackdsp")
|
||||
local tcd = require("scada-common.tcd")
|
||||
|
||||
local core = require("graphics.core")
|
||||
local element = require("graphics.element")
|
||||
|
@ -1,6 +1,6 @@
|
||||
-- Sidebar Graphics Element
|
||||
|
||||
local tcd = require("scada-common.tcallbackdsp")
|
||||
local tcd = require("scada-common.tcd")
|
||||
|
||||
local core = require("graphics.core")
|
||||
local element = require("graphics.element")
|
||||
|
@ -1,6 +1,6 @@
|
||||
-- Scroll-able List Box Display Graphics Element
|
||||
|
||||
local tcd = require("scada-common.tcallbackdsp")
|
||||
local tcd = require("scada-common.tcd")
|
||||
|
||||
local core = require("graphics.core")
|
||||
local element = require("graphics.element")
|
||||
|
@ -2,7 +2,7 @@
|
||||
-- Indicator Light Flasher
|
||||
--
|
||||
|
||||
local tcd = require("scada-common.tcallbackdsp")
|
||||
local tcd = require("scada-common.tcd")
|
||||
|
||||
local flasher = {}
|
||||
|
||||
|
File diff suppressed because one or more lines are too long
@ -4,20 +4,20 @@
|
||||
|
||||
require("/initenv").init_env()
|
||||
|
||||
local crash = require("scada-common.crash")
|
||||
local log = require("scada-common.log")
|
||||
local ppm = require("scada-common.ppm")
|
||||
local tcallbackdsp = require("scada-common.tcallbackdsp")
|
||||
local util = require("scada-common.util")
|
||||
local crash = require("scada-common.crash")
|
||||
local log = require("scada-common.log")
|
||||
local ppm = require("scada-common.ppm")
|
||||
local tcd = require("scada-common.tcd")
|
||||
local util = require("scada-common.util")
|
||||
|
||||
local core = require("graphics.core")
|
||||
local core = require("graphics.core")
|
||||
|
||||
local config = require("pocket.config")
|
||||
local coreio = require("pocket.coreio")
|
||||
local pocket = require("pocket.pocket")
|
||||
local renderer = require("pocket.renderer")
|
||||
local config = require("pocket.config")
|
||||
local coreio = require("pocket.coreio")
|
||||
local pocket = require("pocket.pocket")
|
||||
local renderer = require("pocket.renderer")
|
||||
|
||||
local POCKET_VERSION = "alpha-v0.3.6"
|
||||
local POCKET_VERSION = "alpha-v0.3.7"
|
||||
|
||||
local println = util.println
|
||||
local println_ts = util.println_ts
|
||||
@ -145,7 +145,7 @@ local function main()
|
||||
else
|
||||
-- a non-clock/main watchdog timer event
|
||||
-- notify timer callback dispatcher
|
||||
tcallbackdsp.handle(param1)
|
||||
tcd.handle(param1)
|
||||
end
|
||||
elseif event == "modem_message" then
|
||||
-- got a packet
|
||||
|
@ -18,7 +18,7 @@ local plc = require("reactor-plc.plc")
|
||||
local renderer = require("reactor-plc.renderer")
|
||||
local threads = require("reactor-plc.threads")
|
||||
|
||||
local R_PLC_VERSION = "v1.3.6"
|
||||
local R_PLC_VERSION = "v1.3.7"
|
||||
|
||||
local println = util.println
|
||||
local println_ts = util.println_ts
|
||||
|
@ -1,13 +1,13 @@
|
||||
local log = require("scada-common.log")
|
||||
local mqueue = require("scada-common.mqueue")
|
||||
local ppm = require("scada-common.ppm")
|
||||
local tcallbackdsp = require("scada-common.tcallbackdsp")
|
||||
local util = require("scada-common.util")
|
||||
local log = require("scada-common.log")
|
||||
local mqueue = require("scada-common.mqueue")
|
||||
local ppm = require("scada-common.ppm")
|
||||
local tcd = require("scada-common.tcd")
|
||||
local util = require("scada-common.util")
|
||||
|
||||
local databus = require("reactor-plc.databus")
|
||||
local renderer = require("reactor-plc.renderer")
|
||||
local databus = require("reactor-plc.databus")
|
||||
local renderer = require("reactor-plc.renderer")
|
||||
|
||||
local core = require("graphics.core")
|
||||
local core = require("graphics.core")
|
||||
|
||||
local threads = {}
|
||||
|
||||
@ -157,7 +157,7 @@ function threads.thread__main(smem, init)
|
||||
smem.q.mq_rps.push_command(MQ__RPS_CMD.TRIP_TIMEOUT)
|
||||
elseif event == "timer" then
|
||||
-- notify timer callback dispatcher if no other timer case claimed this event
|
||||
tcallbackdsp.handle(param1)
|
||||
tcd.handle(param1)
|
||||
elseif event == "peripheral_detach" then
|
||||
-- peripheral disconnect
|
||||
local type, device = ppm.handle_unmount(param1)
|
||||
|
@ -28,7 +28,7 @@ local sna_rtu = require("rtu.dev.sna_rtu")
|
||||
local sps_rtu = require("rtu.dev.sps_rtu")
|
||||
local turbinev_rtu = require("rtu.dev.turbinev_rtu")
|
||||
|
||||
local RTU_VERSION = "v1.2.6"
|
||||
local RTU_VERSION = "v1.2.7"
|
||||
|
||||
local RTU_UNIT_TYPE = types.RTU_UNIT_TYPE
|
||||
local RTU_UNIT_HW_STATE = databus.RTU_UNIT_HW_STATE
|
||||
|
@ -1,6 +1,7 @@
|
||||
local log = require("scada-common.log")
|
||||
local mqueue = require("scada-common.mqueue")
|
||||
local ppm = require("scada-common.ppm")
|
||||
local tcd = require("scada-common.tcd")
|
||||
local types = require("scada-common.types")
|
||||
local util = require("scada-common.util")
|
||||
|
||||
@ -82,6 +83,9 @@ function threads.thread__main(smem)
|
||||
elseif event == "timer" and conn_watchdog.is_timer(param1) then
|
||||
-- haven't heard from server recently? unlink
|
||||
rtu_comms.unlink(rtu_state)
|
||||
elseif event == "timer" then
|
||||
-- notify timer callback dispatcher if no other timer case claimed this event
|
||||
tcd.handle(param1)
|
||||
elseif event == "peripheral_detach" then
|
||||
-- handle loss of a device
|
||||
local type, device = ppm.handle_unmount(param1)
|
||||
|
@ -5,14 +5,14 @@
|
||||
local log = require("scada-common.log")
|
||||
local util = require("scada-common.util")
|
||||
|
||||
local tcallbackdsp = {}
|
||||
local tcd = {}
|
||||
|
||||
local registry = {}
|
||||
|
||||
-- request a function to be called after the specified time
|
||||
---@param time number seconds
|
||||
---@param f function callback function
|
||||
function tcallbackdsp.dispatch(time, f)
|
||||
function tcd.dispatch(time, f)
|
||||
local timer = util.start_timer(time)
|
||||
registry[timer] = {
|
||||
callback = f,
|
||||
@ -24,7 +24,7 @@ end
|
||||
-- request a function to be called after the specified time, aborting any registered instances of that function reference
|
||||
---@param time number seconds
|
||||
---@param f function callback function
|
||||
function tcallbackdsp.dispatch_unique(time, f)
|
||||
function tcd.dispatch_unique(time, f)
|
||||
-- cancel if already registered
|
||||
for timer, entry in pairs(registry) do
|
||||
if entry.callback == f then
|
||||
@ -47,7 +47,7 @@ end
|
||||
|
||||
-- abort a requested callback
|
||||
---@param f function callback function
|
||||
function tcallbackdsp.abort(f)
|
||||
function tcd.abort(f)
|
||||
for timer, entry in pairs(registry) do
|
||||
if entry.callback == f then
|
||||
-- cancel event and remove from registry (even if it fires it won't call)
|
||||
@ -59,7 +59,7 @@ end
|
||||
|
||||
-- lookup a timer event and execute the callback if found
|
||||
---@param event integer timer event timer ID
|
||||
function tcallbackdsp.handle(event)
|
||||
function tcd.handle(event)
|
||||
if registry[event] ~= nil then
|
||||
local callback = registry[event].callback
|
||||
-- clear first so that dispatch_unique call from inside callback won't throw a debug message
|
||||
@ -70,7 +70,7 @@ end
|
||||
|
||||
-- identify any overdo callbacks<br>
|
||||
-- prints to log debug output
|
||||
function tcallbackdsp.diagnostics()
|
||||
function tcd.diagnostics()
|
||||
for timer, entry in pairs(registry) do
|
||||
if entry.expiry < util.time_s() then
|
||||
local overtime = util.time_s() - entry.expiry
|
||||
@ -82,4 +82,4 @@ function tcallbackdsp.diagnostics()
|
||||
end
|
||||
end
|
||||
|
||||
return tcallbackdsp
|
||||
return tcd
|
@ -8,7 +8,7 @@ local crash = require("scada-common.crash")
|
||||
local comms = require("scada-common.comms")
|
||||
local log = require("scada-common.log")
|
||||
local ppm = require("scada-common.ppm")
|
||||
local tcd = require("scada-common.tcallbackdsp")
|
||||
local tcd = require("scada-common.tcd")
|
||||
local util = require("scada-common.util")
|
||||
|
||||
local core = require("graphics.core")
|
||||
@ -20,7 +20,7 @@ local supervisor = require("supervisor.supervisor")
|
||||
|
||||
local svsessions = require("supervisor.session.svsessions")
|
||||
|
||||
local SUPERVISOR_VERSION = "v0.16.6"
|
||||
local SUPERVISOR_VERSION = "v0.16.7"
|
||||
|
||||
local println = util.println
|
||||
local println_ts = util.println_ts
|
||||
|
Loading…
Reference in New Issue
Block a user