48 Serial.println(
"Failed to AXP2602 - check your wiring!");
53 Serial.println(
"Init AXP2602 Sensor success!");
117 uint32_t startMeasTime = millis();
121 uint32_t endMesTime = millis();
123 Serial.print(
"Polling time: "); Serial.print(endMesTime - startMeasTime); Serial.println(
" ms");
124 Serial.print(
"\t- Sleep: "); Serial.print(
gauge.
isSleepModeEnabled() ?
"Enabled" :
"Disabled"); Serial.println();
125 Serial.print(
"\t- Temperature:"); Serial.print(
gauge.
getTemperature()); Serial.println(
" ℃");
126 Serial.print(
"\t- BatteryVoltage:"); Serial.print(
gauge.
getVoltage()); Serial.println(
" mV");
127 Serial.print(
"\t- InstantaneousCurrent:"); Serial.print(
gauge.
getCurrent()); Serial.println(
" mAh");
128 Serial.print(
"\t- InstantaneousCurrentRaw:"); Serial.print(
gauge.
getCurrentRaw()); Serial.println(
" RAW");
134 Serial.print(
"\t- isCharging:"); Serial.print(
gauge.
isCharging() ?
"Yes" :
"No"); Serial.println();
135 Serial.print(
"\t- isDischarging:"); Serial.print(
gauge.
isDischarging() ?
"Yes" :
"No"); Serial.println();
136 Serial.print(
"\t- TimeToEmpty:"); Serial.print(
gauge.
getTimeToEmpty()); Serial.println(
" minutes");
137 Serial.print(
"\t- TimeToFull:"); Serial.print(
gauge.
getTimeToFull()); Serial.println(
" minutes");
145 Serial.println(
"Low battery detected!");
146 Serial.println(
"Low battery detected!");
149 Serial.println(
"Watchdog timer timeout!");
150 Serial.println(
"Watchdog timer timeout!");
153 Serial.println(
"Over temperature detected!");
154 Serial.println(
"Over temperature detected!");
157 Serial.println(
"State of Charge updated!");
158 Serial.println(
"State of Charge updated!");
168 Serial.println(
"===============================================");
uint16_t getStateOfCharge() override
Get the battery percentage.
bool begin(SensorCommCustom::CustomCallback callback, SensorCommCustomHal::CustomHalCallback hal_callback)
Begin with custom callback functions.
uint16_t getTimeToFull() override
Get the battery time to full.
bool isSleepModeEnabled()
Check if the AXP2602 chip is in sleep mode.
uint16_t getTimeToEmpty() override
Get the battery time to empty.
bool isDischarging() override
Checks if the battery is discharging.
float getTemperature() override
Get the temperature.
uint16_t getVoltage() override
Get the battery voltage.
float getCurrent() override
Get the actual current value (considering the sampling resistor)
uint8_t getBatteryStatus()
Get the battery health status.
float getThermalDieTemperature()
Get the actual die temperature.
@ IRQ_STATUS_OVER_TEMPERATURE
uint16_t getThermalDieTemperatureRaw()
Get the thermal die temperature.
float getChargingPower()
Get charging power (positive or 0)
int16_t getCurrentRaw()
Get the battery current.
float getDischargingPower()
Get discharging power (positive or 0)
bool refresh() override
Refresh the AXP2602 chip data.
float getAbsolutePower()
Get the absolute power (always positive)
IRQStatus getIRQStatus()
Get the IRQ status.
void clearIRQStatus()
Clear the IRQ status.
bool isCharging() override
Checks if the battery is charging.