#73 additional indicators next to core map

This commit is contained in:
Mikayla Fischler 2022-08-09 00:40:50 -04:00
parent 02c3c5c53c
commit 3c2f631451
4 changed files with 51 additions and 14 deletions

View File

@ -3,20 +3,20 @@
--
require("/initenv").init_env()
local log = require("scada-common.log")
local ppm = require("scada-common.ppm")
local tcallbackdsp = require("scada-common.tcallbackdsp")
local util = require("scada-common.util")
local log = require("scada-common.log")
local ppm = require("scada-common.ppm")
local util = require("scada-common.util")
local core = require("graphics.core")
local core = require("graphics.core")
local apisessions = require("coordinator.apisessions")
local config = require("coordinator.config")
local coordinator = require("coordinator.coordinator")
local renderer = require("coordinator.renderer")
local apisessions = require("coordinator.apisessions")
local config = require("coordinator.config")
local coordinator = require("coordinator.coordinator")
local renderer = require("coordinator.renderer")
local COORDINATOR_VERSION = "alpha-v0.3.10"
local COORDINATOR_VERSION = "alpha-v0.3.11"
local print = util.print
local println = util.println

View File

@ -12,11 +12,12 @@ local Div = require("graphics.elements.div")
local TextBox = require("graphics.elements.textbox")
local ColorMap = require("graphics.elements.colormap")
local CoreMap = require("graphics.elements.indicators.coremap")
local CoreMap = require("graphics.elements.indicators.coremap")
local DataIndicator = require("graphics.elements.indicators.data")
local HorizontalBar = require("graphics.elements.indicators.hbar")
local IndicatorLight = require("graphics.elements.indicators.light")
local StateIndicator = require("graphics.elements.indicators.state")
local VerticalBar = require("graphics.elements.indicators.vbar")
local PushButton = require("graphics.elements.controls.push_button")
local SCRAMButton = require("graphics.elements.controls.scram_button")
@ -32,7 +33,8 @@ local function init(monitor, id)
TextBox{parent=main,text="Reactor Unit #" .. id,alignment=TEXT_ALIGN.CENTER,height=1,fg_bg=style.header}
local scram_fg_bg = core.graphics.cpair(colors.white, colors.gray)
local scram_fg_bg = cpair(colors.white, colors.gray)
local lu_cpair = cpair(colors.gray, colors.gray)
---@fixme test code
local t = 300
@ -50,6 +52,40 @@ local function init(monitor, id)
core_map.update(t)
local core_shift = core_map.height()
local stat_fg_bg = cpair(colors.black,colors.white)
TextBox{parent=main,x=21,y=3,text="Core Temp",height=1,fg_bg=style.label}
DataIndicator{parent=main,x=21,label="",format="%9.2f",value=300,unit="K",lu_colors=lu_cpair,width=12,fg_bg=stat_fg_bg}
main.line_break()
TextBox{parent=main,x=21,text="Burn Rate",height=1,width=12,fg_bg=style.label}
DataIndicator{parent=main,x=21,label="",format="%6.1f",value=0,unit="mB/t",lu_colors=lu_cpair,width=12,fg_bg=stat_fg_bg}
main.line_break()
TextBox{parent=main,x=21,text="Heating Rate",height=1,width=12,fg_bg=style.label}
DataIndicator{parent=main,x=21,label="",format="%11.0f",value=0,unit="",lu_colors=lu_cpair,width=12,fg_bg=stat_fg_bg}
main.line_break()
TextBox{parent=main,text="CR",x=21,y=12,height=1,width=3,fg_bg=style.label}
local ctrl_rods = HorizontalBar{parent=main,x=24,y=12,show_percent=false,bar_fg_bg=cpair(colors.black,colors.gray),height=1,width=9}
ctrl_rods.update(0.75)
TextBox{parent=main,text="FL",x=21,y=20,height=1,width=2,fg_bg=style.label}
TextBox{parent=main,text="WS",x=24,y=20,height=1,width=2,fg_bg=style.label}
TextBox{parent=main,text="CL",x=28,y=20,height=1,width=2,fg_bg=style.label}
TextBox{parent=main,text="HC",x=31,y=20,height=1,width=2,fg_bg=style.label}
local fuel = VerticalBar{parent=main,x=21,y=14,fg_bg=cpair(colors.black,colors.gray),height=5,width=2}
local waste = VerticalBar{parent=main,x=24,y=14,fg_bg=cpair(colors.brown,colors.gray),height=5,width=2}
local ccool = VerticalBar{parent=main,x=28,y=14,fg_bg=cpair(colors.lightBlue,colors.gray),height=5,width=2}
local hcool = VerticalBar{parent=main,x=31,y=14,fg_bg=cpair(colors.orange,colors.gray),height=5,width=2}
---@fixme test code
fuel.update(1)
ccool.update(0.85)
hcool.update(0.08)
waste.update(0.32)
local f = function () print("scram!") end
local scram = SCRAMButton{parent=main,x=2,y=core_shift+4,callback=f,fg_bg=scram_fg_bg}
@ -63,7 +99,7 @@ local function init(monitor, id)
---@fixme test code
main.line_break()
ColorMap{parent=main}
ColorMap{parent=main,x=2,y=51}
local annunciator = Div{parent=main,x=34,y=3}

View File

@ -9,6 +9,7 @@ local cpair = core.graphics.cpair
style.root = cpair(colors.black, colors.lightGray)
style.header = cpair(colors.white, colors.gray)
style.label = cpair(colors.gray, colors.lightGray)
style.colors = {
{ c = colors.red, hex = 0xdf4949 },

View File

@ -35,7 +35,7 @@ local function hbar(args)
-- determine bar colors
local bar_bkg = e.fg_bg.blit_bkg
local bar_fgd = e.fg_bg.blit_fgd
if args.show_percent and args.bar_fg_bg ~= nil then
if args.bar_fg_bg ~= nil then
bar_bkg = args.bar_fg_bg.blit_bkg
bar_fgd = args.bar_fg_bg.blit_fgd
end