From c4c45ae329a9345324d3162b2e43d57ace2296c9 Mon Sep 17 00:00:00 2001 From: Mikayla Fischler Date: Fri, 20 Dec 2024 12:44:39 -0500 Subject: [PATCH] #574 additional fixes and log cleanup --- rtu/startup.lua | 24 ++++++++++++------------ rtu/threads.lua | 4 +++- 2 files changed, 15 insertions(+), 13 deletions(-) diff --git a/rtu/startup.lua b/rtu/startup.lua index 174d400..8f61a66 100644 --- a/rtu/startup.lua +++ b/rtu/startup.lua @@ -338,8 +338,8 @@ local function main() formed = device.isFormed() if formed == ppm.ACCESS_FAULT then - println_ts(util.c("sys_config> failed to check if '", name, "' is formed")) - log.warning(util.c("sys_config> failed to check if '", name, "' is a formed boiler multiblock")) + println_ts(util.c("sys_config> failed to check if '", name, "' is formed")) + log.warning(util.c("sys_config> failed to check if '", name, "' is a formed boiler multiblock")) end elseif type == "turbineValve" then -- turbine multiblock @@ -352,8 +352,8 @@ local function main() formed = device.isFormed() if formed == ppm.ACCESS_FAULT then - println_ts(util.c("sys_config> failed to check if '", name, "' is formed")) - log.warning(util.c("sys_config> failed to check if '", name, "' is a formed turbine multiblock")) + println_ts(util.c("sys_config> failed to check if '", name, "' is formed")) + log.warning(util.c("sys_config> failed to check if '", name, "' is a formed turbine multiblock")) end elseif type == "dynamicValve" then -- dynamic tank multiblock @@ -371,8 +371,8 @@ local function main() formed = device.isFormed() if formed == ppm.ACCESS_FAULT then - println_ts(util.c("sys_config> failed to check if '", name, "' is formed")) - log.warning(util.c("sys_config> failed to check if '", name, "' is a formed dynamic tank multiblock")) + println_ts(util.c("sys_config> failed to check if '", name, "' is formed")) + log.warning(util.c("sys_config> failed to check if '", name, "' is a formed dynamic tank multiblock")) end elseif type == "inductionPort" then -- induction matrix multiblock @@ -384,8 +384,8 @@ local function main() formed = device.isFormed() if formed == ppm.ACCESS_FAULT then - println_ts(util.c("sys_config> failed to check if '", name, "' is formed")) - log.warning(util.c("sys_config> failed to check if '", name, "' is a formed induction matrix multiblock")) + println_ts(util.c("sys_config> failed to check if '", name, "' is formed")) + log.warning(util.c("sys_config> failed to check if '", name, "' is a formed induction matrix multiblock")) end elseif type == "spsPort" then -- SPS multiblock @@ -397,8 +397,8 @@ local function main() formed = device.isFormed() if formed == ppm.ACCESS_FAULT then - println_ts(util.c("sys_config> failed to check if '", name, "' is formed")) - log.warning(util.c("sys_config> failed to check if '", name, "' is a formed SPS multiblock")) + println_ts(util.c("sys_config> failed to check if '", name, "' is formed")) + log.warning(util.c("sys_config> failed to check if '", name, "' is a formed SPS multiblock")) end elseif type == "solarNeutronActivator" then -- SNA @@ -428,7 +428,7 @@ local function main() if not formed then if formed == false then log.info(util.c("sys_config> device '", name, "' is not formed")) - end + else formed = false end elseif faulted then -- sometimes there is a race condition on server boot where it reports formed, but -- the other functions are not yet defined (that's the theory at least). mark as unformed to attempt connection later @@ -458,7 +458,7 @@ local function main() table.insert(units, rtu_unit) - local for_message = "facility" + local for_message = "the facility" if for_reactor > 0 then for_message = util.c("reactor ", for_reactor) end diff --git a/rtu/threads.lua b/rtu/threads.lua index 7ecd6f3..e1d8c6c 100644 --- a/rtu/threads.lua +++ b/rtu/threads.lua @@ -486,7 +486,9 @@ function threads.thread__unit_comms(smem, unit) local last_f_check = 0 - local detail_name = util.c(types.rtu_type_to_string(unit.type), " (", unit.name, ") [", unit.index, "] for reactor ", unit.reactor) + local detail_name = util.c(types.rtu_type_to_string(unit.type), " (", unit.name, ") ", + util.trinary(unit.index == false, "", util.c("[", unit.index, "] ")), "for ", + util.trinary(unit.reactor == 0, "the facility", util.c("reactor ", unit.reactor))) local short_name = util.c(types.rtu_type_to_string(unit.type), " (", unit.name, ")") if packet_queue == nil then