Index: firmware/App/Controllers/AirPump.c =================================================================== diff -u -r8345f0415ce34f2f47afcbf613a00216769f51c6 -r5a5e51331369f0044852f5063c6c043b357ceea9 --- firmware/App/Controllers/AirPump.c (.../AirPump.c) (revision 8345f0415ce34f2f47afcbf613a00216769f51c6) +++ firmware/App/Controllers/AirPump.c (.../AirPump.c) (revision 5a5e51331369f0044852f5063c6c043b357ceea9) @@ -52,7 +52,7 @@ static AIR_PUMP_STATE_T currentAirPumpState; ///< Current air pump control state. static U08 airPumpStallCounter; ///< Air pump stall counter static U08 airPumpStartDelayCounter; ///< Delay before evaluating air pump stall condition -static U16 currentAirPumpRPM; ///< Current air pump RPM +static OVERRIDE_U32_T currentAirPumpRPM; ///< Current air pump RPM static F32 currentAirPumpPowerLevel; ///< Current air pump power level setting in % duty cycle (0..100%). static U32 airPumpDataPublicationTimerCounter; ///< Air pump data broadcast timer counter. static OVERRIDE_U32_T airPumpDataPublishInterval; ///< Air pump data broadcast interval (in ms). @@ -81,7 +81,10 @@ airPumpDataPublicationTimerCounter = DATA_PUBLISH_COUNTER_START_COUNT; currentAirPumpState = AIR_PUMP_STATE_INIT; currentAirPumpPowerLevel = AIR_PUMP_MOTOR_OFF; - currentAirPumpRPM = 0; + currentAirPumpRPM.data = 0; + currentAirPumpRPM.ovData = 0; + currentAirPumpRPM.ovInitData = 0; + currentAirPumpRPM.override = OVERRIDE_RESET; airPumpStallCounter = 0; airPumpStartDelayCounter = 0; airPumpDataPublishInterval.data = AIR_PUMP_DATA_PUB_INTERVAL; @@ -179,7 +182,7 @@ // Check stall condition checkAirPumpStallCondition(); // update the speed every tick - currentAirPumpRPM = getAirPumpMotorRPM(); + currentAirPumpRPM.data = getAirPumpMotorRPM(); publishAirPumpData(); } @@ -255,12 +258,12 @@ airPumpStartDelayCounter++; airPumpStallCounter = 0; } - else if ( 0 == currentAirPumpRPM ) + else if ( 0 == getU32OverrideValue( ¤tAirPumpRPM ) ) { // Air pump commanded on but RPM remains zero if ( ++airPumpStallCounter >= AIR_PUMP_STALL_PERSISTENCE ) { - SET_ALARM_WITH_2_U32_DATA( ALARM_ID_TD_AIR_PUMP_STALL, currentAirPumpPowerLevel, currentAirPumpRPM ); + SET_ALARM_WITH_2_U32_DATA( ALARM_ID_TD_AIR_PUMP_STALL, currentAirPumpPowerLevel, getU32OverrideValue( ¤tAirPumpRPM ) ); // Stop H12 air pump setAirPumpState( AIR_PUMP_STATE_OFF, AIR_PUMP_MOTOR_OFF ); } @@ -298,7 +301,7 @@ data.h12State = getAirPumpState(); data.h12Power = currentAirPumpPowerLevel; - data.h12Rpm = (U32)currentAirPumpRPM; + data.h12Rpm = (U32)getU32OverrideValue( ¤tAirPumpRPM ); //TODO:remove after validating pump speed data.fpgah12Rpm = getAirPumpMotorFPGARPM(); //TODO:remove after validating pump speed @@ -363,5 +366,22 @@ return result; } +/*********************************************************************//** + * @brief + * The testAirPumpRPMOverride function overrides the RPM value reported + * by the air pump sensor. + * @details \b Inputs: none + * @details \b Outputs: currentAirPumpRPM + * @param message Override message from Dialin which includes the RPM + * value to override the air pump RPM to. + * @return TRUE if override request is successful, FALSE if not + *************************************************************************/ +BOOL testAirPumpRPMOverride( MESSAGE_T *message ) +{ + BOOL result = u32Override( message, ¤tAirPumpRPM, 0, 0xFFFF ); + + return result; +} + /**@}*/