diff --git a/reactor-plc/startup.lua b/reactor-plc/startup.lua index d2970df..c33a780 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.6.6" +local R_PLC_VERSION = "v1.6.7" local println = util.println local println_ts = util.println_ts diff --git a/reactor-plc/threads.lua b/reactor-plc/threads.lua index 6699ea3..85e2a86 100644 --- a/reactor-plc/threads.lua +++ b/reactor-plc/threads.lua @@ -173,7 +173,8 @@ function threads.thread__main(smem, init) plc_state.degraded = true elseif networked and type == "modem" then -- we only care if this is our wireless modem - if nic.is_modem(device) then + -- note, check init_ok first since nic will be nil if it is false + if plc_state.init_ok and nic.is_modem(device) then nic.disconnect() println_ts("comms modem disconnected!") @@ -193,7 +194,7 @@ function threads.thread__main(smem, init) end end else - log.warning("non-comms modem disconnected") + log.warning("a modem was disconnected") end end end @@ -235,7 +236,8 @@ function threads.thread__main(smem, init) rps.reset() end elseif networked and type == "modem" then - if device.isWireless() and not nic.is_connected() then + -- note, check init_ok first since nic will be nil if it is false + if device.isWireless() and not (plc_state.init_ok and nic.is_connected()) then -- reconnected modem plc_dev.modem = device plc_state.no_modem = false