mirror of
https://github.com/MikaylaFischler/cc-mek-scada.git
synced 2024-08-30 18:22:34 +00:00
wrap os.pullEventRaw to have return types
This commit is contained in:
parent
d6a201a45f
commit
1afafba501
@ -267,8 +267,7 @@ function coordinator.comms(version, modem, sv_port, sv_listen, api_listen, sv_wa
|
|||||||
clock.start()
|
clock.start()
|
||||||
|
|
||||||
while (util.time_s() - start) < timeout_s and not self.sv_linked do
|
while (util.time_s() - start) < timeout_s and not self.sv_linked do
|
||||||
---@diagnostic disable-next-line: undefined-field
|
local event, p1, p2, p3, p4, p5 = util.pull_event()
|
||||||
local event, p1, p2, p3, p4, p5 = os.pullEventRaw()
|
|
||||||
|
|
||||||
if event == "timer" and clock.is_clock(p1) then
|
if event == "timer" and clock.is_clock(p1) then
|
||||||
-- timed out attempt, try again
|
-- timed out attempt, try again
|
||||||
|
@ -13,7 +13,7 @@ local config = require("coordinator.config")
|
|||||||
local coordinator = require("coordinator.coordinator")
|
local coordinator = require("coordinator.coordinator")
|
||||||
local renderer = require("coordinator.renderer")
|
local renderer = require("coordinator.renderer")
|
||||||
|
|
||||||
local COORDINATOR_VERSION = "alpha-v0.3.4"
|
local COORDINATOR_VERSION = "alpha-v0.3.5"
|
||||||
|
|
||||||
local print = util.print
|
local print = util.print
|
||||||
local println = util.println
|
local println = util.println
|
||||||
@ -149,8 +149,7 @@ log.debug("boot> conn watchdog started")
|
|||||||
-- event loop
|
-- event loop
|
||||||
-- ui_ok will never change in this loop, same as while true or exit if UI start failed
|
-- ui_ok will never change in this loop, same as while true or exit if UI start failed
|
||||||
while ui_ok do
|
while ui_ok do
|
||||||
---@diagnostic disable-next-line: undefined-field
|
local event, param1, param2, param3, param4, param5 = util.pull_event()
|
||||||
local event, param1, param2, param3, param4, param5 = os.pullEventRaw()
|
|
||||||
|
|
||||||
-- handle event
|
-- handle event
|
||||||
if event == "peripheral_detach" then
|
if event == "peripheral_detach" then
|
||||||
|
@ -13,7 +13,7 @@ local config = require("reactor-plc.config")
|
|||||||
local plc = require("reactor-plc.plc")
|
local plc = require("reactor-plc.plc")
|
||||||
local threads = require("reactor-plc.threads")
|
local threads = require("reactor-plc.threads")
|
||||||
|
|
||||||
local R_PLC_VERSION = "beta-v0.8.1"
|
local R_PLC_VERSION = "beta-v0.8.2"
|
||||||
|
|
||||||
local print = util.print
|
local print = util.print
|
||||||
local println = util.println
|
local println = util.println
|
||||||
|
@ -55,8 +55,7 @@ function threads.thread__main(smem, init)
|
|||||||
local plc_comms = smem.plc_sys.plc_comms
|
local plc_comms = smem.plc_sys.plc_comms
|
||||||
local conn_watchdog = smem.plc_sys.conn_watchdog
|
local conn_watchdog = smem.plc_sys.conn_watchdog
|
||||||
|
|
||||||
---@diagnostic disable-next-line: undefined-field
|
local event, param1, param2, param3, param4, param5 = util.pull_event()
|
||||||
local event, param1, param2, param3, param4, param5 = os.pullEventRaw()
|
|
||||||
|
|
||||||
-- handle event
|
-- handle event
|
||||||
if event == "timer" and loop_clock.is_clock(param1) then
|
if event == "timer" and loop_clock.is_clock(param1) then
|
||||||
|
@ -25,7 +25,7 @@ local imatrix_rtu = require("rtu.dev.imatrix_rtu")
|
|||||||
local turbine_rtu = require("rtu.dev.turbine_rtu")
|
local turbine_rtu = require("rtu.dev.turbine_rtu")
|
||||||
local turbinev_rtu = require("rtu.dev.turbinev_rtu")
|
local turbinev_rtu = require("rtu.dev.turbinev_rtu")
|
||||||
|
|
||||||
local RTU_VERSION = "beta-v0.7.9"
|
local RTU_VERSION = "beta-v0.7.10"
|
||||||
|
|
||||||
local rtu_t = types.rtu_t
|
local rtu_t = types.rtu_t
|
||||||
|
|
||||||
|
@ -49,8 +49,7 @@ function threads.thread__main(smem)
|
|||||||
|
|
||||||
-- event loop
|
-- event loop
|
||||||
while true do
|
while true do
|
||||||
---@diagnostic disable-next-line: undefined-field
|
local event, param1, param2, param3, param4, param5 = util.pull_event()
|
||||||
local event, param1, param2, param3, param4, param5 = os.pullEventRaw()
|
|
||||||
|
|
||||||
if event == "timer" and loop_clock.is_clock(param1) then
|
if event == "timer" and loop_clock.is_clock(param1) then
|
||||||
-- start next clock timer
|
-- start next clock timer
|
||||||
|
@ -37,6 +37,40 @@ types.TRI_FAIL = {
|
|||||||
|
|
||||||
-- STRING TYPES --
|
-- STRING TYPES --
|
||||||
|
|
||||||
|
---@alias os_event
|
||||||
|
---| "alarm"
|
||||||
|
---| "char"
|
||||||
|
---| "computer_command"
|
||||||
|
---| "disk"
|
||||||
|
---| "disk_eject"
|
||||||
|
---| "http_check"
|
||||||
|
---| "http_failure"
|
||||||
|
---| "http_success"
|
||||||
|
---| "key"
|
||||||
|
---| "key_up"
|
||||||
|
---| "modem_message"
|
||||||
|
---| "monitor_resize"
|
||||||
|
---| "monitor_touch"
|
||||||
|
---| "mouse_click"
|
||||||
|
---| "mouse_drag"
|
||||||
|
---| "mouse_scroll"
|
||||||
|
---| "mouse_up"
|
||||||
|
---| "paste"
|
||||||
|
---| "peripheral"
|
||||||
|
---| "peripheral_detach"
|
||||||
|
---| "rednet_message"
|
||||||
|
---| "redstone"
|
||||||
|
---| "speaker_audio_empty"
|
||||||
|
---| "task_complete"
|
||||||
|
---| "term_resize"
|
||||||
|
---| "terminate"
|
||||||
|
---| "timer"
|
||||||
|
---| "turtle_inventory"
|
||||||
|
---| "websocket_closed"
|
||||||
|
---| "websocket_failure"
|
||||||
|
---| "websocket_message"
|
||||||
|
---| "websocket_success"
|
||||||
|
|
||||||
---@alias rtu_t string
|
---@alias rtu_t string
|
||||||
types.rtu_t = {
|
types.rtu_t = {
|
||||||
redstone = "redstone",
|
redstone = "redstone",
|
||||||
|
@ -180,6 +180,16 @@ function util.time()
|
|||||||
return util.time_ms()
|
return util.time_ms()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- OS --
|
||||||
|
|
||||||
|
-- OS pull event raw wrapper with types
|
||||||
|
---@param target_event? string event to wait for
|
||||||
|
---@return os_event event, any param1, any param2, any param3, any param4, any param5
|
||||||
|
function util.pull_event(target_event)
|
||||||
|
---@diagnostic disable-next-line: undefined-field
|
||||||
|
return os.pullEventRaw(target_event)
|
||||||
|
end
|
||||||
|
|
||||||
-- PARALLELIZATION --
|
-- PARALLELIZATION --
|
||||||
|
|
||||||
-- protected sleep call so we still are in charge of catching termination
|
-- protected sleep call so we still are in charge of catching termination
|
||||||
|
@ -13,7 +13,7 @@ local svsessions = require("supervisor.session.svsessions")
|
|||||||
local config = require("supervisor.config")
|
local config = require("supervisor.config")
|
||||||
local supervisor = require("supervisor.supervisor")
|
local supervisor = require("supervisor.supervisor")
|
||||||
|
|
||||||
local SUPERVISOR_VERSION = "beta-v0.5.3"
|
local SUPERVISOR_VERSION = "beta-v0.5.4"
|
||||||
|
|
||||||
local print = util.print
|
local print = util.print
|
||||||
local println = util.println
|
local println = util.println
|
||||||
@ -84,8 +84,7 @@ loop_clock.start()
|
|||||||
|
|
||||||
-- event loop
|
-- event loop
|
||||||
while true do
|
while true do
|
||||||
---@diagnostic disable-next-line: undefined-field
|
local event, param1, param2, param3, param4, param5 = util.pull_event()
|
||||||
local event, param1, param2, param3, param4, param5 = os.pullEventRaw()
|
|
||||||
|
|
||||||
-- handle event
|
-- handle event
|
||||||
if event == "peripheral_detach" then
|
if event == "peripheral_detach" then
|
||||||
|
Loading…
Reference in New Issue
Block a user