AXP192 Battery monitoring display enhanced
This commit is contained in:
parent
79e54774f1
commit
50ff7977d6
@ -57,13 +57,16 @@ void doHousekeeping() {
|
|||||||
// read battery voltage into global variable
|
// read battery voltage into global variable
|
||||||
#if (defined BAT_MEASURE_ADC || defined HAS_PMU)
|
#if (defined BAT_MEASURE_ADC || defined HAS_PMU)
|
||||||
batt_voltage = read_voltage();
|
batt_voltage = read_voltage();
|
||||||
ESP_LOGI(TAG, "Voltage: %dmV", batt_voltage);
|
if (batt_voltage = 0xffff)
|
||||||
|
ESP_LOGI(TAG, "Battery: external power");
|
||||||
|
else
|
||||||
|
ESP_LOGI(TAG, "Battery: %dmV", batt_voltage);
|
||||||
#ifdef HAS_PMU
|
#ifdef HAS_PMU
|
||||||
if (I2C_MUTEX_LOCK()) {
|
if (I2C_MUTEX_LOCK()) {
|
||||||
AXP192_displaypower();
|
AXP192_displaypower();
|
||||||
I2C_MUTEX_UNLOCK();
|
I2C_MUTEX_UNLOCK();
|
||||||
}
|
}
|
||||||
#endif // HAS_PMU
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// display BME680/280 sensor data
|
// display BME680/280 sensor data
|
||||||
|
@ -78,12 +78,18 @@ void AXP192_power(bool on) {
|
|||||||
void AXP192_displaypower(void) {
|
void AXP192_displaypower(void) {
|
||||||
if (pmu.isBatteryConnect())
|
if (pmu.isBatteryConnect())
|
||||||
if (pmu.isChargeing())
|
if (pmu.isChargeing())
|
||||||
ESP_LOGI(TAG, "Battery charging @ %.0fmAh", pmu.getBattChargeCurrent());
|
ESP_LOGI(TAG, "Battery charging %.0fmAh @ Temp %.1f°C",
|
||||||
|
pmu.getBattChargeCurrent(), pmu.getTSTemp());
|
||||||
else
|
else
|
||||||
ESP_LOGI(TAG, "Battery discharging @ %0.fmAh",
|
ESP_LOGI(TAG, "Battery not charging, Temp %.1f°C", pmu.getTSTemp());
|
||||||
pmu.getBattDischargeCurrent());
|
|
||||||
else
|
else
|
||||||
ESP_LOGI(TAG, "No Battery");
|
ESP_LOGI(TAG, "No Battery");
|
||||||
|
|
||||||
|
if (pmu.isVBUSPlug())
|
||||||
|
ESP_LOGI(TAG, "USB present, %.0fmAh @ %.1fV", pmu.getVbusCurrent(),
|
||||||
|
pmu.getVbusVoltage());
|
||||||
|
else
|
||||||
|
ESP_LOGI(TAG, "USB not present");
|
||||||
}
|
}
|
||||||
|
|
||||||
void AXP192_init(void) {
|
void AXP192_init(void) {
|
||||||
@ -111,7 +117,7 @@ void AXP192_init(void) {
|
|||||||
pmu.clearIRQ();
|
pmu.clearIRQ();
|
||||||
#endif // PMU_INT
|
#endif // PMU_INT
|
||||||
|
|
||||||
ESP_LOGI(TAG, "AXP192 PMU initialized.");
|
ESP_LOGI(TAG, "AXP192 PMU initialized, chip Temp %.1f°C", pmu.getTemp());
|
||||||
AXP192_displaypower();
|
AXP192_displaypower();
|
||||||
}
|
}
|
||||||
I2C_MUTEX_UNLOCK(); // release i2c bus access
|
I2C_MUTEX_UNLOCK(); // release i2c bus access
|
||||||
|
Loading…
Reference in New Issue
Block a user