Index: firmware/App/Controllers/BloodLeak.c =================================================================== diff -u -rb442cce89b3fde168017fa38c6f5f799da8b4510 -re63dcc4fa401c74ce82958f1dd4105fcf6fd1d60 --- firmware/App/Controllers/BloodLeak.c (.../BloodLeak.c) (revision b442cce89b3fde168017fa38c6f5f799da8b4510) +++ firmware/App/Controllers/BloodLeak.c (.../BloodLeak.c) (revision e63dcc4fa401c74ce82958f1dd4105fcf6fd1d60) @@ -90,7 +90,7 @@ #define BLOOD_LEAK_EMB_MODE_NUM_OF_INFO_CMDS 3 ///< Blood leak embedded mode number of informative commands. #define BLOOD_LEAK_FPGA_ERROR_TIMEOUT_MS ( 2 * MS_PER_SECOND ) ///< Blood leak embedded mode FPGA error timeout in milliseconds. -#define BLOOD_LEAK_RXFIFO_COUNT_MASK 0x03ff ///< Mask high order bits of blood leak sensor rx count +#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 @@ -346,6 +346,11 @@ case BLOOD_LEAK_EMB_MODE_WAIT_FOR_COMMAND_RESPONSE_STATE: bloodLeakEmbModeSubstate = handleBloodLeakEmbModeWaitForCommandResponseState(); break; + + default: + SET_ALARM_WITH_1_U32_DATA( ALARM_ID_HD_SOFTWARE_FAULT, SW_FAULT_ID_BLOOD_LEAK_EMBEDDED_MODE_INVALID_STATE ) + bloodLeakEmbModeSubstate = BLOOD_LEAK_EMB_MODE_WAIT_FOR_COMAND_STATE; + break; } } @@ -563,6 +568,10 @@ // All the commands shall be processed and have data prior to checking the results areCommandsReady &= bloodLeakEmbModeCmd[ i ].isCmdRespRdy; break; + + default: + // Do nothing with the rest of the commands + break; } } @@ -593,6 +602,10 @@ hasCmdSqncFailed |= hasCurrCmdFailed; failedCmd = ( TRUE == hasCurrCmdFailed ? i : NU_EMB_MODE_CMD ); break; + + default: + // Do nothing with the rest of the commands + break; } } @@ -926,7 +939,8 @@ { // If the element in the first index of the command sequence buffer is the read a byte request, set the variable to TRUE so the // wait for data to receive state knows that the request has been sent and it can read the byte. - U08 commandInIndex0 = bloodLeakEmbModeCmdSeq[ BLOOD_LEAK_EMB_MODE_REQUEST_RX_INDEX ][ BLOOD_LEAK_EMB_MODE_CMD_COL_INDEX ]; + U08 commandInIndex0 = bloodLeakEmbModeCmdSeq[ BLOOD_LEAK_EMB_MODE_REQUEST_RX_INDEX ][ BLOOD_LEAK_EMB_MODE_CMD_COL_INDEX ]; + bloodLeakEmbModeHasRxRqstBeenSent = ( BLOOD_LEAK_EMB_MODE_COMM_READ_REQST == commandInIndex0 ? TRUE : FALSE ); bloodLeakUARTCmdIndex = 0; bloodLeakEmbModeCmdSeqLength = 0; @@ -1249,7 +1263,8 @@ * @brief * The publishBloodLeakData function publishes blood leak data at the set interval. * @details Inputs: bloodLeakDataPublicationTimerCounter - * @details Outputs: bloodLeakDataPublicatimerCouonTinter + * @details Outputs: bloodLeakDataPublicatimerCouonTinter, bloodLeakPersistenceCtr, + * bloodLeakState * @return none *************************************************************************/ static void publishBloodLeakData( void ) @@ -1261,6 +1276,7 @@ data.bloodLeakStatus = (U32)getBloodLeakStatus(); data.bloodLeakState = (U32)bloodLeakState; + data.bloodLeakPersistentCounter = bloodLeakPersistenceCtr; bloodLeakDataPublicationCounter = 0; broadcastData( MSG_ID_HD_BLOOD_LEAK_DATA, COMM_BUFFER_OUT_CAN_HD_BROADCAST, (U08*)&data, sizeof( BLOOD_LEAK_DATA_T ) ); @@ -1491,7 +1507,20 @@ } } +/*********************************************************************//** + * @brief + * The getBloodLeakRxBytesAvailable function returns the number of received + * bytes available from FPGA. + * @details Inputs: none + * @details Outputs: none + * @return Number of received bytes available + *************************************************************************/ +static U16 getBloodLeakRxBytesAvailable( void ) +{ + return getFPGABloodLeakRxFIFOCount() & BLOOD_LEAK_RXFIFO_COUNT_MASK; +} + /************************************************************************* * TEST SUPPORT FUNCTIONS *************************************************************************/ @@ -1648,9 +1677,4 @@ return result; } -static U16 getBloodLeakRxBytesAvailable( void ) -{ - return getFPGABloodLeakRxFIFOCount() & BLOOD_LEAK_RXFIFO_COUNT_MASK; -} - /**@}*/ Index: firmware/App/Modes/Prime.c =================================================================== diff -u -ra37189e75de205982befcc91176f33c0523b03a8 -re63dcc4fa401c74ce82958f1dd4105fcf6fd1d60 --- firmware/App/Modes/Prime.c (.../Prime.c) (revision a37189e75de205982befcc91176f33c0523b03a8) +++ firmware/App/Modes/Prime.c (.../Prime.c) (revision e63dcc4fa401c74ce82958f1dd4105fcf6fd1d60) @@ -8,7 +8,7 @@ * @file Prime.c * * @author (last) Sean Nash -* @date (last) 03-Jun-2023 +* @date (last) 12-Jun-2023 * * @author (original) Quang Nguyen * @date (original) 08-Dec-2020 @@ -137,7 +137,7 @@ static U32 primeDialysateBypassStartTime; ///< Starting time of priming dialysate bypass circuit. static U32 steadyVolumeSamplingStartTime; ///< Load cell steady volume sampling interval starting time. static F32 minimumReservoirVolume; ///< Minimum reservoir volume in mL. -static U32 steadyVolumeCount; ///< Use to keep track the number of dVolume/dt < Threshold. +static U32 steadyVolumeCount; ///< Use to keep track the number of dVolume/dt < Threshold static BOOL bubbleClearEnded; ///< Bubble clear ended boolean signal. // ********** private function prototypes ********** @@ -184,16 +184,14 @@ * The transitionToPrime function prepares for transition to prime sub-mode. * This function will reset anything required before the start of priming sequence. * @details Inputs: none - * @details Outputs: currentPrimeState, wetSelfTestsResult, - * primeStartReqReceived, reservoirFilledStatus[], bubbleClearEnded, - * primeDialyzerBubbleClearState + * @details Outputs: currentPrimeState, wetSelfTestsResult, primeStartReqReceived, + * reservoirFilledStatus[], bubbleClearEnded, primeDialyzerBubbleClearState * @return none *************************************************************************/ void transitionToPrime( void ) { primeStartTime = getMSTimerCount(); primeFirstPurgePass = TRUE; - primeDialyzerBubbleClearState = PRIME_BUBBLE_CLEAR_READY_STATE; setAlarmUserActionEnabled( ALARM_USER_ACTION_RESUME, TRUE ); setAlarmUserActionEnabled( ALARM_USER_ACTION_RINSEBACK, FALSE ); @@ -217,10 +215,13 @@ resetPrimeFlags(); - if ( TRUE == getTestConfigStatus( TEST_CONFIG_USE_WET_CARTRIDGE ) ) + if ( getTestConfigStatus( TEST_CONFIG_USE_WET_CARTRIDGE ) != TRUE ) { - // If the use wet cartridge test configuration has been enabled skip the dialyzer - // bubble clear + bubbleClearEnded = FALSE; + primeDialyzerBubbleClearState = PRIME_BUBBLE_CLEAR_READY_STATE; + } + else + { // if using a wet cartridge, we do not want to do the bubble clearing of dialyzer in blood side prime states bubbleClearEnded = TRUE; primeDialyzerBubbleClearState = PRIME_BUBBLE_CLEAR_COMPLETE_STATE; } @@ -599,7 +600,10 @@ purgeAirValvesBloodPumpControl(); purgeAirTimeOutStartTime = getMSTimerCount(); primeSalineDialyzerBubbleClearStartTime = getMSTimerCount(); - primeDialyzerBubbleClearState = PRIME_BUBBLE_CLEAR_READY_STATE; + if ( getTestConfigStatus( TEST_CONFIG_USE_WET_CARTRIDGE ) != TRUE ) + { + primeDialyzerBubbleClearState = PRIME_BUBBLE_CLEAR_READY_STATE; + } if ( TRUE == doesAlarmStatusIndicateStop() ) { @@ -610,7 +614,6 @@ return state; } - /*********************************************************************//** * @brief * The handlePrimePurgeAirState function checks for air trap level and moves @@ -994,6 +997,7 @@ if ( TRUE == isWetSelfTestsPassed() ) { + setCurrent4thLevelState( NO_SUB_STATE ); state = HD_PRIME_COMPLETE; } else if ( TRUE == doesAlarmStatusIndicateStop() )