Index: firmware/App/Controllers/DGInterface.c =================================================================== diff -u -r1978e8476dc44688ed69531c236c154829ab8a76 -r1c04924590760ca29e1c9fe19bca65ec5ce428fe --- firmware/App/Controllers/DGInterface.c (.../DGInterface.c) (revision 1978e8476dc44688ed69531c236c154829ab8a76) +++ firmware/App/Controllers/DGInterface.c (.../DGInterface.c) (revision 1c04924590760ca29e1c9fe19bca65ec5ce428fe) @@ -8,12 +8,14 @@ * @file DGInterface.c * * @author (last) Dara Navaei -* @date (last) 13-Jul-2022 +* @date (last) 15-Jul-2022 * * @author (original) Sean * @date (original) 08-Apr-2020 * ***************************************************************************/ + +#include // To check for NaN #include "DialInFlow.h" #include "Dialysis.h" @@ -482,6 +484,12 @@ *************************************************************************/ void setDialysateFlowData( F32 flowRate ) { + // Check if the sent value by DG is a NaN + if ( isnan( flowRate ) ) + { + flowRate = 0.0; + } + dgDialysateFlowRateMlMin = flowRate; dgDialysateFlowDataFreshFlag = TRUE; } Index: firmware/App/Controllers/DGInterface.h =================================================================== diff -u -r481c81493ac2bf73d1d371cabee016ab8ad8d06c -r1c04924590760ca29e1c9fe19bca65ec5ce428fe --- firmware/App/Controllers/DGInterface.h (.../DGInterface.h) (revision 481c81493ac2bf73d1d371cabee016ab8ad8d06c) +++ firmware/App/Controllers/DGInterface.h (.../DGInterface.h) (revision 1c04924590760ca29e1c9fe19bca65ec5ce428fe) @@ -8,7 +8,7 @@ * @file DGInterface.h * * @author (last) Dara Navaei -* @date (last) 13-Jul-2022 +* @date (last) 15-Jul-2022 * * @author (original) Sean * @date (original) 08-Apr-2020 @@ -66,6 +66,9 @@ F32 tempAvgFill; ///< Average fill temperature in C F32 tempLastFill; ///< Last fill temperature in C F32 timereservoirFillMS; ///< Reservoir fill time in milliseconds + F32 tempRsrvr0ActualTrimmer; ///< Temperature actual reservoir in C. + F32 tempFillMixAvgTrimmer; ///< Temperature fill mix average trimmer in C. + F32 tempRsrvrEndFillTrimmer; ///< Temperature reservoir end fill trimmer in C. } DG_RESERVOIRS_DATA_PAYLOAD_T; /// Payload record structure for DG temperature sensors data message. Index: firmware/App/Modes/SelfTests.c =================================================================== diff -u -r1df7142ce598ed2ed37958df29068ff1a957b11d -r1c04924590760ca29e1c9fe19bca65ec5ce428fe --- firmware/App/Modes/SelfTests.c (.../SelfTests.c) (revision 1df7142ce598ed2ed37958df29068ff1a957b11d) +++ firmware/App/Modes/SelfTests.c (.../SelfTests.c) (revision 1c04924590760ca29e1c9fe19bca65ec5ce428fe) @@ -7,8 +7,8 @@ * * @file SelfTests.c * -* @author (last) Dara Navaei -* @date (last) 23-May-2022 +* @author (last) Sean Nash +* @date (last) 13-Jul-2022 * * @author (original) Quang Nguyen * @date (original) 28-Jan-2021 @@ -233,6 +233,8 @@ selfTestStartTime = getMSTimerCount(); selfTestPreviousPublishDataTime = getMSTimerCount(); + doorClosedRequired( TRUE, TRUE ); + // Pumps should be off signalBloodPumpHardStop(); signalDialInPumpHardStop(); @@ -359,6 +361,8 @@ selfTestStartTime = getMSTimerCount(); selfTestPreviousPublishDataTime = getMSTimerCount(); + doorClosedRequired( TRUE, TRUE ); + // Pumps should be off signalBloodPumpHardStop(); signalDialInPumpHardStop(); @@ -666,14 +670,6 @@ signalDialOutPumpHardStop(); selfTestStartTime = getMSTimerCount(); -#ifndef _RELEASE_ - if ( SW_CONFIG_ENABLE_VALUE == getSoftwareConfigStatus( SW_CONFIG_DISABLE_SWITCHES_MONITOR ) ) - { - frontDoor = STATE_CLOSED; - pumpTrack = STATE_CLOSED; - } -#endif - // TODO: Use appropriate sensor driver if ( ( STATE_CLOSED == frontDoor ) && ( STATE_CLOSED == pumpTrack ) ) { @@ -830,13 +826,16 @@ { NO_CART_SELF_TESTS_STATE_T state = NO_CART_SELF_TESTS_STOPPED_STATE; + doorClosedRequired( FALSE, FALSE ); + // Restart self-test start time selfTestStartTime = getMSTimerCount(); if ( TRUE == selfTestsResumeRequested ) { selfTestsResumeRequested = FALSE; havePumpsStarted = FALSE; + doorClosedRequired( TRUE, TRUE ); state = NO_CART_SELF_TESTS_WAIT_FOR_DOOR_CLOSE_STATE; } @@ -860,14 +859,6 @@ // Restart self-test start time selfTestStartTime = getMSTimerCount(); -#ifndef _RELEASE_ - if ( SW_CONFIG_ENABLE_VALUE == getSoftwareConfigStatus( SW_CONFIG_DISABLE_SWITCHES_MONITOR ) ) - { - frontDoor = STATE_CLOSED; - pumpTrack = STATE_CLOSED; - } -#endif - // TODO: Use appropriate sensor driver if (( STATE_CLOSED == frontDoor ) && (STATE_CLOSED == pumpTrack ) ) { @@ -1129,12 +1120,15 @@ { DRY_SELF_TESTS_STATE_T state = DRY_SELF_TESTS_STOPPED_STATE; + doorClosedRequired( FALSE, FALSE ); + // Restart self-test start time selfTestStartTime = getMSTimerCount(); if ( TRUE == selfTestsResumeRequested ) { selfTestsResumeRequested = FALSE; + doorClosedRequired( TRUE, TRUE ); #ifndef _RELEASE_ if ( getSoftwareConfigStatus( SW_CONFIG_DISABLE_DRY_SELF_TESTS ) != SW_CONFIG_ENABLE_VALUE ) { Index: firmware/App/Services/FPGA.c =================================================================== diff -u -rf908e396e3ea2a08378d77089e6d6b8dd8da3cdc -r1c04924590760ca29e1c9fe19bca65ec5ce428fe --- firmware/App/Services/FPGA.c (.../FPGA.c) (revision f908e396e3ea2a08378d77089e6d6b8dd8da3cdc) +++ firmware/App/Services/FPGA.c (.../FPGA.c) (revision 1c04924590760ca29e1c9fe19bca65ec5ce428fe) @@ -8,7 +8,7 @@ * @file FPGA.c * * @author (last) Dara Navaei -* @date (last) 16-Jun-2022 +* @date (last) 20-Jun-2022 * * @author (original) Dara Navaei * @date (original) 05-Nov-2019 @@ -91,7 +91,9 @@ #define FPGA_FLUID_LEAK_STATE_MASK 0x0040 ///< Bit mask for fluid leak detector. #define FPGA_BLOOD_LEAK_STATUS_MASK 0x1000 ///< Bit mask for blood leak detector. +#define FPGA_BLOOD_LEAK_ST_BIT_INDEX 12 ///< Bit index for the blood leak self test status bit. #define FPGA_BLOOD_LEAK_ZERO_STATE_MASK 0x2000 ///< Bit mask for blood leak detector zero. +#define FPAG_BLOOD_LEAK_ZERO_BIT_INDEX 13 ///< Bit index for the blood leak zero status bit. #define FPGA_BLOOD_LEAK_ZERO_CMD 0x02 ///< Bit for blood leak detector zero command. #define FPGA_BLOOD_LEAK_SELF_TEST_CMD 0x01 ///< Bit for blood leak detector self test command. @@ -1982,21 +1984,6 @@ /*********************************************************************//** * @brief - * The FPGABloodLeakZeroDetected function returns TRUE if blood leak zeroing has - * been detected and FALSE if no blood leak zeroing has been detected. - * @details Inputs: fpgaSensorReadings - * @details Outputs: none - * @return FPGABloodLeakZeroDetected - *************************************************************************/ -BOOL FPGABloodLeakZeroDetected( void ) -{ - U16 FPGABloodLeakZeroDetected = fpgaSensorReadings.fpgaGPIO & FPGA_BLOOD_LEAK_ZERO_STATE_MASK; - - return ( 0 == FPGABloodLeakZeroDetected ? FALSE : TRUE ); -} - -/*********************************************************************//** - * @brief * The setFPGABloodLeakZero function sets the Blood Leak detector into * zeroing mode via the FPGA. * @details Inputs: none @@ -2049,6 +2036,34 @@ /*********************************************************************//** * @brief + * The getFPGABloodLeakZeroStatus function returns the blood leak sensor's + * zero status bit. + * @details Inputs: fpgaSensorReadings + * @details Outputs: none + * @return blood leak sensor zero status bit + *************************************************************************/ +U08 getFPGABloodLeakZeroStatus( void ) +{ + U08 zeroStatus = (U08)( ( fpgaSensorReadings.fpgaGPIO & FPGA_BLOOD_LEAK_ZERO_STATE_MASK ) >> FPAG_BLOOD_LEAK_ZERO_BIT_INDEX ); + return zeroStatus; +} + +/*********************************************************************//** + * @brief + * The getFPGABloodLeakStatus function returns the blood leak sensor's + * blood detection status bit. + * @details Inputs: fpgaSensorReadings + * @details Outputs: none + * @return blood leak sensor self test status bit + *************************************************************************/ +U08 getFPGABloodLeakStatus( void ) +{ + U08 selfTestStatus = (U08)( ( fpgaSensorReadings.fpgaGPIO & FPGA_BLOOD_LEAK_STATUS_MASK ) >> FPGA_BLOOD_LEAK_ST_BIT_INDEX ); + return selfTestStatus; +} + +/*********************************************************************//** + * @brief * The setFPGABloodLeakUARTControl function sets the blood leak sensor UART * control value. * @details Inputs: fpgaSensorReadings @@ -2193,7 +2208,7 @@ * @details Outputs: none * @return fpgaSensorReadings.bloodLeakRxFIFOCount *************************************************************************/ -U08 getFPGABloodLeakRxFIFOCount( void ) +U16 getFPGABloodLeakRxFIFOCount( void ) { return fpgaSensorReadings.bloodLeakRxFIFOCount; } @@ -2226,6 +2241,32 @@ /*********************************************************************//** * @brief + * The getFPGABloodLeakSelfTestErrorCounter function returns the blood leak + * self test error counter. + * @details Inputs: none + * @details Outputs: none + * @return fpgaSensorReadings.bloodLeakSelfTestErrorCounter + *************************************************************************/ +U08 getFPGABloodLeakSelfTestErrorCounter( void ) +{ + return fpgaSensorReadings.bloodLeakSelfTestErrorCounter; +} + +/*********************************************************************//** + * @brief + * The getFPGABloodLeakZeroErrorCounter function returns the blood leak + * zero error counter. + * @details Inputs: none + * @details Outputs: none + * @return fpgaSensorReadings.bloodLeakZeroErrorCounter + *************************************************************************/ +U08 getFPGABloodLeakZeroErrorCounter( void ) +{ + return fpgaSensorReadings.bloodLeakZeroErrorCounter; +} + +/*********************************************************************//** + * @brief * The noFPGABubbleDetected function returns TRUE if no air bubble has been * detected and FALSE if an air bubble has been detected. * @details Inputs: fpgaSensorReadings Index: firmware/App/Services/SystemComm.c =================================================================== diff -u -r1978e8476dc44688ed69531c236c154829ab8a76 -r1c04924590760ca29e1c9fe19bca65ec5ce428fe --- firmware/App/Services/SystemComm.c (.../SystemComm.c) (revision 1978e8476dc44688ed69531c236c154829ab8a76) +++ firmware/App/Services/SystemComm.c (.../SystemComm.c) (revision 1c04924590760ca29e1c9fe19bca65ec5ce428fe) @@ -8,7 +8,7 @@ * @file SystemComm.c * * @author (last) Dara Navaei -* @date (last) 14-Jun-2022 +* @date (last) 03-Aug-2022 * * @author (original) Dara Navaei * @date (original) 05-Nov-2019 @@ -1150,7 +1150,6 @@ handleTesterLogInRequest( message ); break; - // The default cannot be reached in VectorCAST since the cases are run in a for loop default: // Un-recognized or un-handled message ID received - ignore break; @@ -1359,10 +1358,6 @@ handleHDBloodPumpRotorCountOverrideRequest( message ); break; - case MSG_ID_SET_ARTERIAL_PRESSURE_OFFSET: - handleHDSetArterialPressureOffsetRequest( message ); - break; - case MSG_ID_BLOOD_PUMP_HOME_CMD: handleTestBloodPumpHomeRequest( message ); break; Index: firmware/App/Services/SystemCommMessages.c =================================================================== diff -u -r1978e8476dc44688ed69531c236c154829ab8a76 -r1c04924590760ca29e1c9fe19bca65ec5ce428fe --- firmware/App/Services/SystemCommMessages.c (.../SystemCommMessages.c) (revision 1978e8476dc44688ed69531c236c154829ab8a76) +++ firmware/App/Services/SystemCommMessages.c (.../SystemCommMessages.c) (revision 1c04924590760ca29e1c9fe19bca65ec5ce428fe) @@ -8,7 +8,7 @@ * @file SystemCommMessages.c * * @author (last) Dara Navaei -* @date (last) 14-Jun-2022 +* @date (last) 03-Aug-2022 * * @author (original) Dara Navaei * @date (original) 05-Nov-2019 @@ -2004,6 +2004,14 @@ #ifdef EMC_TEST_BUILD +/*********************************************************************//** + * @brief + * The broadcastCANErrorCount function handles the CAN error count + * @details Inputs: none + * @details Outputs: message handled + * @param message a pointer to the message to handle + * @return none + *************************************************************************/ BOOL broadcastCANErrorCount( U32 count ) { BOOL result; @@ -2220,7 +2228,7 @@ memcpy( payloadPtr, &passed, sizeof( BOOL ) ); // Serialize the message (w/ sync, CRC, and appropriate CAN padding) and add serialized message data to appropriate comm buffer - result = serializeMessage( msg, COMM_BUFFER_OUT_CAN_HD_BROADCAST, ACK_NOT_REQUIRED ); // TODO - make ack required when UI ready + result = serializeMessage( msg, COMM_BUFFER_OUT_CAN_HD_BROADCAST, ACK_REQUIRED ); return result; } @@ -2251,6 +2259,33 @@ /*********************************************************************//** * @brief + * The sendUIRequestPOSTFinalResult function constructs a reqeust for UI POST + * final result message and queues the msg for transmit on the appropriate + * CAN channel. + * @details Inputs: none + * @details Outputs: request for UI POST final result msg constructed and queued. + * @return TRUE if msg successfully queued for transmit, FALSE if not + *************************************************************************/ +BOOL sendUIRequestPOSTFinalResult( void ) +{ + BOOL result; + MESSAGE_T msg; + U08 *payloadPtr = msg.payload; + + // Create a message record + blankMessage( &msg ); + msg.hdr.msgID = MSG_ID_HD_REQUEST_UI_FINAL_POST_RESULT; + msg.hdr.payloadLen = 0; + + // Serialize the message (w/ sync, CRC, and appropriate CAN padding) and add serialized message data to appropriate comm buffer + result = serializeMessage( msg, COMM_BUFFER_OUT_CAN_HD_2_UI, ACK_REQUIRED ); + + return result; + +} + +/*********************************************************************//** + * @brief * The handleUIPOSTFinalResult function handles a UI POST final result message. * @details Inputs: none * @details Outputs: UI POST final result delivered to InitPOST mode. @@ -2265,8 +2300,7 @@ BOOL passed; memcpy( &passed, payloadPtr, sizeof( BOOL ) ); - - // TODO - handle UI POST final result + signalUIPOSTFinalResult( passed ); } else { @@ -3590,38 +3624,6 @@ /*********************************************************************//** * @brief - * The handleHDSetArterialPressureOffsetRequest function handles a request to - * set the arterial pressure offset. - * @details Inputs: none - * @details Outputs: message handled - * @param message a pointer to the message to handle - * @return none - *************************************************************************/ -void handleHDSetArterialPressureOffsetRequest( MESSAGE_T *message ) -{ - TEST_OVERRIDE_PAYLOAD_T payload; - BOOL result = FALSE; - - // Verify payload length - if ( sizeof(TEST_OVERRIDE_PAYLOAD_T) == message->hdr.payloadLen ) - { - memcpy( &payload, message->payload, sizeof(TEST_OVERRIDE_PAYLOAD_T) ); - if ( FALSE == payload.reset ) - { - result = testSetArterialPressureOffsetOverride( payload.state.f32 ); - } - else - { - result = testResetArterialPressureOffsetOverride(); - } - } - - // Respond to request - sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); -} - -/*********************************************************************//** - * @brief * The handleTestBloodPumpRotorMeasuredSpeedOverrideRequest function handles a request to * override the measured blood pump rotor speed (RPM). * @details Inputs: none @@ -6401,9 +6403,8 @@ { F32 dacVRef; - result = TRUE; - memcpy( &dacVRef, message->payload, sizeof( F32 ) ); - setSyringePumpDACVref( dacVRef ); + memcpy( &dacVRef, message->payload, sizeof( F32 ) ); // TODO - Payload no longer used. Update Dialin command and expected payload len in f/w. + result = setSyringePumpDACVref(); } } Index: firmware/App/Services/SystemCommMessages.h =================================================================== diff -u -r481c81493ac2bf73d1d371cabee016ab8ad8d06c -r1c04924590760ca29e1c9fe19bca65ec5ce428fe --- firmware/App/Services/SystemCommMessages.h (.../SystemCommMessages.h) (revision 481c81493ac2bf73d1d371cabee016ab8ad8d06c) +++ firmware/App/Services/SystemCommMessages.h (.../SystemCommMessages.h) (revision 1c04924590760ca29e1c9fe19bca65ec5ce428fe) @@ -8,7 +8,7 @@ * @file SystemCommMessages.h * * @author (last) Dara Navaei -* @date (last) 13-Jul-2022 +* @date (last) 03-Aug-2022 * * @author (original) Dara Navaei * @date (original) 05-Nov-2019 @@ -132,6 +132,9 @@ // MSG_ID_DG_POST_FINAL_TEST_RESULT void handleDGPOSTFinalResult( MESSAGE_T *message ); +// MSG_ID_HD_REQUEST_UI_FINAL_POST_RESULT +BOOL sendUIRequestPOSTFinalResult( void ); + // MSG_ID_UI_POST_FINAL_TEST_RESULT void handleUIPOSTFinalResult( MESSAGE_T *message ); @@ -467,9 +470,6 @@ // MSG_ID_BLOOD_ROTOR_COUNT_OVERRIDE void handleHDBloodPumpRotorCountOverrideRequest( MESSAGE_T *message ); -// MSG_ID_SET_ARTERIAL_PRESSURE_OFFSET -void handleHDSetArterialPressureOffsetRequest( MESSAGE_T *message ); - // MSG_ID_BLOOD_PUMP_MC_MEAS_SPEED_OVERRIDE void handleTestBloodPumpMCMeasuredSpeedOverrideRequest( MESSAGE_T *message );