diff --git a/platformio.ini b/platformio.ini index dbddf7535..792f2f8b1 100644 --- a/platformio.ini +++ b/platformio.ini @@ -55,6 +55,7 @@ build_flags = -Wno-missing-field-initializers -DRADIOLIB_EXCLUDE_MORSE -DRADIOLIB_EXCLUDE_RTTY -DRADIOLIB_EXCLUDE_SSTV + -DDEBUG_HEAP monitor_speed = 115200 diff --git a/src/Power.cpp b/src/Power.cpp index ec86adc94..83eceeadf 100644 --- a/src/Power.cpp +++ b/src/Power.cpp @@ -283,6 +283,9 @@ void Power::readPowerStatus() DEBUG_MSG("Battery: usbPower=%d, isCharging=%d, batMv=%d, batPct=%d\n", powerStatus2.getHasUSB(), powerStatus2.getIsCharging(), powerStatus2.getBatteryVoltageMv(), powerStatus2.getBatteryChargePercent()); newStatus.notifyObservers(&powerStatus2); +#ifdef DEBUG_HEAP + DEBUG_MSG("Heap status: %d/%d bytes free\n", ESP.getFreeHeap(), ESP.getHeapSize()); +#endif // If we have a battery at all and it is less than 10% full, force deep sleep if we have more than 3 low readings in a row // Supect fluctuating voltage on the RAK4631 to force it to deep sleep even if battery is at 85% after only a few days