From 48ec973695c47e5fce18ebbe91e6c6204eb8c30b Mon Sep 17 00:00:00 2001 From: Mikayla Fischler Date: Mon, 21 Apr 2025 22:13:58 -0400 Subject: [PATCH] #616 added pellet color option to the coordinator --- coordinator/config/hmi.lua | 9 ++++++--- coordinator/config/system.lua | 2 ++ coordinator/configure.lua | 5 ++++- coordinator/coordinator.lua | 2 ++ coordinator/startup.lua | 2 +- coordinator/ui/style.lua | 25 ++++++++++++++++--------- 6 files changed, 31 insertions(+), 14 deletions(-) diff --git a/coordinator/config/hmi.lua b/coordinator/config/hmi.lua index c913da1..89daef6 100644 --- a/coordinator/config/hmi.lua +++ b/coordinator/config/hmi.lua @@ -234,16 +234,19 @@ function hmi.create(tool_ctl, main_pane, cfg_sys, divs, style) TextBox{parent=crd_cfg,x=1,y=2,text=" Coordinator UI Configuration",fg_bg=cpair(colors.black,colors.lime)} - TextBox{parent=crd_c_1,x=1,y=1,height=3,text="Configure the UI interface options below if you wish to customize formats."} + TextBox{parent=crd_c_1,x=1,y=1,height=2,text="You can customize the UI with the interface options below."} TextBox{parent=crd_c_1,x=1,y=4,text="Clock Time Format"} tool_ctl.clock_fmt = RadioButton{parent=crd_c_1,x=1,y=5,default=util.trinary(ini_cfg.Time24Hour,1,2),options={"24-Hour","12-Hour"},callback=function()end,radio_colors=cpair(colors.lightGray,colors.black),select_color=colors.lime} + TextBox{parent=crd_c_1,x=20,y=4,text="Po/Pu Pellet Color"} + tool_ctl.pellet_color = RadioButton{parent=crd_c_1,x=20,y=5,default=util.trinary(ini_cfg.GreenPuPellet,1,2),options={"Green Pu/Cyan Po","Cyan Pu/Green Po (Mek 10.4+)"},callback=function()end,radio_colors=cpair(colors.lightGray,colors.black),select_color=colors.lime} + TextBox{parent=crd_c_1,x=1,y=8,text="Temperature Scale"} tool_ctl.temp_scale = RadioButton{parent=crd_c_1,x=1,y=9,default=ini_cfg.TempScale,options=types.TEMP_SCALE_NAMES,callback=function()end,radio_colors=cpair(colors.lightGray,colors.black),select_color=colors.lime} - TextBox{parent=crd_c_1,x=24,y=8,text="Energy Scale"} - tool_ctl.energy_scale = RadioButton{parent=crd_c_1,x=24,y=9,default=ini_cfg.EnergyScale,options=types.ENERGY_SCALE_NAMES,callback=function()end,radio_colors=cpair(colors.lightGray,colors.black),select_color=colors.lime} + TextBox{parent=crd_c_1,x=20,y=8,text="Energy Scale"} + tool_ctl.energy_scale = RadioButton{parent=crd_c_1,x=20,y=9,default=ini_cfg.EnergyScale,options=types.ENERGY_SCALE_NAMES,callback=function()end,radio_colors=cpair(colors.lightGray,colors.black),select_color=colors.lime} local function submit_ui_opts() tmp_cfg.Time24Hour = tool_ctl.clock_fmt.get_value() == 1 diff --git a/coordinator/config/system.lua b/coordinator/config/system.lua index bc78cb0..3bb035f 100644 --- a/coordinator/config/system.lua +++ b/coordinator/config/system.lua @@ -528,6 +528,8 @@ function system.create(tool_ctl, main_pane, cfg_sys, divs, ext, style) if f[1] == "AuthKey" then val = string.rep("*", string.len(val)) elseif f[1] == "LogMode" then val = util.trinary(raw == log.MODE.APPEND, "append", "replace") + elseif f[1] == "GreenPuPellet" then + val = tri(raw, "Green Pu/Cyan Po", "Cyan Pu/Green Po") elseif f[1] == "TempScale" then val = util.strval(types.TEMP_SCALE_NAMES[raw]) elseif f[1] == "EnergyScale" then diff --git a/coordinator/configure.lua b/coordinator/configure.lua index a70f0b7..d76aac2 100644 --- a/coordinator/configure.lua +++ b/coordinator/configure.lua @@ -35,7 +35,8 @@ local changes = { { "v1.2.4", { "Added temperature scale options" } }, { "v1.2.12", { "Added main UI theme", "Added front panel UI theme", "Added color accessibility modes" } }, { "v1.3.3", { "Added standard with black off state color mode", "Added blue indicator color modes" } }, - { "v1.5.1", { "Added energy scale options" } } + { "v1.5.1", { "Added energy scale options" } }, + { "v1.6.13", { "Added option for Po/Pu pellet green/cyan pairing" } } } ---@class crd_configurator @@ -95,6 +96,7 @@ local tmp_cfg = { UnitCount = 1, SpeakerVolume = 1.0, Time24Hour = true, + GreenPuPellet = false, TempScale = 1, ---@type TEMP_SCALE EnergyScale = 1, ---@type ENERGY_SCALE DisableFlowView = false, @@ -129,6 +131,7 @@ local fields = { { "UnitDisplays", "Unit Monitors", {} }, { "SpeakerVolume", "Speaker Volume", 1.0 }, { "Time24Hour", "Use 24-hour Time Format", true }, + { "GreenPuPellet", "Pellet Colors", false }, { "TempScale", "Temperature Scale", types.TEMP_SCALE.KELVIN }, { "EnergyScale", "Energy Scale", types.ENERGY_SCALE.FE }, { "DisableFlowView", "Disable Flow Monitor (legacy, discouraged)", false }, diff --git a/coordinator/coordinator.lua b/coordinator/coordinator.lua index c0ba2f3..d5f930d 100644 --- a/coordinator/coordinator.lua +++ b/coordinator/coordinator.lua @@ -38,6 +38,7 @@ function coordinator.load_config() config.UnitCount = settings.get("UnitCount") config.SpeakerVolume = settings.get("SpeakerVolume") config.Time24Hour = settings.get("Time24Hour") + config.GreenPuPellet = settings.get("GreenPuPellet") config.TempScale = settings.get("TempScale") config.EnergyScale = settings.get("EnergyScale") @@ -67,6 +68,7 @@ function coordinator.load_config() cfv.assert_type_int(config.UnitCount) cfv.assert_range(config.UnitCount, 1, 4) cfv.assert_type_bool(config.Time24Hour) + cfv.assert_type_bool(config.GreenPuPellet) cfv.assert_type_int(config.TempScale) cfv.assert_range(config.TempScale, 1, 4) cfv.assert_type_int(config.EnergyScale) diff --git a/coordinator/startup.lua b/coordinator/startup.lua index 5b89edc..ee9468e 100644 --- a/coordinator/startup.lua +++ b/coordinator/startup.lua @@ -19,7 +19,7 @@ local renderer = require("coordinator.renderer") local sounder = require("coordinator.sounder") local threads = require("coordinator.threads") -local COORDINATOR_VERSION = "v1.6.12" +local COORDINATOR_VERSION = "v1.6.13" local CHUNK_LOAD_DELAY_S = 30.0 diff --git a/coordinator/ui/style.lua b/coordinator/ui/style.lua index 6f8f795..e22cb90 100644 --- a/coordinator/ui/style.lua +++ b/coordinator/ui/style.lua @@ -2,16 +2,20 @@ -- Graphics Style Options -- -local util = require("scada-common.util") +local util = require("scada-common.util") -local core = require("graphics.core") -local themes = require("graphics.themes") +local core = require("graphics.core") +local themes = require("graphics.themes") + +local coordinator = require("coordinator.coordinator") ---@class crd_style local style = {} local cpair = core.cpair +local config = coordinator.config + -- front panel styling style.fp_theme = themes.sandstone @@ -223,16 +227,19 @@ style.sps = { } } +local pu_color = util.trinary(config.GreenPuPellet, colors.green, colors.cyan) +local po_color = util.trinary(config.GreenPuPellet, colors.cyan, colors.green) + style.waste = { -- auto waste processing states states = { - { color = cpair(colors.black, colors.green), text = "PLUTONIUM" }, - { color = cpair(colors.black, colors.cyan), text = "POLONIUM" }, + { color = cpair(colors.black, pu_color), text = "PLUTONIUM" }, + { color = cpair(colors.black, po_color), text = "POLONIUM" }, { color = cpair(colors.black, colors.purple), text = "ANTI MATTER" } }, states_abbrv = { - { color = cpair(colors.black, colors.green), text = "Pu" }, - { color = cpair(colors.black, colors.cyan), text = "Po" }, + { color = cpair(colors.black, pu_color), text = "Pu" }, + { color = cpair(colors.black, po_color), text = "Po" }, { color = cpair(colors.black, colors.purple), text = "AM" } }, -- process radio button options @@ -240,8 +247,8 @@ style.waste = { -- unit waste selection unit_opts = { { text = "Auto", fg_bg = cpair(colors.black, colors.lightGray), active_fg_bg = cpair(colors.white, colors.gray) }, - { text = "Pu", fg_bg = cpair(colors.black, colors.lightGray), active_fg_bg = cpair(colors.black, colors.green) }, - { text = "Po", fg_bg = cpair(colors.black, colors.lightGray), active_fg_bg = cpair(colors.black, colors.cyan) }, + { text = "Pu", fg_bg = cpair(colors.black, colors.lightGray), active_fg_bg = cpair(colors.black, pu_color) }, + { text = "Po", fg_bg = cpair(colors.black, colors.lightGray), active_fg_bg = cpair(colors.black, po_color) }, { text = "AM", fg_bg = cpair(colors.black, colors.lightGray), active_fg_bg = cpair(colors.black, colors.purple) } } }