Index: firmware/App/Modes/ModeStandby.c =================================================================== diff -u -r4fb1e15d35f6b968bab5620909c30baec98bfd4e -rf7c714a1a09b10d85a8b013712532d37b4d7b97a --- firmware/App/Modes/ModeStandby.c (.../ModeStandby.c) (revision 4fb1e15d35f6b968bab5620909c30baec98bfd4e) +++ firmware/App/Modes/ModeStandby.c (.../ModeStandby.c) (revision f7c714a1a09b10d85a8b013712532d37b4d7b97a) @@ -17,25 +17,20 @@ //#include "ConcentratePumps.h" //#include "ConductivitySensors.h" -//#include "CPLD.h" -//#include "DrainPump.h" //#include "Heaters.h" -//#include "ModeChemicalDisinfect.h" #include "ModeFault.h" //#include "ModeHeatDisinfect.h" #include "ModeStandby.h" +#include "MessageSupport.h" +#include "Messaging.h" //#include "NVDataMgmt.h" #include "OperationModes.h" //#include "Pressures.h" -//#include "Reservoirs.h" //#include "ROPump.h" -//#include "RTC.h" #include "SystemCommDD.h" -#include "Messaging.h" #include "TaskGeneral.h" -#include "MessageSupport.h" //#include "Timers.h" -//#include "Valves.h" +#include "Valves.h" /** * @addtogroup DDStandbyMode @@ -51,25 +46,23 @@ // ********** private data ********** -static DD_STANDBY_MODE_STATE_T standbyState; ///< Currently active standby state. -//static BOOL stopSampleWaterRequest; ///< Flag indicating HD has requested to stop sample water -//static BOOL startSampleWaterRequest; ///< Flag indicating HD has requested to start sample water -//static BOOL flushFilterRequest; ///< Flag indicating HD has requested to flush filters -//static BOOL endSampleWaterRequest; ///< Flag indicating HD has requested to end sample water -// -//static BOOL pendingStartDGRequest; ///< Flag indicating HD has requested DD start (go to generation idle mode). +static DD_STANDBY_MODE_STATE_T standbyState; ///< Currently active standby state. +//static BOOL stopSampleWaterRequest; ///< Flag indicating TD has requested to stop sample water +//static BOOL startSampleWaterRequest; ///< Flag indicating TD has requested to start sample water +//static BOOL flushFilterRequest; ///< Flag indicating TD has requested to flush filters +//static BOOL endSampleWaterRequest; ///< Flag indicating TD has requested to end sample water + +//static BOOL pendingStartDDRequest; ///< Flag indicating TD has requested DD start (go to generation idle mode). //static U32 waterSampleStartTime; ///< Time stamp for start of water sample state. //static U32 filterFlushStartTime; ///< Time stamp for start of filter flush state. //static U32 filterFlushPublishTimerCounter; ///< Filter flush data publish timer counter. -//static BOOL pendingStartDGFlushRequest; ///< Flag indicating HD has requested DD start flush. -//static BOOL pendingStartDGHeatDisinfectRequest; ///< Flag indicating HD has requested DD start heat disinfect. -//static BOOL pendingStartDGChemicalDisinfectRequest; ///< Flag indicating HD has requested DD start chemical disinfect. -//static BOOL pendingStartDGHeatDisinfectActiveCoolRequest; ///< Flag indicating HD has requested DD start heat disinfect active cool. -//static BOOL pendingStartDGChemicalDisinfectFlushRequest; ///< Flag indicating HD has requested DD start chemical disinfect flush. -//static BOOL pendingStartDGROPermeateSampleRequest; ///< Flag indicating HD has requested DD start RO permeate sample. +//static BOOL pendingStartDDFlushRequest; ///< Flag indicating TD has requested DD start flush. +//static BOOL pendingStartDDHeatDisinfectRequest; ///< Flag indicating TD has requested DD start heat disinfect. +//static BOOL pendingStartDDHeatDisinfectActiveCoolRequest; ///< Flag indicating TD has requested DD start heat disinfect active cool. +//static BOOL pendingStartDDROPermeateSampleRequest; ///< Flag indicating TD has requested DD start RO permeate sample. static OVERRIDE_U32_T filterFlushTimePeriod = { FILTER_FLUSH_TIME_MS, - FILTER_FLUSH_TIME_MS, 0, 0 }; ///< Filter flush time period in ms. + FILTER_FLUSH_TIME_MS, 0, 0 }; ///< Filter flush time period in ms. // ********** private function prototypes ********** @@ -83,13 +76,9 @@ /*********************************************************************//** * @brief - * The initStandbyMode function initializes the standby mode module. + * The initStandbyMode function initializes the standby mode unit. * @details \b Inputs: none - * @details \b Outputs: standbyState, stopSampleWaterRequest, startSampleWaterRequest, - * flushFilterRequest, endSampleWaterRequest, waterSampleStartTime, - * filterFlushStartTime, filterFlushPublishTimerCounter, pendingStartDGRequest, - * pendingStartDGHeatDisinfectActiveCoolRequest, - * pendingStartDGROPermeateSampleRequest + * @details \b Outputs:unit variables initialized. * @return none *************************************************************************/ void initStandbyMode( void ) @@ -102,12 +91,11 @@ // waterSampleStartTime = 0; // filterFlushStartTime = 0; // filterFlushPublishTimerCounter = 0; -// pendingStartDGRequest = FALSE; -// pendingStartDGFlushRequest = FALSE; -// pendingStartDGHeatDisinfectRequest = FALSE; -// pendingStartDGChemicalDisinfectRequest = FALSE; -// pendingStartDGHeatDisinfectActiveCoolRequest = FALSE; -// pendingStartDGROPermeateSampleRequest = FALSE; +// pendingStartDDRequest = FALSE; +// pendingStartDDFlushRequest = FALSE; +// pendingStartDDHeatDisinfectRequest = FALSE; +// pendingStartDDHeatDisinfectActiveCoolRequest = FALSE; +// pendingStartDDROPermeateSampleRequest = FALSE; // Reset the heaters efficiency for another treatment //resetHeatersEstimationGain(); @@ -130,7 +118,6 @@ // deenergizeActuators( PARK_CONC_PUMPS ); // -// setCPLDCleanLEDColor( CPLD_CLEAN_LED_OFF ); // // // Upon transition to mode standby set CD1 and CD2 calibration records to be picked to the normal // // table. If the chemical disinfect fails, the mode transitions back to mode standby. @@ -142,16 +129,12 @@ // setChemNelsonSupportMode( NELSON_NONE ); //#endif // -// // Initialize the reservoirs parameters for another treatment. -// // This is to make sure the boolean flag for the first fill is set to TRUE. -// initReservoirs(); - - // Send DG usage data to HD + // Send DD usage data to TD // The message ID will not be put here because the messages list script will pick this up for another send command // The only important item is the payload length that must be 0 for the handler // usageMsg.hdr.msgID = 0; // usageMsg.hdr.payloadLen = 0; - //handleHDRequestDGUsageInfo( &usageMsg ); + //handleTDRequestDDUsageInfo( &usageMsg ); return standbyState; } @@ -220,82 +203,72 @@ // checkInletWaterConductivity(); // checkInletWaterTemperature(); // checkInletWaterPressure(); -// -// status |= isAlarmConditionActive( ALARM_ID_DG_INLET_WATER_CONDUCTIVITY_IN_LOW_RANGE ); -// status |= isAlarmConditionActive( ALARM_ID_DG_INLET_WATER_CONDUCTIVITY_IN_HIGH_RANGE ); -// status |= isAlarmConditionActive( ALARM_ID_DG_INLET_WATER_TEMPERATURE_IN_HIGH_RANGE ); -// status |= isAlarmConditionActive( ALARM_ID_DG_INLET_WATER_TEMPERATURE_IN_LOW_RANGE ); -// status |= isAlarmConditionActive( ALARM_ID_DG_OUTLET_PRIMARY_CONDUCTIVITY_OUT_OF_RANGE ); -// status |= isAlarmConditionActive( ALARM_ID_DG_INLET_WATER_PRESSURE_IN_HIGH_RANGE ); -// status |= isAlarmConditionActive( ALARM_ID_DG_INLET_WATER_PRESSURE_IN_LOW_RANGE ); +// status |= isAlarmConditionActive( ALARM_ID_DD_INLET_WATER_CONDUCTIVITY_IN_LOW_RANGE ); +// status |= isAlarmConditionActive( ALARM_ID_DD_INLET_WATER_CONDUCTIVITY_IN_HIGH_RANGE ); +// status |= isAlarmConditionActive( ALARM_ID_DD_INLET_WATER_TEMPERATURE_IN_HIGH_RANGE ); +// status |= isAlarmConditionActive( ALARM_ID_DD_INLET_WATER_TEMPERATURE_IN_LOW_RANGE ); +// status |= isAlarmConditionActive( ALARM_ID_DD_OUTLET_PRIMARY_CONDUCTIVITY_OUT_OF_RANGE ); +// status |= isAlarmConditionActive( ALARM_ID_DD_INLET_WATER_PRESSURE_IN_HIGH_RANGE ); +// status |= isAlarmConditionActive( ALARM_ID_DD_INLET_WATER_PRESSURE_IN_LOW_RANGE ); + return status; } /*********************************************************************//** * @brief * The handleStandbyIdleState function executes the idle state of the * standby mode state machine. - * @details \b Inputs: pendingSampleWaterRequest, pendingStartDGRequest, - * pendingStartDGFlushRequest, pendingStartDGHeatDisinfectRequest, - * pendingStartDGChemicalDisinfectRequest + * @details \b Inputs: pendingSampleWaterRequest, pendingStartDDRequest, + * pendingStartDDFlushRequest, pendingStartDDHeatDisinfectRequest, + * pendingStartDDChemicalDisinfectRequest * @details \b Outputs: Idle state of the standby mode executed, - * pendingStartDGFlushRequest, pendingStartDGHeatDisinfectRequest, - * pendingStartDGChemicalDisinfectRequest + * pendingStartDDFlushRequest, pendingStartDDHeatDisinfectRequest, + * pendingStartDDChemicalDisinfectRequest * @return the next state *************************************************************************/ static DD_STANDBY_MODE_STATE_T handleStandbyIdleState( void ) { DD_STANDBY_MODE_STATE_T state = DD_STANDBY_MODE_STATE_IDLE; - // go to standby solo mode if HD is turned off or stops communicating. + // go to standby solo mode if TD is turned off or stops communicating. if ( FALSE == isTDCommunicating() ) - { // TODO if HD comm loss, should we wait an hour or so before going to solo standby? - //requestNewOperationMode( DG_MODE_SOLO ); + { // TODO if TD comm loss, should we wait an hour or so before going to solo standby? + //requestNewOperationMode( DD_MODE_SOLO ); } - // if HD requests water sample, go to water sample state + // if TD requests water sample, go to water sample state // else if ( TRUE == flushFilterRequest ) // { // setValveState( VPI, VALVE_STATE_OPEN ); // flushFilterRequest = FALSE; // filterFlushStartTime = getMSTimerCount(); // state = DD_STANDBY_MODE_STATE_FLUSH_FILTER; // } -// else if ( TRUE == pendingStartDGRequest ) +// else if ( TRUE == pendingStartDDRequest ) // { -// pendingStartDGRequest = FALSE; +// pendingStartDDRequest = FALSE; // signalSyncToHD(); // requestNewOperationMode( DD_MODE_GENE ); // } -// else if ( TRUE == pendingStartDGFlushRequest ) +// else if ( TRUE == pendingStartDDFlushRequest ) // { -// pendingStartDGFlushRequest = FALSE; -// requestNewOperationMode( DG_MODE_FLUS ); +// pendingStartDDFlushRequest = FALSE; +// requestNewOperationMode( DD_MODE_FLUS ); // } -// else if ( TRUE == pendingStartDGHeatDisinfectRequest ) +// else if ( TRUE == pendingStartDDHeatDisinfectRequest ) // { -// pendingStartDGHeatDisinfectRequest = FALSE; +// pendingStartDDHeatDisinfectRequest = FALSE; // requestNewOperationMode( DD_MODE_HEAT ); // } -// else if ( TRUE == pendingStartDGChemicalDisinfectRequest ) +// else if ( TRUE == pendingStartDDHeatDisinfectActiveCoolRequest ) // { -// pendingStartDGChemicalDisinfectRequest = FALSE; -// requestNewOperationMode( DD_MODE_CHEM ); -// } -// else if ( TRUE == pendingStartDGHeatDisinfectActiveCoolRequest ) -// { -// pendingStartDGHeatDisinfectActiveCoolRequest = FALSE; +// pendingStartDDHeatDisinfectActiveCoolRequest = FALSE; // // requestNewOperationMode( DD_MODE_HCOL ); // } -// else if ( TRUE == pendingStartDGChemicalDisinfectFlushRequest ) +// else if ( TRUE == pendingStartDDROPermeateSampleRequest ) // { -// pendingStartDGChemicalDisinfectFlushRequest = FALSE; -// requestNewOperationMode( DD_MODE_CHFL ); -// } -// else if ( TRUE == pendingStartDGROPermeateSampleRequest ) -// { -// pendingStartDGROPermeateSampleRequest = FALSE; +// pendingStartDDROPermeateSampleRequest = FALSE; // requestNewOperationMode( DD_MODE_ROPS ); // } @@ -387,7 +360,7 @@ { DD_STANDBY_MODE_STATE_T state = DD_STANDBY_MODE_STATE_SAMPLE_WATER; -// // After HD requests to stop or 10 seconds has elapsed, close and return to idle state +// // After TD requests to stop or 10 seconds has elapsed, close and return to idle state // if ( ( TRUE == stopSampleWaterRequest ) || ( TRUE == didTimeout( waterSampleStartTime, MAX_WATER_SAMPLE_TIME_MS ) ) ) // { // stopSampleWaterRequest = FALSE; @@ -421,7 +394,7 @@ /*********************************************************************//** * @brief - * The requestWaterSample function handles an HD request to sample water. + * The requestWaterSample function handles an TD request to sample water. * @details \b Inputs: standbyState * @details \b Outputs: pendingSampleWaterRequest * @return TRUE if request accepted, FALSE if not. @@ -482,7 +455,7 @@ /*********************************************************************//** * @brief - * The requestDDStart function handles an HD request to start (go to generation idle mode). + * The requestDDStart function handles an TD request to start (go to generation idle mode). * @details \b Inputs: standbyState * @details \b Outputs: pendingSampleWaterRequest * @return TRUE if request accepted, FALSE if not. @@ -494,7 +467,7 @@ if ( DD_STANDBY_MODE_STATE_IDLE == standbyState ) { result = TRUE; - //pendingStartDGRequest = TRUE; + //pendingStartDDRequest = TRUE; // Reset the volume accumulator for the next run // resetROGenerateVolumeL(); @@ -505,7 +478,7 @@ /*********************************************************************//** * @brief - * The signalAbortWaterSampling function handles an HD request to abort water + * The signalAbortWaterSampling function handles an TD request to abort water * sampling (return to standby idle state). * @details \b Inputs: none * @details \b Outputs: standby mode variable initialized @@ -709,107 +682,6 @@ /*********************************************************************//** * @brief - * The startDDChemicalDisinfect function starts chemical disinfect mode. - * @details \b Inputs: standbyState - * @details \b Outputs: none - * @return: TRUE if the switch was successful - *************************************************************************/ -BOOL startDDChemicalDisinfect( void ) -{ - BOOL status = FALSE; - -// // If DD is in standby mode and the standby mode is in Idle, request chemical disinfect -// // Chemical disinfect cannot be run in solo mode because the user has to confirm that the acid is inserted or removed -// if ( ( DD_MODE_STAN == getCurrentOperationMode() ) && ( DD_STANDBY_MODE_STATE_IDLE == standbyState ) ) -// { -// DD_CMD_RESPONSE_T cmdResponse; -// -// cmdResponse.commandID = DD_CMD_START_CHEM_DISINFECT; -// cmdResponse.rejected = FALSE; -// cmdResponse.rejectCode = DD_CMD_REQUEST_REJECT_REASON_NONE; -// OPN_CLS_STATE_T diaCap = getSwitchStatus( DIALYSATE_CAP ); -// -//#ifndef _RELEASE_ -// if ( SW_CONFIG_ENABLE_VALUE == getSoftwareConfigStatus( SW_CONFIG_DISABLE_CAPS_MONITOR ) ) -// { -// diaCap = STATE_CLOSED; -// } -//#endif -// -// // When chemical disinfect is about to be started, dialysate caps must be closed -// if ( STATE_OPEN == diaCap ) -// { -// cmdResponse.rejected = TRUE; -// cmdResponse.rejectCode = REQUEST_REJECT_REASON_DD_DIALYSATE_CAP_OPEN; -// } -// else -// { -// pendingStartDDChemicalDisinfectRequest = TRUE; -// status = TRUE; -// } -// -// sendCommandResponseMsg( &cmdResponse ); -// } - - return status; -} - -/*********************************************************************//** - * @brief - * The startDDChemicalDisinfectFlush function starts chemical disinfect flush mode. - * @details \b Inputs: standbyState - * @details \b Outputs: none - * @return: TRUE if the switch was successful - *************************************************************************/ -BOOL startDDChemicalDisinfectFlush( void ) -{ - BOOL status = FALSE; -// DD_CMD_RESPONSE_T cmdResponse; -// -// cmdResponse.commandID = DD_CMD_START_CHEM_DISINFECT_FLUSH; -// cmdResponse.rejected = FALSE; -// cmdResponse.rejectCode = DD_CMD_REQUEST_REJECT_REASON_NONE; -// -// // If DD is in standby mode and the standby mode is in Idle, request chemical disinfect flush -// // Chemical disinfect flush cannot be run in solo mode because the user has to confirm that the acid is inserted or removed -// if ( ( DD_MODE_STAN == getCurrentOperationMode() ) && ( DD_STANDBY_MODE_STATE_IDLE == standbyState ) ) -// { -// 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; -// } -//#endif -// -// if ( ( STATE_OPEN == concCap ) || ( STATE_OPEN == diaCap ) ) -// { -// cmdResponse.rejected = TRUE; -// cmdResponse.rejectCode = ( STATE_OPEN == getSwitchStatus( DIALYSATE_CAP ) ? REQUEST_REJECT_REASON_DD_DIALYSATE_CAP_OPEN : -// REQUEST_REJECT_REASON_DD_CONCENTRATE_CAP_OPEN ); -// } -// else -// { -// pendingStartDDChemicalDisinfectFlushRequest = TRUE; -// status = TRUE; -// } -// } -// else -// { -// cmdResponse.rejected = TRUE; -// cmdResponse.rejectCode = REQUEST_REJECT_REASON_DD_NOT_IN_STANDBY_IDLE_STATE; -// } -// -// sendCommandResponseMsg( &cmdResponse ); - - return status; -} - -/*********************************************************************//** - * @brief * The startDDROPermeateSample function starts RO permeate sample mode. * @details \b Inputs: standbyState * @details \b Outputs: pendingStartDDChemicalDisinfectFlushRequest