Add a sleep timeout setting for hall sensor (#1969)
Some checks are pending
Docs / deploy-docs (push) Waiting to run
CI / build (MHP30) (push) Waiting to run
CI / build (Pinecil) (push) Waiting to run
CI / build (Pinecilv2) (push) Waiting to run
CI / build (S60) (push) Waiting to run
CI / build (S60P) (push) Waiting to run
CI / build (T55) (push) Waiting to run
CI / build (TS100) (push) Waiting to run
CI / build (TS101) (push) Waiting to run
CI / build (TS80) (push) Waiting to run
CI / build (TS80P) (push) Waiting to run
CI / build_multi-lang (Pinecil) (push) Waiting to run
CI / build_multi-lang (Pinecilv2) (push) Waiting to run
CI / upload_metadata (push) Blocked by required conditions
CI / tests (push) Waiting to run
CI / check_c-cpp (push) Waiting to run
CI / check_python (push) Waiting to run
CI / check_shell (push) Waiting to run
CI / check_readme (push) Waiting to run

* Add a sleep timeout setting for hall sensor

* Update Settings.h to reorder HallEffectSleepTime to the end

* Update Settings.cpp to reorder HallEffectSleepTime to the end

* add HallEffSleepTimeout to rest of translations

* mix misaligned number in Settings.cpp

* fix clang-format issue in getHallEffectSleepTimeout
This commit is contained in:
ave
2024-08-21 07:23:34 +02:00
committed by GitHub
parent adfc521122
commit 02b21a620b
42 changed files with 110 additions and 2 deletions

View File

@@ -7,6 +7,7 @@
void GUIDelay(); //
bool checkForUnderVoltage(void); //
uint32_t getSleepTimeout(void); //
uint32_t getHallEffectSleepTimeout(void); //
bool shouldBeSleeping(); //
bool shouldShutdown(void); //
void printVoltage(void); //

View File

@@ -0,0 +1,13 @@
#include "OperatingModeUtilities.h"
#ifndef NO_SLEEP_MODE
#ifdef HALL_SENSOR
uint32_t getHallEffectSleepTimeout(void) {
if (getSettingValue(SettingsOptions::HallEffectSensitivity) && getSettingValue(SettingsOptions::HallEffectSleepTime)) {
uint32_t sleepThres = getSettingValue(SettingsOptions::HallEffectSleepTime) * 5 * TICKS_SECOND;
return sleepThres;
}
return TICKS_SECOND;
}
#endif
#endif

View File

@@ -32,7 +32,7 @@ bool shouldBeSleeping() {
if (lastHallEffectSleepStart == 0) {
lastHallEffectSleepStart = xTaskGetTickCount();
}
if ((xTaskGetTickCount() - lastHallEffectSleepStart) > TICKS_SECOND) {
if ((xTaskGetTickCount() - lastHallEffectSleepStart) > getHallEffectSleepTimeout()) {
return true;
}
} else {