From afb3b0957e0d32bc1c276188b30ecb7f97f710b5 Mon Sep 17 00:00:00 2001 From: Mikayla Fischler Date: Sun, 27 Nov 2022 22:44:47 -0500 Subject: [PATCH] bugfix for RTU re-formed detection --- rtu/startup.lua | 2 +- rtu/threads.lua | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/rtu/startup.lua b/rtu/startup.lua index 2e2272d..76944c6 100644 --- a/rtu/startup.lua +++ b/rtu/startup.lua @@ -25,7 +25,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 = "beta-v0.9.6" +local RTU_VERSION = "beta-v0.9.7" local rtu_t = types.rtu_t diff --git a/rtu/threads.lua b/rtu/threads.lua index 3d5b690..8027f34 100644 --- a/rtu/threads.lua +++ b/rtu/threads.lua @@ -341,10 +341,11 @@ function threads.thread__unit_comms(smem, unit) util.nop() end - -- check if multiblock is still formed if this is a multiblock if (type(unit.formed) == "boolean") and (util.time() - last_f_check > 1000) then - if (not unit.formed) and unit.device.isFormed() then + local is_formed = unit.device.isFormed() + + if (not unit.formed) and is_formed then -- newly re-formed local iface = ppm.get_iface(unit.device) if iface then @@ -394,6 +395,8 @@ function threads.thread__unit_comms(smem, unit) log.error("failed to get interface of previously connected RTU unit " .. detail_name, true) end end + + unit.formed = is_formed end -- check for termination request