Automatically switch the display on when receiving a notification

This commit is contained in:
JF 2020-07-04 18:10:30 +02:00
parent 4abbd7d0cf
commit 62de76ba99
2 changed files with 11 additions and 5 deletions

View file

@ -120,15 +120,15 @@ void SystemTask::Work() {
isSleeping = true;
break;
case Messages::OnNewTime:
xTimerReset(idleTimer, 0);
ReloadIdleTimer();
displayApp->PushMessage(Pinetime::Applications::DisplayApp::Messages::UpdateDateTime);
break;
case Messages::OnNewNotification:
xTimerReset(idleTimer, 0);
if(isSleeping) GoToRunning();
displayApp->PushMessage(Pinetime::Applications::DisplayApp::Messages::NewNotification);
break;
case Messages::BleConnected:
xTimerReset(idleTimer, 0);
ReloadIdleTimer();
isBleDiscoveryTimerRunning = true;
bleDiscoveryTimer = 5;
break;
@ -145,10 +145,10 @@ void SystemTask::Work() {
NVIC_SystemReset();
break;
case Messages::OnTouchEvent:
xTimerReset(idleTimer, 0);
ReloadIdleTimer();
break;
case Messages::OnButtonEvent:
xTimerReset(idleTimer, 0);
ReloadIdleTimer();
break;
default: break;
}
@ -217,3 +217,8 @@ void SystemTask::OnIdle() {
NRF_LOG_INFO("Idle timeout -> Going to sleep")
PushMessage(Messages::GoToSleep);
}
void SystemTask::ReloadIdleTimer() const {
if(isSleeping) return;
xTimerReset(idleTimer, 0);
}

View file

@ -66,6 +66,7 @@ namespace Pinetime {
static void Process(void* instance);
void Work();
void ReloadIdleTimer() const;
bool isBleDiscoveryTimerRunning = false;
uint8_t bleDiscoveryTimer = 0;
static constexpr uint32_t idleTime = 15000;