From 3f06911782474a6a715e372d2b90f7204f7ec8b3 Mon Sep 17 00:00:00 2001 From: Russ Butler Date: Mon, 3 Dec 2018 17:54:53 -0600 Subject: [PATCH] Update Ticker wrapper to handle early interrupts Update the LowPowerTickerWrapper class to handle rather than ignore early low power ticker interrupts. This ensures that devices don't get stuck in sleep due to a ignored early low power ticker interrupt. --- hal/LowPowerTickerWrapper.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/hal/LowPowerTickerWrapper.cpp b/hal/LowPowerTickerWrapper.cpp index 1463d21178..a61a7a67fd 100644 --- a/hal/LowPowerTickerWrapper.cpp +++ b/hal/LowPowerTickerWrapper.cpp @@ -33,7 +33,12 @@ void LowPowerTickerWrapper::irq_handler(ticker_irq_handler_type handler) { core_util_critical_section_enter(); - if (_pending_fire_now || _match_check(_intf->read()) || _suspended) { + // This code no longer filters out early interrupts. Instead it + // passes them through to the next layer and ignores further interrupts + // until the next call to set_interrrupt or fire_interrupt (when not suspended). + // This is to ensure that the device doesn't get stuck in sleep due to an + // early low power ticker interrupt that was ignored. + if (_pending_fire_now || _pending_match || _suspended) { _timeout.detach(); _pending_timeout = false; _pending_match = false;