Index: firmware/App/Controllers/ConcentratePumps.c =================================================================== diff -u -rac305d5eedc7fb0e85adef5cd4aa34e58e94e3b8 -rfab0257d4913c021698418277e742c2a61e0368e --- firmware/App/Controllers/ConcentratePumps.c (.../ConcentratePumps.c) (revision ac305d5eedc7fb0e85adef5cd4aa34e58e94e3b8) +++ firmware/App/Controllers/ConcentratePumps.c (.../ConcentratePumps.c) (revision fab0257d4913c021698418277e742c2a61e0368e) @@ -40,7 +40,7 @@ #define CONCENTRATE_PUMP_SPEED_INCREMENT 2.0F ///< Speed increase (mL/min) when controlling concentrate pump to target step speed. #define CONCENTRATE_PUMP_MIN_SPEED 3.0F ///< Minimum speed for concentrate pump in mL per min. #define CONCENTRATE_PUMP_SPD_OUT_OF_RANGE_TOL_WHEN_ON_PCT 0.02F ///< Concentrate pump speed out of range tolerance when on in percentage. -#define CONCENTRATE_PUMP_SPD_OUT_OF_RANGE_TOL_WHEN_OFF_MLPM 1.0F ///< Concentrate pump speed out of range tolerance when off in mL/min. +#define CONCENTRATE_PUMP_SPD_OUT_OF_RANGE_TOL_WHEN_SLOW_MLPM 1.0F ///< Concentrate pump speed out of range tolerance when slow in mL/min. #define CONCENTRATE_PUMP_LOW_SPEED_THRESHOLD_MLPM 10.0F ///< Concentrate pump low speed threshold in mL/min. #define CONCENTRATE_PUMP_ZERO_FLOW_RATE 0xFFFF ///< Pulse width value when zero flow rate or pump is off. @@ -858,7 +858,7 @@ F32 cpTargetSpeed = concentratePumps[ pumpId ].currentPumpSpeed; F32 cpError = fabs( getMeasuredPumpSpeed( pumpId ) - cpTargetSpeed ); BOOL isCpSpeedOut = FALSE; - F32 tolerance = CONCENTRATE_PUMP_SPD_OUT_OF_RANGE_TOL_WHEN_OFF_MLPM; + F32 tolerance = CONCENTRATE_PUMP_SPD_OUT_OF_RANGE_TOL_WHEN_SLOW_MLPM; if ( ( cpTargetSpeed > NEARLY_ZERO ) && ( cpTargetSpeed > CONCENTRATE_PUMP_LOW_SPEED_THRESHOLD_MLPM ) ) { Index: firmware/App/Controllers/DrainPump.c =================================================================== diff -u -rc7ea3969643ead419cbfcd34c3cb203c45bcad71 -rfab0257d4913c021698418277e742c2a61e0368e --- firmware/App/Controllers/DrainPump.c (.../DrainPump.c) (revision c7ea3969643ead419cbfcd34c3cb203c45bcad71) +++ firmware/App/Controllers/DrainPump.c (.../DrainPump.c) (revision fab0257d4913c021698418277e742c2a61e0368e) @@ -363,11 +363,11 @@ { case DRAIN_PUMP_OFF_STATE: { - BOOL isRPMTooHigh = FALSE; - isOffCurrentOut = ( currentA > DRAIN_PUMP_MAX_CURRENT_WHEN_OFF_A ? TRUE : FALSE ); + BOOL isRPMTooHigh = FALSE; - 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 ); + isOffCurrentOut = ( currentA > DRAIN_PUMP_MAX_CURRENT_WHEN_OFF_A ? TRUE : FALSE ); + 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_MAXON_SNSR_FB ), MAX_ALLOWED_OPEN_LOOP_RPM_OUT_OF_RANGE ); checkPersistentAlarm( ALARM_ID_DG_DRAIN_PUMP_OFF_FAULT, isRPMTooHigh, getDrainPumpMeasuredRPM( DRAIN_PUMP_MAXON_SNSR_FB ), MIN_DRAIN_PUMP_RPM ); Index: firmware/App/Controllers/ROPump.c =================================================================== diff -u -r8822f86705a24d1c7dd305b584a95ae3d3c406b8 -rfab0257d4913c021698418277e742c2a61e0368e --- firmware/App/Controllers/ROPump.c (.../ROPump.c) (revision 8822f86705a24d1c7dd305b584a95ae3d3c406b8) +++ firmware/App/Controllers/ROPump.c (.../ROPump.c) (revision fab0257d4913c021698418277e742c2a61e0368e) @@ -387,12 +387,12 @@ // 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 ); BOOL isPressureMax = ( actualPressure >= MAX_ALLOWED_MEASURED_PRESSURE_PSI ? TRUE : FALSE ); - BOOL isDutyCylceOutOfRange = FALSE; + BOOL isDutyCycleOutOfRange = 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). roPumpFeedbackDutyCyclePct.data = 1.0F - ( roFeedbackVoltage / ROP_FEEDBACK_0_PCT_DUTY_CYCLE_VOLTAGE ); - isDutyCylceOutOfRange = ( fabs( getROFeedbackDutyCycle() - roPumpDutyCyclePctSet ) > ROP_DUTY_CYCLE_OUT_OF_RANGE_TOLERANCE ? TRUE : FALSE ); + isDutyCycleOutOfRange = ( fabs( getROFeedbackDutyCycle() - roPumpDutyCyclePctSet ) > ROP_DUTY_CYCLE_OUT_OF_RANGE_TOLERANCE ? TRUE : FALSE ); checkPersistentAlarm( ALARM_ID_DG_RO_PUMP_PRESSURE_OUT_OF_RANGE, isPressureMax, actualPressure, MAX_ALLOWED_MEASURED_PRESSURE_PSI ); @@ -466,7 +466,7 @@ if ( getHardwareConfigStatus() != HW_CONFIG_BETA ) #endif { - checkPersistentAlarm( ALARM_ID_DG_RO_PUMP_DUTY_CYCLE_OUT_OF_RANGE, isDutyCylceOutOfRange, getROFeedbackDutyCycle(), roPumpDutyCyclePctSet ); + checkPersistentAlarm( ALARM_ID_DG_RO_PUMP_DUTY_CYCLE_OUT_OF_RANGE, isDutyCycleOutOfRange, getROFeedbackDutyCycle(), roPumpDutyCyclePctSet ); // Check if it the alarm has timed out and if the pump is supposed to be off but it is still on, activate the safety shutdown if ( ( TRUE == isAlarmActive( ALARM_ID_DG_RO_PUMP_DUTY_CYCLE_OUT_OF_RANGE ) ) && ( FALSE == isROPumpOn ) ) Index: firmware/App/Modes/ModeFill.c =================================================================== diff -u -r2e0a2f81470474f4767e19f76c538542b84a5d86 -rfab0257d4913c021698418277e742c2a61e0368e --- firmware/App/Modes/ModeFill.c (.../ModeFill.c) (revision 2e0a2f81470474f4767e19f76c538542b84a5d86) +++ firmware/App/Modes/ModeFill.c (.../ModeFill.c) (revision fab0257d4913c021698418277e742c2a61e0368e) @@ -586,8 +586,8 @@ * The handleTestInletWaterState function tests for inlet water quality * and if this is the first fill of a treatment, prime the acid and bicarb * lines before jumping to dialysate production state. - * @details Inputs: Temperature, pressure, and conductivity alarms - * @details Outputs: request acid and bicarb pumps on + * @details Inputs: none + * @details Outputs: none * @return the next state *************************************************************************/ static DG_FILL_MODE_STATE_T handleTestInletWaterState( void ) @@ -614,7 +614,7 @@ * @brief * The handlePrimeConcentrateLinesState function primes the acid and bicarb * lines. - * @details Inputs: None + * @details Inputs: concentratePrimingStartTime * @details Outputs: None * @return the next state *************************************************************************/ @@ -993,16 +993,21 @@ * @brief * The setModeFillStateTransition function sets the actuators and variables * for the state transition in mode fill. - * @details Inputs: none - * @details Outputs: concPumpPrimeStartTimeMS, fillStatus + * @details Inputs: pumpSpeedIndex, havePauseActuatorsBeenSet + * @details Outputs: concPumpPrimeStartTimeMS, fillStatus, pumpSpeedIndex, + * concentratePrimingStartTime, totalBicarbConductivity, averageBicarbConductivity, + * bicarbConductivitySampleCount, concentrateTestStartTime, fillStatus, + * havePauseActuatorsBeenSet, flushBubblesStartTime * @param state mode fill state enum * @return none *************************************************************************/ static void setModeFillStateTransition( DG_FILL_MODE_STATE_T state ) { switch( state ) { + case DG_FILL_MODE_STATE_START: case DG_FILL_MODE_STATE_TEST_INLET_WATER: + // Do nothing break; case DG_FILL_MODE_STATE_PRIME_CONCENTRATE_LINES: @@ -1028,7 +1033,6 @@ case DG_FILL_MODE_STATE_TEST_BICARB_CONDUCTIVITY: // Set pumps flow rate to prepare for bicarb conductivity testing setROPumpTargetFlowRateLPM( RO_PUMP_800_ML_PER_MIN / MILLILITERS_PER_LITER, TARGET_RO_PRESSURE_PSI ); - setConcentratePumpTargetSpeed( CONCENTRATEPUMPS_CP2_BICARB, BICARB_PUMP_40_ML_PER_MIN ); requestConcentratePumpOn( CONCENTRATEPUMPS_CP2_BICARB ); @@ -1084,7 +1088,7 @@ break; default: - // Do nothing. Prime state out of range is controlled in the exec function + SET_ALARM_WITH_2_U32_DATA( ALARM_ID_DG_SOFTWARE_FAULT, SW_FAULT_ID_FILL_MODE_INVALID_EXEC_STATE, state ) break; } } Index: firmware/App/Modes/ModeROPermeateSample.c =================================================================== diff -u -rac305d5eedc7fb0e85adef5cd4aa34e58e94e3b8 -rfab0257d4913c021698418277e742c2a61e0368e --- firmware/App/Modes/ModeROPermeateSample.c (.../ModeROPermeateSample.c) (revision ac305d5eedc7fb0e85adef5cd4aa34e58e94e3b8) +++ firmware/App/Modes/ModeROPermeateSample.c (.../ModeROPermeateSample.c) (revision fab0257d4913c021698418277e742c2a61e0368e) @@ -496,7 +496,7 @@ dispenseMessageStatus = DISPENSE_MSG_READY; roPermeateSampledispensedVolumeML = 0.0F; setROPermeateSampleStateTransition( state ); - handleSendROPermeateSampleDispenseReadyToHD(); // TODO should we send this multiple times until confirmation? + sendROPermeateSampleDispenseReadyToHD(); // TODO should we send this multiple times until confirmation? } } } @@ -703,6 +703,10 @@ { switch( state ) { + case DG_RO_PERM_SAMPLE_STATE_START: + // Do nothing + break; + case DG_RO_PERM_SAMPLE_STATE_DRAIN_R1: // Valves setValveState( VPI, VALVE_STATE_CLOSED ); @@ -912,12 +916,19 @@ break; case DISPENSE_MSG_DISPENSING: + // Do nothing + break; + default: - // Do nothing. In these states, we do not need to do anything with actuators + SET_ALARM_WITH_2_U32_DATA( ALARM_ID_DG_SOFTWARE_FAULT, SW_FAULT_ID_DG_RO_PERMEATE_SAMPLE_INVALID_MESSAGE, dispenseMessageStatus ) break; } break; + case DG_RO_PERM_SAMPLE_STATE_CANCEL_BASIC_PATH: + // Do nothing + break; + case DG_RO_PERM_SAMPLE_STATE_CANCEL_WATER_PATH: // Prepare to start draining reservoir 2 first // Valves @@ -954,7 +965,7 @@ break; default: - // Do nothing + SET_ALARM_WITH_2_U32_DATA( ALARM_ID_DG_SOFTWARE_FAULT, SW_FAULT_ID_DG_RO_PERMEATE_SAMPLE_INVALID_EXEC_STATE, state ) break; } } Index: firmware/App/Modes/ModeStandby.c =================================================================== diff -u -r992975fb3cd56ddd7567b5e27f8bebd9b9948e9d -rfab0257d4913c021698418277e742c2a61e0368e --- firmware/App/Modes/ModeStandby.c (.../ModeStandby.c) (revision 992975fb3cd56ddd7567b5e27f8bebd9b9948e9d) +++ firmware/App/Modes/ModeStandby.c (.../ModeStandby.c) (revision fab0257d4913c021698418277e742c2a61e0368e) @@ -707,7 +707,7 @@ { cmdResponse.rejected = TRUE; cmdResponse.rejectCode = REQUEST_REJECT_REASON_DG_DIALYSATE_CAP_OPEN; - } + } else { pendingStartDGChemicalDisinfectRequest = TRUE; Index: firmware/App/Services/SystemCommMessages.c =================================================================== diff -u -r2e0a2f81470474f4767e19f76c538542b84a5d86 -rfab0257d4913c021698418277e742c2a61e0368e --- firmware/App/Services/SystemCommMessages.c (.../SystemCommMessages.c) (revision 2e0a2f81470474f4767e19f76c538542b84a5d86) +++ firmware/App/Services/SystemCommMessages.c (.../SystemCommMessages.c) (revision fab0257d4913c021698418277e742c2a61e0368e) @@ -1851,17 +1851,17 @@ /*********************************************************************//** * @brief - * The handleSendROPermeateSampleDispenseReadyToHD function handles sending + * The sendROPermeateSampleDispenseReadyToHD function handles sending * RO permeate sample dispense ready to HD * @details Inputs: none * @details Outputs: none * @return none *************************************************************************/ -void handleSendROPermeateSampleDispenseReadyToHD( void ) +void sendROPermeateSampleDispenseReadyToHD( void ) { MESSAGE_T msg; U08 *payloadPtr = msg.payload; - U32 dispenseReady = 1; + U32 dispenseReady = (U32)TRUE; // Create a message record blankMessage( &msg ); Index: firmware/App/Services/SystemCommMessages.h =================================================================== diff -u -r2e0a2f81470474f4767e19f76c538542b84a5d86 -rfab0257d4913c021698418277e742c2a61e0368e --- firmware/App/Services/SystemCommMessages.h (.../SystemCommMessages.h) (revision 2e0a2f81470474f4767e19f76c538542b84a5d86) +++ firmware/App/Services/SystemCommMessages.h (.../SystemCommMessages.h) (revision fab0257d4913c021698418277e742c2a61e0368e) @@ -189,7 +189,7 @@ void handleReceiveROPermeatSampleDispenseRequest( MESSAGE_T* message ); // MSG_ID_DG_SEND_RO_PERMEATE_SAMPLE_DISPENSE_READY_TO_HD -void handleSendROPermeateSampleDispenseReadyToHD( void ); +void sendROPermeateSampleDispenseReadyToHD( void ); // MSG_ID_HD_REQUEST_SERVICE_RECORD_FROM_HD void handleSendDGServiceRecordToHD( MESSAGE_T* message );