Index: firmware/App/Controllers/ROPump.c =================================================================== diff -u -r4a57af44f1ae305d89ae1958919153f26a773d05 -rb37ec507e3d9c1bdedf60e0df3ceab39aa535411 --- firmware/App/Controllers/ROPump.c (.../ROPump.c) (revision 4a57af44f1ae305d89ae1958919153f26a773d05) +++ firmware/App/Controllers/ROPump.c (.../ROPump.c) (revision b37ec507e3d9c1bdedf60e0df3ceab39aa535411) @@ -393,6 +393,7 @@ F32 actualPressure = getMeasuredDGPressure( PRESSURE_SENSOR_RO_PUMP_OUTLET ); BOOL isPressureMax = ( actualPressure >= MAX_ALLOWED_MEASURED_PRESSURE_PSI ? TRUE : FALSE ); BOOL isDutyCycleOutOfRange = FALSE; + BOOL isMaxPWM = ( roPumpDutyCyclePctSet > MAX_ALLOWED_RO_PUMP_PWM_PERCENT ) ? TRUE : FALSE; // The feedback voltage is on the 0V line so when the duty cycle is 0, the feedback is 2.5V // The duty cycle is calculated by getting the 1 - (ratio of feedback / to the voltage at 0 percent duty cycle). @@ -412,6 +413,10 @@ if ( getSoftwareConfigStatus( SW_CONFIG_DISABLE_RO_PUMP_MONITOR ) != SW_CONFIG_ENABLE_VALUE ) #endif { + + // See if the maximum PWM alarm has occurred + checkPersistentAlarm( ALARM_ID_DG_MAX_RO_PUMP_PWM_EXCEEDED, isMaxPWM, roPumpDutyCyclePctSet, MAX_ALLOWED_RO_PUMP_PWM_PERCENT ); + // To monitor the flow, the control mode must be in closed loop mode and the pump should be control to flow state // If the pump is controlled to the maximum pressure, the flow might be different from the target flow for more than the target // but the pump is not able to achieve the flow. @@ -807,13 +812,7 @@ *************************************************************************/ static void setROPumpControlSignalDutyCycle( F32 dutyCycle ) { - BOOL isMaxPWM = FALSE; - etpwmSetCmpB( etpwmREG2, (U32)( (S32)( ( dutyCycle * (F32)(etpwmREG2->TBPRD) ) + FLOAT_TO_INT_ROUNDUP_OFFSET ) ) ); - - // See if the maximum PWM alarm has occurred - isMaxPWM = dutyCycle > MAX_ALLOWED_RO_PUMP_PWM_PERCENT ? TRUE : FALSE; - checkPersistentAlarm( ALARM_ID_DG_MAX_RO_PUMP_PWM_EXCEEDED, isMaxPWM, dutyCycle, MAX_ALLOWED_RO_PUMP_PWM_PERCENT ); } /*********************************************************************//**