battery: Implement charging thresholds
Battery Charging Start Threshold: - Valid values are [0, 100] - A value of 0 disables the feature, leaving the charger enabled on AC Battery Charging End Threshold: - Valid values are [0,100] - A value of 100 disabled the feature, leaving the charger enabled on AC The stop threshold must be configured for the start threshold to work.
This commit is contained in:
committed by
Jeremy Soller
parent
4f0aa600d7
commit
fd6f9a0a05
@ -357,7 +357,7 @@ void power_event(void) {
|
||||
battery_charger_disable();
|
||||
} else {
|
||||
DEBUG("plugged in\n");
|
||||
battery_charger_enable();
|
||||
battery_charger_configure();
|
||||
}
|
||||
battery_debug();
|
||||
|
||||
@ -377,6 +377,11 @@ void power_event(void) {
|
||||
|
||||
gpio_set(&AC_PRESENT, !ac_new);
|
||||
|
||||
// Configure charger based on charging thresholds when plugged in
|
||||
if (!ac_new) {
|
||||
battery_charger_configure();
|
||||
}
|
||||
|
||||
// Read power switch state
|
||||
static bool ps_last = true;
|
||||
bool ps_new = gpio_get(&PWR_SW_N);
|
||||
|
Reference in New Issue
Block a user