Merge pull request #2040 from D4rk4/master

Disable deep sleep for nRF  and force shutdown for RAK463x on discharged battery
This commit is contained in:
Thomas Göttgens 2022-12-15 11:21:26 +01:00 committed by GitHub
commit 05f81922e6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -291,8 +291,11 @@ void Power::readPowerStatus()
if (batteryLevel->getBattVoltage() < MIN_BAT_MILLIVOLTS) { if (batteryLevel->getBattVoltage() < MIN_BAT_MILLIVOLTS) {
low_voltage_counter++; low_voltage_counter++;
DEBUG_MSG("Warning RAK4631 Low voltage counter: %d/10\n", low_voltage_counter); DEBUG_MSG("Warning RAK4631 Low voltage counter: %d/10\n", low_voltage_counter);
if (low_voltage_counter > 10) if (low_voltage_counter > 10) {
powerFSM.trigger(EVENT_LOW_BATTERY); // We can't trigger deep sleep on NRF52, it's freezing the board
//powerFSM.trigger(EVENT_LOW_BATTERY);
DEBUG_MSG("Low voltage detected, but not triggering deep sleep\n");
}
} else { } else {
low_voltage_counter = 0; low_voltage_counter = 0;
} }
@ -565,11 +568,15 @@ bool Power::axpChipInit()
} }
DEBUG_MSG("=======================================================================\n"); DEBUG_MSG("=======================================================================\n");
// We can safely ignore this approach for most (or all) boards because MCU turned off
// earlier than battery discharged to 2.6V.
//
// Unfortanly for now we can't use this killswitch for RAK4630-based boards because they have a bug with
// battery voltage measurement. Probably it sometimes drops to low values.
#ifndef RAK4630
// Set PMU shutdown voltage at 2.6V to maximize battery utilization // Set PMU shutdown voltage at 2.6V to maximize battery utilization
PMU->setSysPowerDownVoltage(2600); PMU->setSysPowerDownVoltage(2600);
#endif
#ifdef PMU_IRQ #ifdef PMU_IRQ