diff options
author | JF <jf@codingfield.com> | 2020-06-01 20:40:11 +0200 |
---|---|---|
committer | JF <jf@codingfield.com> | 2020-06-01 20:40:11 +0200 |
commit | e7723598a65c6c041e3b4dff4d0bb144d1c697a0 (patch) | |
tree | af49de485012ec5e0044231071b652ad7cba370e /src/SystemTask/SystemTask.h | |
parent | de822cc3a2f07033e881331ac8914b26023bb003 (diff) |
Automatically go to sleep after 5 sec of inactivity.
Advertise for 3 minutes at startup and on wake-up. Disable automatic continuous StartAdvertising.
Diffstat (limited to 'src/SystemTask/SystemTask.h')
-rw-r--r-- | src/SystemTask/SystemTask.h | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/SystemTask/SystemTask.h b/src/SystemTask/SystemTask.h index 53e69fa7..b6ecf7c9 100644 --- a/src/SystemTask/SystemTask.h +++ b/src/SystemTask/SystemTask.h @@ -16,7 +16,7 @@ namespace Pinetime { class SystemTask { public: enum class Messages {GoToSleep, GoToRunning, OnNewTime, OnNewNotification, BleConnected, - BleFirmwareUpdateStarted, BleFirmwareUpdateFinished + BleFirmwareUpdateStarted, BleFirmwareUpdateFinished, OnTouchEvent, OnButtonEvent }; SystemTask(Drivers::SpiMaster &spi, Drivers::St7789 &lcd, @@ -32,6 +32,9 @@ namespace Pinetime { void OnButtonPushed(); void OnTouchEvent(); + + void OnIdle(); + private: TaskHandle_t taskHandle; @@ -64,7 +67,11 @@ namespace Pinetime { void Work(); bool isBleDiscoveryTimerRunning = false; uint8_t bleDiscoveryTimer = 0; + static constexpr uint32_t idleTime = 5000; + TimerHandle_t idleTimer; + bool doNotGoToSleep = false; + void GoToRunning(); }; } }
\ No newline at end of file |