#329 disable reactor rather than trip on auto control stop
This commit is contained in:
@@ -238,8 +238,9 @@ function plc.rps_init(reactor, is_formed, emer_cool)
|
||||
self.state[state_keys.sys_fail] = true
|
||||
end
|
||||
|
||||
-- SCRAM the reactor now (blocks waiting for server tick)
|
||||
-- SCRAM the reactor now<br>
|
||||
---@return boolean success
|
||||
--- EVENT_CONSUMER: this function consumes events
|
||||
function public.scram()
|
||||
log.info("RPS: reactor SCRAM")
|
||||
|
||||
@@ -254,8 +255,9 @@ function plc.rps_init(reactor, is_formed, emer_cool)
|
||||
end
|
||||
end
|
||||
|
||||
-- start the reactor now (blocks waiting for server tick)
|
||||
-- start the reactor now<br>
|
||||
---@return boolean success
|
||||
--- EVENT_CONSUMER: this function consumes events
|
||||
function public.activate()
|
||||
if not self.tripped then
|
||||
log.info("RPS: reactor start")
|
||||
@@ -612,10 +614,7 @@ function plc.comms(id, version, nic, plc_channel, svr_channel, range, reactor, r
|
||||
|
||||
-- send structure properties (these should not change, server will cache these)
|
||||
local function _send_struct()
|
||||
local min_pos = { x = 0, y = 0, z = 0 }
|
||||
local max_pos = { x = 0, y = 0, z = 0 }
|
||||
|
||||
local mek_data = { false, 0, 0, 0, min_pos, max_pos, 0, 0, 0, 0, 0, 0, 0, 0 }
|
||||
local mek_data = { false, 0, 0, 0, types.new_zero_coordinate(), types.new_zero_coordinate(), 0, 0, 0, 0, 0, 0, 0, 0 }
|
||||
|
||||
local tasks = {
|
||||
function () mek_data[1] = reactor.getLength() end,
|
||||
@@ -685,21 +684,18 @@ function plc.comms(id, version, nic, plc_channel, svr_channel, range, reactor, r
|
||||
local heating_rate = 0.0 ---@type number
|
||||
|
||||
if (not no_reactor) and rps.is_formed() then
|
||||
if _update_status_cache() then
|
||||
mek_data = self.status_cache
|
||||
end
|
||||
|
||||
if _update_status_cache() then mek_data = self.status_cache end
|
||||
heating_rate = reactor.getHeatingRate()
|
||||
end
|
||||
|
||||
local sys_status = {
|
||||
util.time(), -- timestamp
|
||||
(not self.scrammed), -- requested control state
|
||||
no_reactor, -- no reactor peripheral connected
|
||||
formed, -- reactor formed
|
||||
self.auto_ack_token, -- token to indicate auto command has been received before this status update
|
||||
heating_rate, -- heating rate
|
||||
mek_data -- mekanism status data
|
||||
util.time(), -- timestamp
|
||||
(not self.scrammed), -- requested control state
|
||||
no_reactor, -- no reactor peripheral connected
|
||||
formed, -- reactor formed
|
||||
self.auto_ack_token, -- indicate auto command received prior to this status update
|
||||
heating_rate, -- heating rate
|
||||
mek_data -- mekanism status data
|
||||
}
|
||||
|
||||
_send(RPLC_TYPE.STATUS, sys_status)
|
||||
@@ -837,6 +833,10 @@ function plc.comms(id, version, nic, plc_channel, svr_channel, range, reactor, r
|
||||
-- enable the reactor
|
||||
self.scrammed = false
|
||||
_send_ack(packet.type, rps.activate())
|
||||
elseif packet.type == RPLC_TYPE.RPS_DISABLE then
|
||||
-- disable the reactor, but do not trip
|
||||
self.scrammed = true
|
||||
_send_ack(packet.type, rps.scram())
|
||||
elseif packet.type == RPLC_TYPE.RPS_SCRAM then
|
||||
-- disable the reactor per manual request
|
||||
self.scrammed = true
|
||||
|
||||
Reference in New Issue
Block a user