Index: firmware/App/Modes/TreatmentStop.c =================================================================== diff -u -r07a5add2dff254f7be3699e4efac2b99d3554847 -r8e7158d8231435496fcf1d5649e51babf859ccc7 --- firmware/App/Modes/TreatmentStop.c (.../TreatmentStop.c) (revision 07a5add2dff254f7be3699e4efac2b99d3554847) +++ firmware/App/Modes/TreatmentStop.c (.../TreatmentStop.c) (revision 8e7158d8231435496fcf1d5649e51babf859ccc7) @@ -1,65 +1,84 @@ /************************************************************************** - * - * Copyright (c) 2020 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 TreatmentStop.c - * - * @date 15-Jan-2020 - * @author S. Nash - * - * @brief State machine for the treatment stop sub-mode of treatment mode. - * - **************************************************************************/ +* +* Copyright (c) 2019-2021 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 TreatmentStop.c +* +* @author (last) Sean Nash +* @date (last) 13-Nov-2020 +* +* @author (original) Sean +* @date (original) 15-Jan-2020 +* +***************************************************************************/ -#include "TreatmentStop.h" -#include "OperationModes.h" +#include "AirTrap.h" +#include "Buttons.h" #include "ModeTreatment.h" +#include "OperationModes.h" +#include "TreatmentStop.h" +#include "Valves.h" +/** + * @addtogroup TreatmentStop + * @{ + */ + // ********** private data ********** // ********** private function prototypes ********** -/************************************************************************* - * @brief initTreatmentStop - * The initTreatmentStop function initializes the Treatment Mode module. - * @details - * Inputs : none - * Outputs : Treatment Mode module initialized. - * @param none +/*********************************************************************//** + * @brief + * The initTreatmentStop function initializes the Treatment Stop sub-mode + * module. + * @details Inputs: none + * @details Outputs: Treatment Stop sub-mode module initialized. * @return none *************************************************************************/ void initTreatmentStop( void ) { } -/************************************************************************* - * @brief transitionToTreatmentStop - * The transitionToTreatmentStop function prepares for transition to treatment \n +/*********************************************************************//** + * @brief + * The transitionToTreatmentStop function prepares for transition to treatment * stop sub-mode. - * @details - * Inputs : none - * Outputs : - * @param none + * @details Inputs: none + * @details Outputs: none * @return none *************************************************************************/ void transitionToTreatmentStop( void ) { + // set valves to safe state + setValvePosition( VDI, VALVE_POSITION_C_CLOSE ); + setValvePosition( VDO, VALVE_POSITION_C_CLOSE ); + setValvePosition( VBA, VALVE_POSITION_C_CLOSE ); + setValvePosition( VBV, VALVE_POSITION_C_CLOSE ); + // reset saline bolus state in case alarm interrupted one + resetSalineBolus(); + // stop air trap control + endAirTrapControl(); } -/************************************************************************* - * @brief execTreatmentStop - * The execTreatmentStop function executes the Treatment Stop sub-mode \n +/*********************************************************************//** + * @brief + * The execTreatmentStop function executes the Treatment Stop sub-mode * state machine. - * @details - * Inputs : none - * Outputs : - * @param none + * @details Inputs: none + * @details Outputs: none * @return none *************************************************************************/ void execTreatmentStop( void ) { + // TODO - test code - remove later + if ( TRUE == isStopButtonPressed() ) + { + requestNewOperationMode( MODE_POST ); + } } +/**@}*/