#364 fail self check if using a side for both bundled and unbundled redstone
This commit is contained in:
parent
b4a9366f73
commit
1b692b5b9a
@ -137,14 +137,20 @@ local function self_check()
|
|||||||
|
|
||||||
-- check redstone configurations
|
-- check redstone configurations
|
||||||
local ifaces = {}
|
local ifaces = {}
|
||||||
|
local bundled_sides = {}
|
||||||
for i = 1, #cfg.Redstone do
|
for i = 1, #cfg.Redstone do
|
||||||
local entry = cfg.Redstone[i]
|
local entry = cfg.Redstone[i]
|
||||||
local ident = entry.side .. tri(entry.color, ":" .. rsio.color_name(entry.color), "")
|
local ident = entry.side .. tri(entry.color, ":" .. rsio.color_name(entry.color), "")
|
||||||
local dupe = util.table_contains(ifaces, ident)
|
local dupe = util.table_contains(ifaces, ident)
|
||||||
|
local mixed = (bundled_sides[entry.side] and (entry.color == nil)) or (bundled_sides[entry.side] == false and (entry.color ~= nil))
|
||||||
|
|
||||||
|
local mixed_msg = util.trinary(bundled_sides[entry.side], "this side has bundled entry(s) but this entry is not bundled", "this side has non-bundled entry(s) but this entry is bundled")
|
||||||
|
|
||||||
self.self_check_msg("> check redstone " .. ident .. " unique...", not dupe, "only one port should be set to a side/color combination")
|
self.self_check_msg("> check redstone " .. ident .. " unique...", not dupe, "only one port should be set to a side/color combination")
|
||||||
|
self.self_check_msg("> check redstone " .. ident .. " bundle...", not mixed, mixed_msg .. ", which will not work")
|
||||||
self.self_check_msg("> check redstone " .. ident .. " valid...", redstone.validate(entry), "configuration invalid, please re-configure redstone entry")
|
self.self_check_msg("> check redstone " .. ident .. " valid...", redstone.validate(entry), "configuration invalid, please re-configure redstone entry")
|
||||||
|
|
||||||
|
bundled_sides[entry.side] = bundled_sides[entry.side] or entry.color ~= nil
|
||||||
table.insert(ifaces, ident)
|
table.insert(ifaces, ident)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@ -49,7 +49,7 @@ function rtu.load_config()
|
|||||||
return rtu.validate_config(config)
|
return rtu.validate_config(config)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- validate a RTU gateway configuration
|
-- validate an RTU gateway configuration
|
||||||
---@param cfg rtu_config
|
---@param cfg rtu_config
|
||||||
function rtu.validate_config(cfg)
|
function rtu.validate_config(cfg)
|
||||||
local cfv = util.new_validator()
|
local cfv = util.new_validator()
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user