cleanup and fixes
This commit is contained in:
parent
41e6d89a4b
commit
5f8c947105
@ -413,10 +413,10 @@ function redstone.create(tool_ctl, main_pane, cfg_sys, rs_cfg, style)
|
|||||||
local def = {
|
local def = {
|
||||||
unit = tri(PORT_DSGN[port] == 1, u, nil),
|
unit = tri(PORT_DSGN[port] == 1, u, nil),
|
||||||
port = port,
|
port = port,
|
||||||
|
relay = self.rs_cfg_phy,
|
||||||
side = side_options_map[side.get_value()],
|
side = side_options_map[side.get_value()],
|
||||||
color = tri(self.rs_cfg_bundled.get_value() and rsio.is_digital(port), color_options_map[self.rs_cfg_color.get_value()], nil),
|
color = tri(self.rs_cfg_bundled.get_value() and rsio.is_digital(port), color_options_map[self.rs_cfg_color.get_value()], nil),
|
||||||
invert = self.rs_cfg_inverted.get_value() or nil,
|
invert = self.rs_cfg_inverted.get_value() or nil
|
||||||
relay = self.rs_cfg_phy
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if self.rs_cfg_editing == false then
|
if self.rs_cfg_editing == false then
|
||||||
@ -442,9 +442,9 @@ function redstone.create(tool_ctl, main_pane, cfg_sys, rs_cfg, style)
|
|||||||
table.insert(tmp_cfg.Redstone, {
|
table.insert(tmp_cfg.Redstone, {
|
||||||
unit = tri(PORT_DSGN[IO.WASTE_PU + i] == 1, u, nil),
|
unit = tri(PORT_DSGN[IO.WASTE_PU + i] == 1, u, nil),
|
||||||
port = IO.WASTE_PU + i,
|
port = IO.WASTE_PU + i,
|
||||||
|
relay = self.rs_cfg_phy,
|
||||||
side = tri(self.rs_cfg_bundled.get_value(), side_options_map[side.get_value()], default_sides[i + 1]),
|
side = tri(self.rs_cfg_bundled.get_value(), side_options_map[side.get_value()], default_sides[i + 1]),
|
||||||
color = tri(self.rs_cfg_bundled.get_value(), default_colors[i + 1], nil),
|
color = tri(self.rs_cfg_bundled.get_value(), default_colors[i + 1], nil)
|
||||||
relay = self.rs_cfg_phy
|
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -582,7 +582,7 @@ function redstone.create(tool_ctl, main_pane, cfg_sys, rs_cfg, style)
|
|||||||
local a = ini_cfg.Redstone[i]
|
local a = ini_cfg.Redstone[i]
|
||||||
local b = tmp_cfg.Redstone[i]
|
local b = tmp_cfg.Redstone[i]
|
||||||
|
|
||||||
modified = (a.unit ~= b.unit) or (a.port ~= b.port) or (a.side ~= b.side) or (a.color ~= b.color) or (a.invert ~= b.invert)
|
modified = (a.unit ~= b.unit) or (a.port ~= b.port) or (a.relay ~= b.relay) or (a.side ~= b.side) or (a.color ~= b.color) or (a.invert ~= b.invert)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@ -130,7 +130,7 @@ end
|
|||||||
---@param data rtu_rs_definition[]
|
---@param data rtu_rs_definition[]
|
||||||
function tool_ctl.deep_copy_rs(data)
|
function tool_ctl.deep_copy_rs(data)
|
||||||
local array = {}
|
local array = {}
|
||||||
for _, d in ipairs(data) do table.insert(array, { unit = d.unit, port = d.port, side = d.side, color = d.color, invert = d.invert, relay = d.relay }) end
|
for _, d in ipairs(data) do table.insert(array, { unit = d.unit, port = d.port, relay = d.relay, side = d.side, color = d.color, invert = d.invert }) end
|
||||||
return array
|
return array
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@ -213,7 +213,6 @@ local function main()
|
|||||||
valid = util.trinary(entry.color == nil, true, rsio.is_color(entry.color))
|
valid = util.trinary(entry.color == nil, true, rsio.is_color(entry.color))
|
||||||
end
|
end
|
||||||
|
|
||||||
-- local rs_rtu = rs_rtus[phy].rtu
|
|
||||||
local bank = rs_rtus[phy].banks[for_reactor]
|
local bank = rs_rtus[phy].banks[for_reactor]
|
||||||
local conns = all_conns[for_reactor]
|
local conns = all_conns[for_reactor]
|
||||||
|
|
||||||
|
|||||||
@ -104,14 +104,11 @@ function rtu.new_session(id, s_addr, i_seq_num, in_queue, out_queue, timeout, ad
|
|||||||
advert_validator.assert(util.is_int(unit_advert.index) or (unit_advert.index == false))
|
advert_validator.assert(util.is_int(unit_advert.index) or (unit_advert.index == false))
|
||||||
advert_validator.assert_type_int(unit_advert.reactor)
|
advert_validator.assert_type_int(unit_advert.reactor)
|
||||||
|
|
||||||
if u_type == RTU_UNIT_TYPE.REDSTONE then
|
|
||||||
advert_validator.assert_type_table(unit_advert.rs_conns)
|
|
||||||
end
|
|
||||||
|
|
||||||
if advert_validator.valid() then
|
if advert_validator.valid() then
|
||||||
if util.is_int(unit_advert.index) then advert_validator.assert_min(unit_advert.index, 1) end
|
if util.is_int(unit_advert.index) then advert_validator.assert_min(unit_advert.index, 1) end
|
||||||
|
|
||||||
if unit_advert.reactor == -1 then
|
if (unit_advert.reactor == -1) or (u_type == RTU_UNIT_TYPE.REDSTONE) then
|
||||||
|
advert_validator.assert((unit_advert.reactor == -1) and (u_type == RTU_UNIT_TYPE.REDSTONE))
|
||||||
advert_validator.assert_type_table(unit_advert.rs_conns)
|
advert_validator.assert_type_table(unit_advert.rs_conns)
|
||||||
else
|
else
|
||||||
advert_validator.assert_min(unit_advert.reactor, 0)
|
advert_validator.assert_min(unit_advert.reactor, 0)
|
||||||
@ -147,7 +144,7 @@ function rtu.new_session(id, s_addr, i_seq_num, in_queue, out_queue, timeout, ad
|
|||||||
elseif assignment > 0 and assignment <= #self.fac_units then
|
elseif assignment > 0 and assignment <= #self.fac_units then
|
||||||
self.fac_units[assignment].add_redstone(unit)
|
self.fac_units[assignment].add_redstone(unit)
|
||||||
else
|
else
|
||||||
log.warning(util.c(log_tag, "_handle_advertisement(): unrecognized redstone RTU assignment ", assignment, " ", type_string))
|
log.warning(util.c(log_tag, "_handle_advertisement(): invalid redstone RTU assignment ", assignment))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user