Index: firmware/App/Controllers/ConcentratePumps.c =================================================================== diff -u -r1da5fe992c0b461115912698afc9cc7039ad2df3 -r73f0cd487a13d55cf790b3c34f1e9ccc12b6c38f --- firmware/App/Controllers/ConcentratePumps.c (.../ConcentratePumps.c) (revision 1da5fe992c0b461115912698afc9cc7039ad2df3) +++ firmware/App/Controllers/ConcentratePumps.c (.../ConcentratePumps.c) (revision 73f0cd487a13d55cf790b3c34f1e9ccc12b6c38f) @@ -7,8 +7,8 @@ * * @file ConcentratePumps.c * -* @author (last) Vinayakam Mani -* @date (last) 22-Aug-2023 +* @author (last) Dara Navaei +* @date (last) 21-Sep-2023 * * @author (original) Quang Nguyen * @date (original) 22-Oct-2020 @@ -479,6 +479,11 @@ targetSpeed_ml_min *= -1.0; } + /* + * If 3 <= speed <= 48 set it + * If speed < 3 set to 0 + * else speed > 48 set to 48 + */ if ( ( CONCENTRATE_PUMP_MIN_SPEED <= targetSpeed_ml_min ) && ( targetSpeed_ml_min <= CONCENTRATE_PUMP_MAX_SPEED ) ) { concentratePumps[ pumpId ].pumpTargetSpeed = targetSpeed_ml_min; @@ -487,7 +492,7 @@ { concentratePumps[ pumpId ].pumpTargetSpeed = 0.0; } - else if ( targetSpeed_ml_min > CONCENTRATE_PUMP_MAX_SPEED ) + else { concentratePumps[ pumpId ].pumpTargetSpeed = CONCENTRATE_PUMP_MAX_SPEED; } @@ -885,27 +890,32 @@ *************************************************************************/ static void calcMeasuredPumpsSpeed( void ) { + CONCENTRATE_PUMPS_T pumpId; U16 pulseWidthCount = 0; F32 pulseWidthInMicroSeconds = 0.0F; BOOL isPulseWidthOut = FALSE; - CONCENTRATE_PUMPS_T pumpId; CONCENTRATE_PUMPS_T pumpInAlarm = CONCENTRATEPUMPS_FIRST; F32 pumpInAlarmPulseWidthInMicroSeconds = 0.0F; BOOL isPumpPulseWidthOut = FALSE; for ( pumpId = CONCENTRATEPUMPS_FIRST; pumpId < NUM_OF_CONCENTRATE_PUMPS; pumpId++ ) { - switch (pumpId) + switch ( pumpId ) { case CONCENTRATEPUMPS_CP1_ACID: pulseWidthCount = getFPGACP1HallSensePulseWidth(); break; + case CONCENTRATEPUMPS_CP2_BICARB: pulseWidthCount = getFPGACP2HallSensePulseWidth(); break; + +#ifndef _VECTORCAST_ + // Disabled in VectorCAST since it cannot be reached in VectorCAST because the switch case is in a for loop default: // Loop only allows for valid concentrate pump Ids. break; +#endif } pulseWidthInMicroSeconds = pulseWidthCount * CONCENTRATE_PUMP_HALL_SENSE_PERIOD_RESOLUTION; @@ -923,7 +933,7 @@ } // If pulse width is out of range capture pump out of range, pumpId and pulse width - if ( TRUE == isPumpPulseWidthOut) + if ( TRUE == isPumpPulseWidthOut ) { // Pulse width for this concentrate pump is out of range isPulseWidthOut = TRUE; @@ -933,7 +943,6 @@ } checkPersistentAlarm( ALARM_ID_DG_CONC_PUMP_HALL_SENSOR_OUT_OF_RANGE, isPulseWidthOut, pumpInAlarm, pumpInAlarmPulseWidthInMicroSeconds ); - } /*********************************************************************//**