Index: firmware/App/Controllers/SubstitutionPump.c =================================================================== diff -u -r83d4e437a4679b5d01b9b7a695484113a54c122b -r4a1f0518f867d1bc5d27d452a8306e43159e9a51 --- firmware/App/Controllers/SubstitutionPump.c (.../SubstitutionPump.c) (revision 83d4e437a4679b5d01b9b7a695484113a54c122b) +++ firmware/App/Controllers/SubstitutionPump.c (.../SubstitutionPump.c) (revision 4a1f0518f867d1bc5d27d452a8306e43159e9a51) @@ -56,7 +56,7 @@ #define SUBSTITUTION_PUMP_CONTROL_NOT_RESET 0x20 ///< Substitution pump control not reset. #define SUBSTITUTION_PUMP_CONTROL_SLEEP_OFF 0x40 ///< Substitution pump control sleep off. -#define SUBSTITUTION_PUMP_TRANS_TO_RAMP_SPEED_THRESHOLD_MLPM 10.0F ///< Substitution pump transition to ramp to target speed threshold in mL/min. +#define SUBSTITUTION_PUMP_TRANS_TO_RAMP_SPEED_THRESHOLD_MLPM 20.0F ///< Substitution pump transition to ramp to target speed threshold in mL/min. #define SUBSTITUTION_PUMP_RAMP_SPEED_INCREMENT 5.0F ///< Speed increase (mL/min) when controlling Substitution pump to target step speed. #define SUBSTITUTION_PUMP_CNT_TO_RPM(cnt) ( 60 / ( cnt * 0.0001 ) ) ///< Conversion function for hall sensor cnt to rpm. rpm = 60/(cnt*100uS). @@ -257,20 +257,22 @@ static SUBSTITUTION_PUMP_STATE_T handleSubstitutionPumpControlTargetSpeedState( SUBSTITUTION_PUMPS_T pumpId ) { SUBSTITUTION_PUMP_STATE_T state = SUBSTITUTION_PUMP_CONTROL_TARGET_SPEED_STATE; - F32 targetToCurreSpeedDiffMLPM = fabs( getSubstitutionPumpTargetRate( pumpId ) - substitutionPumps[ pumpId ].currentPumpSpeed ); + F32 pumpTargetSpeed = getSubstitutionPumpTargetRate( pumpId ) * SUBSTITUTION_PUMP_VOLUME_PER_REV; // Translate from ml/min to RPM. + F32 currentToTargetDiff = fabs( pumpTargetSpeed - substitutionPumps[ pumpId ].currentPumpSpeed ); if ( ++substitutionPumps[ pumpId ].controlTimerCounter >= SUBSTITUTION_PUMP_CONTROL_INTERVAL ) { substitutionPumps[ pumpId ].controlTimerCounter = 0; stepSubstitutionPumpToTargetRate( pumpId ); } - if ( targetToCurreSpeedDiffMLPM >= SUBSTITUTION_PUMP_TRANS_TO_RAMP_SPEED_THRESHOLD_MLPM ) + if ( currentToTargetDiff >= SUBSTITUTION_PUMP_TRANS_TO_RAMP_SPEED_THRESHOLD_MLPM ) { // If the requested target speed is greater than the threshold, transition back to ramp state regardless of the status of the // control interval stepSubstitutionPumpToTargetRate( pumpId ); - state = SUBSTITUTION_PUMP_RAMP_TO_TARGET_SPEED_STATE; + //TODO: Transition to ramp state if feature requires ramping state. + } //Stop the pump if requested. Index: firmware/App/Services/Messaging.c =================================================================== diff -u -r2c1a0857ad6987f387bdb8434c6498ab88cd1db8 -r4a1f0518f867d1bc5d27d452a8306e43159e9a51 --- firmware/App/Services/Messaging.c (.../Messaging.c) (revision 2c1a0857ad6987f387bdb8434c6498ab88cd1db8) +++ firmware/App/Services/Messaging.c (.../Messaging.c) (revision 4a1f0518f867d1bc5d27d452a8306e43159e9a51) @@ -293,7 +293,7 @@ { MSG_ID_FP_SET_RECOVERY_VALVES_REQUEST, &testIOFPSetValveRecoveryConfig }, { MSG_ID_DD_SUBSTITUTION_PUMP_START_STOP_OVERRIDE_REQUEST, &testSubstitutionPumpStartStopOverride }, { MSG_ID_DD_SUBSTITUTION_PUMP_BROADCAST_INTERVAL_OVERRIDE_REQUEST, &testSubstitutionPumpDataPublishIntervalOverride }, - { MSG_ID_DD_SUBSTITUTION_PUMP_TARGET_SPEED_OVERRIDE_REQUEST, &testSubstitutionPumpTargetRateOverride }, + { MSG_ID_DD_SUBSTITUTION_PUMP_TARGET_RATE_OVERRIDE_REQUEST, &testSubstitutionPumpTargetRateOverride }, }; /// Calculation for number of entries in the incoming message function handler look-up table.