Index: firmware/App/Modes/OperationModes.c =================================================================== diff -u -rce247681f11b5e164e00992fb73ba5c595d349aa -r5ce7985577e93071cd4c361efe2342cdcd7004dd --- firmware/App/Modes/OperationModes.c (.../OperationModes.c) (revision ce247681f11b5e164e00992fb73ba5c595d349aa) +++ firmware/App/Modes/OperationModes.c (.../OperationModes.c) (revision 5ce7985577e93071cd4c361efe2342cdcd7004dd) @@ -140,14 +140,14 @@ transitionToNewOperationMode( newMode ); currentMode = newMode; - if ( MODE_TREA == lastMode ) + if ( ( MODE_TREA == lastMode ) && ( currentMode != MODE_TREA ) ) { - // If the current mode is treatment but transitioning to another mode has been requested (including transitioning to fault mode) + // If the last mode is treatment but the new mode is not treatment // it means the treatment is done. Get the elapsed time since the beginning of the treatment and convert it to hours to be written U32 txElapsedTimeMS = calcTimeSince( getTreatmentStartTimeStamp() ); F32 txElapsedTimeHrs = (F32)txElapsedTimeMS / ( MIN_PER_HOUR * SEC_PER_MIN * MS_PER_SECOND ); // Write the treatment hours and set the service to be false so the treatment hours is not reset - setTxTimeHours( txElapsedTimeHrs, FALSE ); + setTxTimeHours( txElapsedTimeHrs ); } } @@ -253,6 +253,18 @@ /*********************************************************************//** * @brief + * The getCurrentSubMode function gets the current operation sub-mode. + * @details Inputs: currentSubMode + * @details Outputs: none + * @return the current operation sub-mode + *************************************************************************/ +U32 getCurrentSubMode( void ) +{ + return currentSubMode; +} + +/*********************************************************************//** + * @brief * The initiateAlarmAction function initiate an alarm or alarm recovery * action according to the current operation mode. * @details Inputs: currentMode