diff --git a/coordinator/config.lua b/coordinator/config.lua index a29bb46..052bba4 100644 --- a/coordinator/config.lua +++ b/coordinator/config.lua @@ -14,9 +14,6 @@ config.COMMS_TIMEOUT = 5 -- expected number of reactor units, used only to require that number of unit monitors config.NUM_UNITS = 4 --- override default display colors (prettier in my opinion) -config.RECOLOR = true - -- alarm sounder volume (0.0 to 3.0, 1.0 being standard max volume, this is the option given to to speaker.play()) -- note: alarm sine waves are at half saturation, so that multiple will be required to reach full scale config.SOUNDER_VOLUME = 1.0 diff --git a/coordinator/renderer.lua b/coordinator/renderer.lua index 4003d71..edf0de8 100644 --- a/coordinator/renderer.lua +++ b/coordinator/renderer.lua @@ -27,29 +27,18 @@ local ui = { unit_layouts = {} } --- reset a display to the "default", but set text scale to 0.5 +-- init a display to the "default", but set text scale to 0.5 ---@param monitor table monitor ----@param recolor? boolean override default color palette -local function _reset_display(monitor, recolor) +local function _init_display(monitor) monitor.setTextScale(0.5) monitor.setTextColor(colors.white) monitor.setBackgroundColor(colors.black) monitor.clear() monitor.setCursorPos(1, 1) - if recolor then - -- set overridden colors - for i = 1, #style.colors do - monitor.setPaletteColor(style.colors[i].c, style.colors[i].hex) - end - else - -- reset all colors - for _, val in pairs(colors) do - -- colors api has constants and functions, just get color constants - if type(val) == "number" then - monitor.setPaletteColor(val, term.nativePaletteColor(val)) - end - end + -- set overridden colors + for i = 1, #style.colors do + monitor.setPaletteColor(style.colors[i].c, style.colors[i].hex) end end @@ -79,15 +68,14 @@ function renderer.is_monitor_used(periph) return false end --- reset all displays in use by the renderer ----@param recolor? boolean true to use color palette from style -function renderer.reset(recolor) - -- reset primary monitor - _reset_display(engine.monitors.primary, recolor) +-- init all displays in use by the renderer +function renderer.init_displays() + -- init primary monitor + _init_display(engine.monitors.primary) - -- reset unit displays + -- init unit displays for _, monitor in pairs(engine.monitors.unit_displays) do - _reset_display(monitor, recolor) + _init_display(monitor) end end diff --git a/coordinator/startup.lua b/coordinator/startup.lua index a35a0f4..1a23719 100644 --- a/coordinator/startup.lua +++ b/coordinator/startup.lua @@ -19,7 +19,7 @@ local iocontrol = require("coordinator.iocontrol") local renderer = require("coordinator.renderer") local sounder = require("coordinator.sounder") -local COORDINATOR_VERSION = "v0.11.6" +local COORDINATOR_VERSION = "v0.11.7" local print = util.print local println = util.println @@ -45,7 +45,6 @@ cfv.assert_type_int(config.TRUSTED_RANGE) cfv.assert_type_num(config.COMMS_TIMEOUT) cfv.assert_min(config.COMMS_TIMEOUT, 2) cfv.assert_type_int(config.NUM_UNITS) -cfv.assert_type_bool(config.RECOLOR) cfv.assert_type_num(config.SOUNDER_VOLUME) cfv.assert_type_bool(config.TIME_24_HOUR) cfv.assert_type_str(config.LOG_PATH) @@ -88,7 +87,7 @@ local function main() -- init renderer renderer.set_displays(monitors) - renderer.reset(config.RECOLOR) + renderer.init_displays() if not renderer.validate_main_display_width() then println("startup> main display must be 8 blocks wide") diff --git a/coordinator/ui/style.lua b/coordinator/ui/style.lua index ca584f4..4b4bf46 100644 --- a/coordinator/ui/style.lua +++ b/coordinator/ui/style.lua @@ -1,3 +1,6 @@ +-- +-- Graphics Style Options +-- local core = require("graphics.core")