From 9f057fddfd90c076b241f73531e5c731e68bfb42 Mon Sep 17 00:00:00 2001 From: Joe Ross Date: Fri, 16 Jan 2015 20:24:12 -0800 Subject: [PATCH] Correct energy to be in Joules rather then millijoules. Fixes artf3940 Note: power and thus energy will still be wrong until PDP firmware 1.39 or later is used. See artf3939. Change-Id: Ic68b8a28c78f1b5d524fa5fb45e3bc0d9cd4a76a --- hal/lib/Athena/ctre/PDP.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/hal/lib/Athena/ctre/PDP.cpp b/hal/lib/Athena/ctre/PDP.cpp index 2fb4c8f2d4..5cda11e98c 100644 --- a/hal/lib/Athena/ctre/PDP.cpp +++ b/hal/lib/Athena/ctre/PDP.cpp @@ -178,7 +178,8 @@ CTR_Code PDP::GetTotalEnergy(double &energyJoules) raw <<= 8; raw |= rx->Energy_125mWPerUnitXTmeas_l8; energyJoules = 0.125 * raw; /* mW integrated every TmeasMs */ - energyJoules *= rx->TmeasMs_likelywillbe20ms_; /* multiplied by TmeasMs = joules */ + energyJoules *= 0.001; /* convert from mW to W */ + energyJoules *= rx->TmeasMs_likelywillbe20ms_; /* multiplied by TmeasMs = joules */ return rx.err; } /* Clear sticky faults.