Index: firmware/App/Controllers/Heaters.c =================================================================== diff -u -rda3fb953ff72fc65fc6c8c6b91fd833114cb7cbf -r956bf7dbc9e63c875428495061dbdbcdbb8cacb0 --- firmware/App/Controllers/Heaters.c (.../Heaters.c) (revision da3fb953ff72fc65fc6c8c6b91fd833114cb7cbf) +++ firmware/App/Controllers/Heaters.c (.../Heaters.c) (revision 956bf7dbc9e63c875428495061dbdbcdbb8cacb0) @@ -354,6 +354,7 @@ *************************************************************************/ void execHeatersMonitor( void ) { + // TODO check for the heaters' fault flags and fault if any of them are at fault it should alarm #ifndef IGNORE_HEATERS_MONITOR F32 primaryHeatersInternalTemp = getTemperatureValue( TEMPSENSORS_PRIMARY_HEATER_INTERNAL ); F32 trimmerHeaterInternalTemp = getTemperatureValue( TEMPSENSORS_TRIMMER_HEATER_INTERNAL ); @@ -400,22 +401,29 @@ #endif /* - * If any of the heaters are on, check if the flow is below than the minimum value + * If any of the heaters are on or any of the heaters' PWMs are not zero, check if the flow is below than the minimum value * If the flow is below minimum for the first time, set the variables * If the flow is below minimum for more than the defined time, stop the heaters and raise the alarm * If the flow is in range, reset the variables + * This is to make sure that any of the heaters do not stay on while there is no flow */ - if ( ( TRUE == isPrimaryHeaterOn ) || ( TRUE == isTrimmerHeaterOn ) ) + BOOL isHeaterOn = ( TRUE == isPrimaryHeaterOn ) || ( TRUE == isTrimmerHeaterOn ); + BOOL isPWMNonZero = ( mainPrimaryHeaterDutyCycle > HEATERS_MIN_DUTY_CYCLE ) || ( smallPrimaryHeaterDutyCycle > HEATERS_MIN_DUTY_CYCLE ) || + ( trimmerHeaterDutyCycle > HEATERS_MIN_DUTY_CYCLE ); + + if ( ( TRUE == isHeaterOn ) || ( TRUE == isPWMNonZero ) ) { F32 measuredFlow = getMeasuredROFlowRate(); if ( measuredFlow < MIN_RO_FLOWRATE_LPM ) { + // Flow is below minimum for the first time if ( FALSE == isFlowBelowMin ) { isFlowBelowMin = TRUE; heatersOnWithNoFlowTimer = getMSTimerCount(); } + // Flow is below minimum for a long time so raise the alarm else if ( TRUE == didTimeout( heatersOnWithNoFlowTimer, HEATERS_ON_NO_FLOW_TIMEOUT_MS ) ) { stopPrimaryHeater(); @@ -847,12 +855,12 @@ *************************************************************************/ static void resetHeaterState( NAME_OF_HEATER_T heater ) { - if ( heater == PRIMARY_HEATER ) + if ( PRIMARY_HEATER == heater ) { mainPrimaryHeaterDutyCycle = MAIN_PRIMARY_HEATER_MAX_DUTY_CYCLE; resetPIController( PI_CONTROLLER_ID_PRIMARY_HEATER, MAIN_PRIMARY_HEATER_MAX_DUTY_CYCLE ); } - else if ( heater == TRIMMER_HEATER ) + else if ( TRIMMER_HEATER == heater ) { trimmerHeaterDutyCycle = TRIMMER_HEATER_MAX_DUTY_CYCLE; resetPIController( PI_CONTROLLER_ID_TRIMMER_HEATER, TRIMMER_HEATER_MAX_DUTY_CYCLE ); @@ -895,6 +903,8 @@ data.mainPrimayHeaterDC = mainPrimaryHeaterDutyCycle * 100.0; data.smallPrimaryHeaterDC = smallPrimaryHeaterDutyCycle * 100.0; data.trimmerHeaterDC = trimmerHeaterDutyCycle * 100.0; + data.primaryTargetTemp = primaryHeaterTargetTemperature; + data.trimmerTargetTemp = trimmerHeaterTargetTemperature; broadcastHeatersData( &data ); Index: firmware/App/Controllers/Heaters.h =================================================================== diff -u -rbbf67569fc5f34815c0e0855dd452de2be5a7976 -r956bf7dbc9e63c875428495061dbdbcdbb8cacb0 --- firmware/App/Controllers/Heaters.h (.../Heaters.h) (revision bbf67569fc5f34815c0e0855dd452de2be5a7976) +++ firmware/App/Controllers/Heaters.h (.../Heaters.h) (revision 956bf7dbc9e63c875428495061dbdbcdbb8cacb0) @@ -69,6 +69,8 @@ void setPrimaryHeaterTargetTemperature( F32 targetTemp ); void setTrimmerHeaterTargetTemperature( F32 targetTemp ); +F32 getPrimaryHeaterTargetTemperature( void ); + BOOL startPrimaryHeater( void ); BOOL startTrimmerHeater( void ); Index: firmware/App/Controllers/UVReactors.c =================================================================== diff -u -r86eec09ab556fbd970ddcae9dc622727928ee757 -r956bf7dbc9e63c875428495061dbdbcdbb8cacb0 --- firmware/App/Controllers/UVReactors.c (.../UVReactors.c) (revision 86eec09ab556fbd970ddcae9dc622727928ee757) +++ firmware/App/Controllers/UVReactors.c (.../UVReactors.c) (revision 956bf7dbc9e63c875428495061dbdbcdbb8cacb0) @@ -319,6 +319,7 @@ { uvReactorsSelfTestResult = SELF_TEST_STATUS_FAILED; +#ifndef DISABLE_UV_REACTOR_MONITOR // Check which reactor has not been healthy and raise an alarm if ( FALSE == isInletHealthy ) { @@ -328,6 +329,7 @@ { SET_ALARM_WITH_1_U32_DATA( ALARM_ID_UV_REACTOR_NOT_HEALTHY, OUTLET_UV_REACTOR ); } +#endif } // Turn off the UV reactors once the test is finished @@ -386,13 +388,15 @@ // Get the health of the reactor (override or non-override) and decide the status BOOL isReactorUnhealthy = ( UV_REACTOR_HEALTHY == getUVReactorHealth( reactor ) ? FALSE : TRUE ); +#ifndef DISABLE_UV_REACTOR_MONITOR checkPersistentAlarm( ALARM_ID_UV_REACTOR_NOT_HEALTHY, isReactorUnhealthy, (U32)reactor, MAX_ALLOWED_UNHEALTHY_REACTOR_PERIOD ); // Check if the alarm has been active if( isAlarmActive( ALARM_ID_UV_REACTOR_NOT_HEALTHY ) ) { reactorsStatus[ reactor ].switchState = TURN_OFF; } +#endif // Check if it has been requested to turn off a reactor if( TURN_OFF == reactorsStatus[ reactor ].switchState ) Index: firmware/App/DGCommon.h =================================================================== diff -u -rc0700a4503f28288f16070634bb87f4eccb2568c -r956bf7dbc9e63c875428495061dbdbcdbb8cacb0 --- firmware/App/DGCommon.h (.../DGCommon.h) (revision c0700a4503f28288f16070634bb87f4eccb2568c) +++ firmware/App/DGCommon.h (.../DGCommon.h) (revision 956bf7dbc9e63c875428495061dbdbcdbb8cacb0) @@ -57,6 +57,8 @@ #define DISABLE_RTC_CONFIG 1 //#define V_2_SYSTEM 1 #define SKIP_RECIRC 1 + #define DISABLE_UV_REACTOR_MONITOR 1 + #include #include #endif Index: firmware/App/Modes/ModeFill.c =================================================================== diff -u -r594e11a544c7d3f97f057a2d4c146f464e437948 -r956bf7dbc9e63c875428495061dbdbcdbb8cacb0 --- firmware/App/Modes/ModeFill.c (.../ModeFill.c) (revision 594e11a544c7d3f97f057a2d4c146f464e437948) +++ firmware/App/Modes/ModeFill.c (.../ModeFill.c) (revision 956bf7dbc9e63c875428495061dbdbcdbb8cacb0) @@ -20,6 +20,7 @@ #include "FPGA.h" #include "Heaters.h" #include "LoadCell.h" +#include "ModeFault.h" #include "ModeFill.h" #include "OperationModes.h" #include "PersistentAlarm.h" Index: firmware/App/Modes/ModeStandby.c =================================================================== diff -u -r11e3b3ea59f507ffc4cd6b64e1821689295e207c -r956bf7dbc9e63c875428495061dbdbcdbb8cacb0 --- firmware/App/Modes/ModeStandby.c (.../ModeStandby.c) (revision 11e3b3ea59f507ffc4cd6b64e1821689295e207c) +++ firmware/App/Modes/ModeStandby.c (.../ModeStandby.c) (revision 956bf7dbc9e63c875428495061dbdbcdbb8cacb0) @@ -19,6 +19,7 @@ #include "CPLD.h" #include "DrainPump.h" #include "Heaters.h" +#include "ModeFault.h" #include "ModeStandby.h" #include "OperationModes.h" #include "Reservoirs.h" @@ -94,10 +95,17 @@ // re-initialize standby mode each time we transition to standby mode initStandbyMode(); + //deenergizeActuators(); + // set initial actuator states setValveState( VRF, VALVE_STATE_R2_C_TO_NO ); setValveState( VRI, VALVE_STATE_R1_C_TO_NO ); +#ifndef V_2_SYSTEM + setValveState( VRD1, VALVE_STATE_CLOSED ); + setValveState( VRD2, VALVE_STATE_CLOSED ); +#else setValveState( VRD, VALVE_STATE_R2_C_TO_NO ); +#endif setValveState( VRO, VALVE_STATE_R1_C_TO_NO ); setValveState( VPO, VALVE_STATE_NOFILL_C_TO_NO ); setValveState( VRC, VALVE_STATE_DRAIN_C_TO_NO ); @@ -181,7 +189,11 @@ flushFilterRequest = FALSE; filterFlushStartTime = getMSTimerCount(); setValveState( VPI, VALVE_STATE_OPEN ); - setValveState( VPD, VALVE_STATE_OPEN ); // TODO: VPD drain state is closed for V3 +#ifndef V_2_SYSTEM + setValveState( VPD, VALVE_STATE_DRAIN_C_TO_NO ); +#else + setValveState( VPD, VALVE_STATE_OPEN ); // TODO: VPD drain state is closed for V3 +#endif state = DG_STANDBY_MODE_STATE_FLUSH_FILTER; } else if ( TRUE == pendingStartDGRequest ) @@ -246,7 +258,11 @@ if ( TRUE == endSampleWaterRequest ) { setValveState( VPI, VALVE_STATE_CLOSED ); +#ifndef V_2_SYSTEM + setValveState( VPD, VALVE_STATE_DRAIN_C_TO_NO ); +#else setValveState( VPD, VALVE_STATE_CLOSED ); +#endif state = DG_STANDBY_MODE_STATE_IDLE; } @@ -270,7 +286,12 @@ { stopSampleWaterRequest = FALSE; setValveState( VSP, VALVE_STATE_CLOSED ); + +#ifndef V_2_SYSTEM + setValveState( VPD, VALVE_STATE_DRAIN_C_TO_NO ); +#else setValveState( VPD, VALVE_STATE_OPEN ); // TODO: VPD drain state is closed for V3 +#endif state = DG_STANDBY_MODE_STATE_FLUSH_FILTER_IDLE; } @@ -360,6 +381,29 @@ /*********************************************************************//** * @brief + * The startDGFlush function starts DG flush mode. + * @details Inputs: standbyState + * @details Outputs: none + * @return: TRUE if the switch was successful, otherwise FALSE + *************************************************************************/ +BOOL startDGFlush( void ) +{ + BOOL result = FALSE; + + // If DG is in standby mode or in the solo mode and the standby mode is in Idle state, request DG flush + if ( ( DG_MODE_STAN == getCurrentOperationMode() && DG_STANDBY_MODE_STATE_IDLE == standbyState ) || + DG_MODE_SOLO == getCurrentOperationMode() ) + { + requestNewOperationMode( DG_MODE_FLUS ); + + result = TRUE; + } + + return result; +} + +/*********************************************************************//** + * @brief * The startDGHeatDisinfect function starts heat disinfect mode. * @details Inputs: standbyState * @details Outputs: none @@ -374,7 +418,28 @@ ( DG_MODE_SOLO == getCurrentOperationMode() ) ) { requestNewOperationMode( DG_MODE_HEAT ); + status = TRUE; + } + return status; +} + +/*********************************************************************//** + * @brief + * The startDGChemicalDisinfect function starts chemical disinfect mode. + * @details Inputs: standbyState + * @details Outputs: none + * @return: TRUE if the switch was successful + *************************************************************************/ +BOOL startDGChemicalDisinfect( void ) +{ + BOOL status = FALSE; + + // If DG 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 ( ( DG_MODE_STAN == getCurrentOperationMode() ) && ( DG_STANDBY_MODE_STATE_IDLE == standbyState ) ) TODO un-comment this line. This is commented to be able to run chemical without HD for development + { + requestNewOperationMode( DG_MODE_CHEM ); status = TRUE; } Index: firmware/App/Services/FPGA.c =================================================================== diff -u -r1f9bebfb549c5c9334f4d3f0dc2b4da3779d590c -r956bf7dbc9e63c875428495061dbdbcdbb8cacb0 --- firmware/App/Services/FPGA.c (.../FPGA.c) (revision 1f9bebfb549c5c9334f4d3f0dc2b4da3779d590c) +++ firmware/App/Services/FPGA.c (.../FPGA.c) (revision 956bf7dbc9e63c875428495061dbdbcdbb8cacb0) @@ -1562,6 +1562,19 @@ /*********************************************************************//** * @brief + * The getFPGAConcentratePumpsFault function gets concentrate pumps fault + * reported by FGPA. + * @details Inputs: fpgaSensorReadings.fpgaCP1CP2Fault + * @details Outputs: none + * @return Latest concentrate pumps fault value + *************************************************************************/ +U08 getFPGAConcentratePumpsFault( void ) +{ + return fpgaSensorReadings.fpgaCP1CP2Fault; +} + +/*********************************************************************//** + * @brief * The getFPGAEmstatOutByte function gets Emstat conductivity sensor output byte. * @details Inputs: fpgaSensorReadings.fpgaEmstatOutByte * @details Outputs: none Index: firmware/App/Services/FPGA.h =================================================================== diff -u -rc5586e0292b8e988e89a7304f63be32afcad1466 -r956bf7dbc9e63c875428495061dbdbcdbb8cacb0 --- firmware/App/Services/FPGA.h (.../FPGA.h) (revision c5586e0292b8e988e89a7304f63be32afcad1466) +++ firmware/App/Services/FPGA.h (.../FPGA.h) (revision 956bf7dbc9e63c875428495061dbdbcdbb8cacb0) @@ -70,8 +70,8 @@ U32 getFPGATHDoTemp( void ); -U08 getFPGATHDoErrorCount( void ); -U08 getFPGATHDoReadCount( void ); +U08 getFPGATRoErrorCount( void ); +U08 getFPGATRoReadCount( void ); U32 getFPGATDiTemp( void );