Index: firmware/App/Modes/ModeChemicalDisinfect.c =================================================================== diff -u -rbecd984764c6f1737369fc7078059c46809f1864 -r98543f7e5ff638ae6ad2741237a05f8cc4f10814 --- firmware/App/Modes/ModeChemicalDisinfect.c (.../ModeChemicalDisinfect.c) (revision becd984764c6f1737369fc7078059c46809f1864) +++ firmware/App/Modes/ModeChemicalDisinfect.c (.../ModeChemicalDisinfect.c) (revision 98543f7e5ff638ae6ad2741237a05f8cc4f10814) @@ -15,6 +15,8 @@ * ***************************************************************************/ +#include // for memset() + #include "ConcentratePumps.h" #include "ConductivitySensors.h" #include "CPLD.h" @@ -114,7 +116,7 @@ // Initial disinfectant fill of R1 and R2 #define RSRVRS_FULL_VOL_ML 1850.0F ///< Reservoirs 1 & 2 full volume in mL. #define RSRVRS_LEAK_VOL_TIMEOUT_TASK_INT ( ( 30 * MS_PER_SECOND ) / TASK_GENERAL_INTERVAL ) ///< Time delay for declaring that reservoir is leaking due to volume depletion. -#define RSRVRS_MAX_LEAK_VOL_CHANGE_ML 100.0F; ///< Volume loss that is necessary to declare a reservoir leak. +#define RSRVRS_MAX_LEAK_VOL_CHANGE_ML 100.0F ///< Volume loss that is necessary to declare a reservoir leak. // Parameters controlling chemical disinfect #define TARGET_CHEM_DISINFECT_TIME_MS ( 12 * SEC_PER_MIN * MS_PER_SECOND ) ///< Expected chemical disinfect time in ms. @@ -1531,8 +1533,9 @@ { R1FullVolume = currentVolumeML; } - else if ( DG_RESERVOIR_2 == r ) + else { + // If the reservoir is neither 1 or 2, the current volume will be updated so the code will never get here R2FullVolume = currentVolumeML; } } @@ -1739,16 +1742,16 @@ // Reservoir leak detection. if ( ( DG_CHEM_DISINFECT_STATE_DISINFECT_R1_TO_R2 == chemDisinfectState ) || ( DG_CHEM_DISINFECT_STATE_DISINFECT_R2_TO_R1 == chemDisinfectState ) ) { - BOOL isRsrvrVolumeOutOfRange = FALSE; + // Since the reservoir level is only checked if the mode is in R1 to R2 or it is in R2 to R1, it is assumed that the default is R2 to R1 so VectorCAST + // can cover the cases + F32 loadCellValueML = getLoadCellSmallFilteredWeight( LOAD_CELL_RESERVOIR_2_PRIMARY ); + BOOL isRsrvrVolumeOutOfRange = ( fabs( loadCellValueML - R2FullVolume ) > RSRVRS_MAX_LEAK_VOL_CHANGE_ML ? TRUE : FALSE ); if ( DG_CHEM_DISINFECT_STATE_DISINFECT_R1_TO_R2 == chemDisinfectState ) { - isRsrvrVolumeOutOfRange = fabs( getLoadCellSmallFilteredWeight( LOAD_CELL_RESERVOIR_1_PRIMARY ) - R1FullVolume ) > RSRVRS_MAX_LEAK_VOL_CHANGE_ML; + loadCellValueML = getLoadCellSmallFilteredWeight( LOAD_CELL_RESERVOIR_1_PRIMARY ); + isRsrvrVolumeOutOfRange = ( fabs( loadCellValueML - R1FullVolume ) > RSRVRS_MAX_LEAK_VOL_CHANGE_ML ? TRUE : FALSE ); } - else - { - isRsrvrVolumeOutOfRange = fabs( getLoadCellSmallFilteredWeight( LOAD_CELL_RESERVOIR_2_PRIMARY ) - R2FullVolume ) > RSRVRS_MAX_LEAK_VOL_CHANGE_ML; - } isRsrvrLeaking = ( TRUE == isRsrvrLeaking ? isRsrvrLeaking : FALSE );