WakeupMgr: Explicitly invalidate the current alarm in unsetWakeupAlarm (#10032)

Apparently, toggling the rtc interrupt doesn't quite work on some boards? (fix #10031)

(Drive-by tweak to UIManager: Less confusing logging when quit gets tripped both via quit
and _gated_quit (i.e., on poweroff))
reviewable/pr10036/r1
NiLuJe 1 year ago committed by GitHub
parent 16fb32d5a4
commit bb900aa9a7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -216,6 +216,12 @@ Unset wakeup alarm.
Simple wrapper for @{ffi.rtc.unsetWakeupAlarm}.
--]]
function WakeupMgr:unsetWakeupAlarm()
-- Apparently, toggling the interrupt doesn't work on some RTCs,
-- and not necessarily the ones we've flagged as dodgy... (#10031).
-- Deal with this insanity by ensuring the alarm is not set in the future,
-- by overwriting the current alarm with an already expired disabled one.
logger.dbg("WakeupMgr:unsetWakeupAlarm will invalidate any future alarms")
self:setWakeupAlarm(0, false)
return self.rtc:unsetWakeupAlarm()
end

@ -106,7 +106,7 @@ function UIManager:init()
-- A simple wrapper for UIManager:quit()
-- This may be overwritten by setRunForeverMode(); for testing purposes
self._gated_quit = self.quit
self:unsetRunForeverMode()
end
--[[--
@ -785,14 +785,21 @@ end
--- Signals to quit.
-- An exit_code of false is not allowed.
function UIManager:quit(exit_code)
function UIManager:quit(exit_code, implicit)
if exit_code == false then
logger.err("UIManager:quit() called with false")
return
end
-- Also honor older exit codes; default to 0
self._exit_code = exit_code or self._exit_code or 0
logger.info("quitting uimanager with exit code:", self._exit_code)
if not implicit then
-- Explicit call via UIManager:quit (as opposed to self:_gated_quit)
if exit_code then
logger.info("Preparing to quit UIManager with exit code:", exit_code)
else
logger.info("Preparing to quit UIManager")
end
end
self._task_queue_dirty = false
self._window_stack = {}
self._task_queue = {}
@ -818,7 +825,7 @@ end
-- Enable automatic UIManager quit; for testing purposes
function UIManager:unsetRunForeverMode()
self._gated_quit = self.quit
self._gated_quit = function() return self:quit(nil, true) end
end
-- Ignore an empty window stack *once*; for startup w/ a missing last_file shenanigans...
@ -1548,6 +1555,7 @@ function UIManager:run()
self.looper:start()
end
logger.info("Tearing down UIManager with exit code:", self._exit_code)
return self._exit_code
end

Loading…
Cancel
Save