Index: firmware/App/Modes/SelfTests.c =================================================================== diff -u -r66e873b93cceb09fa4e59816e4c7ce7ab4428c86 -r63d676004c2bc1d51fee13985091cf68a345d3a0 --- firmware/App/Modes/SelfTests.c (.../SelfTests.c) (revision 66e873b93cceb09fa4e59816e4c7ce7ab4428c86) +++ firmware/App/Modes/SelfTests.c (.../SelfTests.c) (revision 63d676004c2bc1d51fee13985091cf68a345d3a0) @@ -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(); @@ -660,14 +664,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 ) ) { @@ -824,13 +820,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; } @@ -854,14 +853,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 ) ) { @@ -1120,12 +1111,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/SystemCommMessages.c =================================================================== diff -u -rf05690ed7052ec8bdfd4f28e0b405eea73966460 -r63d676004c2bc1d51fee13985091cf68a345d3a0 --- firmware/App/Services/SystemCommMessages.c (.../SystemCommMessages.c) (revision f05690ed7052ec8bdfd4f28e0b405eea73966460) +++ firmware/App/Services/SystemCommMessages.c (.../SystemCommMessages.c) (revision 63d676004c2bc1d51fee13985091cf68a345d3a0) @@ -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 @@ -42,7 +42,7 @@ #include "Utilities.h" #include "Valves.h" #include "WatchdogMgmt.h" -#include "HDDefs.h" +#include "HDDefs.h" /** * @addtogroup SystemCommMessages @@ -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 ) ); - - signalUIPOSTFinalResult(passed); + signalUIPOSTFinalResult( passed ); } else { @@ -2638,111 +2672,111 @@ return result; } -/*********************************************************************//** - * @brief - * The handleChangeUFSettingsRequest function handles a ultrafiltration - * change settings request message from the UI. - * @details Inputs: none - * @details Outputs: message handled - * @param message a pointer to the message to handle - * @return none - *************************************************************************/ -void handleChangeUFSettingsRequest( MESSAGE_T *message ) -{ - if ( message->hdr.payloadLen == sizeof(F32) ) - { - F32 uFVolume; - - memcpy( &uFVolume, message->payload, sizeof(F32) ); - - verifyUFSettingsChange( uFVolume ); - } - else - { - sendAckResponseMsg( (MSG_ID_T)message->hdr.msgID, COMM_BUFFER_OUT_CAN_HD_2_UI, FALSE ); - } -} - -/*********************************************************************//** - * @brief - * The handleChangeUFSettingsConfirmation function handles a ultrafiltration - * change setting confirmation message from the UI. - * @details Inputs: none - * @details Outputs: message handled - * @param message a pointer to the message to handle - * @return none - *************************************************************************/ -void handleChangeUFSettingsConfirmation( MESSAGE_T *message ) -{ - if ( message->hdr.payloadLen == sizeof(UF_SETTINGS_CHANGE_CONFIRMATION_PAYLOAD_T) ) - { - UF_SETTINGS_CHANGE_CONFIRMATION_PAYLOAD_T payload; - - memcpy( &payload, message->payload, sizeof(UF_SETTINGS_CHANGE_CONFIRMATION_PAYLOAD_T) ); - - verifyUFSettingsConfirmation( payload.volume_mL, payload.adjustType ); - } - else - { - sendAckResponseMsg( (MSG_ID_T)message->hdr.msgID, COMM_BUFFER_OUT_CAN_HD_2_UI, FALSE ); - } -} - -/*********************************************************************//** - * @brief - * The handleChangeTreatmentDurationRequest function handles a treatment - * duration setting change message from the UI. - * @details Inputs: none - * @details Outputs: message handled - * @param message a pointer to the message to handle - * @return none - *************************************************************************/ -void handleChangeTreatmentDurationRequest( MESSAGE_T *message ) -{ - if ( message->hdr.payloadLen == sizeof(U32) ) - { +/*********************************************************************//** + * @brief + * The handleChangeUFSettingsRequest function handles a ultrafiltration + * change settings request message from the UI. + * @details Inputs: none + * @details Outputs: message handled + * @param message a pointer to the message to handle + * @return none + *************************************************************************/ +void handleChangeUFSettingsRequest( MESSAGE_T *message ) +{ + if ( message->hdr.payloadLen == sizeof(F32) ) + { + F32 uFVolume; + + memcpy( &uFVolume, message->payload, sizeof(F32) ); + + verifyUFSettingsChange( uFVolume ); + } + else + { + sendAckResponseMsg( (MSG_ID_T)message->hdr.msgID, COMM_BUFFER_OUT_CAN_HD_2_UI, FALSE ); + } +} + +/*********************************************************************//** + * @brief + * The handleChangeUFSettingsConfirmation function handles a ultrafiltration + * change setting confirmation message from the UI. + * @details Inputs: none + * @details Outputs: message handled + * @param message a pointer to the message to handle + * @return none + *************************************************************************/ +void handleChangeUFSettingsConfirmation( MESSAGE_T *message ) +{ + if ( message->hdr.payloadLen == sizeof(UF_SETTINGS_CHANGE_CONFIRMATION_PAYLOAD_T) ) + { + UF_SETTINGS_CHANGE_CONFIRMATION_PAYLOAD_T payload; + + memcpy( &payload, message->payload, sizeof(UF_SETTINGS_CHANGE_CONFIRMATION_PAYLOAD_T) ); + + verifyUFSettingsConfirmation( payload.volume_mL, payload.adjustType ); + } + else + { + sendAckResponseMsg( (MSG_ID_T)message->hdr.msgID, COMM_BUFFER_OUT_CAN_HD_2_UI, FALSE ); + } +} + +/*********************************************************************//** + * @brief + * The handleChangeTreatmentDurationRequest function handles a treatment + * duration setting change message from the UI. + * @details Inputs: none + * @details Outputs: message handled + * @param message a pointer to the message to handle + * @return none + *************************************************************************/ +void handleChangeTreatmentDurationRequest( MESSAGE_T *message ) +{ + if ( message->hdr.payloadLen == sizeof(U32) ) + { U32 timeInMin; - - memcpy( &timeInMin, message->payload, sizeof(U32) ); - verifyTreatmentDurationSettingChange( timeInMin ); - } - else - { - sendAckResponseMsg( (MSG_ID_T)message->hdr.msgID, COMM_BUFFER_OUT_CAN_HD_2_UI, FALSE ); - } -} -/*********************************************************************//** - * @brief - * The handleChangeBloodDialysateRateChangeRequest function handles a blood - * and dialysate rate settings change message from the UI. - * @details Inputs: none - * @details Outputs: message handled - * @param message a pointer to the message to handle - * @return none - *************************************************************************/ -void handleChangeBloodDialysateRateChangeRequest( MESSAGE_T *message ) -{ - U32 expPayloadSize = sizeof(U32) + sizeof(U32); - - if ( expPayloadSize == message->hdr.payloadLen ) - { - U32 bloodRate; - U32 dialRate; - - memcpy( &bloodRate, &message->payload[0], sizeof(U32) ); - memcpy( &dialRate, &message->payload[sizeof(U32)], sizeof(U32) ); - - verifyBloodAndDialysateRateSettingsChange( bloodRate, dialRate ); - } - else - { - sendAckResponseMsg( (MSG_ID_T)message->hdr.msgID, COMM_BUFFER_OUT_CAN_HD_2_UI, FALSE ); - } + memcpy( &timeInMin, message->payload, sizeof(U32) ); + verifyTreatmentDurationSettingChange( timeInMin ); + } + else + { + sendAckResponseMsg( (MSG_ID_T)message->hdr.msgID, COMM_BUFFER_OUT_CAN_HD_2_UI, FALSE ); + } } /*********************************************************************//** * @brief + * The handleChangeBloodDialysateRateChangeRequest function handles a blood + * and dialysate rate settings change message from the UI. + * @details Inputs: none + * @details Outputs: message handled + * @param message a pointer to the message to handle + * @return none + *************************************************************************/ +void handleChangeBloodDialysateRateChangeRequest( MESSAGE_T *message ) +{ + U32 expPayloadSize = sizeof(U32) + sizeof(U32); + + if ( expPayloadSize == message->hdr.payloadLen ) + { + U32 bloodRate; + U32 dialRate; + + memcpy( &bloodRate, &message->payload[0], sizeof(U32) ); + memcpy( &dialRate, &message->payload[sizeof(U32)], sizeof(U32) ); + + verifyBloodAndDialysateRateSettingsChange( bloodRate, dialRate ); + } + else + { + sendAckResponseMsg( (MSG_ID_T)message->hdr.msgID, COMM_BUFFER_OUT_CAN_HD_2_UI, FALSE ); + } +} + +/*********************************************************************//** + * @brief * The handleChangePressureLimitsRequest function handles a pressure limits * change message from the UI. * @details Inputs: none @@ -6401,9 +6435,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(); } }