battery: Fix condition to start/stop charging

Change the condition, which is currently a level *at* which charging
will start/stop.

Per sysfs [1], these values are a level:

- *below* which charging will begin
- *above* which charging will stop

[1]: https://www.kernel.org/doc/Documentation/ABI/testing/sysfs-class-power

Signed-off-by: Tim Crawford <tcrawford@system76.com>
This commit is contained in:
Tim Crawford
2022-07-31 09:30:39 -06:00
committed by Tim Crawford
parent 5cf57d69b9
commit 7f28764436

View File

@@ -58,7 +58,7 @@ int16_t battery_charger_configure(void) {
// Stop threshold not configured: Always charge on AC.
should_charge = true;
}
else if (battery_info.charge >= battery_get_end_threshold()) {
else if (battery_info.charge > battery_get_end_threshold()) {
// Stop threshold configured: Stop charging at threshold.
should_charge = false;
}
@@ -66,7 +66,7 @@ int16_t battery_charger_configure(void) {
// Start threshold not configured: Always charge up to stop threshold.
should_charge = true;
}
else if (battery_info.charge <= battery_get_start_threshold()) {
else if (battery_info.charge < battery_get_start_threshold()) {
// Start threshold configured: Start charging at threshold.
should_charge = true;
}