Merge branch 'devel' into 193-pocket-main-application

This commit is contained in:
Mikayla Fischler
2023-04-12 18:06:24 -04:00
37 changed files with 183 additions and 113 deletions

View File

@@ -1,11 +1,13 @@
local apisessions = {}
---@param packet capi_frame
---@diagnostic disable-next-line: unused-local
function apisessions.handle_packet(packet)
end
-- attempt to identify which session's watchdog timer fired
---@param timer_event number
---@diagnostic disable-next-line: unused-local
function apisessions.check_all_watchdogs(timer_event)
end

View File

@@ -11,7 +11,6 @@ local dialog = require("coordinator.ui.dialog")
local print = util.print
local println = util.println
local print_ts = util.print_ts
local println_ts = util.println_ts
local PROTOCOL = comms.PROTOCOL
@@ -246,7 +245,7 @@ function coordinator.comms(version, modem, sv_port, sv_listen, api_listen, range
---@param msg table
local function _send_sv(protocol, msg_type, msg)
local s_pkt = comms.scada_packet()
local pkt = nil ---@type mgmt_packet|crdn_packet
local pkt ---@type mgmt_packet|crdn_packet
if protocol == PROTOCOL.SCADA_MGMT then
pkt = comms.mgmt_packet()

View File

@@ -657,8 +657,8 @@ function iocontrol.update_unit_statuses(statuses)
if type(rtu_statuses.rad_mon) == "table" then
if #rtu_statuses.rad_mon > 0 then
local rad_mon = rtu_statuses.rad_mon[1]
local rtu_faulted = rad_mon[1] ---@type boolean
unit.radiation = rad_mon[2] ---@type number
-- local rtu_faulted = rad_mon[1] ---@type boolean
unit.radiation = rad_mon[2] ---@type number
unit.unit_ps.publish("radiation", unit.radiation)
else

View File

@@ -12,10 +12,11 @@ local ALARM_STATE = types.ALARM_STATE
---@class sounder
local sounder = {}
-- note: max samples = 0x20000 (128 * 1024 samples)
local _2_PI = 2 * math.pi -- 2 whole pies, hope you're hungry
local _DRATE = 48000 -- 48kHz audio
local _MAX_VAL = 127 / 2 -- max signed integer in this 8-bit audio
local _MAX_SAMPLES = 0x20000 -- 128 * 1024 samples
local _05s_SAMPLES = 24000 -- half a second worth of samples
local test_alarms = { false, false, false, false, false, false, false, false, false, false, false, false }

View File

@@ -21,9 +21,7 @@ local sounder = require("coordinator.sounder")
local COORDINATOR_VERSION = "v0.12.6"
local print = util.print
local println = util.println
local print_ts = util.print_ts
local println_ts = util.println_ts
local log_graphics = coordinator.log_graphics
@@ -287,7 +285,7 @@ local function main()
else
log_sys("wired modem reconnected")
end
elseif type == "monitor" then
-- elseif type == "monitor" then
-- not supported, system will exit on loss of in-use monitors
elseif type == "speaker" then
local msg = "alarm sounder speaker reconnected"

View File

@@ -18,9 +18,8 @@ local border = core.graphics.border
---@param root graphics_element parent
---@param x integer top left x
---@param y integer top left y
---@param data reactor_db reactor data
---@param ps psil ps interface
local function new_view(root, x, y, data, ps)
local function new_view(root, x, y, ps)
local reactor = Rectangle{parent=root,border=border(1, colors.gray, true),width=30,height=7,x=x,y=y}
local text_fg_bg = cpair(colors.black, colors.lightGray)

View File

@@ -24,19 +24,18 @@ local pipe = core.graphics.pipe
---@param y integer top left y
---@param unit ioctl_unit unit database entry
local function make(parent, x, y, unit)
local height = 0
local num_boilers = #unit.boiler_data_tbl
local num_turbines = #unit.turbine_data_tbl
assert(num_boilers >= 0 and num_boilers <= 2, "minimum 0 boilers, maximum 2 boilers")
assert(num_turbines >= 1 and num_turbines <= 3, "minimum 1 turbine, maximum 3 turbines")
local height = 25
if num_boilers == 0 and num_turbines == 1 then
height = 9
elseif num_boilers == 1 and num_turbines <= 2 then
height = 17
else
height = 25
end
assert(parent.height() >= (y + height), "main display not of sufficient vertical resolution (add an additional row of monitors)")
@@ -51,7 +50,7 @@ local function make(parent, x, y, unit)
-- REACTOR --
-------------
reactor_view(root, 1, 3, unit.reactor_data, unit.unit_ps)
reactor_view(root, 1, 3, unit.unit_ps)
if num_boilers > 0 then
local coolant_pipes = {}

View File

@@ -5,7 +5,6 @@
local util = require("scada-common.util")
local iocontrol = require("coordinator.iocontrol")
local sounder = require("coordinator.sounder")
local style = require("coordinator.ui.style")
@@ -15,14 +14,9 @@ local unit_overview = require("coordinator.ui.components.unit_overview")
local core = require("graphics.core")
local ColorMap = require("graphics.elements.colormap")
local DisplayBox = require("graphics.elements.displaybox")
local Div = require("graphics.elements.div")
local TextBox = require("graphics.elements.textbox")
local PushButton = require("graphics.elements.controls.push_button")
local SwitchButton = require("graphics.elements.controls.switch_button")
local DataIndicator = require("graphics.elements.indicators.data")
local TEXT_ALIGN = core.graphics.TEXT_ALIGN