Index: firmware/App/Controllers/ConcentratePumps.c =================================================================== diff -u -reae0635792a827b7cf9197cf6f6e253f2a094260 -r0b121a7c92a8d86f8369b7094b0bce21389f3747 --- firmware/App/Controllers/ConcentratePumps.c (.../ConcentratePumps.c) (revision eae0635792a827b7cf9197cf6f6e253f2a094260) +++ firmware/App/Controllers/ConcentratePumps.c (.../ConcentratePumps.c) (revision 0b121a7c92a8d86f8369b7094b0bce21389f3747) @@ -1039,13 +1039,13 @@ // If pump is running, stop it w/ park option if ( TRUE == concentratePumps[ pumpId ].hasTurnOnPumpsBeenRequested ) { - requestConcentratePumpOff( pumpId, TRUE ); + requestConcentratePumpOff( (CONCENTRATE_PUMPS_T)pumpId, TRUE ); } // If pump is already stopped, just send park command else { concentratePumps[ pumpId ].hasParkBeenRequested = TRUE; - stopConcentratePump( pumpId ); + stopConcentratePump( (CONCENTRATE_PUMPS_T)pumpId ); } } Index: firmware/App/Modes/ModeFill.c =================================================================== diff -u -reae0635792a827b7cf9197cf6f6e253f2a094260 -r0b121a7c92a8d86f8369b7094b0bce21389f3747 --- firmware/App/Modes/ModeFill.c (.../ModeFill.c) (revision eae0635792a827b7cf9197cf6f6e253f2a094260) +++ firmware/App/Modes/ModeFill.c (.../ModeFill.c) (revision 0b121a7c92a8d86f8369b7094b0bce21389f3747) @@ -739,11 +739,12 @@ DG_FILL_MODE_STATE_T result = DG_FILL_MODE_STATE_DELIVER_DIALYSATE; DG_RESERVOIR_ID_T inactiveRsrvr = getInactiveReservoir(); F32 acidConductivity = getConductivityValue( CONDUCTIVITYSENSORS_CD1_SENSOR ); - F32 bicarbConductivity = getConductivityValue( CONDUCTIVITYSENSORS_CD2_SENSOR ); // TODO the systems team will let us know when we can use TD2 in DVT. Until then it is disabled - F32 inletTemperature = getTemperatureValue( (U32)TEMPSENSORS_OUTLET_PRIMARY_HEATER ); //getTemperatureValue( (U32)TEMPSENSORS_CONDUCTIVITY_SENSOR_2 ); + F32 bicarbConductivity = getConductivityValue( CONDUCTIVITYSENSORS_CD2_SENSOR ); + F32 inletTemperature = getTemperatureValue( (U32)TEMPSENSORS_CONDUCTIVITY_SENSOR_2 ); #ifndef _RELEASE_ - if ( HW_CONFIG_BETA == getHardwareConfigStatus() ) + if ( ( HW_CONFIG_BETA == getHardwareConfigStatus() ) || + ( SW_CONFIG_ENABLE_VALUE == getSoftwareConfigStatus( SW_CONFIG_ENABLE_USING_TPO_FOR_PRIMARY_HEATER_CONTROL ) ) ) { inletTemperature = getTemperatureValue( (U32)TEMPSENSORS_OUTLET_PRIMARY_HEATER ); } Index: firmware/App/Modes/ModeFlush.c =================================================================== diff -u -reae0635792a827b7cf9197cf6f6e253f2a094260 -r0b121a7c92a8d86f8369b7094b0bce21389f3747 --- firmware/App/Modes/ModeFlush.c (.../ModeFlush.c) (revision eae0635792a827b7cf9197cf6f6e253f2a094260) +++ firmware/App/Modes/ModeFlush.c (.../ModeFlush.c) (revision 0b121a7c92a8d86f8369b7094b0bce21389f3747) @@ -444,7 +444,7 @@ turnOnUVReactor( OUTLET_UV_REACTOR ); flushUIState = FLUSH_UI_STATE_FLUSH_RECIRCULATION_PATH; - state = DG_FLUSH_STATE_FLUSH_CIRCULATION_DRAIN_LINE; + state = DG_FLUSH_STATE_FLUSH_CIRCULATION_DRAIN_LINE; } stateTimerStart = getMSTimerCount(); @@ -479,8 +479,7 @@ turnOnUVReactor( OUTLET_UV_REACTOR ); stateTimerStart = getMSTimerCount(); - - state = DG_FLUSH_STATE_FLUSH_DIALYSATE; + state = DG_FLUSH_STATE_FLUSH_DIALYSATE; } return state; @@ -742,7 +741,7 @@ writeDisinfectDataToNV( USAGE_INFO_FILTER_FLUSH ); F32 waterFlowRate = getMeasuredFlowRateLPM( RO_FLOW_SENSOR ); - F32 waterVolume = ( ( waterFlowRate / SEC_PER_MIN ) / ( MS_PER_SECOND / TASK_GENERAL_INTERVAL ) ); + F32 waterVolume = ( ( waterFlowRate / SEC_PER_MIN ) / ( MS_PER_SECOND / TASK_GENERAL_INTERVAL ) ); // Integrate volume of water moved through line flushLinesVolumeL += waterVolume; @@ -758,14 +757,12 @@ setROPumpTargetFlowRateLPM( RO_PUMP_TARGET_FLOW_RATE_LPM, RO_PUMP_MAX_PRESSURE_PSI ); stateTimerStart = getMSTimerCount(); - - state = DG_FLUSH_STATE_FLUSH_CIRCULATION; + state = DG_FLUSH_STATE_FLUSH_CIRCULATION; } else if ( TRUE == didTimeout( stateTimerStart, FLUSH_DRAIN_LINE_TIMEOUT_MS ) ) { alarmDetectedPendingTrigger = ALARM_ID_DG_DRAIN_CIRCULATION_LINE_TIMEOUT; - // Could not reach to the defined drain line on time - state = DG_FLUSH_STATE_CANCEL_BASIC_PATH; + state = DG_FLUSH_STATE_CANCEL_WATER_PATH; } return state; @@ -791,8 +788,7 @@ setValveState( VDR, VALVE_STATE_DRAIN_C_TO_NO ); stateTimerStart = getMSTimerCount(); - - state = DG_FLUSH_STATE_FLUSH_WITH_FRESH_WATER; + state = DG_FLUSH_STATE_FLUSH_WITH_FRESH_WATER; } return state; Index: firmware/App/Modes/ModeHeatDisinfect.c =================================================================== diff -u -r73c6b6fb7bbb934277157ce1e218358c573a6af1 -r0b121a7c92a8d86f8369b7094b0bce21389f3747 --- firmware/App/Modes/ModeHeatDisinfect.c (.../ModeHeatDisinfect.c) (revision 73c6b6fb7bbb934277157ce1e218358c573a6af1) +++ firmware/App/Modes/ModeHeatDisinfect.c (.../ModeHeatDisinfect.c) (revision 0b121a7c92a8d86f8369b7094b0bce21389f3747) @@ -102,13 +102,6 @@ #define HEAT_DISINFECT_MAX_TEMP_GRADIENT_C 15.0F ///< Heat disinfect maximum allowed temperature gradient in between hottest and coldest sensors. #define HEAT_DISINFECT_TEMP_GRAD_OUT_RANGE_TIME_MS ( 0.16 * SEC_PER_MIN * MS_PER_SECOND ) ///< Heat disinfect temperature gradient out of range timeout in milliseconds. -// Cool down RO filter -#define THD_REACH_BELOW_45_AFTER_CIRC_TIME_MS ( 5 * MS_PER_SECOND ) ///< Number of circulations that are needed to make the RO filter is below 45 C. -#define ROF_COOL_DOWN_TARGET_FLOW_LPM 0.3F ///< RO filter cool down target flow in L/min. -#define ROF_COOL_DOWN_CIRCULATION_TIME_MS ( 2 * SEC_PER_MIN * MS_PER_SECOND ) ///< RO filter cool down circulation timer in milliseconds. -#define ROF_COOL_DOWN_MAX_TIME_MS ( 4 * MIN_PER_HOUR * SEC_PER_MIN * MS_PER_SECOND ) ///< RO filter cool down maximum state time in milliseconds. -#define TARGET_THD_SENSOR_FOR_RINSING_C 44.0F ///< Target THd temperature sensor value before rinsing in C. - // Mix drain R1 and R2 #define RSRVRS_MIX_DRAIN_TIMEOUT_MS ( 5 * SEC_PER_MIN * MS_PER_SECOND ) ///< Reservoirs 1 & 2 mix drain timeout in ms. #define DRAIN_PUMP_START_TIME_IN_MIX_DRAIN_MS ( 5 * MS_PER_SECOND ) ///< Time to start the drain pump at mix drain after directing the flow to drain in ms. @@ -171,7 +164,6 @@ static U32 rsrvrFillStableTimeCounter; ///< Reservoirs fill stable time counter. static ALARM_ID_T alarmDetectedPendingTrigger; ///< Heat disinfect alarm to raise. static BOOL isDrainPumpInMixDrainOn; ///< Flag to indicate the drain pump is on during mix drain. -static U32 ROFCoolingTimer; ///< RO filter cooling timer. static U32 targetDisinfectTime; ///< Target disinfect time. static BOOL haveDrainParamsBeenInit[ NUM_OF_DG_RESERVOIRS ]; ///< Boolean flag to indicate whether the drain parameters have been reset or not. static U32 tempGradOutOfRangeTimer; ///< Temperature gradient out of range start timer. @@ -193,7 +185,6 @@ static DG_HEAT_DISINFECT_STATE_T handleHeatDisinfectFillR2WithHotWaterState( void ); static DG_HEAT_DISINFECT_STATE_T handleHeatDisinfectDisinfectR2ToR1State( void ); static DG_HEAT_DISINFECT_STATE_T handleHeatDisinfectCoolDownHeatersState( void ); -static DG_HEAT_DISINFECT_STATE_T handleHeatDisinfectCoolDownROFilterState( void ); static DG_HEAT_DISINFECT_STATE_T handleHeatDisinfectMixDrainR1State( void ); static DG_HEAT_DISINFECT_STATE_T handleHeatDisinfectMixDrainR2State( void ); static DG_HEAT_DISINFECT_STATE_T handleHeatDisinfectCancelModeBasicPathState( void ); @@ -241,7 +232,6 @@ rsrvrFillStableTimeCounter = 0; isPartialDisinfectInProgress = FALSE; isDrainPumpInMixDrainOn = FALSE; - ROFCoolingTimer = 0; concentratePumpsPrimeTimer = 0; targetDisinfectTime = 0; haveDrainParamsBeenInit[ DG_RESERVOIR_1 ] = FALSE; @@ -284,6 +274,7 @@ *************************************************************************/ U32 execHeatDisinfectMode( void ) { + // The inlet pressure shall be checked all the time as long as VPi is open checkInletWaterPressure(); if ( heatDisinfectState != DG_HEAT_DISINFECT_STATE_FLUSH_DRAIN ) @@ -354,10 +345,6 @@ heatDisinfectState = handleHeatDisinfectCoolDownHeatersState(); break; - case DG_HEAT_DISINFECT_STATE_COOL_DOWN_RO_FILTER: - heatDisinfectState = handleHeatDisinfectCoolDownROFilterState(); - break; - case DG_HEAT_DISINFECT_STATE_MIX_DRAIN_R1: heatDisinfectState = handleHeatDisinfectMixDrainR1State(); break; @@ -1242,75 +1229,17 @@ setValveState( VDR, VALVE_STATE_RECIRC_C_TO_NC ); setValveState( VRC, VALVE_STATE_RECIRC_C_TO_NC ); setValveState( VPO, VALVE_STATE_NOFILL_C_TO_NO ); - setROPumpTargetFlowRateLPM( ROF_COOL_DOWN_TARGET_FLOW_LPM, HEAT_DISINFECT_MAX_RO_PRESSURE_PSI ); + //setROPumpTargetFlowRateLPM( ROF_COOL_DOWN_TARGET_FLOW_LPM, HEAT_DISINFECT_MAX_RO_PRESSURE_PSI ); - ROFCoolingTimer = 0; - stateTimer = getMSTimerCount(); - state = DG_HEAT_DISINFECT_STATE_COOL_DOWN_RO_FILTER; + stateTimer = getMSTimerCount(); + state = DG_HEAT_DISINFECT_STATE_COMPLETE; } return state; } /*********************************************************************//** * @brief - * The handleHeatDisinfectCoolDownROFilterState function handles the heat - * disinfect cool down RO filter state. The state monitors the temperature - * at THd and if it is less than 45 C, it transitions to the next state. - * @details Inputs: stateTimer, ROFCoolingTimer - * @details Outputs: stateTimer, ROFcoolingTimer, heatDisinfectUIState - * @return next state of the heat disinfect state machine - *************************************************************************/ -static DG_HEAT_DISINFECT_STATE_T handleHeatDisinfectCoolDownROFilterState( void ) -{ - DG_HEAT_DISINFECT_STATE_T state = DG_HEAT_DISINFECT_STATE_COOL_DOWN_RO_FILTER; - // THd is the closet sensor to the RO filter and this temperature is monitored - // until it is dropped below 45 C to be able to run fluid through the RO filter - F32 THdTemp = getTemperatureValue( TEMPSENSORS_HEAT_DISINFECT ); - - // Set the heat disinfect UI state - heatDisinfectUIState = HEAT_DISINFECT_UI_STATE_COOL_DOWN_DEVICE; - - if ( ( 0 == ROFCoolingTimer ) && ( THdTemp < TARGET_THD_SENSOR_FOR_RINSING_C ) ) - { - // Temperature is below target - perform mandatory cool down - ROFCoolingTimer = getMSTimerCount(); - } - else if ( THdTemp >= TARGET_THD_SENSOR_FOR_RINSING_C ) - { - // Temperature is not below target - reset the timer and keep looking - ROFCoolingTimer = 0; - } - - if ( ( 0 != ROFCoolingTimer ) && ( TRUE == didTimeout( ROFCoolingTimer, ROF_COOL_DOWN_CIRCULATION_TIME_MS ) ) ) - { - // Temperature is below target, transition to next state - setValveState( VPI, VALVE_STATE_OPEN ); - setValveState( VBF, VALVE_STATE_CLOSED ); - setValveState( VPO, VALVE_STATE_FILL_C_TO_NC ); - setValveState( VRC, VALVE_STATE_RECIRC_C_TO_NC ); - setValveState( VDR, VALVE_STATE_DRAIN_C_TO_NO ); - setValveState( VRO, VALVE_STATE_R1_C_TO_NO ); - setValveState( VRI, VALVE_STATE_R1_C_TO_NO ); - setValveState( VRF, VALVE_STATE_R2_C_TO_NO ); - signalROPumpHardStop(); - - rsrvr1Status = DG_RESERVOIR_ABOVE_TARGET; - stateTimer = getMSTimerCount(); - state = DG_HEAT_DISINFECT_STATE_MIX_DRAIN_R1; - } - else if ( ( TRUE == didTimeout( stateTimer, ROF_COOL_DOWN_MAX_TIME_MS ) ) ) - { - prevHeatDisinfectState = state; - alarmDetectedPendingTrigger = ALARM_ID_DG_HEAT_DISINFECT_TARGET_TEMP_TIMEOUT; // TODO - cool down alarm? - state = DG_HEAT_DISINFECT_STATE_CANCEL_WATER_PATH; - } - - return state; -} - -/*********************************************************************//** - * @brief * The handleHeatDisinfectMixDrainR1State function handles the heat * disinfect mix drain R1 state. The state drains reservoir 1 and if it * times out, it transitions to basic cancellation state. Otherwise, it Index: firmware/App/Modes/ModeHeatDisinfectActiveCool.c =================================================================== diff -u -r73c6b6fb7bbb934277157ce1e218358c573a6af1 -r0b121a7c92a8d86f8369b7094b0bce21389f3747 --- firmware/App/Modes/ModeHeatDisinfectActiveCool.c (.../ModeHeatDisinfectActiveCool.c) (revision 73c6b6fb7bbb934277157ce1e218358c573a6af1) +++ firmware/App/Modes/ModeHeatDisinfectActiveCool.c (.../ModeHeatDisinfectActiveCool.c) (revision 0b121a7c92a8d86f8369b7094b0bce21389f3747) @@ -5,6 +5,7 @@ #include "ModeHeatDisinfectActiveCool.h" #include "OperationModes.h" #include "ROPump.h" +#include "Switches.h" #include "TaskGeneral.h" #include "TemperatureSensors.h" #include "Timers.h" @@ -36,10 +37,12 @@ static DG_HEAT_DISINFECT_ACTIVE_COOL_STATE_T handleHeatDisinfectActiveCoolStartState( void ); static DG_HEAT_DISINFECT_ACTIVE_COOL_STATE_T handleHeatDisinfectActiveCoolCoolDownROFilterState( void ); +static DG_HEAT_DISINFECT_ACTIVE_COOL_STATE_T handleHeatDisinfectActiveCoolCompleteState( void ); static DG_HEAT_DISINFECT_ACTIVE_COOL_STATE_T handleHeatDisinfectActiveCoolCancelBasicPathState( void ); static void failHeatDisinfectActiveCool( void ); static void publishHeatDisinfectActiveCoolData( void ); +static void monitorModeHeatDisinfectActiveCool( void ); /*********************************************************************//** * @brief @@ -92,7 +95,7 @@ U32 execHeatDisinfectActiveCoolMode( void ) { // TODO the inlet water check? - // TODO check the caps to be closed + monitorModeHeatDisinfectActiveCool(); switch( heatDisinfectActiveCoolState ) { @@ -109,6 +112,7 @@ break; case DG_HEAT_DISINFECT_ACTIVE_COOL_STATE_COMPLETE: + heatDisinfectActiveCoolState = handleHeatDisinfectActiveCoolCompleteState(); break; default: @@ -252,6 +256,23 @@ /*********************************************************************//** * @brief + * The handleHeatDisinfectActiveCoolCompleteState function handles the + * heat disinfect active cool complete state. + * @details Inputs: none + * @details Outputs: none + * @return next state of the heat disinfect active cool state machine + *************************************************************************/ +static DG_HEAT_DISINFECT_ACTIVE_COOL_STATE_T handleHeatDisinfectActiveCoolCompleteState( void ) +{ + DG_HEAT_DISINFECT_ACTIVE_COOL_STATE_T state = DG_HEAT_DISINFECT_ACTIVE_COOL_STATE_COMPLETE; + + stopDGHeatDisinfectActiveCool(); + + return state; +} + +/*********************************************************************//** + * @brief * The handleHeatDisinfectActiveCoolCancelBasicPathState function handles the * heat disinfect active cool cancel mode basic path state. The state sets * the state to complete and raises an alarm. @@ -312,5 +333,33 @@ } } +/*********************************************************************//** + * @brief + * The monitorModeHeatDisinfectActiveCool function monitors the status of + * the caps and sets the state of the state machine to water cancellation + * path if the caps are not closed during the run. + * @details Inputs: none + * @details Outputs: heatDisinfectActiceCoolPrevState, + * heatDisinfectActiceCoolPrevState, alarmDetectedPendingTrigger + * @return: none + *************************************************************************/ +static void monitorModeHeatDisinfectActiveCool( void ) +{ +#ifndef _RELEASE_ + if ( getSoftwareConfigStatus( SW_CONFIG_DISABLE_CAPS_MONITOR ) != SW_CONFIG_ENABLE_VALUE ) +#endif + { + if ( ( STATE_OPEN == getSwitchStatus( CONCENTRATE_CAP ) ) || ( STATE_OPEN == getSwitchStatus( DIALYSATE_CAP ) ) ) + { + // Set the variables to fail and go to cancel water path. Set the pending alarm to no alarm so the cancel water path + // will not be raising the alarm at end of the cancel water path. The recoverable alarm is raised here in this function + U32 cap = (U32)( STATE_OPEN == getSwitchStatus( CONCENTRATE_CAP ) ? CONCENTRATE_CAP : DIALYSATE_CAP ); + heatDisinfectActiceCoolPrevState = heatDisinfectActiveCoolState; + heatDisinfectActiveCoolState = DG_HEAT_DISINFECT_ACTIVE_COOL_STATE_CANCEL_BASIC_PATH; + alarmDetectedPendingTrigger = ALARM_ID_DG_DIALYSATE_OR_CONC_CAP_NOT_IN_PROPER_POSITION; + } + } +} + /**@}*/ Index: firmware/App/Modes/ModeStandby.c =================================================================== diff -u -r1e34d32fcfac88792ed72e55953dee721bacd9d5 -r0b121a7c92a8d86f8369b7094b0bce21389f3747 --- firmware/App/Modes/ModeStandby.c (.../ModeStandby.c) (revision 1e34d32fcfac88792ed72e55953dee721bacd9d5) +++ firmware/App/Modes/ModeStandby.c (.../ModeStandby.c) (revision 0b121a7c92a8d86f8369b7094b0bce21389f3747) @@ -61,6 +61,7 @@ static BOOL pendingStartDGFlushRequest; ///< Flag indicating HD has requested DG start flush. static BOOL pendingStartDGHeatDisinfectRequest; ///< Flag indicating HD has requested DG start heat disinfect. static BOOL pendingStartDGChemicalDisinfectRequest; ///< Flag indicating HD has requested DG start chemical disinfect. +static BOOL pendingStartDGHeatDisinfectActiveCoolRequest; ///< Flag indicating HD has requested DG start heat disinfect active cool. static OVERRIDE_U32_T filterFlushTimePeriod = { FILTER_FLUSH_TIME_MS, FILTER_FLUSH_TIME_MS, 0, 0 }; ///< Filter flush time period in ms. @@ -78,23 +79,25 @@ * @details Inputs: none * @details Outputs: standbyState, stopSampleWaterRequest, startSampleWaterRequest, * flushFilterRequest, endSampleWaterRequest, waterSampleStartTime, - * filterFlushStartTime, filterFlushPublishTimerCounter, pendingStartDGRequest + * filterFlushStartTime, filterFlushPublishTimerCounter, pendingStartDGRequest, + * pendingStartDGHeatDisinfectActiveCoolRequest * @return none *************************************************************************/ void initStandbyMode( void ) { - standbyState = DG_STANDBY_MODE_STATE_IDLE; - stopSampleWaterRequest = FALSE; - startSampleWaterRequest = FALSE; - flushFilterRequest = FALSE; - endSampleWaterRequest = FALSE; - waterSampleStartTime = 0; - filterFlushStartTime = 0; - filterFlushPublishTimerCounter = 0; - pendingStartDGRequest = FALSE; - pendingStartDGFlushRequest = FALSE; - pendingStartDGHeatDisinfectRequest = FALSE; - pendingStartDGChemicalDisinfectRequest = FALSE; + standbyState = DG_STANDBY_MODE_STATE_IDLE; + stopSampleWaterRequest = FALSE; + startSampleWaterRequest = FALSE; + flushFilterRequest = FALSE; + endSampleWaterRequest = FALSE; + waterSampleStartTime = 0; + filterFlushStartTime = 0; + filterFlushPublishTimerCounter = 0; + pendingStartDGRequest = FALSE; + pendingStartDGFlushRequest = FALSE; + pendingStartDGHeatDisinfectRequest = FALSE; + pendingStartDGChemicalDisinfectRequest = FALSE; + pendingStartDGHeatDisinfectActiveCoolRequest = FALSE; // Reset the heaters efficiency for another treatment resetHeatersEstimationGain(); @@ -215,7 +218,13 @@ requestNewOperationMode( DG_MODE_CHEM ); } + else if ( TRUE == pendingStartDGHeatDisinfectActiveCoolRequest ) + { + pendingStartDGHeatDisinfectActiveCoolRequest = FALSE; + requestNewOperationMode( DG_MODE_HCOL ); + } + return state; } @@ -520,6 +529,66 @@ /*********************************************************************//** * @brief + * The startDGHeatDisinfectActiveCool function starts heat disinfect active + * cool mode. + * @details Inputs: standbyState + * @details Outputs: none + * @return: TRUE if the switch was successful + *************************************************************************/ +BOOL startDGHeatDisinfectActiveCool( void ) +{ + BOOL status = FALSE; + + // If DG is in standby mode and the standby mode is in Idle state or if DG is in solo mode, request DG heat disinfect + if ( ( DG_MODE_STAN == getCurrentOperationMode() ) && ( DG_STANDBY_MODE_STATE_IDLE == standbyState ) || ( DG_MODE_SOLO == getCurrentOperationMode() ) ) + { + DG_CMD_RESPONSE_T cmdResponse; + DG_USAGE_INFO_RECORD_T usageInfo; + + getNVRecord2Driver( GET_USAGE_RECORD, (U08*)&usageInfo, sizeof( DG_USAGE_INFO_RECORD_T ), 0, ALARM_ID_NO_ALARM ); + + cmdResponse.commandID = DG_CMD_START_HEAT_DISINFECT; + cmdResponse.rejected = FALSE; + cmdResponse.rejectCode = DG_CMD_REQUEST_REJECT_REASON_NONE; + OPN_CLS_STATE_T concCap = getSwitchStatus( CONCENTRATE_CAP ); + OPN_CLS_STATE_T diaCap = getSwitchStatus( DIALYSATE_CAP ); + +#ifndef _RELEASE_ + if ( SW_CONFIG_ENABLE_VALUE == getSoftwareConfigStatus( SW_CONFIG_DISABLE_CAPS_MONITOR ) ) + { + concCap = STATE_CLOSED; + diaCap = STATE_CLOSED; + // Using the caps switch to disable the chemical disinfect date checks + usageInfo.lastChemDisFlushCompleteDateEpoch = 40; + usageInfo.lastChemDisCompleteDateEpoch = 32; + } +#endif + + if ( ( STATE_OPEN == concCap ) || ( STATE_OPEN == diaCap ) ) + { + cmdResponse.rejected = TRUE; + cmdResponse.rejectCode = ( STATE_OPEN == getSwitchStatus( DIALYSATE_CAP ) ? REQUEST_REJECT_REASON_DG_DIALYSATE_CAP_OPEN : + REQUEST_REJECT_REASON_DG_CONCENTRATE_CAP_OPEN ); + } + else if ( usageInfo.lastChemDisFlushCompleteDateEpoch < usageInfo.lastChemDisCompleteDateEpoch ) + { + cmdResponse.rejected = TRUE; + cmdResponse.rejectCode = REQUEST_REJECT_REASON_DG_CHEM_FLUSH_NOT_COMPLETED; + } + else + { + pendingStartDGHeatDisinfectActiveCoolRequest = TRUE; + status = TRUE; + } + + sendCommandResponseMsg( &cmdResponse ); + } + + return status; +} + +/*********************************************************************//** + * @brief * The startDGChemicalDisinfect function starts chemical disinfect mode. * @details Inputs: standbyState * @details Outputs: none Index: firmware/App/Modes/ModeStandby.h =================================================================== diff -u -r025612ad77fe630889a364586de54bffe5262d56 -r0b121a7c92a8d86f8369b7094b0bce21389f3747 --- firmware/App/Modes/ModeStandby.h (.../ModeStandby.h) (revision 025612ad77fe630889a364586de54bffe5262d56) +++ firmware/App/Modes/ModeStandby.h (.../ModeStandby.h) (revision 0b121a7c92a8d86f8369b7094b0bce21389f3747) @@ -50,6 +50,7 @@ BOOL startDGFlush( void ); // HD start flush mode BOOL startDGHeatDisinfect( void ); // HD start heat disinfect mode +BOOL startDGHeatDisinfectActiveCool( void ); DG_STANDBY_MODE_STATE_T getCurrentStandbyState( void ); // get the current state of the standby mode. BOOL testSetFilterFlushTimePeriodOverride( U32 value ); Index: firmware/App/Services/Reservoirs.c =================================================================== diff -u -r1e34d32fcfac88792ed72e55953dee721bacd9d5 -r0b121a7c92a8d86f8369b7094b0bce21389f3747 --- firmware/App/Services/Reservoirs.c (.../Reservoirs.c) (revision 1e34d32fcfac88792ed72e55953dee721bacd9d5) +++ firmware/App/Services/Reservoirs.c (.../Reservoirs.c) (revision 0b121a7c92a8d86f8369b7094b0bce21389f3747) @@ -19,6 +19,7 @@ #include "ConcentratePumps.h" #include "DrainPump.h" +#include "FPGA.h" #include "Heaters.h" #include "LoadCell.h" #include "MessageSupport.h" @@ -680,11 +681,22 @@ if ( targetROFlowLPM > 0 ) { - F32 acidTemperature = acidConcentrateCalRecord.acidConcentrate[ CAL_DATA_ACID_CONCENTRATE_1 ].acidBottleTemperature; - F32 bicarbTemperature = bicarbConcentrateCalRecord.bicarbConcentrate[ CAL_DATA_BICARB_CONCENTRATE_1 ].bicarbBottleTemperature; - - priTargetTemp = ( tempTarget * ( tgtTotalFlowLPM / targetROFlowLPM ) ) - ( acidTemperature * ( tgtAicdFlowLPM / targetROFlowLPM ) ) - - ( bicarbTemperature * ( tgtBicarbFlowLPM / targetROFlowLPM ) ); +#ifndef _RELEASE_ + if ( ( HW_CONFIG_BETA == getHardwareConfigStatus() ) || + ( SW_CONFIG_ENABLE_VALUE == getSoftwareConfigStatus( SW_CONFIG_ENABLE_USING_TPO_FOR_PRIMARY_HEATER_CONTROL ) ) ) + { + // In the later DVT units, TD2 is used for setting the primary heater target temperature. But in the older DVTs as well as the Beta units + // the target temperature is calculated by estimating the temperature of the dialysates and volume that is being mixed into the RO water + F32 acidTemperature = acidConcentrateCalRecord.acidConcentrate[ CAL_DATA_ACID_CONCENTRATE_1 ].acidBottleTemperature; + F32 bicarbTemperature = bicarbConcentrateCalRecord.bicarbConcentrate[ CAL_DATA_BICARB_CONCENTRATE_1 ].bicarbBottleTemperature; + priTargetTemp = ( tempTarget * ( tgtTotalFlowLPM / targetROFlowLPM ) ) - ( acidTemperature * ( tgtAicdFlowLPM / targetROFlowLPM ) ) - + ( bicarbTemperature * ( tgtBicarbFlowLPM / targetROFlowLPM ) ); + } + else +#endif + { + priTargetTemp = tempTarget; + } } return priTargetTemp; Index: firmware/App/Services/SystemComm.c =================================================================== diff -u -reae0635792a827b7cf9197cf6f6e253f2a094260 -r0b121a7c92a8d86f8369b7094b0bce21389f3747 --- firmware/App/Services/SystemComm.c (.../SystemComm.c) (revision eae0635792a827b7cf9197cf6f6e253f2a094260) +++ firmware/App/Services/SystemComm.c (.../SystemComm.c) (revision 0b121a7c92a8d86f8369b7094b0bce21389f3747) @@ -905,6 +905,10 @@ handleSetDGServiceTime( message ); break; + case MSG_ID_DG_START_STOP_HEAT_DISINFECT_ACTIVE_COOL: + handleStartStopDGHeatDisinfectActiveCool( message ); + break; + // NOTE: This case must be last case MSG_ID_DG_TESTER_LOGIN_REQUEST: handleTesterLogInRequest( message ); @@ -1232,6 +1236,10 @@ handleTestDGConcPumpParkCommandRequest( message ); break; + case MSG_ID_DG_NV_RECORD_CRC_OVERRIDE: + handleTestDGNVRecordCRCOverride( message ); + break; + default: // TODO - unrecognized message ID received - ignore break; Index: firmware/App/Services/SystemCommMessages.c =================================================================== diff -u -reae0635792a827b7cf9197cf6f6e253f2a094260 -r0b121a7c92a8d86f8369b7094b0bce21389f3747 --- firmware/App/Services/SystemCommMessages.c (.../SystemCommMessages.c) (revision eae0635792a827b7cf9197cf6f6e253f2a094260) +++ firmware/App/Services/SystemCommMessages.c (.../SystemCommMessages.c) (revision 0b121a7c92a8d86f8369b7094b0bce21389f3747) @@ -27,9 +27,12 @@ #include "FlowSensors.h" #include "FPGA.h" #include "Heaters.h" +#include "ModeChemicalDisinfect.h" #include "ModeFill.h" #include "ModeFlush.h" #include "ModeGenIdle.h" +#include "ModeHeatDisinfect.h" +#include "ModeHeatDisinfectActiveCool.h" #include "ModeInitPOST.h" #include "ModeStandby.h" #include "MsgQueues.h" @@ -1557,7 +1560,39 @@ sendAckResponseMsg( (MSG_ID_T)message->hdr.msgID, COMM_BUFFER_OUT_CAN_DG_2_UI, result ); } +/************************************************************************* + * @brief + * The handleStartStopDGHeatDisinfectActiveCool function handles a request + * start or stop DG heat disinfect active cool mode. + * @details Inputs: none + * @details Outputs: message handled + * @param message: a pointer to the message to handle + * @return result + *************************************************************************/ +void handleStartStopDGHeatDisinfectActiveCool( MESSAGE_T* message ) +{ + BOOL status = FALSE; + if ( message->hdr.payloadLen == sizeof(U32) ) + { + BOOL startingDGHeatDisinfectActiveCool; + + memcpy( &startingDGHeatDisinfectActiveCool, message->payload, sizeof(U32) ); + + if ( TRUE == startingDGHeatDisinfectActiveCool ) + { + status = startDGHeatDisinfectActiveCool(); + } + else + { + status = stopDGHeatDisinfectActiveCool(); + } + } + + sendAckResponseMsg( (MSG_ID_T)message->hdr.msgID, COMM_BUFFER_OUT_CAN_DG_2_HD, status ); +} + + // *********************************************************************** // **************** Message Handling Helper Functions ******************** // *********************************************************************** Index: firmware/App/Services/SystemCommMessages.h =================================================================== diff -u -reae0635792a827b7cf9197cf6f6e253f2a094260 -r0b121a7c92a8d86f8369b7094b0bce21389f3747 --- firmware/App/Services/SystemCommMessages.h (.../SystemCommMessages.h) (revision eae0635792a827b7cf9197cf6f6e253f2a094260) +++ firmware/App/Services/SystemCommMessages.h (.../SystemCommMessages.h) (revision 0b121a7c92a8d86f8369b7094b0bce21389f3747) @@ -25,9 +25,6 @@ #include "FluidLeak.h" #include "LoadCell.h" #include "MessageSupport.h" -#include "ModeChemicalDisinfect.h" -#include "ModeFlush.h" -#include "ModeHeatDisinfect.h" #include "MsgQueues.h" #include "NVDataMgmt.h" #include "Reservoirs.h" @@ -166,6 +163,9 @@ // MSG_ID_DG_SET_SERVICE_TIME void handleSetDGServiceTime( MESSAGE_T *message ); +// MSG_ID_DG_START_STOP_HEAT_DISINFECT_ACTIVE_COOL +void handleStartStopDGHeatDisinfectActiveCool( MESSAGE_T* message ); + // *********** public test support message functions ********** // MSG_TESTER_LOG_IN