Index: firmware/App/Drivers/SafetyShutdown.c =================================================================== diff -u -re5bb82cad756fbb10f04d576dffd499df78f6b35 -r7fa65a3aae9c4ef70a6e53f3e3bb20f0425bd681 --- firmware/App/Drivers/SafetyShutdown.c (.../SafetyShutdown.c) (revision e5bb82cad756fbb10f04d576dffd499df78f6b35) +++ firmware/App/Drivers/SafetyShutdown.c (.../SafetyShutdown.c) (revision 7fa65a3aae9c4ef70a6e53f3e3bb20f0425bd681) @@ -1,4 +1,4 @@ -/************************************************************************** +/**********************************************************************//** * * Copyright (c) 2019-2020 Diality Inc. - All Rights Reserved. * @@ -17,8 +17,14 @@ #include #include "gio.h" +#include "SystemCommMessages.h" #include "SafetyShutdown.h" +/** + * @addtogroup SafetyShutdown + * @{ + */ + // ********** private definitions ********** // GIO port A pin assignments for pins connected to CPLD @@ -28,31 +34,116 @@ #define SET_SAFETY_SHUTDOWN() gioSetBit( gioPORTB, SAFETY_GIO_PORT_PIN, PIN_SIGNAL_HIGH ) #define CLR_SAFETY_SHUTDOWN() gioSetBit( gioPORTB, SAFETY_GIO_PORT_PIN, PIN_SIGNAL_LOW ) -/************************************************************************* - * @brief initSafetyShutdown +// ********** private definitions ********** + +static BOOL safetyShutdownActivated = FALSE; ///< Status of safety shutdown signal. +static BOOL safetyShutdownOverrideResetState = FALSE; ///< Natural status of safety shutdown signal. Used to restore state on override reset. + +/*********************************************************************//** + * @brief * The initSafetyShutdown function initializes the Buttons module. * @details * Inputs : none * Outputs : Safety Shutdown module signal output set to initial state. - * @param none * @return none *************************************************************************/ void initSafetyShutdown( void ) { CLR_SAFETY_SHUTDOWN(); } -/************************************************************************* - * @brief activateSafetyShutdown +/*********************************************************************//** + * @brief * The activateSafetyShutdown function activates the safety shutdown signal. * @details * Inputs : none * Outputs : Safety Shutdown signal output set to active state. - * @param none * @return none *************************************************************************/ void activateSafetyShutdown( void ) { + safetyShutdownActivated = TRUE; SET_SAFETY_SHUTDOWN(); } +/*********************************************************************//** + * @brief + * The isSafetyShutdownActivated function returns whether the safety shutdown \n + * signal has been activated. + * @details + * Inputs : none + * Outputs : none + * @return safetyShutdownActivated + *************************************************************************/ +BOOL isSafetyShutdownActivated( void ) +{ + return safetyShutdownActivated; +} + +/*********************************************************************//** + * @brief + * The testSetSafetyShutdownOverride function overrides the HD safety \n + * shutdown. + * @details + * Inputs : none + * Outputs : HD safety shutdown overridden + * @param value : TRUE to activate safety shutdown, FALSE to de-activate it. + * @return TRUE if override successful, FALSE if not + *************************************************************************/ +BOOL testSetSafetyShutdownOverride( U32 value ) +{ + BOOL result = FALSE; + + if ( TRUE == isTestingActivated() ) + { + MOTOR_DIR_T dir; + + // remember natural state before override so we can reset + safetyShutdownOverrideResetState = safetyShutdownActivated; + // override safety shutdown signal + if ( value > 0 ) + { + activateSafetyShutdown(); + } + else + { + safetyShutdownActivated = FALSE; + CLR_SAFETY_SHUTDOWN(); + } + result = TRUE; + } + + return result; +} + +/*********************************************************************//** + * @brief + * The testResetSafetyShutdownOverride function resets the override of the \n + * HD safety shutdown. + * @details + * Inputs : none + * Outputs : shutdown override reset + * @return TRUE if override reset successful, FALSE if not + *************************************************************************/ +BOOL testResetSafetyShutdownOverride( void ) +{ + BOOL result = FALSE; + + if ( TRUE == isTestingActivated() ) + { + if ( TRUE == safetyShutdownOverrideResetState ) + { + activateSafetyShutdown(); + } + else + { + safetyShutdownActivated = FALSE; + CLR_SAFETY_SHUTDOWN(); + } + result = TRUE; + } + + return result; +} + +/**@}*/ Index: firmware/App/Drivers/SafetyShutdown.h =================================================================== diff -u -r9b262ba08e3180f121c3cf19d8d25e565183f87d -r7fa65a3aae9c4ef70a6e53f3e3bb20f0425bd681 --- firmware/App/Drivers/SafetyShutdown.h (.../SafetyShutdown.h) (revision 9b262ba08e3180f121c3cf19d8d25e565183f87d) +++ firmware/App/Drivers/SafetyShutdown.h (.../SafetyShutdown.h) (revision 7fa65a3aae9c4ef70a6e53f3e3bb20f0425bd681) @@ -1,4 +1,4 @@ -/************************************************************************** +/**********************************************************************//** * * Copyright (c) 2019-2020 Diality Inc. - All Rights Reserved. * @@ -19,9 +19,24 @@ #include "HDCommon.h" +/** + * @defgroup SafetyShutdown SafetyShutdown + * @brief Safety Shutdown module. Allows any module to activate the safety shutdown + * signal. + * + * @addtogroup SafetyShutdown + * @{ + */ + // ********** public function prototypes ********** void initSafetyShutdown( void ); void activateSafetyShutdown( void ); +BOOL isSafetyShutdownActivated( void ); +BOOL testSetSafetyShutdownOverride( U32 value ); +BOOL testResetSafetyShutdownOverride( void ); + +/**@}*/ + #endif Index: firmware/App/HDCommon.h =================================================================== diff -u -r2df21d2472a8d79d78af7e359518acf3614accc5 -r7fa65a3aae9c4ef70a6e53f3e3bb20f0425bd681 --- firmware/App/HDCommon.h (.../HDCommon.h) (revision 2df21d2472a8d79d78af7e359518acf3614accc5) +++ firmware/App/HDCommon.h (.../HDCommon.h) (revision 7fa65a3aae9c4ef70a6e53f3e3bb20f0425bd681) @@ -29,10 +29,10 @@ // ********** build switches ********** #define UF_TEST_ENABLED 1 -//#define UF_TEST_WITH_DG 1 +#define UF_TEST_WITH_DG 1 #ifndef _RELEASE_ #ifndef _VECTORCAST_ - #define RM46_EVAL_BOARD_TARGET 1 +// #define RM46_EVAL_BOARD_TARGET 1 // #define BREADBOARD_TARGET 1 // #define SIMULATE_UI 1 #define SKIP_POST 1 Index: firmware/App/Modes/ModeStandby.c =================================================================== diff -u -r2df21d2472a8d79d78af7e359518acf3614accc5 -r7fa65a3aae9c4ef70a6e53f3e3bb20f0425bd681 --- firmware/App/Modes/ModeStandby.c (.../ModeStandby.c) (revision 2df21d2472a8d79d78af7e359518acf3614accc5) +++ firmware/App/Modes/ModeStandby.c (.../ModeStandby.c) (revision 7fa65a3aae9c4ef70a6e53f3e3bb20f0425bd681) @@ -148,7 +148,7 @@ { if ( DG_RECIRCULATE_MODE_STATE_RECIRC_WATER == dgSubMode ) { - cmdStartDGFill( 1700 ); + cmdStartDGFill( 1700 ); // TODO - define this in pre-treatment mode when implemented. } } else if ( DG_MODE_FILL == dgOpMode ) @@ -175,7 +175,7 @@ { setStartReservoirVolume(); cmdSetDGActiveReservoir( DG_RESERVOIR_1 ); - requestNewOperationMode( MODE_PRES ); + requestNewOperationMode( MODE_TPAR ); } } } Index: firmware/App/Modes/ModeTreatment.c =================================================================== diff -u -r2df21d2472a8d79d78af7e359518acf3614accc5 -r7fa65a3aae9c4ef70a6e53f3e3bb20f0425bd681 --- firmware/App/Modes/ModeTreatment.c (.../ModeTreatment.c) (revision 2df21d2472a8d79d78af7e359518acf3614accc5) +++ firmware/App/Modes/ModeTreatment.c (.../ModeTreatment.c) (revision 7fa65a3aae9c4ef70a6e53f3e3bb20f0425bd681) @@ -494,6 +494,10 @@ pendingTreatmentTimeChange = trtTime; timeDiff = trtTime - ( (U32)( (F32)presTreatmentTimeSecs / (F32)SEC_PER_MIN ) + 1 ); } + else + { + pendingTreatmentTimeChange = 0; + } } else { Index: firmware/App/Services/SystemComm.c =================================================================== diff -u -r9d4666bf3064df18a6d935125d7a69e4e8234e84 -r7fa65a3aae9c4ef70a6e53f3e3bb20f0425bd681 --- firmware/App/Services/SystemComm.c (.../SystemComm.c) (revision 9d4666bf3064df18a6d935125d7a69e4e8234e84) +++ firmware/App/Services/SystemComm.c (.../SystemComm.c) (revision 7fa65a3aae9c4ef70a6e53f3e3bb20f0425bd681) @@ -1276,6 +1276,10 @@ handleTestDialOutLoadCellWeightOverrideRequest( message ); break; + case MSG_ID_HD_SAFETY_SHUTDOWN_OVERRIDE: + handleTestHDSafetyShutdownOverrideRequest( message ); + break; + default: // TODO - unrecognized message ID received - ignore break; Index: firmware/App/Services/SystemCommMessages.c =================================================================== diff -u -r2df21d2472a8d79d78af7e359518acf3614accc5 -r7fa65a3aae9c4ef70a6e53f3e3bb20f0425bd681 --- firmware/App/Services/SystemCommMessages.c (.../SystemCommMessages.c) (revision 2df21d2472a8d79d78af7e359518acf3614accc5) +++ firmware/App/Services/SystemCommMessages.c (.../SystemCommMessages.c) (revision 7fa65a3aae9c4ef70a6e53f3e3bb20f0425bd681) @@ -2061,3 +2061,15 @@ * @return none *************************************************************************/ DATA_ARRAY_OVERRIDE_HANDLER_FUNC_F32( F32, handleTestDialOutLoadCellWeightOverrideRequest, testSetDialOutLoadCellWeightOverride, testResetDialOutLoadCellWeightOverride ) + +/************************************************************************* + * @brief + * The handleTestHDSafetyShutdownOverrideRequest function handles a \n + * request to override the safety shutdown signal. + * @details + * Inputs : none + * Outputs : message handled + * @param message : a pointer to the message to handle + * @return none + *************************************************************************/ +DATA_OVERRIDE_HANDLER_FUNC_U32( U32, handleTestHDSafetyShutdownOverrideRequest, testSetSafetyShutdownOverride, testResetSafetyShutdownOverride ) Index: firmware/App/Services/SystemCommMessages.h =================================================================== diff -u -r2df21d2472a8d79d78af7e359518acf3614accc5 -r7fa65a3aae9c4ef70a6e53f3e3bb20f0425bd681 --- firmware/App/Services/SystemCommMessages.h (.../SystemCommMessages.h) (revision 2df21d2472a8d79d78af7e359518acf3614accc5) +++ firmware/App/Services/SystemCommMessages.h (.../SystemCommMessages.h) (revision 7fa65a3aae9c4ef70a6e53f3e3bb20f0425bd681) @@ -258,5 +258,8 @@ // MSG_ID_DIAL_OUT_LOAD_CELL_WEIGHT_OVERRIDE void handleTestDialOutLoadCellWeightOverrideRequest( MESSAGE_T *message ); +// MSG_ID_HD_SAFETY_SHUTDOWN_OVERRIDE: +void handleTestHDSafetyShutdownOverrideRequest( MESSAGE_T *message ); + #endif