Index: firmware/App/Controllers/DrainPump.c =================================================================== diff -u -rfc78b1e5af6d7ab8f7656b410c4cacdfd76a49e6 -rfcdecd8b2c6b086ddf4700ecc1892bd47aef08c1 --- firmware/App/Controllers/DrainPump.c (.../DrainPump.c) (revision fc78b1e5af6d7ab8f7656b410c4cacdfd76a49e6) +++ firmware/App/Controllers/DrainPump.c (.../DrainPump.c) (revision fcdecd8b2c6b086ddf4700ecc1892bd47aef08c1) @@ -123,6 +123,7 @@ static U32 drainControlTimerCtr; ///< Determines when to perform control on drain pump. static BOOL hasClosedLoopBeenRequested; ///< Closed loop pump control flag. static OVERRIDE_U32_T drainPumpMeasuredRPM = { 0, 0, 0, 0 }; ///< Measured drain pump RPM from feedback. +static OVERRIDE_U32_T drainPumpMaxonMeasuredRPM = { 0, 0, 0, 0 }; ///< Measured Maxon drain pump RPM. static OVERRIDE_F32_T drainPumpMeasuredCurrentA = { 0.0F, 0.0F, 0.0F, 0 }; ///< Measured drain pump current feedback. static OVERRIDE_U32_T drainPumpMeasuredDir = { 0, 0, 0, 0 }; ///< Measured drain pump direction. static BOOL signalNewRPMRequest; ///< Signal flag the indicates there is a new RPM request. @@ -333,10 +334,14 @@ *************************************************************************/ void execDrainPumpMonitor( void ) { - U16 fpgaADCSpeedCount = getFPGADrainPumpSpeed(); - U16 fpgaADCCurrentCount = getFPGADrainPumpCurrentFeedback(); - F32 currentA = getDrainPumpMeasuredCurrentA(); - U32 dirHallSensorErrorCount = (U32)( getFPGADrainPumpDirection() & DRAIN_PUMP_DIR_ERROR_CNT_BIT_MASK ); + U16 fpgaADCSpeedCount = getFPGADrainPumpSpeed(); + U16 fpgaMaxonADCSpeedCount = getFPGADrainPumpSpeedFeedback(); + U16 fpgaADCCurrentCount = getFPGADrainPumpCurrentFeedback(); + F32 currentA = getDrainPumpMeasuredCurrentA(); + U32 dirHallSensorErrorCount = (U32)( getFPGADrainPumpDirection() & DRAIN_PUMP_DIR_ERROR_CNT_BIT_MASK ); + + // Update the override variables + drainPumpMaxonMeasuredRPM.data = MAX_DRAIN_PUMP_RPM * ( fpgaMaxonADCSpeedCount / BITS_12_FULL_SCALE ); drainPumpMeasuredRPM.data = ( DRAIN_PUMP_OFF_RPM_ADC_COUNT == fpgaADCSpeedCount ? 0 : (U32)( RPM_CONVERSION_COEFF / (F32)fpgaADCSpeedCount ) ); drainPumpMeasuredCurrentA.data = (F32)fpgaADCCurrentCount * CURRENT_CONVERSION_COEFF; drainPumpMeasuredDir.data = (U32)( ( getFPGADrainPumpDirection() & DRAIN_PUMP_DIR_BIT_MASK ) >> SHIFT_BITS_BY_7 ); @@ -345,9 +350,7 @@ if ( getSoftwareConfigStatus( SW_CONFIG_DISABLE_DRAIN_PUMP_MONITOR ) != SW_CONFIG_ENABLE_VALUE ) #endif { -#ifndef _RELEASE_ if ( ( getHardwareConfigStatus() != HW_CONFIG_BETA ) && ( getCurrentOperationMode() != DG_MODE_INIT ) ) -#endif { checkFPGAPersistentErrorCountAlarm( FPGA_PERS_ERROR_DRAIN_PUMP_DIR_HALL_SENSOR, dirHallSensorErrorCount ); } @@ -356,21 +359,22 @@ { case DRAIN_PUMP_OFF_STATE: { + BOOL isRPMTooHigh = FALSE; BOOL isOffCurrentOut = ( currentA > DRAIN_PUMP_MAX_CURRENT_WHEN_OFF_A ? TRUE : FALSE ); - BOOL isRPMTooHigh = ( getDrainPumpMeasuredRPM() > MIN_DRAIN_PUMP_RPM ? TRUE : FALSE ); - checkPersistentAlarm( ALARM_ID_DG_DRAIN_PUMP_RPM_OUT_OF_RANGE, FALSE, getDrainPumpMeasuredRPM(), MAX_ALLOWED_OPEN_LOOP_RPM_OUT_OF_RANGE ); - checkPersistentAlarm( ALARM_ID_DG_DRAIN_PUMP_OFF_FAULT, isRPMTooHigh, getDrainPumpMeasuredRPM(), MIN_DRAIN_PUMP_RPM ); + isRPMTooHigh |= ( getDrainPumpMeasuredRPM( DRAIN_PUMP_HALL_SNSR_FB ) > MIN_DRAIN_PUMP_RPM ? TRUE : FALSE ); + isRPMTooHigh |= ( getDrainPumpMeasuredRPM( DRAIN_PUMP_MAXON_SNSR_FB ) > MIN_DRAIN_PUMP_RPM ? TRUE : FALSE ); + checkPersistentAlarm( ALARM_ID_DG_DRAIN_PUMP_RPM_OUT_OF_RANGE, FALSE, getDrainPumpMeasuredRPM( DRAIN_PUMP_HALL_SNSR_FB ), MAX_ALLOWED_OPEN_LOOP_RPM_OUT_OF_RANGE ); + checkPersistentAlarm( ALARM_ID_DG_DRAIN_PUMP_OFF_FAULT, isRPMTooHigh, getDrainPumpMeasuredRPM( DRAIN_PUMP_HALL_SNSR_FB ), MIN_DRAIN_PUMP_RPM ); + // If the off fault alarm has become active, trigger the safety shutdown if ( TRUE == isAlarmActive( ALARM_ID_DG_DRAIN_PUMP_OFF_FAULT ) ) { activateSafetyShutdown(); } -#ifndef _RELEASE_ if ( ( getHardwareConfigStatus() != HW_CONFIG_BETA ) && ( getCurrentOperationMode() != DG_MODE_INIT ) ) -#endif { checkPersistentAlarm( ALARM_ID_DG_DRAIN_PUMP_CURRENT_OUT_OF_RANGE, isOffCurrentOut, currentA, DRAIN_PUMP_MAX_CURRENT_WHEN_OFF_A ); checkPersistentAlarm( ALARM_ID_DG_DRAIN_PUMP_DIRECTION_INVALID, FALSE, getFPGADrainPumpDirection(), DRAIN_PUMP_FORWARD_DIR ); @@ -383,15 +387,13 @@ { U32 direction = getDrainPumpMeasuredDirection(); BOOL isDirInvalid = ( direction != DRAIN_PUMP_FORWARD_DIR ? TRUE : FALSE ); - U32 rpmDiff = abs( getDrainPumpTargetRPM() - getDrainPumpMeasuredRPM() ); + U32 rpmDiff = abs( getDrainPumpTargetRPM() - getDrainPumpMeasuredRPM( DRAIN_PUMP_HALL_SNSR_FB ) ); BOOL isRPMOutOfRange = ( rpmDiff > MAX_ALLOWED_OPEN_LOOP_RPM_OUT_OF_RANGE ? TRUE : FALSE ); checkPersistentAlarm( ALARM_ID_DG_DRAIN_PUMP_RPM_OUT_OF_RANGE, isRPMOutOfRange, getDrainPumpMeasuredRPM(), MAX_ALLOWED_OPEN_LOOP_RPM_OUT_OF_RANGE ); checkPersistentAlarm( ALARM_ID_DG_DRAIN_PUMP_OFF_FAULT, FALSE, getDrainPumpMeasuredRPM(), MIN_DRAIN_PUMP_RPM ); -#ifndef _RELEASE_ if ( ( getHardwareConfigStatus() != HW_CONFIG_BETA ) && ( getCurrentOperationMode() != DG_MODE_INIT ) ) -#endif { checkPersistentAlarm( ALARM_ID_DG_DRAIN_PUMP_DIRECTION_INVALID, isDirInvalid, (F32)direction, DRAIN_PUMP_FORWARD_DIR ); } @@ -403,9 +405,7 @@ U32 direction = getDrainPumpMeasuredDirection(); BOOL isDirInvalid = ( direction != DRAIN_PUMP_FORWARD_DIR ? TRUE : FALSE ); -#ifndef _RELEASE_ if ( ( getHardwareConfigStatus() != HW_CONFIG_BETA ) && ( getCurrentOperationMode() != DG_MODE_INIT ) ) -#endif { checkPersistentAlarm( ALARM_ID_DG_DRAIN_PUMP_DIRECTION_INVALID, isDirInvalid, (F32)direction, DRAIN_PUMP_FORWARD_DIR ); } @@ -420,9 +420,7 @@ break; } -#ifndef _RELEASE_ if ( ( getHardwareConfigStatus() != HW_CONFIG_BETA ) && ( getCurrentOperationMode() != DG_MODE_INIT ) ) -#endif { // Check the persistent alarm for the maximum drain pump current BOOL isCurrentOutOfRange = ( currentA > DRAIN_PUMP_MAX_CURRENT_A ? TRUE : FALSE ); @@ -557,7 +555,7 @@ * @details Outputs: none * @return drain pump RPM *************************************************************************/ -U32 getDrainPumpMeasuredRPM( void ) +U32 getDrainPumpMeasuredRPM( DRAIN_PUMP_SPEED_FB_SNSR_T speed ) { U32 rpm = getU32OverrideValue( &drainPumpMeasuredRPM );