Index: firmware/App/Modes/ModeChemicalDisinfectFlush.c =================================================================== diff -u -rd8686d68bf29761ee329fc638264d2e60a5191c0 -re82ddb85a3b3a1fc5d591d8cca0d006597fd94cf --- firmware/App/Modes/ModeChemicalDisinfectFlush.c (.../ModeChemicalDisinfectFlush.c) (revision d8686d68bf29761ee329fc638264d2e60a5191c0) +++ firmware/App/Modes/ModeChemicalDisinfectFlush.c (.../ModeChemicalDisinfectFlush.c) (revision e82ddb85a3b3a1fc5d591d8cca0d006597fd94cf) @@ -23,7 +23,7 @@ #include "Heaters.h" #include "LoadCell.h" #include "MessageSupport.h" -#include "ModeChemicalDisinfect.h" +#include "ModeChemicalDisinfectFlush.h" #include "ModeFault.h" #include "ModeStandby.h" #include "NVDataMgmt.h" @@ -51,7 +51,7 @@ #define CHEM_DISINFECT_FLUSH_DATA_PUB_INTERVAL ( MS_PER_SECOND / TASK_GENERAL_INTERVAL ) ///< Mode chem disinfect data publish interval in counts. // Start state defines -#define MIN_INLET_PRESSURE_PSI 30.0F ///< Minimum water inlet pressure in psi. +#define MIN_INLET_PRESSURE_PSI 10.0F ///< Minimum water inlet pressure in psi. // Drain R1 & R2 states defines #define DRAIN_PUMP_TARGET_RPM 2400 ///< Drain pump target RPM during drain. @@ -62,22 +62,23 @@ // Flush drain path state defines #define FLUSH_DRAIN_WAIT_TIME_MS ( SEC_PER_MIN * MS_PER_SECOND ) ///< Flush Drain path wait time in milliseconds. #define MAX_ALLOWED_FLUSH_DRAIN_PERIODS 2 ///< Number of flush drain periods to wait for inlet water to come in range -#define MIN_INLET_TEMPERATURE_C 24.0F ///< Minimum water inlet temperature in C. TODO original temperature was 25 C +#define MIN_INLET_TEMPERATURE_C 10.0F ///< Minimum water inlet temperature in C. TODO original temperature was 25 C #define MAX_INLET_CONDUCTIVITY_US_PER_CM 2000.0F ///< Maximum water inlet conductivity in us/cm -#define MIN_INLET_CONDUCTIVITY_US_PER_CM 100.0F ///< Minimum water inlet conductivity in us/cm +#define MIN_INLET_CONDUCTIVITY_US_PER_CM 0.0F ///< Minimum water inlet conductivity in us/cm // Flush circulation path state defines #define RO_PUMP_TARGET_FLUSH_FILL_FLOW_RATE_LPM 0.8F ///< RO pump target flow rate during flush/fill in L/min. #define MAX_RO_PUMP_FLUSH_FILL_PRESSURE_PSI 130 ///< Maximum RO pump pressure during flush/fill states in psi. #define FLUSH_CICRCULATION_WAIT_TIME_MS ( 30 * MS_PER_SECOND ) ///< Flush/rinse circulation path wait time in milliseconds. // Flush and drain R1 and R2 -#define RSRVRS_FULL_VOL_ML 1850.0F ///< Reservoirs 1 & 2 full volume in mL. TODo original value was 1900 +#define RSRVRS_FULL_VOL_ML 1650.0F ///< Reservoirs 1 & 2 full volume in mL. TODo original value was 1900 #define RSRVRS_FULL_STABLE_TIME_COUNT ( ( 4 * MS_PER_SECOND ) / TASK_GENERAL_INTERVAL ) ///< Reservoirs 1 & 2 full stable time in counts. #define RSRVRS_FILL_UP_TIMEOUT_MS ( 5 * SEC_PER_MIN * MS_PER_SECOND ) ///< Reservoirs 1 & 2 full fill up timeout in ms. #define RSRVRS_FLUSH_DRAIN_TIMEOUT_MS ( 2 * SEC_PER_MIN * MS_PER_SECOND ) ///< Reservoirs 1 & 2 drain timeout in ms. #define FLUSH_ADDITIONAL_TIME_MS ( 38 * MS_PER_SECOND ) ///< Additional time to flush after reservoir full #define NUM_OF_RINSE_CYCLES 2 ///< Number of rinse cycles +#define CHEM_DISINFECT_FLUSH_TIME_MS ( 12 * SEC_PER_MIN * MS_PER_SECOND ) ///< Chemical disinfect flush time in ms. TODO: get the correct time for the mode #define CONC_PUMP_FLUSH_SPEED_ML_PER_MIN 40.0 ///< Concentrate pump speed for flush #define FLUSH_DISINFECTANT_LINE_WAIT_TIME_MS ( 2.5 * SEC_PER_MIN * MS_PER_SECOND ) ///< Time to flush disinfectant line in milliseconds. @@ -101,38 +102,38 @@ // ********** private data ********** -static DG_CHEM_DISINFECT_FLUSH_STATE_T chemDisinfectFlushState = DG_CHEM_DISINFECT_FLUSH_STATE_START; ///< Currently active chemical disinfect state. -static DG_CHEM_DISINFECT_FLUSH_STATE_T prevChemDisinfectFlushState = DG_CHEM_DISINFECT_FLUSH_STATE_START; ///< Previous active chemical disinfect flush state before alarm. -static DG_CHEM_DISINFECT_UI_STATE_T chemDisinfectFlushUIState = CHEM_DISINFECT_FLUSH_UI_STATE_NOT_RUNNING; ///< Currently active chemical disinfect UI state. -static U32 overallChemDisinfectFlushTimer = 0; ///< Chemical disinfect cycle total timer. -static U32 stateTimer = 0; ///< Chemical disinfect state timer to be used in different states. -static U32 stateTrialCounter = 0; ///< Chemical disinfect state trial counter to be used for retries in different states. -static BOOL areTempSensorsInRange = FALSE; ///< Chemical disinfect temperature sensors in/out range flag. +static DG_CHEM_DISINFECT_FLUSH_STATE_T chemDisinfectFlushState = DG_CHEM_DISINFECT_FLUSH_STATE_START; ///< Currently active chemical disinfect flush state. +static DG_CHEM_DISINFECT_FLUSH_STATE_T prevChemDisinfectFlushState = DG_CHEM_DISINFECT_FLUSH_STATE_START; ///< Previous active chemical disinfect flush state before alarm. +static DG_CHEM_DISINFECT_FLUSH_UI_STATE_T chemDisinfectFlushUIState = CHEM_DISINFECT_FLUSH_UI_STATE_NOT_RUNNING; ///< Currently active chemical disinfect flush UI state. +static U32 overallChemDisinfectFlushTimer = 0; ///< Chemical disinfect flush cycle total timer. +static U32 stateTimer = 0; ///< Chemical disinfect flush state timer to be used in different states. +static U32 stateTrialCounter = 0; ///< Chemical disinfect flush state trial counter to be used for retries in different states. +static BOOL areTempSensorsInRange = FALSE; ///< Chemical disinfect flush temperature sensors in/out range flag. static BOOL haveInletWaterChecksPassed = TRUE; ///< Inlet water pressure, temperature, and pressure in range flag /// Boolean flag to check whether draining R1 and R2 is at the end of the chemical disinfect flush cycle or in the beginning. So the drain states can be reused. static BOOL isThisLastDrain = FALSE; static DG_RESERVOIR_STATUS_T rsrvr1Status = NUM_OF_DG_RESERVOIR_STATUS; ///< Reservoir 1 status. static DG_RESERVOIR_STATUS_T rsrvr2Status = NUM_OF_DG_RESERVOIR_STATUS; ///< Reservoir 2 status. -static F32 R1ChemDisinfectFlushVol = 0.0; ///< Reservoir 1 full volume during chemical disinfect. -static F32 R2ChemDisinfectFlushVol = 0.0; ///< Reservoir 2 full volume during chemical disinfect. -static U32 chemDisinfectFlushTimer = 0; ///< Chemical disinfect timer. +static F32 R1ChemDisinfectFlushVol = 0.0; ///< Reservoir 1 full volume during chemical disinfect flush. +static F32 R2ChemDisinfectFlushVol = 0.0; ///< Reservoir 2 full volume during chemical disinfect flush. +static U32 chemDisinfectFlushTimer = 0; ///< Chemical disinfect flush timer. static U32 rinseCycleCounter = 0; ///< Counter for rinse fill and drain cycles -static U32 rsrvrsVolMonitorTimer = 0; ///< Reservoir 1 & 2 volume monitor timers during chemical disinfect. -static BOOL areRsrvrsLeaking = FALSE; ///< Reservoir 1 & 2 leak check flag during chemical disinfect. -static U32 dataPublishCounter = 0; ///< Chemical Disinfect data publish counter. +static U32 rsrvrsVolMonitorTimer = 0; ///< Reservoir 1 & 2 volume monitor timers during chemical disinfect flush. +static BOOL areRsrvrsLeaking = FALSE; ///< Reservoir 1 & 2 leak check flag during chemical disinfect flush. +static U32 dataPublishCounter = 0; ///< Chemical disinfect flush data publish counter. static CANCELLATION_MODE_T cancellationMode = CANCELLATION_MODE_NONE; ///< Cancellation mode. static U32 rsrvrFillStableTimeCounter; ///< Reservoirs fill stable time counter. -static ALARM_ID_T alarmDetectedPendingTrigger; ///< Chemical disinfect alarm to raise. -static U32 numberOfPostDisinfectRinses; ///< Number of times to rinse the fluid path after chemical disinfect. +static ALARM_ID_T alarmDetectedPendingTrigger; ///< Chemical disinfect flush alarm to raise. +static U32 numberOfPostDisinfectRinses; ///< Number of times to rinse the fluid path after chemical disinfect flush. static BOOL haveDrainParamsBeenInit[ NUM_OF_DG_RESERVOIRS ]; ///< Boolean flag to indicate whether the drain parameters have been reset or not. static DISINFECT_FLUSH_NV_OPS_T disinfectFlushNVOps; ///< Disinfect flush non-volatile memory operations. // ********** private function prototypes ********** //static DG_CHEM_DISINFECT_FLUSH_STATE_T handleChemicalDisinfectFlushRemoveAcidBottleFromUIState( void ); static DG_CHEM_DISINFECT_FLUSH_STATE_T handleChemicalDisinfectFlushStartState( void ); -static DG_CHEM_DISINFECT_FLUSH_STATE_T handleChemicalDisinfectFlushDrainR1State( void ); -static DG_CHEM_DISINFECT_FLUSH_STATE_T handleChemicalDisinfectFlushDrainR2State( void ); +static DG_CHEM_DISINFECT_FLUSH_STATE_T handleChemicalDisinfectFlushDisinfectantDrainR1State( void ); +static DG_CHEM_DISINFECT_FLUSH_STATE_T handleChemicalDisinfectFlushDisinfectantDrainR2State( void ); static DG_CHEM_DISINFECT_FLUSH_STATE_T handleChemicalDisinfectFlushFlushDrainState( void ); static DG_CHEM_DISINFECT_FLUSH_STATE_T handleChemicalDisinfectFlushFlushDisinfectantLineState( void ); static DG_CHEM_DISINFECT_FLUSH_STATE_T handleChemicalDisinfectFlushFlushUFState( void ); @@ -147,7 +148,7 @@ static DG_RESERVOIR_STATUS_T getRsrvrDrainStatus( DG_RESERVOIR_ID_T r, U32 drainSteadyStateTimeout, U32 timeout ); static void publishChemicalDisinfectFlushData( void ); static void monitorModeChemicalDisinfectFlush( void ); -static void writeDisinfectDataToNV( void ); +static void writeDisinfectFlushDataToNV( void ); /*********************************************************************//** * @brief @@ -166,7 +167,7 @@ void initChemicalDisinfectFlushMode( void ) { chemDisinfectFlushState = DG_CHEM_DISINFECT_FLUSH_STATE_START; - prevChemDisinfectFlushState = DG_CHEM_DISINFECT_FLUSH_STATE_START; + prevChemDisinfectFlushState = DG_CHEM_DISINFECT_FLUSH_STATE_START; stateTimer = 0; isThisLastDrain = FALSE; stateTrialCounter = 0; @@ -225,11 +226,11 @@ break; case DG_CHEM_DISINFECT_FLUSH_STATE_DISINFECTANT_DRAIN_R1: - chemDisinfectFlushState = handleChemicalDisinfectFlushDrainR1State(); + chemDisinfectFlushState = handleChemicalDisinfectFlushDisinfectantDrainR1State(); break; case DG_CHEM_DISINFECT_FLUSH_STATE_DISINFECTANT_DRAIN_R2: - chemDisinfectFlushState = handleChemicalDisinfectFlushDrainR2State(); + chemDisinfectFlushState = handleChemicalDisinfectFlushDisinfectantDrainR2State(); break; case DG_CHEM_DISINFECT_FLUSH_STATE_FLUSH_DRAIN: @@ -270,7 +271,7 @@ break; } - //publishChemicalDisinfectFlushData(); + publishChemicalDisinfectFlushData(); return chemDisinfectFlushState; } @@ -367,12 +368,12 @@ * ChemDisinfectFlushUIState * @return next state of the chemical disinfect state machine *************************************************************************/ -static DG_CHEM_DISINFECT_FLUSH_STATE_T handleChemicalDisinfectFlushDrainR1State( void ) +static DG_CHEM_DISINFECT_FLUSH_STATE_T handleChemicalDisinfectFlushDisinfectantDrainR1State( void ) { DG_CHEM_DISINFECT_FLUSH_STATE_T state = DG_CHEM_DISINFECT_FLUSH_STATE_DISINFECTANT_DRAIN_R1; // Set the chemical disinfect that is published on the UI - chemDisinfectFlushUIState = CHEM_DISINFECT_UI_STATE_FLUSH_AFTER_DISINFECT; + chemDisinfectFlushUIState = CHEM_DISINFECT_FLUSH_UI_STATE_FLUSH_AFTER_DISINFECT; if ( DG_RESERVOIR_ABOVE_TARGET == rsrvr1Status ) { @@ -416,7 +417,7 @@ * chemDisinfectFlushUIState * @return next state of the chemical disinfect state machine *************************************************************************/ -static DG_CHEM_DISINFECT_FLUSH_STATE_T handleChemicalDisinfectFlushDrainR2State( void ) +static DG_CHEM_DISINFECT_FLUSH_STATE_T handleChemicalDisinfectFlushDisinfectantDrainR2State( void ) { DG_CHEM_DISINFECT_FLUSH_STATE_T state = DG_CHEM_DISINFECT_FLUSH_STATE_DISINFECTANT_DRAIN_R2; @@ -438,7 +439,7 @@ // ??? make sure load cell check is done in tareLoadCell or add that here? // Set valves for next state, flush drain - setValveState( VPO, VALVE_STATE_NOFILL_C_TO_NO ); + setValveState( VPO, VALVE_STATE_NOFILL_C_TO_NO ); setValveState( VRD2, VALVE_STATE_CLOSED ); setValveState( VPI, VALVE_STATE_OPEN ); @@ -480,7 +481,7 @@ { if (haveInletWaterChecksPassed) { - // set pumps and valves for next state, flush disinfectant line + // set pumps and valves for next state, flush disinfectant line setValveState( VPD, VALVE_STATE_OPEN_C_TO_NC ); setROPumpTargetFlowRateLPM( RO_PUMP_TARGET_FLUSH_FILL_FLOW_RATE_LPM, MAX_RO_PUMP_FLUSH_FILL_PRESSURE_PSI ); // Set the concentrate pump to run at a constant speed during priming in reverse @@ -489,14 +490,14 @@ // Turn on the bicarb line with forward direction, to dispense the chemical and mix setConcentratePumpTargetSpeed( CONCENTRATEPUMPS_CP2_BICARB, CONC_PUMP_FLUSH_SPEED_ML_PER_MIN ); requestConcentratePumpOn( CONCENTRATEPUMPS_CP2_BICARB ); - turnOnUVReactor( INLET_UV_REACTOR ); + turnOnUVReactor( INLET_UV_REACTOR ); turnOnUVReactor( OUTLET_UV_REACTOR ); - stateTimer = getMSTimerCount(); - state = DG_CHEM_DISINFECT_FLUSH_STATE_FLUSH_DISINFECTANT_LINE; + stateTimer = getMSTimerCount(); + state = DG_CHEM_DISINFECT_FLUSH_STATE_FLUSH_DISINFECTANT_LINE; } else - { + { // If the number of failures have not exceeded the limit, try again. stateTrialCounter++; if ( stateTrialCounter < MAX_ALLOWED_FLUSH_DRAIN_PERIODS ) @@ -506,11 +507,11 @@ // Couldn't get a good water sample after a couple of trials and the disinfect flush cycle failed else { - alarmDetectedPendingTrigger = ALARM_ID_INLET_WATER_TEMPERATURE_IN_LOW_RANGE; //ALARM_ID_DG_NEW_WAT; + alarmDetectedPendingTrigger = ALARM_ID_INLET_WATER_TEMPERATURE_IN_LOW_RANGE; //ALARM_ID_DG_NEW_WAT; prevChemDisinfectFlushState = state; - state = DG_CHEM_DISINFECT_FLUSH_STATE_CANCEL_BASIC_PATH; + state = DG_CHEM_DISINFECT_FLUSH_STATE_CANCEL_BASIC_PATH; } - } + } } @@ -569,12 +570,12 @@ if ( TRUE == didTimeout( stateTimer, FLUSH_UF_WAIT_TIME_MS ) ) { // set the pumps and valves for the next state, flush R2 to R1 and drain R1 - setValveState( VRO, VALVE_STATE_R2_C_TO_NC ); + setValveState( VRO, VALVE_STATE_R2_C_TO_NC ); setValveState( VRD2, VALVE_STATE_CLOSED ); setValveState( VRD1, VALVE_STATE_OPEN ); rsrvr1Status = DG_RESERVOIR_ABOVE_TARGET; - rsrvr2Status = DG_RESERVOIR_BELOW_TARGET; + rsrvr2Status = DG_RESERVOIR_BELOW_TARGET; rinseCycleCounter = 0; stateTimer = getMSTimerCount(); state = DG_CHEM_DISINFECT_FLUSH_STATE_FLUSH_R2_TO_R1_DRAIN_R1; @@ -591,7 +592,7 @@ * rinses reservoir 2 and drains reservoir 1 at the same time. If the drain * process times out, it transitions to basic cancellation state, and * if the rinse times out, it transitions to water cancellation state. - * If the drain and rinse are completed within the define time, it + * If the drain and rinse are completed within the defined time, it * transitions to the next state. * @details Inputs: rsrvr1Status, rsrvr2Status * @details Outputs: stateTimer, rsrvr1Status, rsrvr2Status, @@ -615,7 +616,7 @@ // Done with draining R1 signalDrainPumpHardStop(); setValveState( VRD1, VALVE_STATE_CLOSED ); - rsrvr1Empty = TRUE; + rsrvr1Empty = TRUE; } else if ( DG_RESERVOIR_NOT_REACHED_TARGET == rsrvr1Status ) { @@ -647,18 +648,18 @@ if ( ( TRUE == rsrvr2Full ) && ( TRUE == rsrvr1Empty ) && ( TRUE == didTimeout( stateTimer, FLUSH_ADDITIONAL_TIME_MS ) ) ) { // Set the valves to flush R1 to R2 and drain R2 - setValveState( VRD2, VALVE_STATE_OPEN ); - setValveState( VRO, VALVE_STATE_R1_C_TO_NO ); - setValveState( VRI, VALVE_STATE_R2_C_TO_NC ); - setValveState( VRF, VALVE_STATE_R1_C_TO_NC ); + setValveState( VRD2, VALVE_STATE_OPEN ); + setValveState( VRO, VALVE_STATE_R1_C_TO_NO ); + setValveState( VRI, VALVE_STATE_R2_C_TO_NC ); + setValveState( VRF, VALVE_STATE_R1_C_TO_NC ); + // Turn on the drain pump to drain R2 + setDrainPumpTargetRPM( DRAIN_PUMP_TARGET_RPM ); - // Turn on the drain pump to drain R2 - setDrainPumpTargetRPM( DRAIN_PUMP_TARGET_RPM ); + // Set the reservoir status + rsrvr1Status = DG_RESERVOIR_BELOW_TARGET; + rsrvr2Status = DG_RESERVOIR_ABOVE_TARGET; - // Set the reservoir status - rsrvr1Status = DG_RESERVOIR_BELOW_TARGET; - rsrvr2Status = DG_RESERVOIR_ABOVE_TARGET; - state = DG_CHEM_DISINFECT_FLUSH_STATE_FLUSH_R1_TO_R2_DRAIN_R2; + state = DG_CHEM_DISINFECT_FLUSH_STATE_FLUSH_R1_TO_R2_DRAIN_R2; } return state; @@ -671,7 +672,7 @@ * rinses reservoir 1 and drains reservoir 2 at the same time. If the drain * process times out, it transitions to basic cancellation state, and * if the rinse times out, it transitions to water cancellation state. - * If the drain and rinse are completed within the define time, it + * If the drain and rinse are completed within the defined time, it * transitions to the next state. * @details Inputs: rsrvr1Status, rsrvr2Status, rinseCycleCounter * @details Outputs: stateTimer, rsrvr1Status, rsrvr2Status, @@ -697,13 +698,13 @@ // Done with draining R2 signalDrainPumpHardStop(); setValveState( VRD2, VALVE_STATE_CLOSED ); - rsrvr2Empty = TRUE; + rsrvr2Empty = TRUE; } else if ( DG_RESERVOIR_NOT_REACHED_TARGET == rsrvr2Status ) { - // reservoir 2 drain timeout + // reservoir 2 drain timeout prevChemDisinfectFlushState = state; - state = DG_CHEM_DISINFECT_FLUSH_STATE_CANCEL_WATER_PATH; + state = DG_CHEM_DISINFECT_FLUSH_STATE_CANCEL_WATER_PATH; } } @@ -712,7 +713,7 @@ // Reservoir 1 must be completely full if ( DG_RESERVOIR_BELOW_TARGET == rsrvr1Status ) { - rsrvr1Status = getRsrvrFillStatus( DG_RESERVOIR_2, RSRVRS_FULL_VOL_ML, RSRVRS_FILL_UP_TIMEOUT_MS ); + rsrvr1Status = getRsrvrFillStatus( DG_RESERVOIR_1, RSRVRS_FULL_VOL_ML, RSRVRS_FILL_UP_TIMEOUT_MS ); } if ( DG_RESERVOIR_REACHED_TARGET == rsrvr1Status ) { @@ -730,9 +731,9 @@ { ++rinseCycleCounter; if ( rinseCycleCounter < NUM_OF_RINSE_CYCLES ) - { + { // Set the valves to flush R2 to R1 and drain R1 - setValveState( VRO, VALVE_STATE_R2_C_TO_NC ); + setValveState( VRO, VALVE_STATE_R2_C_TO_NC ); setValveState( VRD1, VALVE_STATE_OPEN ); setValveState( VRF, VALVE_STATE_R2_C_TO_NO ); setValveState( VRI, VALVE_STATE_R1_C_TO_NO ); @@ -744,10 +745,10 @@ // Set the reservoir status rsrvr2Status = DG_RESERVOIR_BELOW_TARGET; rsrvr1Status = DG_RESERVOIR_ABOVE_TARGET; - state = DG_CHEM_DISINFECT_FLUSH_STATE_FLUSH_R1_TO_R2_DRAIN_R2; - } + state = DG_CHEM_DISINFECT_FLUSH_STATE_FLUSH_R2_TO_R1_DRAIN_R1; + } else - { + { // number of rinse cycles complete // Set the valves to drain R1 setValveState( VPI, VALVE_STATE_CLOSED ); setValveState( VRF, VALVE_STATE_R2_C_TO_NO ); @@ -758,21 +759,22 @@ // Turn on the drain pump to drain R2 setDrainPumpTargetRPM( DRAIN_PUMP_TARGET_RPM ); - // Turn off CP1 and CP2 - requestConcentratePumpOff( CONCENTRATEPUMPS_CP1_ACID ); - requestConcentratePumpOff( CONCENTRATEPUMPS_CP2_BICARB ); + // Turn off CP1 and CP2 and ROP + signalROPumpHardStop(); + requestConcentratePumpOff( CONCENTRATEPUMPS_CP1_ACID ); + requestConcentratePumpOff( CONCENTRATEPUMPS_CP2_BICARB ); - //Turn off UV reactors - turnOffUVReactor( INLET_UV_REACTOR ); + //Turn off UV reactors + turnOffUVReactor( INLET_UV_REACTOR ); turnOffUVReactor( OUTLET_UV_REACTOR ); // Set the reservoir status rsrvr2Status = DG_RESERVOIR_ABOVE_TARGET; rsrvr1Status = DG_RESERVOIR_ABOVE_TARGET; - isThisLastDrain = TRUE; + isThisLastDrain = TRUE; state = DG_CHEM_DISINFECT_FLUSH_STATE_DISINFECTANT_DRAIN_R1; - } + } } return state; @@ -1019,30 +1021,32 @@ * @details Outputs: dataPublishCounter * @return: none *************************************************************************/ -/* needs work + static void publishChemicalDisinfectFlushData( void ) { if ( ++dataPublishCounter >= CHEM_DISINFECT_FLUSH_DATA_PUB_INTERVAL ) { MODE_CHEMICAL_DISINFECT_FLUSH_DATA_T data; - MODE_CHEMICAL_DISINFECT_UI_DATA_T uiData; + MODE_CHEMICAL_DISINFECT_FLUSH_UI_DATA_T uiData; data.chemDisinfectFlushState = (U32)chemDisinfectFlushState; data.stateElapsedTime = calcTimeSince( stateTimer ); data.overallElapsedTime = calcTimeSince( overallChemDisinfectFlushTimer ); data.cancellationMode = (U32)cancellationMode; + uiData.chemDisinfectFlushTargetTime = CHEM_DISINFECT_FLUSH_TIME_MS; + uiData.chemDisinfectFlushCountdownTime = calcTimeSince( overallChemDisinfectFlushTimer ); // General data publish channel - broadcastData( MSG_ID_DG_CHEM_DISINFECT_DATA, COMM_BUFFER_OUT_CAN_DG_BROADCAST, (U08*)&data, sizeof( MODE_CHEMICAL_DISINFECT_FLUSH_DATA_T ) ); + broadcastData( MSG_ID_DG_CHEM_DISINFECT_FLUSH_DATA, COMM_BUFFER_OUT_CAN_DG_BROADCAST, (U08*)&data, sizeof( MODE_CHEMICAL_DISINFECT_FLUSH_DATA_T ) ); // Publish data to UI - broadcastData( MSG_ID_DG_CHEM_DISINFECT_TIME_DATA, COMM_BUFFER_OUT_CAN_DG_2_UI, (U08*)&uiData, sizeof( MODE_CHEMICAL_DISINFECT_FLUSH_UI_DATA_T ) ); + broadcastData( MSG_ID_DG_CHEM_DISINFECT_FLUSH_TIME_DATA, COMM_BUFFER_OUT_CAN_DG_2_UI, (U08*)&uiData, sizeof( MODE_CHEMICAL_DISINFECT_FLUSH_UI_DATA_T ) ); dataPublishCounter = 0; } } -*/ + /*********************************************************************//** * @brief * The monitorModeChemicalDisinfectFlush function monitors the status of the caps and @@ -1120,10 +1124,8 @@ * @details Outputs: disinfectNVOps * @return: none *************************************************************************/ -static void writeDisinfectDataToNV( void ) +static void writeDisinfectFlushDataToNV( void ) { - ; ///< Boolean flag to indicate whether the disinfect flush status been written to NV or not. - BOOL ; if ( FALSE == disinfectFlushNVOps.hasDisFlushCompleteDateBeenWrittenToNV ) { disinfectFlushNVOps.hasDisFlushCompleteDateBeenWrittenToNV = setDisinfectStatus( TRUE );