Sleep 2 hours on low battery
This commit is contained in:
parent
cb37426fbb
commit
d2f1605b90
@ -144,7 +144,7 @@
|
||||
#ifdef HWREVISION07
|
||||
#define SOLAR_VOLT_FACTOR (4.0306f) /**< 100k and 33k voltage dividor */
|
||||
#else
|
||||
#define SOLAR_VOLT_FACTOR 11f
|
||||
#define SOLAR_VOLT_FACTOR 11.0f
|
||||
#endif
|
||||
#define BATTSENSOR_INDEX_SOLAR 0
|
||||
#define BATTSENSOR_INDEX_BATTERY 1
|
||||
@ -160,7 +160,7 @@
|
||||
#define VOLT_MAX_BATT 4.2f
|
||||
#define VOLT_MIN_BATT 3.0f /**< Minimum battery voltage for normal operation */
|
||||
#define LOWVOLT_SLEEP_FACTOR 3 /**< Factor for nightsleep delay, if the battery drops below minimum (@see VOLT_MIN_BATT) */
|
||||
#define LOWVOLT_SLEEP_MINIMUM 5400 /**< At low voltage sleep at least for 90 minutes */
|
||||
#define LOWVOLT_SLEEP_MINIMUM 7200 /**< At low voltage sleep at least for 120 minutes (two hours) */
|
||||
|
||||
#define WATER_LEVEL_MINIMUM 500 /**< Minimum Analog value (1023 is the maximum)*/
|
||||
|
||||
|
@ -239,11 +239,14 @@ void espDeepSleep(bool afterPump = false)
|
||||
}
|
||||
}
|
||||
|
||||
#define SECOND2USECOND_FACTOR (1000U * 1000U)
|
||||
|
||||
/* sleep always at least one second */
|
||||
if (secondsToSleep < 0) {
|
||||
secondsToSleep = 1;
|
||||
if (secondsToSleep <= 0) {
|
||||
secondsToSleep = (unsigned long) (UINT64_MAX / SECOND2USECOND_FACTOR);
|
||||
}
|
||||
esp_sleep_enable_timer_wakeup((secondsToSleep * 1000U * 1000U));
|
||||
esp_sleep_enable_timer_wakeup((secondsToSleep * SECOND2USECOND_FACTOR));
|
||||
#undef SECOND2USECOND_FACTOR
|
||||
if (aliveWasRead())
|
||||
{
|
||||
delay(1000);
|
||||
|
Loading…
Reference in New Issue
Block a user