File tree Expand file tree Collapse file tree 1 file changed +7
-4
lines changed
libraries/Nicla_System/examples/NiclaSenseME_BatteryStatus Expand file tree Collapse file tree 1 file changed +7
-4
lines changed Original file line number Diff line number Diff line change @@ -58,20 +58,23 @@ bool updateBatteryLevel() {
58
58
updateTimestamp = millis ();
59
59
auto percentage = nicla::getBatteryVoltagePercentage ();
60
60
61
- if (percentage < 0 ) {
62
- return false ; // Percentage couldn't be determined.
61
+ if (percentage < 0 ) {
62
+ Serial.println (" Battery voltage percentage couldn't be determined." );
63
+ return false ;
63
64
}
64
65
65
66
// Only if the percentage has changed, we update the values as they depend on it.
66
67
if (batteryPercentage != percentage) {
67
68
int8_t currentChargeLevel = static_cast <int8_t >(nicla::getBatteryChargeLevel ());
68
69
if (currentChargeLevel == 0 ){
69
- return false ; // Unknown battery charge level.
70
+ Serial.println (" Battery charge level couldn't be determined." );
71
+ return false ;
70
72
}
71
73
72
74
auto currentVoltage = nicla::getCurrentBatteryVoltage ();
73
75
if (currentVoltage == 0 ){
74
- return false ; // Unknown battery voltage.
76
+ Serial.println (" Battery voltage couldn't be determined." );
77
+ return false ;
75
78
}
76
79
77
80
batteryPercentage = percentage;
You can’t perform that action at this time.
0 commit comments