Index: firmware/App/Controllers/DrainPump.c =================================================================== diff -u -r24e8fcb5744724be72ea26bebd95ec594c2c26fe -r752defbb739ea0756a8bf060f00bc6b9429c2764 --- firmware/App/Controllers/DrainPump.c (.../DrainPump.c) (revision 24e8fcb5744724be72ea26bebd95ec594c2c26fe) +++ firmware/App/Controllers/DrainPump.c (.../DrainPump.c) (revision 752defbb739ea0756a8bf060f00bc6b9429c2764) @@ -550,7 +550,7 @@ *************************************************************************/ static DRAIN_PUMP_STATE_T handleDrainPumpControlToTargetState( void ) { - DRAIN_PUMP_STATE_T result = DRAIN_PUMP_CONTROL_TO_TARGET_STATE; + DRAIN_PUMP_STATE_T state = DRAIN_PUMP_CONTROL_TO_TARGET_STATE; // control at set interval if ( ++drainControlTimerCounter >= DRP_CONTROL_INTERVAL ) @@ -565,7 +565,14 @@ drainControlTimerCounter = 0; } - return result; + // Check if the RPM is 0, and if it is turn off the pump + if ( 0 == getTargetDrainPumpRPM() ) + { + state = DRAIN_PUMP_OFF_STATE; + signalDrainPumpHardStop(); + } + + return state; } /*********************************************************************//** Index: firmware/App/Controllers/ROPump.c =================================================================== diff -u -rbd9f7ebe27d5fbdc893d04c9925f1990e873edfa -r752defbb739ea0756a8bf060f00bc6b9429c2764 --- firmware/App/Controllers/ROPump.c (.../ROPump.c) (revision bd9f7ebe27d5fbdc893d04c9925f1990e873edfa) +++ firmware/App/Controllers/ROPump.c (.../ROPump.c) (revision 752defbb739ea0756a8bf060f00bc6b9429c2764) @@ -66,8 +66,6 @@ #define RO_FLOW_ADC_TO_LPM_FACTOR 300 ///< Conversion factor from ADC counts to LPM (liters/min) for RO flow rate (multiply this by inverse of FPGA reading). -#define RO_FLOW_ADC_TO_LPM_FACTOR_TEMP_REMOVE 5555 //TODo remove - #define ROP_FLOW_TO_PWM_SLOPE 0.1 ///< Slope of flow to PWM line equation. #define ROP_FLOW_TO_PWM_INTERCEPT 0.0 ///< Intercept of flow to PWM line equation. @@ -136,12 +134,6 @@ static U32 flowFilterCounter = 0; ///< Flow filtering counter. static DG_FLOW_SENSORS_CAL_RECORD_T flowSensorsCalRecord; ///< Flow sensors calibration record. -// TODO remove -static S32 temporaryFlowVariableRemove; -static F32 temporaryFlowValueRemove; - -// TODO remove - // ********** private function prototypes ********** static RO_PUMP_STATE_T handleROPumpOffState( void ); @@ -198,10 +190,6 @@ roPumpState = RO_PUMP_OFF_STATE; roPumpControlMode = NUM_OF_PUMP_CONTROL_MODES; isROPumpOn = FALSE; - - - temporaryFlowVariableRemove = 0; - temporaryFlowValueRemove = 0.0; } /*********************************************************************//** @@ -339,11 +327,6 @@ // Update sum for flow average calculation measuredFlowReadingsSum += (S32)roFlowReading; - // TODO remove this code - U16 tempROFlowRemove = getFPGAFMPTemporaryFlow(); - temporaryFlowVariableRemove += (S32)tempROFlowRemove; - // TODO remove this code - // Read the pressure at the sensor. The pump cannot be more that the maximum allowed pressure // to make sure the hardware (especially the ROF) is not damaged. If it is the case, we need to stop immediately F32 actualPressure = getMeasuredDGPressure( PRESSURE_SENSOR_RO_PUMP_OUTLET ); @@ -377,25 +360,6 @@ measuredFlowReadingsSum = 0; flowFilterCounter = 0; - - // TODO remove this code after testing - F32 flowTemp = RO_FLOW_ADC_TO_LPM_FACTOR_TEMP_REMOVE / ( (F32)temporaryFlowVariableRemove * FLOW_AVERAGE_MULTIPLIER ); - - temporaryFlowValueRemove = pow(flowTemp, 4) * flowSensorsCalRecord.flowSensors[ CAL_DATA_RO_PUMP_FLOW_SENSOR ].fourthOrderCoeff + - pow(flowTemp, 3) * flowSensorsCalRecord.flowSensors[ CAL_DATA_RO_PUMP_FLOW_SENSOR ].thirdOrderCoeff + - pow(flowTemp, 2) * flowSensorsCalRecord.flowSensors[ CAL_DATA_RO_PUMP_FLOW_SENSOR ].secondOrderCoeff + - flowTemp * flowSensorsCalRecord.flowSensors[ CAL_DATA_RO_PUMP_FLOW_SENSOR ].gain + - flowSensorsCalRecord.flowSensors[ CAL_DATA_RO_PUMP_FLOW_SENSOR ].offset; - - // If the flow is less than a certain value, FPGA will return 0xFFFF meaning that - // the flow is 0. - if ( FLOW_SENSOR_ZERO_READING == tempROFlowRemove ) - { - temporaryFlowValueRemove = 0.0; - } - - temporaryFlowVariableRemove = 0; - // TODO remove this code after testing } #ifndef IGNORE_RO_PUMP_MONITOR @@ -870,8 +834,6 @@ pumpData.roPumpDutyCycle = roPumpDutyCyclePctSet * FRACTION_TO_PERCENT_FACTOR; pumpData.roPumpState = (U32)roPumpState; - pumpData.roPumpTemporaryFlowRateRemove = temporaryFlowValueRemove; - broadcastROPumpData( &pumpData ); roPumpDataPublicationTimerCounter = 0; } Index: firmware/App/Controllers/ROPump.h =================================================================== diff -u -r2468e56fbecd26da713bc78535bd727f4b105fe1 -r752defbb739ea0756a8bf060f00bc6b9429c2764 --- firmware/App/Controllers/ROPump.h (.../ROPump.h) (revision 2468e56fbecd26da713bc78535bd727f4b105fe1) +++ firmware/App/Controllers/ROPump.h (.../ROPump.h) (revision 752defbb739ea0756a8bf060f00bc6b9429c2764) @@ -42,8 +42,6 @@ F32 roPumpDutyCycle; ///< RO pump duty cycle. U32 roPumpState; ///< RO pump current state. F32 roPumpTgtFlowRate; ///< RO pump target flow rate. - - F32 roPumpTemporaryFlowRateRemove; } RO_PUMP_DATA_T; // ********** public function prototypes ********** Index: firmware/App/Services/FPGA.c =================================================================== diff -u -r2468e56fbecd26da713bc78535bd727f4b105fe1 -r752defbb739ea0756a8bf060f00bc6b9429c2764 --- firmware/App/Services/FPGA.c (.../FPGA.c) (revision 2468e56fbecd26da713bc78535bd727f4b105fe1) +++ firmware/App/Services/FPGA.c (.../FPGA.c) (revision 752defbb739ea0756a8bf060f00bc6b9429c2764) @@ -1936,9 +1936,4 @@ return ( fpgaSensorReadings.fpgaGPIO & CONCENTRATE_CAP_SWITCH_MASK ); } -U16 getFPGAFMPTemporaryFlow( void ) -{ - return fpgaSensorReadings.fpgaFMPROFlowTemporary; -} - /**@}*/ Index: firmware/App/Services/FPGA.h =================================================================== diff -u -r2468e56fbecd26da713bc78535bd727f4b105fe1 -r752defbb739ea0756a8bf060f00bc6b9429c2764 --- firmware/App/Services/FPGA.h (.../FPGA.h) (revision 2468e56fbecd26da713bc78535bd727f4b105fe1) +++ firmware/App/Services/FPGA.h (.../FPGA.h) (revision 752defbb739ea0756a8bf060f00bc6b9429c2764) @@ -142,9 +142,6 @@ U08 getFPGADialysateCapStatus( void ); U08 getFPGAConcentrateCapStatus( void ); - -U16 getFPGAFMPTemporaryFlow( void ); - /**@}*/ #endif Index: firmware/App/Services/SystemComm.c =================================================================== diff -u -rb1a0571d530426aefd393d07dbaf7675cd0e4c02 -r752defbb739ea0756a8bf060f00bc6b9429c2764 --- firmware/App/Services/SystemComm.c (.../SystemComm.c) (revision b1a0571d530426aefd393d07dbaf7675cd0e4c02) +++ firmware/App/Services/SystemComm.c (.../SystemComm.c) (revision 752defbb739ea0756a8bf060f00bc6b9429c2764) @@ -1156,8 +1156,8 @@ handleTestMonitoredVoltageOverrideRequest( message ); break; - case MSG_ID_DRAIN_PUMP_SET_DELTA_PRESSURE_OVERRIDE: - handleSetDrainPumpDeltaPressureOverrideRequest( message ); + case MSG_ID_DRAIN_PUMP_TARGET_OUTLET_PRESSURE: + handleSetDrainPumpTargetOutletPressure( message ); break; case MSG_ID_DG_SWITCHES_STATUS_OVERRIDE: Index: firmware/App/Services/SystemCommMessages.c =================================================================== diff -u -rbd9f7ebe27d5fbdc893d04c9925f1990e873edfa -r752defbb739ea0756a8bf060f00bc6b9429c2764 --- firmware/App/Services/SystemCommMessages.c (.../SystemCommMessages.c) (revision bd9f7ebe27d5fbdc893d04c9925f1990e873edfa) +++ firmware/App/Services/SystemCommMessages.c (.../SystemCommMessages.c) (revision 752defbb739ea0756a8bf060f00bc6b9429c2764) @@ -778,7 +778,7 @@ result = TRUE; memcpy( &payload, message->payload, sizeof( TARGET_TEMPS_PAYLOAD_T ) ); setHeaterTargetTemperature( DG_PRIMARY_HEATER, payload.targetPrimaryHeaterTemp ); - setHeaterTargetTemperature( DG_TRIMMER_HEATER, payload.targetTrimmerHeaterTemp ); + //setHeaterTargetTemperature( DG_TRIMMER_HEATER, payload.targetTrimmerHeaterTemp ); // DEBUG_DENALI for treatment testing } sendAckResponseMsg( (MSG_ID_T)message->hdr.msgID, COMM_BUFFER_OUT_CAN_DG_2_HD, result ); } @@ -2309,14 +2309,14 @@ /************************************************************************* * @brief - * The handleSetDrainPumpDeltaPressureOverrideRequest function handles a - * request to override the delta pressure for the drain pump. + * The handleSetDrainPumpTargetOutletPressure function handles a + * request to set the drain pump outlet pressure. * @details Inputs: none * @details Outputs: message handled * @param message a pointer to the message to handle * @return none *************************************************************************/ -void handleSetDrainPumpDeltaPressureOverrideRequest( MESSAGE_T *message ) +void handleSetDrainPumpTargetOutletPressure( MESSAGE_T *message ) { BOOL result = 0; Index: firmware/App/Services/SystemCommMessages.h =================================================================== diff -u -r2468e56fbecd26da713bc78535bd727f4b105fe1 -r752defbb739ea0756a8bf060f00bc6b9429c2764 --- firmware/App/Services/SystemCommMessages.h (.../SystemCommMessages.h) (revision 2468e56fbecd26da713bc78535bd727f4b105fe1) +++ firmware/App/Services/SystemCommMessages.h (.../SystemCommMessages.h) (revision 752defbb739ea0756a8bf060f00bc6b9429c2764) @@ -268,7 +268,7 @@ void handleTestDGSafetyShutdownOverrideRequest( MESSAGE_T *message ); // MSG_ID_DRAIN_PUMP_SET_DELTA_PRESSURE_OVERRIDE -void handleSetDrainPumpDeltaPressureOverrideRequest( MESSAGE_T *message ); +void handleSetDrainPumpTargetOutletPressure( MESSAGE_T *message ); // MSG_ID_DG_SWITCHES_STATUS_OVERRIDE void handleSetSwitchesStatusOverrideRequest( MESSAGE_T *message );