forked from haui/InfiniTime_mirror
Compare commits
3 commits
main
...
power-opti
Author | SHA1 | Date | |
---|---|---|---|
6e03b47eb3 | |||
491d3ae20f | |||
7ad970ea87 |
|
@ -181,7 +181,7 @@ void SystemTask::Work() {
|
|||
UpdateMotion();
|
||||
|
||||
Messages msg;
|
||||
if (xQueueReceive(systemTasksMsgQueue, &msg, 100) == pdTRUE) {
|
||||
if (xQueueReceive(systemTasksMsgQueue, &msg, GetQueueTimeout()) == pdTRUE) {
|
||||
switch (msg) {
|
||||
case Messages::EnableSleeping:
|
||||
// Make sure that exiting an app doesn't enable sleeping,
|
||||
|
@ -504,3 +504,15 @@ void SystemTask::PushMessage(System::Messages msg) {
|
|||
xQueueSend(systemTasksMsgQueue, &msg, portMAX_DELAY);
|
||||
}
|
||||
}
|
||||
|
||||
TickType_t SystemTask::GetQueueTimeout() const {
|
||||
// By default, the timeout on the queue is 100ms.
|
||||
// It's extended to 4s in sleep mode, when no motion based wake up option is enabled.
|
||||
TickType_t timeout = pdMS_TO_TICKS(100);
|
||||
if (state == SystemTaskState::Sleeping && ((!settingsController.isWakeUpModeOn(Pinetime::Controllers::Settings::WakeUpMode::RaiseWrist) &&
|
||||
!settingsController.isWakeUpModeOn(Pinetime::Controllers::Settings::WakeUpMode::Shake)) ||
|
||||
settingsController.GetNotificationStatus() == Controllers::Settings::Notification::Sleep)) {
|
||||
timeout = pdMS_TO_TICKS(4000);
|
||||
}
|
||||
return timeout;
|
||||
}
|
|
@ -138,6 +138,8 @@ namespace Pinetime {
|
|||
bool stepCounterMustBeReset = false;
|
||||
static constexpr TickType_t batteryMeasurementPeriod = pdMS_TO_TICKS(10 * 60 * 1000);
|
||||
|
||||
TickType_t GetQueueTimeout() const;
|
||||
|
||||
SystemMonitor monitor;
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue