Index: firmware/App/Controllers/AirPump.c =================================================================== diff -u -r8ff21f9b2a0b33d4e59978aa6c7f7398e700c520 -r16f07c4783e5778c68629ce68ab4f15e66508156 --- firmware/App/Controllers/AirPump.c (.../AirPump.c) (revision 8ff21f9b2a0b33d4e59978aa6c7f7398e700c520) +++ firmware/App/Controllers/AirPump.c (.../AirPump.c) (revision 16f07c4783e5778c68629ce68ab4f15e66508156) @@ -17,6 +17,7 @@ #include "AirPump.h" #include "AlarmMgmtTD.h" +#include "FpgaTD.h" #include "GLXferPump.h" #include "Messaging.h" #include "OperationModes.h" @@ -93,13 +94,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 @@ -108,13 +109,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; } /*********************************************************************//** @@ -238,6 +241,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; Index: firmware/App/Drivers/GLXferPump.h =================================================================== diff -u -rfbb77dff1aeac3b26529790ad6af0e63f5a1f578 -r16f07c4783e5778c68629ce68ab4f15e66508156 --- firmware/App/Drivers/GLXferPump.h (.../GLXferPump.h) (revision fbb77dff1aeac3b26529790ad6af0e63f5a1f578) +++ firmware/App/Drivers/GLXferPump.h (.../GLXferPump.h) (revision 16f07c4783e5778c68629ce68ab4f15e66508156) @@ -45,6 +45,8 @@ void setAirPumpMotorPower( F32 power ); F32 getAirPumpMotorPower( void ); U16 getAirPumpMotorRPM( void ); +// TODO:remove after testing +F32 getAirPumpMotorScalarPower( void ); BOOL testSetAirPump( MESSAGE_T *message );