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() {
5858 updateTimestamp = millis ();
5959 auto percentage = nicla::getBatteryVoltagePercentage ();
6060
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 ;
6364 }
6465
6566 // Only if the percentage has changed, we update the values as they depend on it.
6667 if (batteryPercentage != percentage) {
6768 int8_t currentChargeLevel = static_cast <int8_t >(nicla::getBatteryChargeLevel ());
6869 if (currentChargeLevel == 0 ){
69- return false ; // Unknown battery charge level.
70+ Serial.println (" Battery charge level couldn't be determined." );
71+ return false ;
7072 }
7173
7274 auto currentVoltage = nicla::getCurrentBatteryVoltage ();
7375 if (currentVoltage == 0 ){
74- return false ; // Unknown battery voltage.
76+ Serial.println (" Battery voltage couldn't be determined." );
77+ return false ;
7578 }
7679
7780 batteryPercentage = percentage;
You can’t perform that action at this time.
0 commit comments