Index: firmware/App/Controllers/ROPump.c =================================================================== diff -u -rd4c85d331ab8cf9da1b9af3551465bc97baa73a1 -r26929d4f3960103a83d939cc5aa197e5e8c00a86 --- firmware/App/Controllers/ROPump.c (.../ROPump.c) (revision d4c85d331ab8cf9da1b9af3551465bc97baa73a1) +++ firmware/App/Controllers/ROPump.c (.../ROPump.c) (revision 26929d4f3960103a83d939cc5aa197e5e8c00a86) @@ -89,6 +89,7 @@ #define ROP_PSI_TO_PWM_DC(p) ( 0.2 + ( (F32)((p) - 100) * 0.01 ) ) ///< Conversion factor from target PSI to PWM duty cycle estimate. #define SAFETY_SHUTDOWN_TIMEOUT ( 3 * MS_PER_SECOND ) ///< RO pump safety shutdown activation timeout in ms. #define ROP_FLOW_STABILIZE_TIME ( 3 * MS_PER_SECOND ) ///< Time required for RO flow to stabilize. +#define ROP_MAX_RAMP_UP_RETRY 5 ///< Maximum ramp up retires before alarm. /// Enumeration of RO pump states. typedef enum ROPump_States @@ -144,6 +145,7 @@ static U32 flowFilterCounter = 0; ///< Flow filtering counter. static U32 roPumpOnStartTime = 0; ///< Start time when RO pump turned on. static BOOL setupROPumpControl = 0; ///< Flag to indicate if we need to setup RO pump control. +static U32 rampUpRetryCount = 0; ///< Number of ramp up retries. // ********** private function prototypes ********** @@ -204,6 +206,7 @@ flowFilterCounter = 0; flowVerificationCounter = 0; roPumpDataPublicationTimerCounter = 0; + rampUpRetryCount = 0; roPumpState = RO_PUMP_OFF_STATE; roPumpControlMode = NUM_OF_PUMP_CONTROL_MODES; roPumpControlModeSet = roPumpControlMode; @@ -490,6 +493,7 @@ if ( TRUE == didTimeout( roPumpOnStartTime, ROP_FLOW_STABILIZE_TIME ) ) { + rampUpRetryCount = 0; result = RO_PUMP_RAMP_UP_STATE; } @@ -610,6 +614,10 @@ } else { + if ( ++rampUpRetryCount > ROP_MAX_RAMP_UP_RETRY ) + { + SET_ALARM_WITH_2_F32_DATA( ALARM_ID_DG_RO_PUMP_TOO_MANY_RAMP_UP_RETRY, rampUpRetryCount, ROP_MAX_RAMP_UP_RETRY ); + } result = RO_PUMP_RAMP_UP_STATE; } }