Alternative detection of battery charged
This commit is contained in:
parent
849ce36c6f
commit
ab8546a7b7
@ -94,7 +94,7 @@ uint8_t acpi_read(uint8_t addr) {
|
|||||||
// If AC adapter connected
|
// If AC adapter connected
|
||||||
if (!gpio_get(&ACIN_N)) {
|
if (!gpio_get(&ACIN_N)) {
|
||||||
// And battery is not fully charged
|
// And battery is not fully charged
|
||||||
if (!(battery_status & 0x0020)) {
|
if (battery_current != 0) {
|
||||||
// Battery is charging
|
// Battery is charging
|
||||||
data |= 1 << 1;
|
data |= 1 << 1;
|
||||||
}
|
}
|
||||||
|
@ -531,7 +531,7 @@ void power_event(void) {
|
|||||||
// Discharging (no AC adapter)
|
// Discharging (no AC adapter)
|
||||||
gpio_set(&LED_BAT_CHG, false);
|
gpio_set(&LED_BAT_CHG, false);
|
||||||
gpio_set(&LED_BAT_FULL, false);
|
gpio_set(&LED_BAT_FULL, false);
|
||||||
} else if (battery_status & 0x0020) {
|
} else if (battery_current == 0) {
|
||||||
// Fully charged
|
// Fully charged
|
||||||
// TODO: turn off charger
|
// TODO: turn off charger
|
||||||
gpio_set(&LED_BAT_CHG, false);
|
gpio_set(&LED_BAT_CHG, false);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user