cleanup for pull request

This commit is contained in:
Mikayla 2024-06-14 21:10:42 +00:00
parent 87a91e309d
commit 1c719ad67b
9 changed files with 33 additions and 47 deletions

View File

@ -29,7 +29,6 @@ local function textbox(args)
if args.anchor == true then args.can_focus = true end
-- regex to identify entries without a height currently: ^.*TextBox\{((?!height=).)*$
-- provide a constraint condition to element creation to prevent an pointlessly tall text box
---@param frame graphics_frame
local function constrain(frame)

View File

@ -489,7 +489,7 @@ function iocontrol.record_unit_data(data)
local anc = unit.annunciator
rcs_hazard = rcs_hazard or anc.RCPTrip
rcs_warn = rcs_warn or anc.RCSFlowLow or anc.CoolantLevelLow or anc.RCSFault or anc.MaxWaterReturnFeed or
anc.CoolantFeedMismatch or anc.BoilRateMismatch or anc.SteamFeedMismatch or anc.MaxWaterReturnFeed
anc.CoolantFeedMismatch or anc.BoilRateMismatch or anc.SteamFeedMismatch
local rcs_status = 4
if rcs_hazard then
@ -530,7 +530,7 @@ function iocontrol.record_unit_data(data)
-- update reactor/control status
if unit.reactor_data.mek_status.status then
reactor_status = 4
reactor_state = 5 -- running
reactor_state = 5 -- running
control_status = util.trinary(unit.annunciator.AutoControl, 4, 3)
else
if unit.reactor_data.no_reactor then
@ -706,18 +706,12 @@ function iocontrol.record_unit_data(data)
end
if tripped(unit.alarms[ALARM.ReactorDamage]) then
local items = {
white("REACTOR DAMAGED"), blue("CHECK RCS"), blue("AWAIT DMG REDUCED")
}
local items = { white("REACTOR DAMAGED"), blue("CHECK RCS"), blue("AWAIT DMG REDUCED") }
table.insert(ecam, { color = colors.red, text = "REACTOR DAMAGE", help = "ReactorDamage", items = items })
end
if tripped(unit.alarms[ALARM.ReactorOverTemp]) then
local items = {
white("DAMAGING TEMP"), blue("CHECK RCS"), blue("AWAIT COOLDOWN")
}
local items = { white("DAMAGING TEMP"), blue("CHECK RCS"), blue("AWAIT COOLDOWN") }
table.insert(ecam, { color = colors.red, text = "REACTOR OVER TEMP", help = "ReactorOverTemp", items = items })
end
@ -728,7 +722,6 @@ function iocontrol.record_unit_data(data)
if tripped(unit.alarms[ALARM.ReactorWasteLeak]) then
local items = { white("AT WASTE CAPACITY"), blue("CHECK WASTE OUTPUT"), blue("KEEP RCT DISABLED") }
table.insert(ecam, { color = colors.red, text = "REACTOR WASTE LEAK", help = "ReactorWasteLeak", items = items})
end
@ -741,9 +734,7 @@ function iocontrol.record_unit_data(data)
local items = {}
local stat = unit.reactor_data.rps_status
-- for k, _ in pairs(stat) do
-- stat[k] = true
-- end
-- for k, _ in pairs(stat) do stat[k] = true end
local function insert(cond, key, text, color) if cond[key] then table.insert(items, { text = text, help = key, color = color }) end end

View File

@ -80,7 +80,7 @@ function threads.thread__main(smem)
local packet = pocket_comms.parse_packet(param1, param2, param3, param4, param5)
pocket_comms.handle_packet(packet)
elseif event == "mouse_click" or event == "mouse_up" or event == "mouse_drag" or event == "mouse_scroll" or
event == "double_click" then
event == "double_click" then
-- handle a mouse event
renderer.handle_mouse(core.events.new_mouse_event(event, param1, param2, param3))
elseif event == "char" or event == "key" or event == "key_up" then
@ -143,8 +143,8 @@ function threads.thread__render(smem)
-- load in from shared memory
local pkt_state = smem.pkt_state
local render_queue = smem.q.mq_render
local nav = smem.pkt_sys.nav
local render_queue = smem.q.mq_render
local last_update = util.time()

View File

@ -84,7 +84,7 @@ local function new_view(root)
local use = Div{parent=page_div,x=2,width=p_width}
local uis = Div{parent=page_div,x=2,width=p_width}
local fps = Div{parent=page_div,x=2,width=p_width}
local gls = Div{parent=page_div,x=2}
local gls = Div{parent=page_div,x=2,width=p_width}
local panes = { home, search, use, uis, fps, gls }
local doc_map = {}
@ -118,7 +118,7 @@ local function new_view(root)
search_results.remove_all()
if string.len(query) < 3 then
TextBox{parent=search_results,text=util.trinary(string.len(query)==0,"Click 'GO' to search...","Search requires at least 3 characters.")}
TextBox{parent=search_results,text="Search requires at least 3 characters."}
return
end

View File

@ -3,7 +3,6 @@
--
local util = require("scada-common.util")
-- local log = require("scada-common.log")
local iocontrol = require("pocket.iocontrol")
local pocket = require("pocket.pocket")
@ -23,12 +22,10 @@ local TextBox = require("graphics.elements.textbox")
local WaitingAnim = require("graphics.elements.animations.waiting")
local PushButton = require("graphics.elements.controls.push_button")
local DataIndicator = require("graphics.elements.indicators.data")
local IconIndicator = require("graphics.elements.indicators.icon")
-- local RadIndicator = require("graphics.elements.indicators.rad")
-- local VerticalBar = require("graphics.elements.indicators.vbar")
local PushButton = require("graphics.elements.controls.push_button")
local ALIGN = core.ALIGN
local cpair = core.cpair

View File

@ -27,7 +27,7 @@ return function (data, base_page, title, items, scroll_height)
TextBox{parent=section_div,y=1,text=title,height=1,alignment=ALIGN.CENTER}
PushButton{parent=section_div,x=3,y=1,text="<",fg_bg=btn_fg_bg,active_fg_bg=btn_active,callback=base_page.nav_to}
local gls_term_view_page = app.new_page(section_page, #panes + 1)
local view_page = app.new_page(section_page, #panes + 1)
local section_view_div = Div{parent=page_div,x=2}
table.insert(panes, section_view_div)
TextBox{parent=section_view_div,y=1,text=title,height=1,alignment=ALIGN.CENTER}
@ -47,7 +47,7 @@ return function (data, base_page, title, items, scroll_height)
local function view()
_end.focus()
gls_term_view_page.nav_to()
view_page.nav_to()
anchor.focus()
end

View File

@ -1,21 +1,21 @@
local types = require("scada-common.types")
local util = require("scada-common.util")
local types = require("scada-common.types")
local util = require("scada-common.util")
local iocontrol = require("pocket.iocontrol")
local iocontrol = require("pocket.iocontrol")
local style = require("pocket.ui.style")
local style = require("pocket.ui.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 DataIndicator = require("graphics.elements.indicators.data")
local PushButton = require("graphics.elements.controls.push_button")
local DataIndicator = require("graphics.elements.indicators.data")
local StateIndicator = require("graphics.elements.indicators.state")
local IconIndicator = require("graphics.elements.indicators.icon")
local VerticalBar = require("graphics.elements.indicators.vbar")
local PushButton = require("graphics.elements.controls.push_button")
local IconIndicator = require("graphics.elements.indicators.icon")
local VerticalBar = require("graphics.elements.indicators.vbar")
local ALIGN = core.ALIGN
local cpair = core.cpair
@ -69,7 +69,7 @@ return function (app, u_page, panes, blr_pane, b_id, ps, update)
temp.register(ps, "temperature", function (t) temp.update(db.temp_convert(t)) end)
local b_wll = IconIndicator{parent=blr_div,y=10,label="Water Level Lo",states=red_ind_s}
local b_hr = IconIndicator{parent=blr_div,label="Heating Rate Lo",states=yel_ind_s}
local b_hr = IconIndicator{parent=blr_div,label="Heating Rate Lo",states=yel_ind_s}
b_wll.register(ps, "WaterLevelLow", b_wll.update)
b_hr.register(ps, "HeatingRateLow", b_hr.update)

View File

@ -10,13 +10,13 @@ local core = require("graphics.core")
local Div = require("graphics.elements.div")
local TextBox = require("graphics.elements.textbox")
local PushButton = require("graphics.elements.controls.push_button")
local DataIndicator = require("graphics.elements.indicators.data")
local StateIndicator = require("graphics.elements.indicators.state")
local IconIndicator = require("graphics.elements.indicators.icon")
local VerticalBar = require("graphics.elements.indicators.vbar")
local PushButton = require("graphics.elements.controls.push_button")
local ALIGN = core.ALIGN
local cpair = core.cpair

View File

@ -9,14 +9,14 @@ local core = require("graphics.core")
local Div = require("graphics.elements.div")
local TextBox = require("graphics.elements.textbox")
local PushButton = require("graphics.elements.controls.push_button")
local DataIndicator = require("graphics.elements.indicators.data")
local IconIndicator = require("graphics.elements.indicators.icon")
local PowerIndicator = require("graphics.elements.indicators.power")
local StateIndicator = require("graphics.elements.indicators.state")
local VerticalBar = require("graphics.elements.indicators.vbar")
local PushButton = require("graphics.elements.controls.push_button")
local ALIGN = core.ALIGN
local cpair = core.cpair
@ -70,16 +70,15 @@ return function (app, u_page, panes, tbn_pane, u_id, t_id, ps, update)
input_rate.register(ps, "steam_input_rate", input_rate.update)
local t_sdo = IconIndicator{parent=tbn_div,y=10,label="Steam Dumping",states=tri_ind_s}
local t_tos = IconIndicator{parent=tbn_div,label="Over Speed",states=red_ind_s}
local t_gtrp = IconIndicator{parent=tbn_div,label="Generator Trip",states=yel_ind_s}
local t_trp = IconIndicator{parent=tbn_div,label="Turbine Trip",states=red_ind_s}
local t_tos = IconIndicator{parent=tbn_div,label="Over Speed",states=red_ind_s}
local t_gtrp = IconIndicator{parent=tbn_div,label="Generator Trip",states=yel_ind_s}
local t_trp = IconIndicator{parent=tbn_div,label="Turbine Trip",states=red_ind_s}
t_sdo.register(ps, "SteamDumpOpen", t_sdo.update)
t_tos.register(ps, "TurbineOverSpeed", t_tos.update)
t_gtrp.register(ps, "GeneratorTrip", t_gtrp.update)
t_trp.register(ps, "TurbineTrip", t_trp.update)
local tbn_ext_div = Div{parent=tbn_pane,x=2,width=tbn_pane.get_width()-2}
table.insert(panes, tbn_ext_div)