mirror of
https://github.com/MikaylaFischler/cc-mek-scada.git
synced 2024-08-30 18:22:34 +00:00
#179 remove recolor option from coordinator config
This commit is contained in:
parent
0d7fde635d
commit
3f15ae6b6f
@ -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
|
||||
|
@ -27,30 +27,19 @@ 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
|
||||
end
|
||||
end
|
||||
|
||||
-- link to the monitor peripherals
|
||||
@ -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
|
||||
|
||||
|
@ -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")
|
||||
|
@ -1,3 +1,6 @@
|
||||
--
|
||||
-- Graphics Style Options
|
||||
--
|
||||
|
||||
local core = require("graphics.core")
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user