mirror of
https://github.com/MikaylaFischler/cc-mek-scada.git
synced 2024-08-30 18:22:34 +00:00
pocket cleanup
This commit is contained in:
parent
43e708aa0d
commit
81005d3e2c
@ -17,7 +17,7 @@ local coreio = require("pocket.coreio")
|
|||||||
local pocket = require("pocket.pocket")
|
local pocket = require("pocket.pocket")
|
||||||
local renderer = require("pocket.renderer")
|
local renderer = require("pocket.renderer")
|
||||||
|
|
||||||
local POCKET_VERSION = "alpha-v0.2.6"
|
local POCKET_VERSION = "alpha-v0.2.7"
|
||||||
|
|
||||||
local println = util.println
|
local println = util.println
|
||||||
local println_ts = util.println_ts
|
local println_ts = util.println_ts
|
||||||
@ -120,54 +120,54 @@ local function main()
|
|||||||
conn_wd.sv.feed()
|
conn_wd.sv.feed()
|
||||||
conn_wd.api.feed()
|
conn_wd.api.feed()
|
||||||
log.debug("startup> conn watchdog started")
|
log.debug("startup> conn watchdog started")
|
||||||
end
|
|
||||||
|
|
||||||
-- main event loop
|
-- main event loop
|
||||||
while ui_ok do
|
while true do
|
||||||
local event, param1, param2, param3, param4, param5 = util.pull_event()
|
local event, param1, param2, param3, param4, param5 = util.pull_event()
|
||||||
|
|
||||||
-- handle event
|
-- handle event
|
||||||
if event == "timer" then
|
if event == "timer" then
|
||||||
if loop_clock.is_clock(param1) then
|
if loop_clock.is_clock(param1) then
|
||||||
-- main loop tick
|
-- main loop tick
|
||||||
|
|
||||||
-- relink if necessary
|
-- relink if necessary
|
||||||
pocket_comms.link_update()
|
pocket_comms.link_update()
|
||||||
|
|
||||||
loop_clock.start()
|
loop_clock.start()
|
||||||
elseif conn_wd.sv.is_timer(param1) then
|
elseif conn_wd.sv.is_timer(param1) then
|
||||||
-- supervisor watchdog timeout
|
-- supervisor watchdog timeout
|
||||||
log.info("supervisor server timeout")
|
log.info("supervisor server timeout")
|
||||||
pocket_comms.close_sv()
|
pocket_comms.close_sv()
|
||||||
elseif conn_wd.api.is_timer(param1) then
|
elseif conn_wd.api.is_timer(param1) then
|
||||||
-- coordinator watchdog timeout
|
-- coordinator watchdog timeout
|
||||||
log.info("coordinator api server timeout")
|
log.info("coordinator api server timeout")
|
||||||
pocket_comms.close_api()
|
pocket_comms.close_api()
|
||||||
else
|
else
|
||||||
-- a non-clock/main watchdog timer event
|
-- a non-clock/main watchdog timer event
|
||||||
-- notify timer callback dispatcher
|
-- notify timer callback dispatcher
|
||||||
tcallbackdsp.handle(param1)
|
tcallbackdsp.handle(param1)
|
||||||
|
end
|
||||||
|
elseif event == "modem_message" then
|
||||||
|
-- got a packet
|
||||||
|
local packet = pocket_comms.parse_packet(param1, param2, param3, param4, param5)
|
||||||
|
pocket_comms.handle_packet(packet)
|
||||||
|
elseif event == "mouse_click" then
|
||||||
|
-- handle a monitor touch event
|
||||||
|
renderer.handle_mouse(core.events.touch(param1, param2, param3))
|
||||||
|
end
|
||||||
|
|
||||||
|
-- check for termination request
|
||||||
|
if event == "terminate" or ppm.should_terminate() then
|
||||||
|
log.info("terminate requested, closing server connections...")
|
||||||
|
pocket_comms.close()
|
||||||
|
log.info("connections closed")
|
||||||
|
break
|
||||||
end
|
end
|
||||||
elseif event == "modem_message" then
|
|
||||||
-- got a packet
|
|
||||||
local packet = pocket_comms.parse_packet(param1, param2, param3, param4, param5)
|
|
||||||
pocket_comms.handle_packet(packet)
|
|
||||||
elseif event == "mouse_click" then
|
|
||||||
-- handle a monitor touch event
|
|
||||||
renderer.handle_mouse(core.events.touch(param1, param2, param3))
|
|
||||||
end
|
end
|
||||||
|
|
||||||
-- check for termination request
|
renderer.close_ui()
|
||||||
if event == "terminate" or ppm.should_terminate() then
|
|
||||||
log.info("terminate requested, closing server connections...")
|
|
||||||
pocket_comms.close()
|
|
||||||
log.info("connections closed")
|
|
||||||
break
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
renderer.close_ui()
|
|
||||||
|
|
||||||
println_ts("exited")
|
println_ts("exited")
|
||||||
log.info("exited")
|
log.info("exited")
|
||||||
end
|
end
|
||||||
|
@ -8,11 +8,11 @@ local style = require("pocket.ui.style")
|
|||||||
|
|
||||||
local conn_waiting = require("pocket.ui.components.conn_waiting")
|
local conn_waiting = require("pocket.ui.components.conn_waiting")
|
||||||
|
|
||||||
local home_page = require("pocket.ui.components.home_page")
|
local home_page = require("pocket.ui.pages.home_page")
|
||||||
local unit_page = require("pocket.ui.components.unit_page")
|
local unit_page = require("pocket.ui.pages.unit_page")
|
||||||
local reactor_page = require("pocket.ui.components.reactor_page")
|
local reactor_page = require("pocket.ui.pages.reactor_page")
|
||||||
local boiler_page = require("pocket.ui.components.boiler_page")
|
local boiler_page = require("pocket.ui.pages.boiler_page")
|
||||||
local turbine_page = require("pocket.ui.components.turbine_page")
|
local turbine_page = require("pocket.ui.pages.turbine_page")
|
||||||
|
|
||||||
local core = require("graphics.core")
|
local core = require("graphics.core")
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user