#589 supervisor control reboot recovery
This commit is contained in:
@@ -395,8 +395,7 @@ function facility.new(config)
|
|||||||
settings.unset("LastProcessState")
|
settings.unset("LastProcessState")
|
||||||
settings.unset("LastUnitStates")
|
settings.unset("LastUnitStates")
|
||||||
|
|
||||||
local saved = settings.save("/supervisor.settings")
|
if not settings.save("/supervisor.settings") then
|
||||||
if not saved then
|
|
||||||
log.warning("facility.clear_boot_state(): failed to save supervisor settings file")
|
log.warning("facility.clear_boot_state(): failed to save supervisor settings file")
|
||||||
else
|
else
|
||||||
log.debug("FAC: cleared boot state on exit")
|
log.debug("FAC: cleared boot state on exit")
|
||||||
@@ -404,9 +403,9 @@ function facility.new(config)
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- initialize startup recovery
|
-- initialize startup recovery
|
||||||
---@param state sv_control_state
|
---@param state sv_control_state|nil
|
||||||
function public.startup_recovery_init(state)
|
function public.startup_recovery_init(state)
|
||||||
if self.recovery == RCV_STATE.INACTIVE then
|
if self.recovery == RCV_STATE.INACTIVE and state then
|
||||||
self.recovery_boot_state = state
|
self.recovery_boot_state = state
|
||||||
self.recovery = RCV_STATE.PRIMED
|
self.recovery = RCV_STATE.PRIMED
|
||||||
log.info("FAC: startup resume ready")
|
log.info("FAC: startup resume ready")
|
||||||
|
|||||||
@@ -243,6 +243,11 @@ function update.auto_control(ExtChargeIdling)
|
|||||||
|
|
||||||
log.debug(util.c("FAC: state changed from ", PROCESS_NAMES[self.last_mode + 1], " to ", PROCESS_NAMES[self.mode + 1]))
|
log.debug(util.c("FAC: state changed from ", PROCESS_NAMES[self.last_mode + 1], " to ", PROCESS_NAMES[self.mode + 1]))
|
||||||
|
|
||||||
|
settings.set("LastProcessState", self.mode)
|
||||||
|
if not settings.save("/supervisor.settings") then
|
||||||
|
log.warning("facility_update.auto_control(): failed to save supervisor settings file")
|
||||||
|
end
|
||||||
|
|
||||||
if (self.last_mode == PROCESS.INACTIVE) or (self.last_mode == PROCESS.GEN_RATE_FAULT_IDLE) then
|
if (self.last_mode == PROCESS.INACTIVE) or (self.last_mode == PROCESS.GEN_RATE_FAULT_IDLE) then
|
||||||
self.start_fail = START_STATUS.OK
|
self.start_fail = START_STATUS.OK
|
||||||
|
|
||||||
@@ -653,14 +658,6 @@ end
|
|||||||
|
|
||||||
-- update last mode, set next mode, and update saved state as needed
|
-- update last mode, set next mode, and update saved state as needed
|
||||||
function update.post_auto()
|
function update.post_auto()
|
||||||
if self.mode ~= next_mode then
|
|
||||||
settings.set("LastProcessState", next_mode)
|
|
||||||
local saved = settings.save("/supervisor.settings")
|
|
||||||
if not saved then
|
|
||||||
log.warning("facility_update.post_auto(): failed to save supervisor settings file")
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
self.last_mode = self.mode
|
self.last_mode = self.mode
|
||||||
self.mode = next_mode
|
self.mode = next_mode
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user