From 473b0dd10da49583701c24a8dd5a19073d9b185f Mon Sep 17 00:00:00 2001 From: Mikayla Fischler Date: Sun, 14 Apr 2024 16:16:18 -0400 Subject: [PATCH] fixes and comments --- coordinator/coordinator.lua | 2 +- coordinator/iocontrol.lua | 15 ++++++++++++++- coordinator/session/pocket.lua | 2 ++ graphics/elements/appmultipane.lua | 5 ++--- pocket/iocontrol.lua | 2 +- pocket/startup.lua | 2 +- 6 files changed, 21 insertions(+), 7 deletions(-) diff --git a/coordinator/coordinator.lua b/coordinator/coordinator.lua index f4c8b69..e72cccf 100644 --- a/coordinator/coordinator.lua +++ b/coordinator/coordinator.lua @@ -485,7 +485,7 @@ function coordinator.comms(version, nic, sv_watchdog) _send_api_establish_ack(packet.scada_frame, ESTABLISH_ACK.BAD_VERSION) elseif api_v ~= comms.api_version then if self.last_api_est_acks[src_addr] ~= ESTABLISH_ACK.BAD_API_VERSION then - log.info(util.c("dropping API establish packet with incorrect api version v", comms_v, " (expected v", comms.version, ")")) + log.info(util.c("dropping API establish packet with incorrect api version v", api_v, " (expected v", comms.api_version, ")")) end _send_api_establish_ack(packet.scada_frame, ESTABLISH_ACK.BAD_API_VERSION) diff --git a/coordinator/iocontrol.lua b/coordinator/iocontrol.lua index c91e24d..1de337f 100644 --- a/coordinator/iocontrol.lua +++ b/coordinator/iocontrol.lua @@ -279,7 +279,20 @@ function iocontrol.init(conf, comms, temp_scale) }, ---@type alarms - alarms = { ALARM_STATE.INACTIVE, ALARM_STATE.INACTIVE, ALARM_STATE.INACTIVE, ALARM_STATE.INACTIVE, ALARM_STATE.INACTIVE, ALARM_STATE.INACTIVE, ALARM_STATE.INACTIVE, ALARM_STATE.INACTIVE, ALARM_STATE.INACTIVE, ALARM_STATE.INACTIVE, ALARM_STATE.INACTIVE, ALARM_STATE.INACTIVE }, + alarms = { + ALARM_STATE.INACTIVE, -- containment breach + ALARM_STATE.INACTIVE, -- containment radiation + ALARM_STATE.INACTIVE, -- reactor lost + ALARM_STATE.INACTIVE, -- damage critical + ALARM_STATE.INACTIVE, -- reactor taking damage + ALARM_STATE.INACTIVE, -- reactor over temperature + ALARM_STATE.INACTIVE, -- reactor high temperature + ALARM_STATE.INACTIVE, -- waste leak + ALARM_STATE.INACTIVE, -- waste level high + ALARM_STATE.INACTIVE, -- RPS transient + ALARM_STATE.INACTIVE, -- RCS transient + ALARM_STATE.INACTIVE -- turbine trip + }, annunciator = {}, ---@type annunciator diff --git a/coordinator/session/pocket.lua b/coordinator/session/pocket.lua index 83ebdce..7101297 100644 --- a/coordinator/session/pocket.lua +++ b/coordinator/session/pocket.lua @@ -151,6 +151,8 @@ function pocket.new_session(id, s_addr, in_queue, out_queue, timeout) u.has_tank }) end + + _send(CRDN_TYPE.API_GET_UNITS, data) else log.debug(log_header .. "handler received unsupported CRDN packet type " .. pkt.type) end diff --git a/graphics/elements/appmultipane.lua b/graphics/elements/appmultipane.lua index fc56441..5973182 100644 --- a/graphics/elements/appmultipane.lua +++ b/graphics/elements/appmultipane.lua @@ -13,7 +13,7 @@ local MOUSE_CLICK = core.events.MOUSE_CLICK ---@field nav_colors cpair on/off colors (a/b respectively) for page navigator ---@field scroll_nav boolean? true to allow scrolling to change the active pane ---@field drag_nav boolean? true to allow mouse dragging to change the active pane (on mouse up) ----@field callback function? function to call when scrolling or dragging changes the pane +---@field callback function? function to call when pane is changed by mouse interaction ---@field parent graphics_element ---@field id? string element id ---@field x? integer 1 if omitted @@ -44,6 +44,7 @@ local function multipane(args) for i = 1, #args.panes do args.panes[i].hide() end args.panes[e.value].show() + -- draw page indicator dots for i = 1, #args.panes do e.w_set_cur(nav_x_start + (i - 1), e.frame.h) e.w_set_fgd(util.trinary(i == e.value, args.nav_colors.color_a, args.nav_colors.color_b)) @@ -62,10 +63,8 @@ local function multipane(args) if event.type == MOUSE_CLICK.TAP then e.set_value(id) - args.callback(e.value) elseif event.type == MOUSE_CLICK.UP then e.set_value(id) - args.callback(e.value) end end end diff --git a/pocket/iocontrol.lua b/pocket/iocontrol.lua index 0f779c1..30f4879 100644 --- a/pocket/iocontrol.lua +++ b/pocket/iocontrol.lua @@ -99,7 +99,7 @@ function iocontrol.alloc_nav() end end - -- create a new page entry in the page navigation tree + -- create a new page entry in the app's page navigation tree ---@param parent nav_tree_page? a parent page or nil to set this as the root ---@param nav_to function|integer function to navigate to this page or pane index ---@return nav_tree_page new_page this new page diff --git a/pocket/startup.lua b/pocket/startup.lua index 3f1d8c3..67e2f79 100644 --- a/pocket/startup.lua +++ b/pocket/startup.lua @@ -18,7 +18,7 @@ local iocontrol = require("pocket.iocontrol") local pocket = require("pocket.pocket") local renderer = require("pocket.renderer") -local POCKET_VERSION = "v0.7.5-alpha" +local POCKET_VERSION = "v0.8.0-alpha" local println = util.println local println_ts = util.println_ts