Index: firmware/App/Controllers/BloodLeak.c =================================================================== diff -u -r9ded16038a0d6dd844da697aaf03505ec3ed335a -rcf72c9fc8fd10c06bec1981cb26c1e653b7e8d92 --- firmware/App/Controllers/BloodLeak.c (.../BloodLeak.c) (revision 9ded16038a0d6dd844da697aaf03505ec3ed335a) +++ firmware/App/Controllers/BloodLeak.c (.../BloodLeak.c) (revision cf72c9fc8fd10c06bec1981cb26c1e653b7e8d92) @@ -691,6 +691,8 @@ // Pass self-test if entire sequence was successful if ( FALSE == hasCmdSqncFailed ) { + // Done with the commands, request a fresh intensity read to check it range + enqueueEmbModeCmd( I_EMB_MODE_CMD ); state = BLOOD_LEAK_VERIFY_INTENSITY_AFTER_ZEROING_STATE; } // If not successful, retry if we've not run out @@ -1664,24 +1666,30 @@ *************************************************************************/ static void enqueueInfoEmbModeCmds( void ) { - if ( ( TRUE == didTimeout( bloodLeakEmbModeInfoCmdEnqLastTimeStamp, BLOOD_LEAK_EMB_MODE_INFO_CMD_TIMEOUT_MS ) ) && - ( bloodLeakState >= BLOOD_LEAK_INIT_STATE ) && ( bloodLeakState != BLOOD_LEAK_CHECK_ZERO_AND_SELF_TEST_STATE ) ) + if ( TRUE == didTimeout( bloodLeakEmbModeInfoCmdEnqLastTimeStamp, BLOOD_LEAK_EMB_MODE_INFO_CMD_TIMEOUT_MS ) ) { - // 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 ) + switch ( bloodLeakState ) { - enqueueEmbModeCmd( I_EMB_MODE_CMD ); - } - else if ( 1 == bloodLeakEmbModeInfoCmdCounter ) - { - enqueueEmbModeCmd( V_EMB_MODE_CMD ); - } + case BLOOD_LEAK_INIT_STATE: + case BLOOD_LEAK_NORMAL_STATE: + case BLOOD_LEAK_RECOVER_BLOOD_DETECT_STATE: + // 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 ); + } + else if ( 1 == bloodLeakEmbModeInfoCmdCounter ) + { + enqueueEmbModeCmd( V_EMB_MODE_CMD ); + } - // Set the timer for the next time out to enqueue - // Reset the counter. The counter starts from 0 - bloodLeakEmbModeInfoCmdEnqLastTimeStamp = getMSTimerCount(); - bloodLeakEmbModeInfoCmdCounter = INC_WRAP( bloodLeakEmbModeInfoCmdCounter, 0, BLOOD_LEAK_EMB_MODE_NUM_OF_INFO_CMDS - 1 ); + // Set the timer for the next time out to enqueue + // Reset the counter. The counter starts from 0 + bloodLeakEmbModeInfoCmdEnqLastTimeStamp = getMSTimerCount(); + bloodLeakEmbModeInfoCmdCounter = INC_WRAP( bloodLeakEmbModeInfoCmdCounter, 0, BLOOD_LEAK_EMB_MODE_NUM_OF_INFO_CMDS - 1 ); + break; + } } } @@ -1742,7 +1750,7 @@ *************************************************************************/ static void processBloodLeakIntensityData( void ) { - if ( TRUE == bloodLeakEmbModeCmd[ I_EMB_MODE_CMD ].isCmdRespRdy ) + if ( ( TRUE == bloodLeakEmbModeCmd[ I_EMB_MODE_CMD ].isCmdRespRdy ) && ( bloodLeakState != BLOOD_LEAK_VERIFY_INTENSITY_AFTER_ZEROING_STATE ) ) { U32 index = bloodLeakZeroingStatus.rawIntensityNextIndex; U32 indexValue = bloodLeakZeroingStatus.rawIntensity[ index ];