1
0
forked from me/IronOS

Add a sleep timeout setting for hall sensor (#1969)

* 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 {