Increase deepsleep time

This commit is contained in:
Ollo 2024-04-01 12:10:22 +02:00
parent 3764183944
commit ff081a8d44

View File

@ -204,7 +204,7 @@ void espDeepSleep(bool afterPump = false)
esp_sleep_pd_config(ESP_PD_DOMAIN_RTC_PERIPH, ESP_PD_OPTION_ON); esp_sleep_pd_config(ESP_PD_DOMAIN_RTC_PERIPH, ESP_PD_OPTION_ON);
long secondsToSleep = -1; unsigned long secondsToSleep = -1;
if (afterPump) if (afterPump)
{ {
@ -215,7 +215,6 @@ void espDeepSleep(bool afterPump = false)
{ {
if (mBatteryVoltage < VOLT_MIN_BATT) if (mBatteryVoltage < VOLT_MIN_BATT)
{ {
log(LOG_LEVEL_INFO, String(String(mBatteryVoltage) + "V! Almost empty -> deepSleepNight " + String(LOWVOLT_SLEEP_FACTOR)) + " times", LOG_SLEEP_LOWVOLTAGE);
/* use the largest sleeping duration */ /* use the largest sleeping duration */
if (deepSleepNightTime.get() > deepSleepTime.get()) { if (deepSleepNightTime.get() > deepSleepTime.get()) {
secondsToSleep = (deepSleepNightTime.get() * LOWVOLT_SLEEP_FACTOR); secondsToSleep = (deepSleepNightTime.get() * LOWVOLT_SLEEP_FACTOR);
@ -226,6 +225,7 @@ void espDeepSleep(bool afterPump = false)
if (secondsToSleep < LOWVOLT_SLEEP_MINIMUM) { if (secondsToSleep < LOWVOLT_SLEEP_MINIMUM) {
secondsToSleep = LOWVOLT_SLEEP_MINIMUM; secondsToSleep = LOWVOLT_SLEEP_MINIMUM;
} }
log(LOG_LEVEL_INFO, String(String(mBatteryVoltage) + "V! Almost empty -> deepSleepNight " + String(LOWVOLT_SLEEP_FACTOR)) + " times (" + secondsToSleep + "s)", LOG_SLEEP_LOWVOLTAGE);
} }
else if (mSolarVoltage < SOLAR_CHARGE_MIN_VOLTAGE) else if (mSolarVoltage < SOLAR_CHARGE_MIN_VOLTAGE)
{ {