mirror of
https://github.com/MikaylaFischler/cc-mek-scada.git
synced 2024-08-30 18:22:34 +00:00
protected sleep call
This commit is contained in:
parent
67a93016c0
commit
146e0bf569
@ -12,7 +12,7 @@ os.loadAPI("config.lua")
|
||||
os.loadAPI("plc.lua")
|
||||
os.loadAPI("threads.lua")
|
||||
|
||||
local R_PLC_VERSION = "alpha-v0.4.1"
|
||||
local R_PLC_VERSION = "alpha-v0.4.2"
|
||||
|
||||
local print = util.print
|
||||
local println = util.println
|
||||
|
@ -8,6 +8,8 @@ local println = util.println
|
||||
local print_ts = util.print_ts
|
||||
local println_ts = util.println_ts
|
||||
|
||||
local psleep = util.psleep
|
||||
|
||||
local MAIN_CLOCK = 1 -- (1Hz, 20 ticks)
|
||||
local ISS_CLOCK = 0.5 -- (2Hz, 10 ticks)
|
||||
local COMMS_CLOCK = 0.25 -- (4Hz, 5 ticks)
|
||||
@ -302,9 +304,9 @@ function thread__iss(smem)
|
||||
local sleep_for = ISS_CLOCK - (util.time() - last_update)
|
||||
last_update = util.time()
|
||||
if sleep_for > 0 then
|
||||
sleep(sleep_for)
|
||||
psleep(sleep_for)
|
||||
else
|
||||
sleep(0.05)
|
||||
psleep(0.05)
|
||||
end
|
||||
end
|
||||
end
|
||||
@ -361,9 +363,9 @@ function thread__comms(smem)
|
||||
local sleep_for = COMMS_CLOCK - (util.time() - last_update)
|
||||
last_update = util.time()
|
||||
if sleep_for > 0 then
|
||||
sleep(sleep_for)
|
||||
psleep(sleep_for)
|
||||
else
|
||||
sleep(0.05)
|
||||
psleep(0.05)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -19,7 +19,7 @@ os.loadAPI("dev/boiler_rtu.lua")
|
||||
os.loadAPI("dev/imatrix_rtu.lua")
|
||||
os.loadAPI("dev/turbine_rtu.lua")
|
||||
|
||||
local RTU_VERSION = "alpha-v0.4.1"
|
||||
local RTU_VERSION = "alpha-v0.4.2"
|
||||
|
||||
local print = util.print
|
||||
local println = util.println
|
||||
|
@ -8,6 +8,8 @@ local println = util.println
|
||||
local print_ts = util.print_ts
|
||||
local println_ts = util.println_ts
|
||||
|
||||
local psleep = util.psleep
|
||||
|
||||
local MAIN_CLOCK = 2 -- (2Hz, 40 ticks)
|
||||
local COMMS_CLOCK = 0.25 -- (4Hz, 5 ticks)
|
||||
|
||||
@ -146,9 +148,9 @@ function thread__comms(smem)
|
||||
local sleep_for = COMMS_CLOCK - (util.time() - last_update)
|
||||
last_update = util.time()
|
||||
if sleep_for > 0 then
|
||||
sleep(sleep_for)
|
||||
psleep(sleep_for)
|
||||
else
|
||||
sleep(0.05)
|
||||
psleep(0.05)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user