1
Fork 0
mirror of https://github.com/RGBCube/superfreq synced 2025-07-27 17:07:44 +00:00

daemon: set charging

This commit is contained in:
RGBCube 2025-06-04 19:09:23 +03:00
parent 1283e5be14
commit c2325fa5ed
Signed by: RGBCube
SSH key fingerprint: SHA256:CzqbPcfwt+GxFYNnFVCqoN5Itn4YFrshg1TrnACpA5M

View file

@ -139,7 +139,7 @@ impl Daemon {
/// The discharge rate is averaged per hour.
/// So a return value of Some(0.3) means the battery has been
/// discharging 30% per hour.
fn power_supply_discharge_rate(&self) -> Option<f64> {
fn power_supply_discharge_rate(&mut self) -> Option<f64> {
let mut last_charge = None;
// A list of increasing charge percentages.
@ -159,7 +159,9 @@ impl Daemon {
})
.collect();
if discharging.len() < 2 {
self.charging = discharging.len() < 2;
if self.charging {
return None;
}