From 962993372003f94d2704028c49ea951406b4dd31 Mon Sep 17 00:00:00 2001 From: Paul Fornage <36117326+paulwrath1223@users.noreply.github.com> Date: Mon, 18 Dec 2023 19:15:24 -0800 Subject: [PATCH] fixed watt-hour and amp-hour calculation --- src/main.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main.rs b/src/main.rs index 2201339..69d6e8e 100644 --- a/src/main.rs +++ b/src/main.rs @@ -84,8 +84,8 @@ async fn main() -> Result<(), BatTestError>{ output.flush()?; let avg_amps = amps_sum/entries as f64; let avg_watts = watts_sum/entries as f64; - let total_amp_hours = avg_amps/total_hours; - let total_watt_hours = avg_watts/total_hours; + let total_amp_hours = avg_amps*total_hours; + let total_watt_hours = avg_watts*total_hours; println!("Discharge complete. Sucked {} watt hours and {} amp hours out of that bad boy.", total_watt_hours, total_amp_hours); output.write_record(&["","",""])?; output.write_record(&["Finish time","Watt hours","Amp hours"])?;