Skip to content

Commit f7845c2

Browse files
committed
nicla-system: Fix incorrect battery voltage reading.
1 parent b3d7f82 commit f7845c2

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

libraries/Nicla_System/src/Nicla_System.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -292,8 +292,9 @@ int8_t nicla::getBatteryVoltagePercentage(bool useLatchedValue) {
292292
if(chargingEnabled) {
293293
disableCharging();
294294
}
295-
// Write 1 to VBMON_READ to trigger a new reading
296-
_pmic.writeByte(BQ25120A_ADDRESS, BQ25120A_BATT_MON, 1);
295+
// Write 1 to bit 7 VBMON_READ to trigger a new reading
296+
_pmic.writeByte(BQ25120A_ADDRESS, BQ25120A_BATT_MON, 0b10000000);
297+
297298
delay(3); // According to datasheet, 2ms is enough, but we add 1ms for safety
298299

299300
if(chargingEnabled) {

0 commit comments

Comments
 (0)