fix avg formula

This commit is contained in:
Laila van Reenen 2025-05-05 11:55:07 +02:00
parent aefe383504
commit f05f1b0163
Signed by: LailaTheElf
GPG Key ID: 8A3EF0226518C12D

View File

@ -22,7 +22,7 @@ pub fn pulse_counter(pulses: Arc<AtomicCell<u32>>, last_time: Arc<AtomicCell<Opt
let time = f64::from(u32::try_from(now - last).unwrap()) / (60.0 * 60.0 * 1000.0);
let watt = 1.0 / time;
let avg = power.load();
power.store(avg + (watt-avg)/f64::from(count));
power.store(avg + (watt-avg)/f64::from(count+1));
},
None => {}
}