fixed pocket main thread crash on nil current page, added info page to alarm test app
This commit is contained in:
parent
99c9fec195
commit
20f949a9dd
@ -150,7 +150,7 @@ function pocket.init_nav(smem)
|
||||
---@class pocket_app
|
||||
local app = {
|
||||
loaded = false,
|
||||
cur_page = nil, ---@type nav_tree_page
|
||||
cur_page = nil, ---@type nav_tree_page|nil
|
||||
pane = pane,
|
||||
paned_pages = {}, ---@type nav_tree_page[]
|
||||
sidebar_items = {} ---@type sidebar_entry[]
|
||||
@ -348,7 +348,7 @@ function pocket.init_nav(smem)
|
||||
function nav.get_containers() return self.containers end
|
||||
|
||||
-- get the currently active page
|
||||
---@return nav_tree_page
|
||||
---@return nav_tree_page|nil
|
||||
function nav.get_current_page()
|
||||
return self.apps[self.cur_app].get_current_page()
|
||||
end
|
||||
|
||||
@ -22,7 +22,7 @@ local pocket = require("pocket.pocket")
|
||||
local renderer = require("pocket.renderer")
|
||||
local threads = require("pocket.threads")
|
||||
|
||||
local POCKET_VERSION = "v1.0.0"
|
||||
local POCKET_VERSION = "v1.0.1"
|
||||
|
||||
local println = util.println
|
||||
local println_ts = util.println_ts
|
||||
|
||||
@ -58,8 +58,10 @@ function threads.thread__main(smem)
|
||||
pocket_comms.link_update()
|
||||
|
||||
-- update any tasks for the active page
|
||||
if nav.get_current_page() then
|
||||
local page_tasks = nav.get_current_page().tasks
|
||||
for i = 1, #page_tasks do page_tasks[i]() end
|
||||
end
|
||||
|
||||
loop_clock.start()
|
||||
elseif sv_wd.is_timer(param1) then
|
||||
|
||||
@ -155,14 +155,27 @@ local function new_view(root)
|
||||
|
||||
--#endregion
|
||||
|
||||
--#region info page
|
||||
|
||||
app.new_page(nil, 3)
|
||||
|
||||
local info_div = Div{parent=page_div}
|
||||
|
||||
TextBox{parent=info_div,x=2,y=1,text="This app provides tools to test alarm sounds by alarm and by tone (1-8)."}
|
||||
TextBox{parent=info_div,x=2,y=6,text="The system must be idle (all units stopped with no alarms active) for testing to run."}
|
||||
TextBox{parent=info_div,x=2,y=12,text="Currently, testing will be denied unless you have a Facility Authentication Key set (this will change in the future)."}
|
||||
|
||||
--#endregion
|
||||
|
||||
-- setup multipane
|
||||
local u_pane = MultiPane{parent=page_div,x=1,y=1,panes={alarms_div,tones_div}}
|
||||
local u_pane = MultiPane{parent=page_div,x=1,y=1,panes={alarms_div,tones_div,info_div}}
|
||||
app.set_root_pane(u_pane)
|
||||
|
||||
local list = {
|
||||
{ label = " # ", tall = true, color = core.cpair(colors.black, colors.green), callback = db.nav.go_home },
|
||||
{ label = " \x13 ", color = core.cpair(colors.black, colors.red), callback = function () app.switcher(1) end },
|
||||
{ label = " \x0f ", color = core.cpair(colors.black, colors.yellow), callback = function () app.switcher(2) end }
|
||||
{ label = " \x0f ", color = core.cpair(colors.black, colors.yellow), callback = function () app.switcher(2) end },
|
||||
{ label = " ? ", color = core.cpair(colors.black, colors.blue), callback = function () app.switcher(3) end }
|
||||
}
|
||||
|
||||
app.set_sidebar(list)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user