@@ -37,6 +37,8 @@ Charger charger;
37
37
38
38
// Charge current in mA, a safe value for most batteries is half the battery capacity
39
39
constexpr int CHARGE_CURRENT_MA = 100 ; // mA
40
+
41
+ // End of charge current in mA, a safe value for most batteries is 5% of the battery capacity
40
42
constexpr int END_OF_CHARGE_CURRENT_MA = 5 ; // mA
41
43
42
44
void setup () {
@@ -52,15 +54,11 @@ void setup() {
52
54
53
55
Serial.print (" * ✅ Charging is enabled: " );
54
56
Serial.println (charger.isEnabled () ? " true" : " false" );
55
-
56
- auto chargeCurrent = charger.getChargeCurrent ();
57
+
57
58
auto chargeVoltage = charger.getChargeVoltage ();
58
- auto endOfChargeCurrent = charger.getEndOfChargeCurrent ();
59
59
auto inputCurrentLimit = charger.getInputCurrentLimit ();
60
60
61
- Serial.println (" * ⚡️ Charge current: " + String (chargeCurrent) + " mA" );
62
61
Serial.println (" * ⚡️ Charge voltage: " + String (chargeVoltage) + " V" );
63
- Serial.println (" * ⚡️ End of charge current: " + String (endOfChargeCurrent) + " mA" );
64
62
Serial.println (" * ⚡️ Input current limit: " + String (inputCurrentLimit) + " mA" );
65
63
66
64
if (!charger.setChargeCurrent (CHARGE_CURRENT_MA)){
@@ -72,6 +70,12 @@ void setup() {
72
70
Serial.println (" Failed to set end of charge current" );
73
71
Serial.println (" Please double check the supported values in the documentation" );
74
72
}
73
+
74
+ auto chargeCurrent = charger.getChargeCurrent ();
75
+ auto endOfChargeCurrent = charger.getEndOfChargeCurrent ();
76
+
77
+ Serial.println (" * ⚡️ Charge current set to: " + String (CHARGE_CURRENT_MA) + " mA" );
78
+ Serial.println (" * ⚡️ End of charge current set to: " + String (END_OF_CHARGE_CURRENT_MA) + " mA" );
75
79
}
76
80
77
81
String getChargerState (){
0 commit comments