Index: firmware/App/Modes/ModeStandby.c =================================================================== diff -u -rb30c057e2f4371a0ef49248303b85f321adf7a23 -rcd5be724d5a3ba7457e761191d82f278654d7f5c --- firmware/App/Modes/ModeStandby.c (.../ModeStandby.c) (revision b30c057e2f4371a0ef49248303b85f321adf7a23) +++ firmware/App/Modes/ModeStandby.c (.../ModeStandby.c) (revision cd5be724d5a3ba7457e761191d82f278654d7f5c) @@ -1,14 +1,14 @@ /************************************************************************** * -* Copyright (c) 2019-2023 Diality Inc. - All Rights Reserved. +* Copyright (c) 2019-2024 Diality Inc. - All Rights Reserved. * * THIS CODE MAY NOT BE COPIED OR REPRODUCED IN ANY FORM, IN PART OR IN * WHOLE, WITHOUT THE EXPLICIT PERMISSION OF THE COPYRIGHT OWNER. * * @file ModeStandby.c * * @author (last) Dara Navaei -* @date (last) 14-Jun-2023 +* @date (last) 10-Nov-2023 * * @author (original) Dara Navaei * @date (original) 05-Nov-2019 @@ -70,6 +70,7 @@ static BOOL treatStartReqReceived; ///< Flag indicates user has requested initiation of a treatment. static GENERIC_CONFIRM_ID_T disinfectCancelReqID; ///< ID of requested cancel disinfect mode. static BOOL homingInitiated; ///< Boolean flag to indicate homing is initiated. +static BOOL flagNoDisinfectRequired = FALSE; ///< Flag indicates disinfect not required on next mode entry. static DG_CLEANING_MODE_STATUS_T currentDGCleaningMode; ///< Current DG cleaning mode status. /// Interval (in task intervals) at which to publish standby mode data to CAN bus. @@ -152,13 +153,14 @@ setValvePosition( VBV, VALVE_POSITION_A_INSERT_EJECT ); // If we just exited Post Treatment Mode, goto disinfect sub state. - if ( MODE_POST == previousOpMode ) + if ( ( MODE_POST == previousOpMode ) && ( flagNoDisinfectRequired != TRUE ) ) { doorClosedRequired( FALSE, FALSE ); // door no longer required to be closed in standby mode currentStandbyState = STANDBY_WAIT_FOR_DISINFECT_STATE; } else { + flagNoDisinfectRequired = FALSE; doorClosedRequired( TRUE, FALSE ); } syringeDetectionRequired( FALSE ); @@ -307,6 +309,19 @@ /*********************************************************************//** * @brief + * The signalNoDisinfectRequired function signals the standby mode module + * that a disinfection will not be required on next entry to standby mode. + * @details Inputs: none + * @details Outputs: flagNoDisinfectRequired + * @return none + *************************************************************************/ +void signalNoDisinfectRequired( void ) +{ + flagNoDisinfectRequired = TRUE; +} + +/*********************************************************************//** + * @brief * The signalAlarmActionToStandbyMode function executes the given alarm action * as appropriate while in Standby Mode. * @details Inputs: none @@ -639,7 +654,7 @@ else #endif { - if ( ( TRUE == homingInitiated ) && ( TRUE == isSyringePumpHome() ) && ( TRUE == isSyringePumpStopped() ) ) + if ( ( TRUE == isSyringePumpHome() ) && ( TRUE == isSyringePumpStopped() ) ) { syringePumpVerifyForceSensorDACCalibration(); homingInitiated = FALSE; // reset for next time @@ -1141,6 +1156,7 @@ getNVRecord2Driver( GET_USAGE_RECORD, (U08*)&usageRecord, sizeof( HD_USAGE_INFO_RECORD_T ), 0, ALARM_ID_NO_ALARM ); U32 lastChemCompleteDateS = data.dgUsageInfo.lastChemDisCompleteDateEpoch; + U32 lastChemStartDateS = data.dgUsageInfo.lastChemDisStartDateEpoch; U32 lastChemFlushCompleteDateS = data.dgUsageInfo.lastChemDisFlushCompleteDateEpoch; U32 lastHeatCompleteDateS = data.dgUsageInfo.lastHeatDisCompleteDateEpoch; U32 lastFlushCompleteDateS = data.dgUsageInfo.lastBasicFlushCompleteDateEpoch; @@ -1156,7 +1172,7 @@ BOOL isHeatDisValid = ( ( currentRTCEpochTimeS - lastHeatCompleteDateS ) < DISINFECTS_TIME_INTERVAL_S ? TRUE : FALSE ); // Last Chem Flush Complete < Last Chem Disinfect Start, so after running a chemical disinfect, a chemical disinfect flush has been done - BOOL isChemFlushComplete = ( lastChemFlushCompleteDateS > lastChemCompleteDateS ? TRUE : FALSE ); + BOOL isChemFlushComplete = ( lastChemFlushCompleteDateS > lastChemStartDateS ? TRUE : FALSE ); // If either of the basic flush, heat disinfect, or chemical disinfect flush have been done within the interval, it means the filters have been flushed BOOL isBasicFlushValid = ( ( currentRTCEpochTimeS - lastFlushCompleteDateS ) < FLUSH_TIME_INTERVAL_S ? TRUE : FALSE );