Index: firmware/App/Monitors/BloodLeak.c =================================================================== diff -u -r55b07134d116ff3068a6b5d5cae28bce7100adb3 -rd4ff0e628e0cd7866272a8a8a6f26db97286e3b4 --- firmware/App/Monitors/BloodLeak.c (.../BloodLeak.c) (revision 55b07134d116ff3068a6b5d5cae28bce7100adb3) +++ firmware/App/Monitors/BloodLeak.c (.../BloodLeak.c) (revision d4ff0e628e0cd7866272a8a8a6f26db97286e3b4) @@ -1,19 +1,14 @@ /************************************************************************** * -<<<<<<< HEAD * Copyright (c) 2025-2026 Diality Inc. - All Rights Reserved. -======= -* Copyright (c) 2025-2025 Diality Inc. - All Rights Reserved. ->>>>>>> staging * * 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 BloodLeak.c * -* @author (last) Dara Navaei -<<<<<<< HEAD -* @date (last) 10-Sep-2024 +* @author (last) Jashwant Gantyada +* @date (last) 07-Jan-2026 * * @author (original) Dara Navaei * @date (original) 10-Sep-2024 @@ -128,7 +123,6 @@ U32 driftUpperRangeStatus; ///< Blood leak drift upper range status. } BLOOD_LEAK_ZEROING_STATUS_T; - // ********** private data ********** static BLOOD_LEAK_STATE_T bloodLeakState; ///< Current state of blood leak state machine. @@ -185,8 +179,6 @@ *************************************************************************/ void initBloodLeak( void ) { - // Initialize the embedded mode specifications - //initEmbModeSpecs(); initBloodLeakDriver(); bloodLeakDataPublicationCounter = DATA_PUBLISH_COUNTER_START_COUNT; @@ -346,10 +338,10 @@ *************************************************************************/ BOOL hasBloodLeakZeroSequenceFailed( void ) { + EMB_MODE_CMD_T cmdSpec; // The zero sequence contains Z->G->Z->Q->T and each of the commands has a request counter but for checking whether the // zero sequence has failed only the Z command is checked. When the zero sequence is enqueued, all of the them enqueued so they are // at the same request count number. - EMB_MODE_CMD_T cmdSpec; getBloodLeakEmbCmdMode(G_EMB_MODE_CMD, &cmdSpec); BOOL status = (cmdSpec.commandRqstCount > BLOOD_LEAK_EMB_MODE_MAX_NUM_CMD_TRIES ? TRUE : FALSE); @@ -477,10 +469,9 @@ static BLOOD_LEAK_STATE_T handleBloodLeakWaitForPostState( void ) { BLOOD_LEAK_STATE_T state = BLOOD_LEAK_WAIT_FOR_POST_STATE; - BOOL isEmbModeReady = FALSE; - //U32 cmdResp = bloodLeakEmbModeCmd[ CS_EMB_MODE_CMD ].commandResp; - EMB_MODE_CMD_T csCmdSpec; + + BOOL isEmbModeReady = FALSE; getBloodLeakEmbCmdMode( CS_EMB_MODE_CMD, &csCmdSpec ); U32 cmdResp = csCmdSpec.commandResp; @@ -527,10 +518,8 @@ static BLOOD_LEAK_STATE_T handleBloodLeakCheckSetPointState( void ) { BLOOD_LEAK_STATE_T state = BLOOD_LEAK_CHECK_SET_POINT_STATE; - //U16 bloodLeakSetPoint = bloodLeakEmbModeCmd[ D_EMB_MODE_CMD ].commandResp; - //BOOL isCommandRespReady = bloodLeakEmbModeCmd[ D_EMB_MODE_CMD ].isCmdRespRdy; - //U08 commandDRqstCount = bloodLeakEmbModeCmd[ D_EMB_MODE_CMD ].commandRqstCount; EMB_MODE_CMD_T dCmdSpec; + getBloodLeakEmbCmdMode(D_EMB_MODE_CMD, &dCmdSpec); BOOL isCommandRespReady = dCmdSpec.isCmdRespRdy; U08 commandDRqstCount = dCmdSpec.commandRqstCount; @@ -591,11 +580,12 @@ *************************************************************************/ static BLOOD_LEAK_STATE_T handleBloodLeakCheckZeroAndSelfTestState( void ) { - U08 i; BLOOD_LEAK_STATE_T state = BLOOD_LEAK_CHECK_ZERO_AND_SELF_TEST_STATE; - BOOL areCommandsReady = TRUE; EMB_MODE_CMD_T spec; + U08 i; + BOOL areCommandsReady = TRUE; + // Check to see if all commands in sequence have been responded to for ( i = 0; i < NUM_OF_EMB_CMDS; i++ ) { @@ -606,8 +596,6 @@ case Q_EMB_MODE_CMD: case T_EMB_MODE_CMD: // All the commands shall be processed and have data prior to checking the results - //areCommandsReady &= bloodLeakEmbModeCmd[ i ].isCmdRespRdy; - //break; getBloodLeakEmbCmdMode( (BLOOD_LEAK_EMB_MODE_CMD_T)i, &spec ); areCommandsReady &= spec.isCmdRespRdy; break; @@ -633,17 +621,13 @@ case Q_EMB_MODE_CMD: case T_EMB_MODE_CMD: // Check to see if any of the command responses failed - //hasCurrCmdFailed = ( BLOOD_LEAK_EMB_MODE_PASS_ASCII == bloodLeakEmbModeCmd[ i ].commandResp ? FALSE : TRUE ); - //hasCmdSqncFailed |= hasCurrCmdFailed; getBloodLeakEmbCmdMode( (BLOOD_LEAK_EMB_MODE_CMD_T)i, &spec ); hasCurrCmdFailed = ( BLOOD_LEAK_EMB_MODE_PASS_ASCII == spec.commandResp ? FALSE : TRUE ); hasCmdSqncFailed |= hasCurrCmdFailed; 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; getBloodLeakEmbCmdMode( (BLOOD_LEAK_EMB_MODE_CMD_T)i, &spec ); hasCurrCmdFailed = ( spec.commandResp > 0 ? FALSE : TRUE ); hasCmdSqncFailed |= hasCurrCmdFailed; @@ -685,8 +669,8 @@ static BLOOD_LEAK_STATE_T handleBloodLeakVerifyIntensityAfterZeroingState( void ) { BLOOD_LEAK_STATE_T state = BLOOD_LEAK_VERIFY_INTENSITY_AFTER_ZEROING_STATE; - EMB_MODE_CMD_T iCmdSpec; + getBloodLeakEmbCmdMode( I_EMB_MODE_CMD, &iCmdSpec ); if ( TRUE == iCmdSpec.isCmdRespRdy ) { @@ -844,7 +828,6 @@ return state; } - /*********************************************************************//** * @brief * The publishBloodLeakData function publishes blood leak data at the set interval. @@ -878,7 +861,6 @@ } } - /*********************************************************************//** * @brief * The getFPGABloodDetectProcessedStatus function returns the status of the @@ -924,6 +906,7 @@ static void processBloodLeakIntensityData( void ) { EMB_MODE_CMD_T iCmdSpec; + getBloodLeakEmbCmdMode( I_EMB_MODE_CMD, &iCmdSpec ); if ( ( TRUE == iCmdSpec.isCmdRespRdy ) && ( bloodLeakState != BLOOD_LEAK_VERIFY_INTENSITY_AFTER_ZEROING_STATE ) ) @@ -940,6 +923,7 @@ resetEmbModeCmdRespConsumedFlag( I_EMB_MODE_CMD ); } } + /*********************************************************************//** * @brief * The isLowerRangeIntensityDriftZeroingNeeded function checks whether blood @@ -950,6 +934,7 @@ *************************************************************************/ static BOOL isLowerRangeIntensityDriftZeroingNeeded( void ) { + EMB_MODE_CMD_T cmdSpec; /* * Nominal intensity = 930 * Set point is queried from the blood leak detector @@ -960,8 +945,6 @@ */ BOOL status = FALSE; BOOL isZeroingNeeded = TRUE; - //U32 setPoint = bloodLeakEmbModeCmd[ D_EMB_MODE_CMD ].commandResp; - EMB_MODE_CMD_T cmdSpec; getBloodLeakEmbCmdMode(D_EMB_MODE_CMD, &cmdSpec); U32 setPoint = cmdSpec.commandResp; F32 driftMinFromTop = BLD_NOMINAL_INTENSITY - ( setPoint * BLD_MAX_INTENSITY_OUT_OF_RANGE ); @@ -1052,6 +1035,7 @@ * TEST SUPPORT FUNCTIONS *************************************************************************/ + /*********************************************************************//** * @brief * The testBloodLeakDataPublishIntervalOverride function overrides the