code cleanup

This commit is contained in:
Mikayla Fischler 2023-06-03 17:31:06 -04:00
parent 24a7275543
commit b4932b33b6
6 changed files with 16 additions and 17 deletions

View File

@ -44,6 +44,7 @@ local function data(args)
e.window.setCursorPos(1, 1)
e.window.write(args.label)
local value_color = e.fg_bg.fgd
local label_len = string.len(args.label)
local data_start = 1
local clear_width = args.width
@ -53,8 +54,6 @@ local function data(args)
clear_width = args.width - (label_len + 1)
end
local value_color = e.fg_bg.fgd
-- on state change
---@param value any new value
function e.on_update(value)

View File

@ -56,7 +56,7 @@ local function listbox(args)
local mouse_last_y = 0 -- last reported y coordinate of drag
-- draw scroll bar arrows, optionally showing one of them as pressed
---@param pressed_arrow? integer arrow to show as pressed (1 = scroll up, 0 = neither, -1 = scroll down)
---@param pressed_arrow? 1|0|-1 arrow to show as pressed (1 = scroll up, 0 = neither, -1 = scroll down)
local function draw_arrows(pressed_arrow)
local nav_fg_bg = args.nav_fg_bg or e.fg_bg
local active_fg_bg = args.nav_active or nav_fg_bg
@ -200,7 +200,7 @@ local function listbox(args)
end
-- handle a child element having been added to the list
---@param id string|integer element identifier
---@param id element_id element identifier
---@param child graphics_element child element
function e.on_added(id, child)
table.insert(list, { id = id, e = child, y = 0, h = child.get_height() })
@ -208,7 +208,7 @@ local function listbox(args)
end
-- handle a child element having been removed from the list
---@param id string|integer element identifier
---@param id element_id element identifier
function e.on_removed(id)
for idx, elem in ipairs(list) do
if elem.id == id then

File diff suppressed because one or more lines are too long

View File

@ -15,10 +15,10 @@ databus.ps = psil.create()
function databus.heartbeat() databus.ps.toggle("heartbeat") end
-- transmit firmware versions across the bus
---@param plc_v string supervisor version
---@param sv_v string supervisor version
---@param comms_v string comms version
function databus.tx_versions(plc_v, comms_v)
databus.ps.publish("version", plc_v)
function databus.tx_versions(sv_v, comms_v)
databus.ps.publish("version", sv_v)
databus.ps.publish("comms_version", comms_v)
end
@ -38,7 +38,7 @@ function databus.tx_plc_connected(reactor_id, fw, channel)
databus.ps.publish("plc_" .. reactor_id .. "_chan", tostring(channel))
end
-- transmit PLC session connection state
-- transmit PLC disconnected
---@param reactor_id integer reactor unit ID
function databus.tx_plc_disconnected(reactor_id)
databus.ps.publish("plc_" .. reactor_id .. "_fw", " ------- ")
@ -110,7 +110,7 @@ function databus.tx_crd_connected(fw, channel)
databus.ps.publish("crd_chan", tostring(channel))
end
-- transmit coordinator session connection state
-- transmit coordinator disconnected
function databus.tx_crd_disconnected()
databus.ps.publish("crd_fw", " ------- ")
databus.ps.publish("crd_conn", false)
@ -133,7 +133,7 @@ function databus.tx_crd_rtt(rtt)
end
end
-- transmit PDG firmware version and session connection state
-- transmit PKT firmware version and PDG session connection state
---@param session_id integer PDG session
---@param fw string firmware version
---@param channel integer PDG remote port
@ -143,7 +143,7 @@ function databus.tx_pdg_connected(session_id, fw, channel)
pgi.create_pdg_entry(session_id)
end
-- transmit PDG disconnected
-- transmit PDG session disconnected
---@param session_id integer PDG session
function databus.tx_pdg_disconnected(session_id)
pgi.delete_pdg_entry(session_id)

View File

@ -195,7 +195,7 @@ local function main()
-- check for termination request
if event == "terminate" or ppm.should_terminate() then
println_ts("closing sesssions...")
println_ts("closing sessions...")
log.info("terminate requested, closing sessions...")
svsessions.close_all()
log.info("sessions closed")

View File

@ -308,7 +308,7 @@ function supervisor.comms(_version, num_reactors, cooling_conf, modem, dev_liste
-- this is an attempt to establish a new pocket diagnostic session
local s_id = svsessions.establish_pdg_session(l_port, r_port, firmware_v)
println(util.c("PDG (", firmware_v, ") [:", r_port, "] \xbb connected"))
println(util.c("PKT (", firmware_v, ") [:", r_port, "] \xbb connected"))
log.info(util.c("SVCTL_ESTABLISH: pocket (", firmware_v, ") [:", r_port, "] connected with session ID ", s_id))
_send_svctl_establish(next_seq_id, r_port, { ESTABLISH_ACK.ALLOW })