mirror of
https://github.com/RGBCube/superfreq
synced 2025-07-27 17:07:44 +00:00
daemon: reset battery discharge tracking on AC connection; preserve history
This commit is contained in:
parent
7047f64984
commit
8d784b5d56
1 changed files with 2 additions and 1 deletions
|
@ -110,10 +110,11 @@ impl SystemHistory {
|
||||||
if let Some(battery) = report.batteries.first() {
|
if let Some(battery) = report.batteries.first() {
|
||||||
// Reset when we are charging or have just connected AC
|
// Reset when we are charging or have just connected AC
|
||||||
if battery.ac_connected {
|
if battery.ac_connected {
|
||||||
|
// Reset discharge tracking but continue updating the rest of
|
||||||
|
// the history so we still detect activity/load changes on AC.
|
||||||
self.battery_discharge_rate = None;
|
self.battery_discharge_rate = None;
|
||||||
self.last_battery_percentage = None;
|
self.last_battery_percentage = None;
|
||||||
self.last_battery_timestamp = None;
|
self.last_battery_timestamp = None;
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if let Some(current_percentage) = battery.capacity_percent {
|
if let Some(current_percentage) = battery.capacity_percent {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue