Index: firmware/App/Controllers/BloodLeak.c =================================================================== diff -u -rd9ce84753986b57d6105565a268a1932e275b88f -rce45405bd0094f54a599a1906e201622347fd15a --- firmware/App/Controllers/BloodLeak.c (.../BloodLeak.c) (revision d9ce84753986b57d6105565a268a1932e275b88f) +++ firmware/App/Controllers/BloodLeak.c (.../BloodLeak.c) (revision ce45405bd0094f54a599a1906e201622347fd15a) @@ -204,6 +204,8 @@ static U32 bloodLeakEmbModeCmdEnqueueCount; ///< Blood leak embedded mode command enqueue count. static U32 bloodLeakEmbModeInfoCmdEnqLastTimeStamp; ///< Blood leak embedded mode informative command (i.e. I, V, D) timer. static U32 bloodLeakEmbModeInfoCmdCounter; ///< Blood leak embedded mode informative command counter. +static OVERRIDE_U32_T bloodLeakEmbModeIntensityOverride; ///< Blood leak embedded mode intensity override. +static OVERRIDE_U32_T bloodLeakEmbModeDetectOverride; ///< Blood leak embedded mode blood detect override. // ********** private function prototypes ********** @@ -235,6 +237,7 @@ static BOOL isDialysateLineInBypass( void ); static void processBloodLeakIntensityData( void ); static void resetEmbModeCmdRespConsumedFlag( U08 cmd ); +static U32 getEmbModeInfoValue( U08 cmd ); /*********************************************************************//** * @brief @@ -721,7 +724,7 @@ if ( TRUE == bloodLeakEmbModeCmd[ I_EMB_MODE_CMD ].isCmdRespRdy ) { - U32 intensity = bloodLeakEmbModeCmd[ I_EMB_MODE_CMD ].commandResp; + U32 intensity = getEmbModeInfoValue( I_EMB_MODE_CMD ); state = BLOOD_LEAK_INIT_STATE; bloodLeakSelfTestStatus = SELF_TEST_STATUS_FAILED; @@ -1443,8 +1446,8 @@ data.bloodLeakState = (U32)bloodLeakState; data.bloodLeakPersistentCounter = bloodLeakPersistenceCtr; data.bloodLeakSerialCommState = bloodLeakEmbModeSubstate; - data.bloodLeakIntensity = bloodLeakEmbModeCmd[ I_EMB_MODE_CMD ].commandResp; - data.bloodLeakDetect = bloodLeakEmbModeCmd[ V_EMB_MODE_CMD ].commandResp; + data.bloodLeakIntensity = getEmbModeInfoValue( I_EMB_MODE_CMD ); + data.bloodLeakDetect = getEmbModeInfoValue( V_EMB_MODE_CMD ); data.bloodLeakIntensityMovingAvg = bloodLeakZeroingStatus.intensityMovingAverage; bloodLeakDataPublicationCounter = 0; @@ -1760,7 +1763,7 @@ { U32 index = bloodLeakZeroingStatus.rawIntensityNextIndex; U32 indexValue = bloodLeakZeroingStatus.rawIntensity[ index ]; - U32 newIntensity = bloodLeakEmbModeCmd[ I_EMB_MODE_CMD ].commandResp; + U32 newIntensity = getEmbModeInfoValue( I_EMB_MODE_CMD ); bloodLeakZeroingStatus.rawIntensity[ index ] = newIntensity; bloodLeakZeroingStatus.intensityRunningSum = bloodLeakZeroingStatus.intensityRunningSum - indexValue + newIntensity; @@ -1784,6 +1787,44 @@ bloodLeakEmbModeCmd[ cmd ].isCmdRespRdy = FALSE; } +/*********************************************************************//** + * @brief + * The getEmbModeInfoValue function gets the data of the embedded info cmds. + * This is only for the info values (I, V). + * @details Inputs: bloodLeakEmbModeIntensityOverride, + * bloodLeakEmbModeDetectOverride + * @details Outputs: bloodLeakEmbModeCmd + * @param cmd the command to get the read data + * @return the value of the read command + *************************************************************************/ +static U32 getEmbModeInfoValue( U08 cmd ) +{ + U32 value = bloodLeakEmbModeCmd[ cmd ].commandResp; + + switch( cmd ) + { + case I_EMB_MODE_CMD: + if ( OVERRIDE_KEY == bloodLeakEmbModeIntensityOverride.override ) + { + value = bloodLeakEmbModeIntensityOverride.ovData; + } + break; + + case V_EMB_MODE_CMD: + if ( OVERRIDE_KEY == bloodLeakEmbModeDetectOverride.override ) + { + value = bloodLeakEmbModeDetectOverride.ovData; + } + break; + + default: + // Do nothing with the rest of the commands + break; + } + + return value; +} + /************************************************************************* * TEST SUPPORT FUNCTIONS *************************************************************************/ @@ -1940,4 +1981,84 @@ return result; } +/*********************************************************************//** + * @brief + * The testSetBloodLeakEmbeddedModeInfoOverride function overrides the + * blood leak embedded mode info values. + * @details Inputs: none + * @details Outputs: bloodLeakEmbModeIntensityOverride, + * bloodLeakEmbModeDetectOverride + * @param command the command to override its value + * @param value the value that the command is overridden to + * @return TRUE if override successful, FALSE if not + *************************************************************************/ +BOOL testSetBloodLeakEmbeddedModeInfoOverride( U08 command, U32 value ) +{ + BOOL result = FALSE; + + if ( ( TRUE == isTestingActivated() ) && ( command < NUM_OF_EMB_CMDS ) ) + { + switch( command ) + { + case I_EMB_MODE_CMD: + result = TRUE; + bloodLeakEmbModeIntensityOverride.ovData = value; + bloodLeakEmbModeIntensityOverride.override = OVERRIDE_KEY; + break; + + case V_EMB_MODE_CMD: + result = TRUE; + bloodLeakEmbModeDetectOverride.ovData = value; + bloodLeakEmbModeDetectOverride.override = OVERRIDE_KEY; + break; + + default: + // Do nothing with the rest of the commands. They cannot be overridden. + break; + } + } + + return result; +} + +/*********************************************************************//** + * @brief + * The testResetBloodLeakEmbeddedModeInfoOverride function reset the overrides + * of the blood leak embedded mode info values. + * @details Inputs: none + * @details Outputs: bloodLeakEmbModeIntensityOverride, + * bloodLeakEmbModeDetectOverride + * @param command the command to reset its override value + * @param value the value that the command's value override is reset + * @return TRUE if override successful, FALSE if not + *************************************************************************/ +BOOL testResetBloodLeakEmbeddedModeInfoOverride( U08 command ) +{ + BOOL result = FALSE; + + if ( ( TRUE == isTestingActivated() ) && ( command < NUM_OF_EMB_CMDS ) ) + { + switch( command ) + { + case I_EMB_MODE_CMD: + result = TRUE; + bloodLeakEmbModeIntensityOverride.ovData = 0; + bloodLeakEmbModeIntensityOverride.override = OVERRIDE_RESET; + break; + + case V_EMB_MODE_CMD: + result = TRUE; + bloodLeakEmbModeDetectOverride.ovData = 0; + bloodLeakEmbModeDetectOverride.override = OVERRIDE_RESET; + break; + + default: + // Do nothing with the rest of the commands. They cannot be overridden. + break; + } + } + + return result; +} + /**@}*/ Index: firmware/App/Controllers/BloodLeak.h =================================================================== diff -u -r9ded16038a0d6dd844da697aaf03505ec3ed335a -rce45405bd0094f54a599a1906e201622347fd15a --- firmware/App/Controllers/BloodLeak.h (.../BloodLeak.h) (revision 9ded16038a0d6dd844da697aaf03505ec3ed335a) +++ firmware/App/Controllers/BloodLeak.h (.../BloodLeak.h) (revision ce45405bd0094f54a599a1906e201622347fd15a) @@ -79,6 +79,9 @@ BOOL testSetBloodLeak2EmbeddedMode( void ); BOOL testSetBloodLeakEmbeddedModeCommand( U08 command, U16 setPointPayload ); +BOOL testSetBloodLeakEmbeddedModeInfoOverride( U08 command, U32 value ); +BOOL testResetBloodLeakEmbeddedModeInfoOverride( U08 command ); + /**@}*/ #endif Index: firmware/App/Services/SystemComm.c =================================================================== diff -u -r8cf0fafa78ce14b5dbdf95510e957846660ac2b9 -rce45405bd0094f54a599a1906e201622347fd15a --- firmware/App/Services/SystemComm.c (.../SystemComm.c) (revision 8cf0fafa78ce14b5dbdf95510e957846660ac2b9) +++ firmware/App/Services/SystemComm.c (.../SystemComm.c) (revision ce45405bd0094f54a599a1906e201622347fd15a) @@ -1844,6 +1844,10 @@ handleSetHDInstitutionalRecord( message ); break; + case MSG_ID_HD_BLOOD_LEAK_EMB_MODE_INFO_VALUES_OVERRIDE: + handleBloodLeakEmbModeInfoValuesOverride( message ); + break; + // The default cannot be reached in VectorCAST since the cases are run in a for loop default: // Unrecognized message ID received - ignore Index: firmware/App/Services/SystemCommMessages.c =================================================================== diff -u -refead43ba16292aa173f72ebfa2b73aebfd2a587 -rce45405bd0094f54a599a1906e201622347fd15a --- firmware/App/Services/SystemCommMessages.c (.../SystemCommMessages.c) (revision efead43ba16292aa173f72ebfa2b73aebfd2a587) +++ firmware/App/Services/SystemCommMessages.c (.../SystemCommMessages.c) (revision ce45405bd0094f54a599a1906e201622347fd15a) @@ -8895,4 +8895,36 @@ sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, status ); } +/*********************************************************************//** +* @brief +* The handleBloodLeakEmbModeInfoValuesOverride function handles the blood +* leak embedded mode info commands override. +* @details Inputs: none +* @details Outputs: message handled +* @param message a pointer to the message to handle +* @return none +*************************************************************************/ +void handleBloodLeakEmbModeInfoValuesOverride( MESSAGE_T* message ) +{ + TEST_OVERRIDE_ARRAY_PAYLOAD_T payload; + BOOL result = FALSE; + + // verify payload length + if ( sizeof( TEST_OVERRIDE_ARRAY_PAYLOAD_T ) == message->hdr.payloadLen ) + { + memcpy( &payload, message->payload, sizeof( TEST_OVERRIDE_ARRAY_PAYLOAD_T ) ); + if ( FALSE == payload.reset ) + { + result = testSetBloodLeakEmbeddedModeInfoOverride( payload.index, payload.state.u32 ); + } + else + { + result = testResetBloodLeakEmbeddedModeInfoOverride( payload.index ); + } + } + + // respond to request + sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); +} + /**@}*/ Index: firmware/App/Services/SystemCommMessages.h =================================================================== diff -u -ra1a0187daedaf2c12e6f9eccfbf9e423d952e029 -rce45405bd0094f54a599a1906e201622347fd15a --- firmware/App/Services/SystemCommMessages.h (.../SystemCommMessages.h) (revision a1a0187daedaf2c12e6f9eccfbf9e423d952e029) +++ firmware/App/Services/SystemCommMessages.h (.../SystemCommMessages.h) (revision ce45405bd0094f54a599a1906e201622347fd15a) @@ -1033,6 +1033,9 @@ // MSG_ID_HD_SET_INSTITUTIONAL_RECORD void handleSetHDInstitutionalRecord( MESSAGE_T *message ); +// MSG_ID_HD_BLOOD_LEAK_EMB_MODE_INFO_VALUES_OVERRIDE +void handleBloodLeakEmbModeInfoValuesOverride( MESSAGE_T* message ); + /**@}*/ #endif