Index: firmware/App/Modes/ModeService.c =================================================================== diff -u -rbbf1e3736be03a4f041ace57e0f95e23caf472dd -r3b70632c04247a6973960e1f37ae73eb4384a6b7 --- firmware/App/Modes/ModeService.c (.../ModeService.c) (revision bbf1e3736be03a4f041ace57e0f95e23caf472dd) +++ firmware/App/Modes/ModeService.c (.../ModeService.c) (revision 3b70632c04247a6973960e1f37ae73eb4384a6b7) @@ -1,18 +1,19 @@ -/*********************************************************************//*** - * - * Copyright (c) 2019-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 ModeService.c - * - * @date 19-Sep-2019 - * @author S. Nash - * - * @brief Top-level state machine for the service mode. - * - **************************************************************************/ +/************************************************************************** +* +* Copyright (c) 2019-2022 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 ModeService.c +* +* @author (last) Michael Garthwaite +* @date (last) 07-Sep-2022 +* +* @author (original) Dara Navaei +* @date (original) 05-Nov-2019 +* +***************************************************************************/ #include "OperationModes.h" #include "ModeService.h" @@ -32,10 +33,9 @@ /*********************************************************************//** * @brief - * The initServiceMode function initializes the Service Mode module. - * @details - * Inputs : none - * Outputs : Service Mode module initialized. + * The initServiceMode function initializes the service mode module. + * @details Inputs: none + * @details Outputs: Service mode module initialized * @return none *************************************************************************/ void initServiceMode( void ) @@ -46,21 +46,24 @@ /*********************************************************************//** * @brief * The transitionToServiceMode function prepares for transition to service mode. - * @details - * Inputs : none - * Outputs : - * @return none + * @details Inputs: none + * @details Outputs: none + * @return initial state *************************************************************************/ -void transitionToServiceMode( void ) +U32 transitionToServiceMode( void ) { + deenergizeActuators(); + + initServiceMode(); + + return serviceState; } /*********************************************************************//** * @brief - * The execServiceMode function executes the Service Mode state machine. - * @details - * Inputs : none - * Outputs : + * The execServiceMode function executes the service mode state machine. + * @details Inputs: none + * @details Outputs: Service mode state machine executed * @return current state. *************************************************************************/ U32 execServiceMode( void ) @@ -72,7 +75,7 @@ break; default: - // TODO - s/w fault + SET_ALARM_WITH_2_U32_DATA( ALARM_ID_DG_SOFTWARE_FAULT, SW_FAULT_ID_SERVICE_MODE_INVALID_EXEC_STATE, serviceState ) serviceState = DG_SERVICE_STATE_START; break; } @@ -82,12 +85,10 @@ /*********************************************************************//** * @brief - * The getCurrentServiceState function returns the current state of the \n - * service mode. - * @details - * Inputs : serviceState - * Outputs : none - * @return the current state of service mode. + * The getCurrentServiceState function returns the current state of the service mode. + * @details Inputs: serviceState + * @details Outputs: none + * @return the current state of service mode *************************************************************************/ DG_SERVICE_STATE_T getCurrentServiceState( void ) {