#367 logic for missing device detection and user-friendly messages

This commit is contained in:
Mikayla
2024-08-21 21:23:16 +00:00
parent 01a1c374ab
commit 12f187f596
6 changed files with 206 additions and 35 deletions

View File

@@ -2,14 +2,12 @@
-- RTU ID Check Failure Entry
--
local databus = require("supervisor.databus")
local style = require("supervisor.panel.style")
local style = require("supervisor.panel.style")
local core = require("graphics.core")
local core = require("graphics.core")
local Div = require("graphics.elements.div")
local TextBox = require("graphics.elements.textbox")
local Div = require("graphics.elements.div")
local TextBox = require("graphics.elements.textbox")
local ALIGN = core.ALIGN
@@ -17,9 +15,9 @@ local cpair = core.cpair
-- create an ID check list entry
---@param parent graphics_element parent
---@param unit unit_session RTU session
---@param msg string message
---@param fail_code integer failure code
local function init(parent, unit, fail_code, cmp_id)
local function init(parent, msg, fail_code, cmp_id)
local s_hi_box = style.theme.highlight_box
local label_fg = style.fp.label_fg
@@ -42,17 +40,13 @@ local function init(parent, unit, fail_code, cmp_id)
TextBox{parent=entry,text="",width=11,fg_bg=cpair(colors.black,colors.yellow)}
end
if fail_code ~= 4 and cmp_id then
local rtu_addr = TextBox{parent=entry,x=1,y=2,text="@ C ??",alignment=ALIGN.CENTER,width=8,fg_bg=s_hi_box,nav_active=cpair(colors.gray,colors.black)}
if fail_code == 4 then
TextBox{parent=entry,x=13,y=2,text=msg}
else
TextBox{parent=entry,x=13,y=2,text="@ C "..cmp_id,alignment=ALIGN.CENTER,width=8,fg_bg=s_hi_box,nav_active=cpair(colors.gray,colors.black)}
TextBox{parent=entry,x=21,y=2,text=msg}
end
if fail_code ~= 4 and cmp_id then
local rtu_addr = TextBox{parent=entry,x=1,y=2,text="@ C ??",alignment=ALIGN.CENTER,width=8,fg_bg=s_hi_box,nav_active=cpair(colors.gray,colors.black)}
end
TextBox{parent=entry,x=21,y=2,text="FW:",width=3}
local rtu_fw_v = TextBox{parent=entry,x=25,y=2,text=" ------- ",width=9,fg_bg=label_fg}
return root
end