Index: firmware/App/Monitors/Pressures.c =================================================================== diff -u -r87d45fcfcfdfa6d7638834181fd07bed56a3af67 -rf979c391268b595e44fb6747d43487e4d2294e68 --- firmware/App/Monitors/Pressures.c (.../Pressures.c) (revision 87d45fcfcfdfa6d7638834181fd07bed56a3af67) +++ firmware/App/Monitors/Pressures.c (.../Pressures.c) (revision f979c391268b595e44fb6747d43487e4d2294e68) @@ -1019,8 +1019,8 @@ *************************************************************************/ static void filterBaroPressureReadings( F32 baroPresPSI ) { - F32 prevSampleToRemovePSI = baroMovingAvg.baroSamplesPSI[ baroMovingAvg.baroSamplesNextIndex ]; U32 currentIndex = baroMovingAvg.baroSamplesNextIndex; + F32 prevSampleToRemovePSI = baroMovingAvg.baroSamplesPSI[ currentIndex ]; baroMovingAvg.baroSamplesPSI[ currentIndex ] = baroPresPSI; baroMovingAvg.baroRunningSumPSI = baroMovingAvg.baroRunningSumPSI + baroPresPSI - prevSampleToRemovePSI; @@ -1174,4 +1174,20 @@ return result; } +/*********************************************************************//** + * @brief + * The testBaroPressureOverride function overrides baro sensor pressure. + * @details \b Inputs: none + * @details \b Outputs: baroMovingAvg.baroAvgPSI + * @param message Override message from Dialin which includes the value to + * override the baro pressure to. + * @return TRUE if override request is successful, FALSE if not + *************************************************************************/ +BOOL testBaroPressureOverride( MESSAGE_T * message ) +{ + BOOL result = f32Override( message, &baroMovingAvg.baroAvgPSI ); + + return result; +} + /**@}*/