From 0b60dc9fa49bd6b8238a1e46e1b245ca662d5223 Mon Sep 17 00:00:00 2001 From: Mikayla Fischler Date: Sun, 14 Apr 2024 19:24:12 -0400 Subject: [PATCH] #474 run main reactor-plc loop clock when not networked --- reactor-plc/startup.lua | 2 +- reactor-plc/threads.lua | 25 +++++++++++-------------- 2 files changed, 12 insertions(+), 15 deletions(-) diff --git a/reactor-plc/startup.lua b/reactor-plc/startup.lua index cf5fcbe..024daeb 100644 --- a/reactor-plc/startup.lua +++ b/reactor-plc/startup.lua @@ -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.7.8" +local R_PLC_VERSION = "v1.7.9" local println = util.println local println_ts = util.println_ts diff --git a/reactor-plc/threads.lua b/reactor-plc/threads.lua index 6ccf43e..22e1d86 100644 --- a/reactor-plc/threads.lua +++ b/reactor-plc/threads.lua @@ -71,22 +71,19 @@ function threads.thread__main(smem, init) -- blink heartbeat indicator databus.heartbeat() - -- core clock tick - if networked then - -- start next clock timer - loop_clock.start() + -- start next clock timer + loop_clock.start() - -- send updated data - if nic.is_connected() then - if plc_comms.is_linked() then - smem.q.mq_comms_tx.push_command(MQ__COMM_CMD.SEND_STATUS) + -- send updated data + if networked and nic.is_connected() then + if plc_comms.is_linked() then + smem.q.mq_comms_tx.push_command(MQ__COMM_CMD.SEND_STATUS) + else + if ticks_to_update == 0 then + plc_comms.send_link_req() + ticks_to_update = LINK_TICKS else - if ticks_to_update == 0 then - plc_comms.send_link_req() - ticks_to_update = LINK_TICKS - else - ticks_to_update = ticks_to_update - 1 - end + ticks_to_update = ticks_to_update - 1 end end end