Skip to content

Commit 97a14d6

Browse files
committed
add heap output in about; better verbage around fuel guage
1 parent 639132e commit 97a14d6

File tree

1 file changed

+8
-12
lines changed

1 file changed

+8
-12
lines changed

sfeIoTNodeLoRaWAN/sfeIoTNodeLoRaWANAbout.cpp

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414

1515
#include "sfeIoTNodeLoRaWAN.h"
1616
#include <Flux/flxClock.h>
17+
#include <Flux/flxPlatform.h>
1718
#include <Flux/flxSerial.h>
1819

1920
void sfeIoTNodeLoRaWAN::_displayAboutObjHelper(char pre_ch, const char *szName, bool enabled)
@@ -132,22 +133,17 @@ void sfeIoTNodeLoRaWAN::displayAppStatus(bool useInfo)
132133
// else
133134
// flxLog__(logLevel, "%cSD card not available", pre_ch);
134135

135-
// // show heap level
136-
// flxLog__(logLevel, "%cSystem Heap - Total: %dB Free: %dB (%.1f%%)", pre_ch, ESP.getHeapSize(),
137-
// ESP.getFreeHeap(),
138-
// (float)ESP.getFreeHeap() / (float)ESP.getHeapSize() * 100.);
136+
// show heap level
137+
flxLog__(logLevel, "%cSystem Heap - Total: %dB Free: %dB (%.1f%%)", pre_ch, flxPlatform::heap_size(),
138+
flxPlatform::heap_free(), (float)flxPlatform::heap_free() / (float)flxPlatform::heap_size() * 100.);
139139

140140
// Battery fuel gauge available?
141141
if (_fuelGauge != nullptr)
142142
{
143-
// Output if a) we have a batter connected, and if so the % charge, and if it's charging
144-
float batterySOC = _fuelGauge->getSOC();
145-
// Is a battery connected - look at SOC
146-
if (batterySOC < kBatteryNoBatterySOC)
147-
flxLog__(logLevel, "%cBattery - Level: %c%.1f%%", pre_ch, _fuelGauge->getChangeRate() > 0 ? '+' : ' ',
148-
batterySOC);
149-
else
150-
flxLog__(logLevel, "%cBattery - Not Connected", pre_ch);
143+
// There is no way to detect if a batter is connected using the fuel gauge. Sad...
144+
// So we just output the state of charge ...
145+
flxLog__(logLevel, "%cFuel Gauge - State of Charge: %c%.1f%%", pre_ch,
146+
_fuelGauge->getChangeRate() > 0 ? '+' : ' ', _fuelGauge->getSOC());
151147
}
152148
// flxLog__(logLevel, "%cSystem Deep Sleep: %s", pre_ch, sleepEnabled() ? "enabled" : "disabled");
153149
// flxLog_N("%c Sleep Interval: %d seconds", pre_ch, sleepInterval());

0 commit comments

Comments
 (0)