From 0e81391144103b82ac71a697ab38360da38582ce Mon Sep 17 00:00:00 2001 From: Mikayla Fischler Date: Wed, 22 May 2024 21:45:52 -0400 Subject: [PATCH] #200 fixes to alarm/info display --- pocket/iocontrol.lua | 2 +- pocket/pocket.lua | 2 +- pocket/ui/pages/unit_page.lua | 27 ++++++++++++++++----------- 3 files changed, 18 insertions(+), 13 deletions(-) diff --git a/pocket/iocontrol.lua b/pocket/iocontrol.lua index 4500daa..485628f 100644 --- a/pocket/iocontrol.lua +++ b/pocket/iocontrol.lua @@ -786,7 +786,7 @@ function iocontrol.record_unit_data(data) if tripped(unit.alarms[ALARM.ContainmentBreach]) then local items = { - { text = "REACTOR EXPLOSION", color = colors.white }, + { text = "REACTOR MELTDOWN", color = colors.white }, { text = "WEAR HAZMAT SUIT", color = colors.blue } } diff --git a/pocket/pocket.lua b/pocket/pocket.lua index a0f3f5a..f330ab2 100644 --- a/pocket/pocket.lua +++ b/pocket/pocket.lua @@ -274,7 +274,7 @@ function pocket.comms(version, nic, sv_watchdog, api_watchdog) local ok = util.trinary(max == nil, packet.length == length, packet.length >= length and packet.length <= (max or 0)) if not ok then local fmt = "[comms] RX_PACKET{r_chan=%d,proto=%d,type=%d}: packet length mismatch -> expect %d != actual %d" - log.debug(util.sprintf(fmt, packet.scada_frame.remote_channel(), packet.scada_frame.protocol(), packet.type)) + log.debug(util.sprintf(fmt, packet.scada_frame.remote_channel(), packet.scada_frame.protocol(), packet.type, length, packet.scada_frame.length())) end return ok end diff --git a/pocket/ui/pages/unit_page.lua b/pocket/ui/pages/unit_page.lua index 8291be5..f6ad149 100644 --- a/pocket/ui/pages/unit_page.lua +++ b/pocket/ui/pages/unit_page.lua @@ -97,7 +97,7 @@ local function new_view(root) end local function load() - local page_div = Div{parent=main,x=2,y=2,width=main.get_width()-2} + local page_div = Div{parent=main,y=2,width=main.get_width()} local panes = {} @@ -125,7 +125,8 @@ local function new_view(root) end for i = 1, db.facility.num_units do - local u_div = panes[i] ---@type graphics_element + local u_pane = panes[i] + local u_div = Div{parent=u_pane,x=2,width=main.get_width()-2} local unit = db.units[i] ---@type pioctl_unit local u_ps = unit.unit_ps @@ -197,7 +198,7 @@ local function new_view(root) nav_links[i].alarm = alm_page.nav_to - TextBox{parent=alm_div,y=1,text="ECAM :)",height=1,alignment=ALIGN.CENTER} + TextBox{parent=alm_div,y=1,text="Status Info Display",height=1,alignment=ALIGN.CENTER} local ecam_disp = ListBox{parent=alm_div,x=2,y=3,scroll_height=500,nav_fg_bg=cpair(colors.lightGray,colors.gray),nav_active=cpair(colors.white,colors.gray)} @@ -206,23 +207,25 @@ local function new_view(root) ecam_disp.remove_all() for _, entry in ipairs(ecam) do - local div = Div{parent=ecam_disp,fg_bg=cpair(entry.color,colors.black)} - local text = TextBox{parent=div,text=entry.text} + local div = Div{parent=ecam_disp,height=1+#entry.items,fg_bg=cpair(entry.color,colors.black)} + local text = TextBox{parent=div,height=1,text=entry.text} if entry.help then - PushButton{parent=div,x=20,y=text.get_y(),text="?",callback=function()db.nav.open_help(entry.help)end,fg_bg=cpair(colors.gray,colors.black)} + PushButton{parent=div,x=21,y=text.get_y(),text="?",callback=function()db.nav.open_help(entry.help)end,fg_bg=cpair(colors.gray,colors.black)} end for _, item in ipairs(entry.items) do local fg_bg = nil if item.color then fg_bg = cpair(item.color, colors.black) end - text = TextBox{parent=div,x=3,text=item.text,fg_bg=fg_bg} + text = TextBox{parent=div,x=3,height=1,text=item.text,fg_bg=fg_bg} if item.help then - PushButton{parent=div,x=20,y=text.get_y(),text="?",callback=function()db.nav.open_help(item.help)end,fg_bg=cpair(colors.gray,colors.black)} + PushButton{parent=div,x=21,y=text.get_y(),text="?",callback=function()db.nav.open_help(item.help)end,fg_bg=cpair(colors.gray,colors.black)} end end + + ecam_disp.line_break() end end) @@ -230,7 +233,8 @@ local function new_view(root) --#region RPS Tab - local rps_div = Div{parent=page_div} + local rps_pane = Div{parent=page_div} + local rps_div = Div{parent=rps_pane,x=2,width=main.get_width()-2} table.insert(panes, rps_div) local rps_page = app.new_page(u_page, #panes) @@ -274,8 +278,9 @@ local function new_view(root) --#region RCS Tab - local rcs_div = Div{parent=page_div} - table.insert(panes, rcs_div) + local rcs_pane = Div{parent=page_div} + local rcs_div = Div{parent=rcs_pane,x=2,width=main.get_width()-2} + table.insert(panes, rcs_pane) local rcs_page = app.new_page(u_page, #panes) rcs_page.tasks = { update }