Compare commits
6 Commits
v1.8.3-bet
...
v1.8.5-bet
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9f7e3bc282 | ||
|
|
4ec060ba24 | ||
|
|
b1f1753a8d | ||
|
|
94a62f8c31 | ||
|
|
e6f49f256c | ||
|
|
a048b0aa4a |
@@ -2,9 +2,7 @@ return {
|
||||
-- initialize booted environment
|
||||
init_env = function ()
|
||||
local _require, _env = require("cc.require"), setmetatable({}, { __index = _ENV })
|
||||
-- overwrite require/package globals
|
||||
require, package = _require.make(_env, "/")
|
||||
-- reset terminal
|
||||
term.clear(); term.setCursorPos(1, 1)
|
||||
end
|
||||
}
|
||||
|
||||
@@ -463,8 +463,8 @@ local function config_view(display)
|
||||
for k, v in pairs(tmp_cfg) do settings.set(k, v) end
|
||||
|
||||
if settings.save("reactor-plc.settings") then
|
||||
load_settings(ini_cfg)
|
||||
load_settings(settings_cfg, true)
|
||||
load_settings(ini_cfg)
|
||||
|
||||
try_set(networked, ini_cfg.Networked)
|
||||
try_set(u_id, ini_cfg.UnitID)
|
||||
@@ -648,8 +648,9 @@ end
|
||||
---@param ask_config? boolean indicate if this is being called by the PLC startup app due to an invalid configuration
|
||||
function configurator.configure(ask_config)
|
||||
tool_ctl.ask_config = ask_config == true
|
||||
tool_ctl.has_config = load_settings(ini_cfg)
|
||||
|
||||
load_settings(settings_cfg, true)
|
||||
tool_ctl.has_config = load_settings(ini_cfg)
|
||||
|
||||
reset_term()
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ local plc = require("reactor-plc.plc")
|
||||
local renderer = require("reactor-plc.renderer")
|
||||
local threads = require("reactor-plc.threads")
|
||||
|
||||
local R_PLC_VERSION = "v1.6.4"
|
||||
local R_PLC_VERSION = "v1.6.5"
|
||||
|
||||
local println = util.println
|
||||
local println_ts = util.println_ts
|
||||
|
||||
@@ -531,9 +531,13 @@ local function config_view(display)
|
||||
if not (exclude_conns and (k == "Peripherals" or k == "Redstone")) then settings.set(k, v) end
|
||||
end
|
||||
|
||||
-- always set these if missing
|
||||
if settings.get("Peripherals") == nil then settings.set("Peripherals", {}) end
|
||||
if settings.get("Redstone") == nil then settings.set("Redstone", {}) end
|
||||
|
||||
if settings.save("rtu.settings") then
|
||||
load_settings(ini_cfg)
|
||||
load_settings(settings_cfg, true)
|
||||
load_settings(ini_cfg)
|
||||
|
||||
try_set(s_vol, ini_cfg.SpeakerVolume)
|
||||
try_set(svr_chan, ini_cfg.SVR_Channel)
|
||||
@@ -582,8 +586,8 @@ local function config_view(display)
|
||||
PushButton{parent=sum_c_3,x=43,y=14,min_width=7,text="Apply",callback=save_and_continue,fg_bg=cpair(colors.black,colors.green),active_fg_bg=btn_act_fg_bg}
|
||||
|
||||
TextBox{parent=sum_c_4,x=1,y=1,height=1,text="Settings saved!"}
|
||||
PushButton{parent=sum_c_4,x=1,y=14,min_width=6,text="Home",callback=function()tool_ctl.go_home()end,fg_bg=nav_fg_bg,active_fg_bg=btn_act_fg_bg}
|
||||
PushButton{parent=sum_c_4,x=44,y=14,min_width=6,text="Exit",callback=exit,fg_bg=cpair(colors.black,colors.red),active_fg_bg=cpair(colors.white,colors.gray)}
|
||||
PushButton{parent=sum_c_4,x=1,y=14,min_width=6,text="Exit",callback=exit,fg_bg=cpair(colors.black,colors.red),active_fg_bg=cpair(colors.white,colors.gray)}
|
||||
PushButton{parent=sum_c_4,x=44,y=14,min_width=6,text="Home",callback=function()tool_ctl.go_home()end,fg_bg=nav_fg_bg,active_fg_bg=btn_act_fg_bg}
|
||||
|
||||
TextBox{parent=sum_c_5,x=1,y=1,height=2,text="The old config.lua file will now be deleted, then the configurator will exit."}
|
||||
|
||||
@@ -652,8 +656,8 @@ local function config_view(display)
|
||||
settings.set("Peripherals", tmp_cfg.Peripherals)
|
||||
|
||||
if settings.save("rtu.settings") then
|
||||
load_settings(ini_cfg)
|
||||
load_settings(settings_cfg, true)
|
||||
load_settings(ini_cfg)
|
||||
peri_pane.set_value(5)
|
||||
else
|
||||
peri_pane.set_value(6)
|
||||
@@ -694,6 +698,7 @@ local function config_view(display)
|
||||
tool_ctl.p_idx.set_max(2)
|
||||
tool_ctl.p_unit.reposition(44, 4)
|
||||
tool_ctl.p_unit.enable()
|
||||
tool_ctl.p_unit.show()
|
||||
tool_ctl.p_assign_btn.hide(true)
|
||||
tool_ctl.p_assign_end.hide(true)
|
||||
tool_ctl.p_desc.reposition(1, 7)
|
||||
@@ -706,6 +711,7 @@ local function config_view(display)
|
||||
tool_ctl.p_idx.set_max(3)
|
||||
tool_ctl.p_unit.reposition(45, 4)
|
||||
tool_ctl.p_unit.enable()
|
||||
tool_ctl.p_unit.show()
|
||||
tool_ctl.p_assign_btn.hide(true)
|
||||
tool_ctl.p_assign_end.hide(true)
|
||||
tool_ctl.p_desc.reposition(1, 7)
|
||||
@@ -715,6 +721,7 @@ local function config_view(display)
|
||||
tool_ctl.p_prompt.set_value("This SNA is for reactor unit # .")
|
||||
tool_ctl.p_unit.reposition(31, 4)
|
||||
tool_ctl.p_unit.enable()
|
||||
tool_ctl.p_unit.show()
|
||||
tool_ctl.p_assign_btn.hide(true)
|
||||
tool_ctl.p_assign_end.hide(true)
|
||||
tool_ctl.p_desc_ext.set_value("Before adding lots of SNAs: multiply the \"PEAK\" rate on the flow monitor (after connecting at least 1 SNA) by 10 to get the mB/t of waste that they can process. Enough SNAs to provide 2x to 3x of your max burn rate should be a good margin to catch up after night or cloudy weather. Too many devices (such as SNAs) on one RTU can cause lag.")
|
||||
@@ -728,6 +735,8 @@ local function config_view(display)
|
||||
tool_ctl.p_idx.redraw()
|
||||
tool_ctl.p_idx.set_max(4)
|
||||
tool_ctl.p_unit.reposition(18, 6)
|
||||
tool_ctl.p_unit.enable()
|
||||
tool_ctl.p_unit.show()
|
||||
|
||||
if tool_ctl.p_assign_btn.get_value() == 1 then
|
||||
tool_ctl.p_idx.enable()
|
||||
@@ -750,6 +759,8 @@ local function config_view(display)
|
||||
tool_ctl.p_idx.redraw()
|
||||
tool_ctl.p_idx.set_max(99)
|
||||
tool_ctl.p_unit.reposition(18, 6)
|
||||
tool_ctl.p_unit.enable()
|
||||
tool_ctl.p_unit.show()
|
||||
if tool_ctl.p_assign_btn.get_value() == 1 then tool_ctl.p_unit.disable() else tool_ctl.p_unit.enable() end
|
||||
tool_ctl.p_desc.reposition(1, 8)
|
||||
tool_ctl.p_desc.set_value("You can connect more than one environment detector for a particular unit or the facility. In that case, the maximum radiation reading from those assigned to that particular unit or the facility will be used for alarms and display.")
|
||||
@@ -958,8 +969,8 @@ local function config_view(display)
|
||||
settings.set("Redstone", tmp_cfg.Redstone)
|
||||
|
||||
if settings.save("rtu.settings") then
|
||||
load_settings(ini_cfg)
|
||||
load_settings(settings_cfg, true)
|
||||
load_settings(ini_cfg)
|
||||
rs_pane.set_value(4)
|
||||
else
|
||||
rs_pane.set_value(5)
|
||||
@@ -1445,9 +1456,9 @@ end
|
||||
---@param ask_config? boolean indicate if this is being called by the RTU startup app due to an invalid configuration
|
||||
function configurator.configure(ask_config)
|
||||
tool_ctl.ask_config = ask_config == true
|
||||
tool_ctl.has_config = load_settings(ini_cfg)
|
||||
load_settings(settings_cfg, true)
|
||||
|
||||
load_settings(settings_cfg, true)
|
||||
tool_ctl.has_config = load_settings(ini_cfg)
|
||||
tmp_cfg.Peripherals = deep_copy_peri(ini_cfg.Peripherals)
|
||||
tmp_cfg.Redstone = deep_copy_rs(ini_cfg.Redstone)
|
||||
|
||||
|
||||
@@ -58,6 +58,9 @@ function rtu.load_config()
|
||||
cfv.assert_type_str(config.LogPath)
|
||||
cfv.assert_type_bool(config.LogDebug)
|
||||
|
||||
cfv.assert_type_table(config.Peripherals)
|
||||
cfv.assert_type_table(config.Redstone)
|
||||
|
||||
return cfv.valid()
|
||||
end
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@ local sna_rtu = require("rtu.dev.sna_rtu")
|
||||
local sps_rtu = require("rtu.dev.sps_rtu")
|
||||
local turbinev_rtu = require("rtu.dev.turbinev_rtu")
|
||||
|
||||
local RTU_VERSION = "v1.7.2"
|
||||
local RTU_VERSION = "v1.7.4"
|
||||
|
||||
local RTU_UNIT_TYPE = types.RTU_UNIT_TYPE
|
||||
local RTU_UNIT_HW_STATE = databus.RTU_UNIT_HW_STATE
|
||||
|
||||
@@ -16,13 +16,13 @@ local type = type
|
||||
|
||||
local t_concat = table.concat
|
||||
local t_insert = table.insert
|
||||
local t_unpack = table.unpack
|
||||
local t_pack = table.pack
|
||||
|
||||
---@class util
|
||||
local util = {}
|
||||
|
||||
-- scada-common version
|
||||
util.version = "1.1.9"
|
||||
util.version = "1.1.10"
|
||||
|
||||
util.TICK_TIME_S = 0.05
|
||||
util.TICK_TIME_MS = 50
|
||||
@@ -104,17 +104,13 @@ end
|
||||
---@return table lines
|
||||
function util.strwrap(str, limit) return cc_strings.wrap(str, limit) end
|
||||
|
||||
-- luacheck: no unused args
|
||||
|
||||
-- concatenation with built-in to string
|
||||
---@nodiscard
|
||||
---@vararg any
|
||||
---@return string
|
||||
---@diagnostic disable-next-line: unused-vararg
|
||||
function util.concat(...)
|
||||
local strings = {}
|
||||
---@diagnostic disable-next-line: undefined-field
|
||||
for i = 1, arg.n do strings[i] = util.strval(arg[i]) end
|
||||
local args, strings = t_pack(...), {}
|
||||
for i = 1, args.n do strings[i] = util.strval(args[i]) end
|
||||
return t_concat(strings)
|
||||
end
|
||||
|
||||
@@ -125,10 +121,7 @@ util.c = util.concat
|
||||
---@nodiscard
|
||||
---@param format string
|
||||
---@vararg any
|
||||
---@diagnostic disable-next-line: unused-vararg
|
||||
function util.sprintf(format, ...) return string.format(format, t_unpack(arg)) end
|
||||
|
||||
-- luacheck: unused args
|
||||
function util.sprintf(format, ...) return string.format(format, ...) end
|
||||
|
||||
-- format a number string with commas as the thousands separator<br>
|
||||
-- subtracts from spaces at the start if present for each comma used
|
||||
|
||||
Reference in New Issue
Block a user