Skip to content

Commit 5fff648

Browse files
committed
nicla-system: Make the safety timer configuration explicit.
1 parent e51a021 commit 5fff648

File tree

3 files changed

+12
-3
lines changed

3 files changed

+12
-3
lines changed

libraries/Nicla_System/examples/NiclaSenseME_BatteryChargingSimple/NiclaSenseME_BatteryChargingSimple.ino

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,23 @@ void setup(){
2727
nicla::leds.begin(); // Start I2C connection to LED driver
2828
nicla::setBatteryNTCEnabled(true); // Set to false if your battery doesn't have a NTC.
2929

30+
/*
31+
Set the maximum charging time to 9 hours. This helps to prevent overcharging.
32+
Set this to a lower value (e.g. 3h) if your battery will be done with charging sooner.
33+
To get an estimation of the charging time, you can use the following formula:
34+
Charging time (in hours) = (Battery capacity in mAh) / (0.8 * Charging current in mA)
35+
This formula takes into account that the charging process is approximately 80% efficient (hence the 0.8 factor).
36+
This is just a rough estimate, and actual charging time may vary depending on factors like the charger, battery quality, and charging conditions.
37+
*/
38+
nicla::configureChargingSafetyTimer(ChargingSafetyTimerOption::NineHours);
39+
3040
/*
3141
A safe default charging current value that works for most common LiPo batteries is 0.5C,
3242
which means charging at a rate equal to half of the battery's capacity.
3343
For example, a 200mAh battery could be charged at 100mA (0.1A).
3444
*/
3545
nicla::enableCharging(100);
46+
3647
nicla::leds.setColor(blue);
3748
}
3849

libraries/Nicla_System/src/Nicla_System.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -150,8 +150,6 @@ bool nicla::enableCharging(uint16_t mA)
150150
// Also sets the input current limit to 350mA.
151151
_pmic.writeByte(BQ25120A_ADDRESS, BQ25120A_ILIM_UVLO_CTRL, 0x3F);
152152

153-
configureChargingSafetyTimer(ChargingSafetyTimerOption::NineHours);
154-
155153
return _pmic.getFastChargeControlRegister() == _fastChargeRegisterData;
156154
}
157155

libraries/Nicla_System/src/Nicla_System.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ class nicla {
101101
* For example, a 200mAh battery could be charged at 100mA (0.1A).
102102
* This charging rate is generally safe for most LiPo batteries and provides a good balance between charging speed and battery longevity.
103103
* @note If your battery doesn't have an NTC thermistor, the charging speed will be limited to ~16mA.
104-
* @note There is a saftey timer that will stop the charging after 9 hours by default.
104+
* @note There is a saftey timer that will stop the charging after 3 hours by default.
105105
* This can be configured by calling configureChargingSafetyTimer().
106106
* @return true If the fast charging is enabled successfully. False, otherwise.
107107
* @see disableCharging()

0 commit comments

Comments
 (0)