Index: firmware/App/Controllers/BloodLeak.c =================================================================== diff -u -r205bcc6c6f404589f1e8c2b89aa5ac0c4cb400bd -rebcce5a89e3eb7d7d80145a9e6bba51923296a4b --- firmware/App/Controllers/BloodLeak.c (.../BloodLeak.c) (revision 205bcc6c6f404589f1e8c2b89aa5ac0c4cb400bd) +++ firmware/App/Controllers/BloodLeak.c (.../BloodLeak.c) (revision ebcce5a89e3eb7d7d80145a9e6bba51923296a4b) @@ -7,8 +7,8 @@ * * @file BloodLeak.c * -* @author (last) Sean Nash -* @date (last) 24-Aug-2023 +* @author (last) Dara Navaei +* @date (last) 13-Sep-2023 * * @author (original) Peman Montazemi * @date (original) 18-Mar-2021 @@ -397,6 +397,22 @@ /*********************************************************************//** * @brief + * The zeroBloodLeakReset function resets the commandRqstCount for all the + * zero blood leak commands. + * @details Inputs: none + * @details Outputs: none + * @return none + *************************************************************************/ +void zeroBloodLeakReset( void ) +{ + resetEmbModeCmdRqstCount( Z_EMB_MODE_CMD ); + resetEmbModeCmdRqstCount( G_EMB_MODE_CMD ); + resetEmbModeCmdRqstCount( Q_EMB_MODE_CMD ); + resetEmbModeCmdRqstCount( T_EMB_MODE_CMD ); +} + +/*********************************************************************//** + * @brief * The hasBloodLeakZeroSequenceFailed function returns TURE if the number * of times the zero sequence has failed. * @details Inputs: bloodLeakEmbModeCmd @@ -517,13 +533,12 @@ 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; + SEND_EVENT_WITH_2_U32_DATA( HD_EVENT_BLOOD_LEAK_NUM_OF_SET_POINT_CHECK_FAILURES, (U32)commandDRqstCount, state ) + if ( ( bloodLeakSetPoint != bloodLeakCalRecord.setPoint ) && ( TRUE == isCommandRespReady ) ) { - U08 commandDRqstCount = bloodLeakEmbModeCmd[ D_EMB_MODE_CMD ].commandRqstCount; - - SEND_EVENT_WITH_2_U32_DATA( HD_EVENT_BLOOD_LEAK_NUM_OF_SET_POINT_CHECK_FAILURES, (U32)commandDRqstCount, state ) - if ( commandDRqstCount < BLOOD_LEAK_EMB_MODE_MAX_NUM_CMD_TRIES ) { enqueueEmbModeCmd( D_EMB_MODE_CMD ); @@ -638,10 +653,7 @@ if ( FALSE == hasCmdSqncFailed ) { // Done with zero sequence, transition to other states - resetEmbModeCmdRqstCount( Z_EMB_MODE_CMD ); - resetEmbModeCmdRqstCount( G_EMB_MODE_CMD ); - resetEmbModeCmdRqstCount( Q_EMB_MODE_CMD ); - resetEmbModeCmdRqstCount( T_EMB_MODE_CMD ); + zeroBloodLeakReset(); bloodLeakSelfTestStatus = SELF_TEST_STATUS_PASSED; state = BLOOD_LEAK_NORMAL_STATE; }