Index: firmware/App/Controllers/AirPump.c =================================================================== diff -u -r52c71d1f7ca375d7d08829a92ccf3f6363fe22a2 -r1e806f55dd70e314a8bbb70c5233443dc807998a --- firmware/App/Controllers/AirPump.c (.../AirPump.c) (revision 52c71d1f7ca375d7d08829a92ccf3f6363fe22a2) +++ firmware/App/Controllers/AirPump.c (.../AirPump.c) (revision 1e806f55dd70e314a8bbb70c5233443dc807998a) @@ -17,6 +17,7 @@ #include "AirPump.h" #include "AlarmMgmtTD.h" +#include "FpgaTD.h" #include "Messaging.h" #include "OperationModes.h" #include "PersistentAlarm.h" @@ -91,13 +92,13 @@ *************************************************************************/ BOOL setAirPumpState( AIR_PUMP_STATE_T state, F32 power ) { + BOOL result = FALSE; // need to pass the result immediately to user when user enter invalid range if ( ( power < AIR_PUMP_DUTY_CYCLE_MIN ) && ( power > AIR_PUMP_DUTY_CYCLE_MAX ) ) { - return FALSE; + result = FALSE; } - - if ( state < NUM_OF_AIR_PUMP_STATES ) + else if ( state >= AIR_PUMP_STATE_INIT && state < NUM_OF_AIR_PUMP_STATES ) { currentAirPumpState = state; // power level should be 0 (OFF) when pump state is not ON @@ -106,13 +107,15 @@ power = AIR_PUMP_MOTOR_OFF; } currentAirPumpPowerLevel = power; + result = TRUE; } else { SET_ALARM_WITH_2_U32_DATA( ALARM_ID_TD_SOFTWARE_FAULT, SW_FAULT_ID_TD_AIR_PUMP_INVALID_STATE1, (U32)state ) + result = FALSE; } - return TRUE; + return result; } /*********************************************************************//** @@ -236,6 +239,8 @@ data.h12Rpm = (U32)currentAirPumpRPM; //TODO:remove after validating pump speed data.fpgah12Rpm = getH12AirPumpMotorRPM(); + //TODO:remove after validating pump speed + data.scalarPower = getAirPumpMotorScalarPower(); broadcastData( MSG_ID_TD_AIR_PUMP_DATA, COMM_BUFFER_OUT_CAN_TD_BROADCAST, (U08*)&data, sizeof( AIR_PUMP_PAYLOAD_T ) ); airPumpDataPublicationTimerCounter = 0;