File tree Expand file tree Collapse file tree 3 files changed +6
-6
lines changed
examples/NiclaSenseME_BatteryStatus Expand file tree Collapse file tree 3 files changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -24,7 +24,7 @@ bool updateBatteryLevel(bool enforceNewReading = false) {
24
24
if (intervalFired || isFirstReading || enforceNewReading) {
25
25
Serial.println (" Checking the battery level..." );
26
26
updateTimestamp = millis ();
27
- auto percentage = nicla::getBatteryPercentage ();
27
+ auto percentage = nicla::getBatteryVoltagePercentage ();
28
28
29
29
if (percentage < 0 ) {
30
30
return false ; // Percentage couldn't be determined.
@@ -209,7 +209,7 @@ void loop()
209
209
Serial.println (voltage);
210
210
211
211
Serial.print (" Battery Percent: " );
212
- auto percent = nicla::getBatteryPercentage ();
212
+ auto percent = nicla::getBatteryVoltagePercentage ();
213
213
Serial.println (percent);
214
214
215
215
Serial.print (" Battery Temperature: " );
Original file line number Diff line number Diff line change @@ -206,14 +206,14 @@ void nicla::setRegulatedBatteryVoltage(float voltage){
206
206
}
207
207
208
208
float nicla::getCurrentBatteryVoltage (){
209
- auto percentage = getBatteryPercentage ();
209
+ auto percentage = getBatteryVoltagePercentage ();
210
210
if (percentage < 0 ) {
211
211
return 0 ;
212
212
}
213
213
return getRegulatedBatteryVoltage () / 100 * percentage;
214
214
}
215
215
216
- int8_t nicla::getBatteryPercentage (bool useLatchedValue) {
216
+ int8_t nicla::getBatteryVoltagePercentage (bool useLatchedValue) {
217
217
/*
218
218
* 9.3.4 Voltage Based Battery Monitor (Page 20)
219
219
* The device implements a simple voltage battery monitor which can be used to determine the depth of discharge.
@@ -293,7 +293,7 @@ int8_t nicla::getBatteryPercentage(bool useLatchedValue) {
293
293
}
294
294
295
295
BatteryChargeLevel nicla::getBatteryChargeLevel () {
296
- auto percent = getBatteryPercentage ();
296
+ auto percent = getBatteryVoltagePercentage ();
297
297
298
298
if (percent >= 98 ) {
299
299
return BatteryChargeLevel::Full;
Original file line number Diff line number Diff line change @@ -97,7 +97,7 @@ class nicla {
97
97
* @return int8_t The percentage of the regulated voltage in the range of 60% to 100%.
98
98
* A value of < 0 indicates that the battery percentage could not be determined.
99
99
*/
100
- static int8_t getBatteryPercentage (bool useLatchedValue = false );
100
+ static int8_t getBatteryVoltagePercentage (bool useLatchedValue = false );
101
101
102
102
/* *
103
103
* @brief Get the Battery Charge level encoded as a number (0-5). The following values are possible:
You can’t perform that action at this time.
0 commit comments