Index: firmware/App/Controllers/BloodLeak.c =================================================================== diff -u -r06fc887b00bc2ff2398074e7ee1a2c264b6a2809 -raa630bf86b0557ab2a74f47df5db679ea5b13238 --- firmware/App/Controllers/BloodLeak.c (.../BloodLeak.c) (revision 06fc887b00bc2ff2398074e7ee1a2c264b6a2809) +++ firmware/App/Controllers/BloodLeak.c (.../BloodLeak.c) (revision aa630bf86b0557ab2a74f47df5db679ea5b13238) @@ -93,7 +93,7 @@ #define BLOOD_LEAK_RXFIFO_COUNT_MASK 0x03FF ///< Mask high order bits of blood leak sensor rx count #define MAX_BLOOD_LEAK_COMM_FAILURES_WINDOW_MS ( 1 * SEC_PER_MIN * MS_PER_SECOND ) ///< Blood Leak comm failures window -#define MAX_BLOOD_LEAK_COMM_FAILURES 3 ///< Blood Leak maximum comm failures per MAX_BLOOD_LEAK_COMM_FAILURES_WINDOW_MS +#define MAX_BLOOD_LEAK_COMM_FAILURES 10 ///< Blood Leak maximum comm failures per MAX_BLOOD_LEAK_COMM_FAILURES_WINDOW_MS /// Defined states for the blood leak detector state machine. typedef enum BloodLeakStates @@ -600,7 +600,6 @@ // Enqueue the zero and self test sequence (Z->G->Z->Q->T) BOOL hasCmdSqncFailed = FALSE; BOOL hasCurrCmdFailed = FALSE; - U08 failedCmd; for ( i = 0; i < NUM_OF_EMB_CMDS; i++ ) { @@ -612,14 +611,12 @@ // Check to see if any of the command responses failed hasCurrCmdFailed = ( BLOOD_LEAK_EMB_MODE_PASS_ASCII == bloodLeakEmbModeCmd[ i ].commandResp ? FALSE : TRUE ); hasCmdSqncFailed |= hasCurrCmdFailed; - failedCmd = ( TRUE == hasCurrCmdFailed ? i : NU_EMB_MODE_CMD ); break; case G_EMB_MODE_CMD: // G command will return a value that has to be greater than 0 hasCurrCmdFailed = ( bloodLeakEmbModeCmd[ i ].commandResp > 0 ? FALSE : TRUE ); hasCmdSqncFailed |= hasCurrCmdFailed; - failedCmd = ( TRUE == hasCurrCmdFailed ? i : NU_EMB_MODE_CMD ); break; default: @@ -792,8 +789,10 @@ if ( FALSE == isEmbModeCmdQueueEmpty() ) { + U08 commandASCII = 0; + bloodLeakEmbModeRqstedCmd = dequeueEmbModeCmd(); - U08 commandASCII = bloodLeakEmbModeCmd[ bloodLeakEmbModeRqstedCmd ].commandASCII; + commandASCII = bloodLeakEmbModeCmd[ bloodLeakEmbModeRqstedCmd ].commandASCII; switch( bloodLeakEmbModeRqstedCmd ) { @@ -1060,13 +1059,14 @@ sendBloodLeakEmbeddedModeCommandResponse( bloodLeakEmbModeRqstedCmd, length, bloodLeakEmbModeRespBuffer ); - bloodLeakEmbModeRqstedCmd = NU_EMB_MODE_CMD; - state = BLOOD_LEAK_EMB_MODE_WAIT_FOR_COMAND_STATE; - if ( TRUE == incTimeWindowedCount( TIME_WINDOWED_COUNT_BLOOD_LEAK_COMM_ERROR ) ) { - //SET_ALARM_WITH_2_U32_DATA( ALARM_ID_HD_BLOOD_LEAK_FPGA_FAULT, MAX_BLOOD_LEAK_COMM_FAILURES, (U32)MAX_BLOOD_LEAK_COMM_FAILURES_WINDOW_MS ) + SET_ALARM_WITH_2_U32_DATA( ALARM_ID_HD_BLOOD_LEAK_FPGA_FAULT, (U32)bloodLeakEmbModeRqstedCmd, (U32)MAX_BLOOD_LEAK_COMM_FAILURES_WINDOW_MS ) } + + bloodLeakEmbModeRqstedCmd = NU_EMB_MODE_CMD; + state = BLOOD_LEAK_EMB_MODE_WAIT_FOR_COMAND_STATE; + } return state; @@ -1507,8 +1507,8 @@ if ( ( TRUE == didTimeout( bloodLeakEmbModeInfoCmdEnqLastTimeStamp, BLOOD_LEAK_EMB_MODE_INFO_CMD_TIMOUE_MS ) ) && ( bloodLeakState >= BLOOD_LEAK_INIT_STATE ) && ( bloodLeakState != BLOOD_LEAK_CHECK_ZERO_AND_SELF_TEST_STATE ) ) { - // Enqueue the next command. Make sure the blood leak state is greater than init state since in the post state and - // check for set point, other commands are being enqueued for checking + // Enqueue the next command. Make sure the blood leak state is greater than init state and it is not the zero and self test state + // to make sure setting the embedded mode and getting the set point and zero sequence should go undisturbed. if ( 0 == bloodLeakEmbModeInfoCmdCounter ) { enqueueEmbModeCmd( I_EMB_MODE_CMD ); Index: firmware/App/Controllers/BloodLeak.h =================================================================== diff -u -r06fc887b00bc2ff2398074e7ee1a2c264b6a2809 -raa630bf86b0557ab2a74f47df5db679ea5b13238 --- firmware/App/Controllers/BloodLeak.h (.../BloodLeak.h) (revision 06fc887b00bc2ff2398074e7ee1a2c264b6a2809) +++ firmware/App/Controllers/BloodLeak.h (.../BloodLeak.h) (revision aa630bf86b0557ab2a74f47df5db679ea5b13238) @@ -44,10 +44,10 @@ /// Blood leak detector data publish typedef struct { - U32 bloodLeakStatus; ///< Blood leak detector status - U32 bloodLeakState; ///< Blood leak detector state - U32 bloodLeakPersistentCounter; ///< Blood leak detector persistent counter - U32 bloodLeakSerialCommState; ///< Blood leak detector serial communication state + U32 bloodLeakStatus; ///< Blood leak detector status. + U32 bloodLeakState; ///< Blood leak detector state. + U32 bloodLeakPersistentCounter; ///< Blood leak detector persistent counter. + U32 bloodLeakSerialCommState; ///< Blood leak detector serial communication state. } BLOOD_LEAK_DATA_T; // ********** public function prototypes **********