mirror of
https://github.com/InfiniTimeOrg/InfiniTime.git
synced 2024-10-22 15:11:51 +02:00
Power optimization - Increase SystemTaskPeriod
Improve the timeout on the queue : by default, the timeout is 100ms, and it's extended to 4s in sleep mode, when no motion based wake up option is enabled.
This commit is contained in:
parent
7ad970ea87
commit
491d3ae20f
|
@ -181,7 +181,7 @@ void SystemTask::Work() {
|
||||||
UpdateMotion();
|
UpdateMotion();
|
||||||
|
|
||||||
Messages msg;
|
Messages msg;
|
||||||
if (xQueueReceive(systemTasksMsgQueue, &msg, 4000) == pdTRUE) {
|
if (xQueueReceive(systemTasksMsgQueue, &msg, GetQueueTimeout()) == pdTRUE) {
|
||||||
switch (msg) {
|
switch (msg) {
|
||||||
case Messages::EnableSleeping:
|
case Messages::EnableSleeping:
|
||||||
// Make sure that exiting an app doesn't enable sleeping,
|
// Make sure that exiting an app doesn't enable sleeping,
|
||||||
|
@ -504,3 +504,14 @@ void SystemTask::PushMessage(System::Messages msg) {
|
||||||
xQueueSend(systemTasksMsgQueue, &msg, portMAX_DELAY);
|
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)) {
|
||||||
|
timeout = pdMS_TO_TICKS(4000);
|
||||||
|
}
|
||||||
|
return timeout;
|
||||||
|
}
|
|
@ -138,6 +138,8 @@ namespace Pinetime {
|
||||||
bool stepCounterMustBeReset = false;
|
bool stepCounterMustBeReset = false;
|
||||||
static constexpr TickType_t batteryMeasurementPeriod = pdMS_TO_TICKS(10 * 60 * 1000);
|
static constexpr TickType_t batteryMeasurementPeriod = pdMS_TO_TICKS(10 * 60 * 1000);
|
||||||
|
|
||||||
|
TickType_t GetQueueTimeout() const;
|
||||||
|
|
||||||
SystemMonitor monitor;
|
SystemMonitor monitor;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue