Index: firmware/App/Controllers/DGInterface.c =================================================================== diff -u -r1978e8476dc44688ed69531c236c154829ab8a76 -r11e082f2ae04aae2948ee53f4d3c3fd3f784914a --- firmware/App/Controllers/DGInterface.c (.../DGInterface.c) (revision 1978e8476dc44688ed69531c236c154829ab8a76) +++ firmware/App/Controllers/DGInterface.c (.../DGInterface.c) (revision 11e082f2ae04aae2948ee53f4d3c3fd3f784914a) @@ -14,6 +14,8 @@ * @date (original) 08-Apr-2020 * ***************************************************************************/ + +#include // To check for NaN #include "DialInFlow.h" #include "Dialysis.h" @@ -356,26 +358,26 @@ /*********************************************************************//** * @brief - * The getDialysateTemperature function gets the latest dialysate temperature. - * @details Inputs: dgDialysateTemp + * The getDGDisinfectsStates function returns the DG disinfects readings. + * @details Inputs: none * @details Outputs: none - * @return the current dialysate temperature + * @return the current DG disinfects readings *************************************************************************/ -F32 getDialysateTemperature( void ) +DG_DISINFECT_UI_STATES_T getDGDisinfectsStates( void ) { - return dgDialysateTemp; + return disinfectsStatus; } /*********************************************************************//** * @brief - * The getDGDisinfectsStates function returns the DG disinfects readings. - * @details Inputs: none + * The getDialysateTemperature function gets the latest dialysate temperature. + * @details Inputs: dgDialysateTemp * @details Outputs: none - * @return the current DG disinfects readings + * @return the current dialysate temperature *************************************************************************/ -DG_DISINFECT_UI_STATES_T getDGDisinfectsStates( void ) +F32 getDialysateTemperature( void ) { - return disinfectsStatus; + return dgDialysateTemp; } /*********************************************************************//** @@ -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; } @@ -619,7 +627,7 @@ dgTrimmerHeaterOn = TRUE; dgCmdResp[ DG_CMD_START_TRIMMER_HEATER ].commandID = DG_CMD_NONE; - sendDGStartStopTrimmerHeaterCommand( START_DG_CMD, dgTrimmerTempSet ); + sendDGStartStopTrimmerHeaterCommand( START_DG_CMD ); } /*********************************************************************//** @@ -635,7 +643,7 @@ dgTrimmerHeaterOn = FALSE; dgCmdResp[ DG_CMD_STOP_TRIMMER_HEATER ].commandID = DG_CMD_NONE; - sendDGStartStopTrimmerHeaterCommand( STOP_DG_CMD, 0 ); + sendDGStartStopTrimmerHeaterCommand( STOP_DG_CMD ); } /*********************************************************************//** Index: firmware/App/Services/SystemComm.c =================================================================== diff -u -r1978e8476dc44688ed69531c236c154829ab8a76 -r11e082f2ae04aae2948ee53f4d3c3fd3f784914a --- firmware/App/Services/SystemComm.c (.../SystemComm.c) (revision 1978e8476dc44688ed69531c236c154829ab8a76) +++ firmware/App/Services/SystemComm.c (.../SystemComm.c) (revision 11e082f2ae04aae2948ee53f4d3c3fd3f784914a) @@ -52,8 +52,7 @@ #define MAX_COMM_CRC_FAILURE_WINDOW_MS (10 * SEC_PER_MIN * MS_PER_SECOND) ///< CRC error window #define MSG_NOT_ACKED_TIMEOUT_MS 150 ///< Maximum time for a Denali message that requires ACK to be ACK'd - -#define MSG_NOT_ACKED_TIMEOUT_MS_INIT 5000 ///< Maximum time for a Denali message that requires ACK to be ACK'd on the INIT state for the first (UI version request) message of the POST +#define MSG_NOT_ACKED_TIMEOUT_MS_INIT 5000 ///< Maximum time for a Denali message that requires ACK to be ACK'd on the INIT state for the first (UI version request) message of the POST #define MSG_NOT_ACKED_MAX_RETRIES 3 ///< Maximum number of times a message that requires ACK that was not ACK'd can be re-sent before alarm #define PENDING_ACK_LIST_SIZE 25 ///< Maximum number of Denali messages that can be pending ACK at any given time @@ -1619,10 +1618,6 @@ handleTestSyringePumpHeprinBolusTargetRateOverrideRequest( message ); break; - case MSG_ID_HD_REQ_CURRENT_TREATMENT_PARAMETERS: - handleTestCurrentTreamtmentParametersRequest( message ); - break; - case MSG_ID_HD_FANS_DUTY_CYCLE_OVERRIDE: handleSetFansDutyCycleOverrideRequest( message ); break; Index: firmware/App/Services/SystemCommMessages.c =================================================================== diff -u -r1978e8476dc44688ed69531c236c154829ab8a76 -r11e082f2ae04aae2948ee53f4d3c3fd3f784914a --- firmware/App/Services/SystemCommMessages.c (.../SystemCommMessages.c) (revision 1978e8476dc44688ed69531c236c154829ab8a76) +++ firmware/App/Services/SystemCommMessages.c (.../SystemCommMessages.c) (revision 11e082f2ae04aae2948ee53f4d3c3fd3f784914a) @@ -1569,10 +1569,9 @@ * @details Inputs: none * @details Outputs: DG start/stop trimmer heater command msg constructed and queued. * @param start TRUE indicates start heater, FALSE indicates stop heater - * @param trimmerHtrTemp target temperature for trimmer heater * @return TRUE if msg successfully queued for transmit, FALSE if not *************************************************************************/ -BOOL sendDGStartStopTrimmerHeaterCommand( BOOL start, F32 trimmerHtrTemp ) +BOOL sendDGStartStopTrimmerHeaterCommand( BOOL start ) { BOOL result; MESSAGE_T msg; @@ -1581,11 +1580,9 @@ // Create a message record blankMessage( &msg ); msg.hdr.msgID = MSG_ID_DG_START_STOP_TRIMMER_HEATER_CMD; - msg.hdr.payloadLen = sizeof( BOOL ) + sizeof( F32 ); + msg.hdr.payloadLen = sizeof( BOOL ); memcpy( payloadPtr, &start, sizeof( BOOL ) ); - payloadPtr += sizeof( BOOL ); - memcpy( payloadPtr, &trimmerHtrTemp, sizeof( F32 ) ); // 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_DG, ACK_REQUIRED ); @@ -2004,6 +2001,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 +2225,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 +2256,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 +2297,7 @@ BOOL passed; memcpy( &passed, payloadPtr, sizeof( BOOL ) ); - - // TODO - handle UI POST final result + signalUIPOSTFinalResult( passed ); } else { @@ -2329,13 +2360,13 @@ { TEMPERATURE_SENSORS_DATA_T payload; - memcpy( &payload, message->payload, sizeof( TEMPERATURE_SENSORS_DATA_T ) ); - setDialysateTemperatureReadings( payload.inletDialysate, payload.outletRedundant ); - } - // TODO - what to do if invalid payload length? - // TODO - how to know if DG stops sending these? -} - + memcpy( &payload, message->payload, sizeof( TEMPERATURE_SENSORS_DATA_T ) ); + setDialysateTemperatureReadings( payload.TDi, payload.TRo ); + } + // TODO - what to do if invalid payload length? + // TODO - how to know if DG stops sending these? +} + /*********************************************************************//** * @brief * The handleDialysateFlowData function handles dialysate flow data broadcast @@ -5157,6 +5188,7 @@ if ( sizeof( TEST_OVERRIDE_PAYLOAD_T ) == message->hdr.payloadLen ) { memcpy( &payload, message->payload, sizeof( TEST_OVERRIDE_PAYLOAD_T ) ); + if ( FALSE == payload.reset ) { result = testSetBatteryRemainingPercentOverride( payload.state.u32 ); @@ -6401,9 +6433,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(); } } @@ -7098,6 +7129,30 @@ } /*********************************************************************//** + * @brief + * The sendRequestForDGResendAlarms function sends out the HD request for + * DG re-send all active alarms. + * @details Inputs: none + * @details Outputs: DG alarms re-send request msg constructed and queued + * @return TRUE if msg successfully queued for transmit, FALSE if not + *************************************************************************/ +BOOL sendRequestForDGResendAlarms( void ) +{ + BOOL result; + MESSAGE_T msg; + + // Create a message record + blankMessage( &msg ); + msg.hdr.msgID = MSG_ID_HD_REQUEST_DG_ALARMS; + 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_DG, ACK_REQUIRED ); + + return result; +} + +/*********************************************************************//** * @brief * The handleGetHDUsageInfoRecord function handles a request to get the HD * usage information record. @@ -7253,15 +7308,15 @@ /*********************************************************************//** * @brief - * The handleSendBloodLeakEmbeddedModeCommandResponse function sends out + * The sendBloodLeakEmbeddedModeCommandResponse function sends out * the blood leak embedded mode command response. * @details Inputs: none * @details Outputs: blood leak embedded mode command response msg constructed and queued * @param responseLen: the length of the buffer * @param response: pointer to the response buffer * @return TRUE if msg successfully queued for transmit, FALSE if not *************************************************************************/ -BOOL handleSendBloodLeakEmbeddedModeCommandResponse( U32 responseLen, U08* response ) +BOOL sendBloodLeakEmbeddedModeCommandResponse( U32 responseLen, U08* response ) { BOOL result; MESSAGE_T msg; @@ -7283,6 +7338,30 @@ } /*********************************************************************//** +* @brief +* The handleResendAllAlarmsCommand function handles a request to re-send +* all active HD alarms. +* @details Inputs: none +* @details Outputs: message handled +* @param message a pointer to the message to handle +* @return none +*************************************************************************/ +void handleResendAllAlarmsCommand( MESSAGE_T* message ) +{ + BOOL result = FALSE; + + // verify payload length + if ( 0 == message->hdr.payloadLen ) + { + handleResendActiveAlarmsRequest(); + result = TRUE; + } + + // respond to request + sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); +} + +/*********************************************************************//** * @brief * The sendDGServiceModeRequest function constructs a service mode request msg * to the DG and queues the msg for transmit on the appropriate CAN channel. Index: firmware/App/Services/SystemCommMessages.h =================================================================== diff -u -r4ec54dc76acf9a434fb860c51739a7dd6f72afd6 -r11e082f2ae04aae2948ee53f4d3c3fd3f784914a --- firmware/App/Services/SystemCommMessages.h (.../SystemCommMessages.h) (revision 4ec54dc76acf9a434fb860c51739a7dd6f72afd6) +++ firmware/App/Services/SystemCommMessages.h (.../SystemCommMessages.h) (revision 11e082f2ae04aae2948ee53f4d3c3fd3f784914a) @@ -395,6 +395,9 @@ // MSG_ID_DG_START_STOP_CHEM_DISINFECT BOOL sendDGStartChemicalDisinfectModeCommand( BOOL start ); +// MSG_ID_HD_REQUEST_DG_SERVICE_MODE +BOOL sendDGServiceModeRequest(); + // MSG_ID_ALARM_STATUS BOOL broadcastAlarmStatus( COMP_ALARM_STATUS_T almStatus ); @@ -422,9 +425,6 @@ // MSG_ID_HD_SET_SW_CONFIG_RECORD void handleSetHDSoftwareConfigRecord( MESSAGE_T *message ); -// MSG_ID_UI_REQUEST_SERVICE_MODE -void handleUIServiceModeRequest( MESSAGE_T *message ); -void sendUIServiceModeResponse( BOOL accepted, U32 rejCode ); // MSG_ID_HD_REQUEST_DG_ALARMS BOOL sendRequestForDGResendAlarms( void );