From ae85cfc57957e3bc8d927135678d080950ab3885 Mon Sep 17 00:00:00 2001 From: Mikayla Fischler Date: Sun, 5 Jan 2025 15:05:01 -0500 Subject: [PATCH] #557 start of induction matrix and sps pages --- pocket/iorx.lua | 4 ++ pocket/ui/pages/facility_matrix.lua | 59 +++++++++++++++++++++++++++++ pocket/ui/pages/facility_sps.lua | 0 3 files changed, 63 insertions(+) create mode 100644 pocket/ui/pages/facility_matrix.lua create mode 100644 pocket/ui/pages/facility_sps.lua diff --git a/pocket/iorx.lua b/pocket/iorx.lua index 0aac073..528c2f4 100644 --- a/pocket/iorx.lua +++ b/pocket/iorx.lua @@ -651,6 +651,10 @@ function iorx.record_waste_data(data) fac.ps.publish("sps_process_rate", f_data[9]) end +function iorx.record_fac_detail_data(data) + +end + return function (io_obj) io = io_obj return iorx diff --git a/pocket/ui/pages/facility_matrix.lua b/pocket/ui/pages/facility_matrix.lua new file mode 100644 index 0000000..57301e6 --- /dev/null +++ b/pocket/ui/pages/facility_matrix.lua @@ -0,0 +1,59 @@ +local types = require("scada-common.types") +local util = require("scada-common.util") + +local iocontrol = require("pocket.iocontrol") + +local style = require("pocket.ui.style") + +local core = require("graphics.core") + +local Div = require("graphics.elements.Div") +local TextBox = require("graphics.elements.TextBox") + +local DataIndicator = require("graphics.elements.indicators.DataIndicator") +local HorizontalBar = require("graphics.elements.indicators.HorizontalBar") +local IconIndicator = require("graphics.elements.indicators.IconIndicator") +local StateIndicator = require("graphics.elements.indicators.StateIndicator") + +local cpair = core.cpair + +local label = style.label +local lu_col = style.label_unit_pair +local text_fg = style.text_fg + +local mode_ind_s = { + { color = cpair(colors.black, colors.lightGray), symbol = "-" }, + { color = cpair(colors.black, colors.white), symbol = "+" } +} + +-- create an induction matrix view for the facility app +---@param app pocket_app +---@param page nav_tree_page|nil parent page, if applicable +---@param panes Div[] +---@param tank_pane Div +---@param ps psil +---@param update function +return function (app, page, panes, tank_pane, ps, update) + local fac = iocontrol.get_db().facility + + local mtx_div = Div{parent=tank_pane,x=2,width=tank_pane.get_width()-2} + table.insert(panes, mtx_div) + + local matrix_page = app.new_page(page, #panes) + matrix_page.tasks = { update } + + TextBox{parent=mtx_div,y=1,text="I Matrix",width=9} + local status = StateIndicator{parent=mtx_div,x=10,y=1,states=style.imatrix.states,value=1,min_width=12} + status.register(ps, "InductionMatrixStateStatus", status.update) + + TextBox{parent=mtx_div,y=3,text="Fill",width=10,fg_bg=label} + local chg_pcnt = DataIndicator{parent=mtx_div,x=14,y=3,label="",format="%5.2f",value=100,unit="%",lu_colors=lu_col,width=8,fg_bg=text_fg} + local chg_amnt = DataIndicator{parent=mtx_div,label="",format="%18d",value=0,commas=true,unit="mB",lu_colors=lu_col,width=21,fg_bg=text_fg} + + TextBox{parent=mtx_div,y=6,text="Charge Level",width=12,fg_bg=label} + local level = HorizontalBar{parent=mtx_div,y=7,bar_fg_bg=cpair(colors.green,colors.gray),height=1,width=21} + + level.register(ps, "fill", level.update) + + return matrix_page.nav_to +end diff --git a/pocket/ui/pages/facility_sps.lua b/pocket/ui/pages/facility_sps.lua new file mode 100644 index 0000000..e69de29