#87 check if the reactor is active on startup/reconnect before scram'ing, rps now ignores scram errors if the error is due to the reactor being inactive

This commit is contained in:
Mikayla Fischler
2022-09-29 11:02:03 -04:00
parent 4f7775ccb6
commit 7a90ea7e4e
2 changed files with 8 additions and 4 deletions

View File

@@ -18,6 +18,10 @@ local println = util.println
local print_ts = util.print_ts
local println_ts = util.println_ts
-- I sure hope the devs don't change this error message, not that it would have safety implications
-- I wish they didn't change it to error on SCRAM calls if the reactor was already inactive
local PCALL_SCRAM_MSG = "pcall: Scram requires the reactor to be active."
--- RPS: Reactor Protection System
---
--- identifies dangerous states and SCRAMs reactor if warranted
@@ -169,7 +173,7 @@ function plc.rps_init(reactor)
log.info("RPS: reactor SCRAM")
self.reactor.scram()
if self.reactor.__p_is_faulted() then
if self.reactor.__p_is_faulted() and (self.reactor.__p_last_fault() ~= PCALL_SCRAM_MSG) then
log.error("RPS: failed reactor SCRAM")
return false
else