Index: firmware/App/Services/SystemCommMessages.c =================================================================== diff -u -r1aeab08c1baf6445514b81fe51fc60a3e536e782 -reeb4e9c7c8ca2bc41168353c3d30f311080972b2 --- firmware/App/Services/SystemCommMessages.c (.../SystemCommMessages.c) (revision 1aeab08c1baf6445514b81fe51fc60a3e536e782) +++ firmware/App/Services/SystemCommMessages.c (.../SystemCommMessages.c) (revision eeb4e9c7c8ca2bc41168353c3d30f311080972b2) @@ -54,10 +54,6 @@ // ********** private definitions ********** -#ifdef DEBUG_ENABLED - #define DEBUG_EVENT_MAX_TEXT_LEN 40 -#endif - #define MAX_MSGS_BLOCKED_FOR_XMIT 8 ///< Maximum number of messages to block transmission for. #pragma pack(push,1) @@ -283,17 +279,26 @@ BOOL result; MESSAGE_T msg; U08 *payloadPtr = msg.payload; + U32 data; // create a message record blankMessage( &msg ); msg.hdr.msgID = MSG_ID_ALARM_TRIGGERED; - msg.hdr.payloadLen = sizeof( U32 ) + sizeof( ALARM_DATA_T ) + sizeof( ALARM_DATA_T ); + msg.hdr.payloadLen = sizeof( U32 ) * 5; memcpy( payloadPtr, &alarm, sizeof( U32 ) ); payloadPtr += sizeof( U32 ); - memcpy( payloadPtr, &almData1, sizeof( ALARM_DATA_T ) ); - payloadPtr += sizeof( ALARM_DATA_T ); - memcpy( payloadPtr, &almData2, sizeof( ALARM_DATA_T ) ); + data = (U32)almData1.dataType; + memcpy( payloadPtr, &data, sizeof( U32 ) ); + payloadPtr += sizeof( U32 ); + data = almData1.data.uInt.data; + memcpy( payloadPtr, &data, sizeof( U32 ) ); + payloadPtr += sizeof( U32 ); + data = (U32)almData2.dataType; + memcpy( payloadPtr, &data, sizeof( U32 ) ); + payloadPtr += sizeof( U32 ); + data = almData2.data.uInt.data; + memcpy( payloadPtr, &data, sizeof( U32 ) ); // 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_DG_ALARM, ACK_REQUIRED ); @@ -417,15 +422,15 @@ { BOOL result = FALSE; - if ( message->hdr.payloadLen == sizeof( TARGET_TEMPS_PAYLOAD_T ) ) + if ( message->hdr.payloadLen == sizeof( DG_CMD_DIALYSATE_HEATING_PARAMS_T ) ) { - TARGET_TEMPS_PAYLOAD_T payload; + DG_CMD_DIALYSATE_HEATING_PARAMS_T payload; result = TRUE; - memcpy( &payload, message->payload, sizeof( TARGET_TEMPS_PAYLOAD_T ) ); - setHeaterTargetTemperature( DG_PRIMARY_HEATER, payload.targetPrimaryHeaterTemp ); - setHeaterTargetTemperature( DG_TRIMMER_HEATER, payload.targetTrimmerHeaterTemp ); + memcpy( &payload, message->payload, sizeof( DG_CMD_DIALYSATE_HEATING_PARAMS_T ) ); + setDialysateHeatingParameters( payload ); } + sendAckResponseMsg( (MSG_ID_T)message->hdr.msgID, COMM_BUFFER_OUT_CAN_DG_2_HD, result ); } @@ -523,6 +528,43 @@ /*********************************************************************//** * @brief + * The handleDGServiceScheduleRequest function handles a request for DG + * service information. + * @details Inputs: none + * @details Outputs: message handled, response constructed and queued for + * transmit. + * @return none + *************************************************************************/ +void handleDGSendConcentrateMixingRatios( MESSAGE_T *message ) +{ + MESSAGE_T msg; + + DG_ACID_CONCENTRATES_RECORD_T acid = getAcidConcentrateCalRecord(); + DG_BICARB_CONCENTRATES_RECORD_T bicarb = getBicarbConcentrateCalRecord(); + // By the time these are requested, the prepare time is no longer needed since the concentrate lines are + // primed before the actual treatment starts + U32 fillPrepTimeMS = 0; + + U08 *payloadPtr = msg.payload; + + // Create a message record + blankMessage( &msg ); + msg.hdr.msgID = MSG_ID_DG_CONCENTRATE_MIXING_RATIOS_DATA; + msg.hdr.payloadLen = sizeof( F32 ) + sizeof( F32 ) + sizeof( U32 ); + + // Fill message payload + memcpy( payloadPtr, &acid.acidConcentrate[ CAL_DATA_ACID_CONCENTRATE_1 ].acidConcMixRatio, sizeof( F32 ) ); + payloadPtr += sizeof( F32 ); + memcpy( payloadPtr, &bicarb.bicarbConcentrate[ CAL_DATA_BICARB_CONCENTRATE_1 ].bicarbConcMixRatio, sizeof( F32 ) ); + payloadPtr += sizeof( U32 ); + memcpy( payloadPtr, &fillPrepTimeMS, sizeof( U32 ) ); + + // Serialize the message (w/ sync, CRC, and appropriate CAN padding) and add serialized message data to appropriate comm buffer + serializeMessage( msg, COMM_BUFFER_OUT_CAN_DG_2_HD, ACK_REQUIRED ); +} + +/*********************************************************************//** + * @brief * The sendDGCalibrationRecord function sends out the DG calibration * record. * @details Inputs: none @@ -561,7 +603,6 @@ return result; } - /*********************************************************************//** * @brief * The sendDGSystemRecord function sends out the DG system record. @@ -841,7 +882,7 @@ if ( DG_CMD_START == fillCmd.cmd ) { - startFillCmd( fillCmd.fillToVolumeMl ); + startFillCmd( fillCmd.fillToVolumeMl, fillCmd.targetFlowLPM ); } else { @@ -1032,56 +1073,6 @@ * TEST SUPPORT FUNCTIONS *************************************************************************/ -#ifdef DEBUG_ENABLED - /*********************************************************************//** - * @brief - * The sendDebugData function sends debug data out to the PC port. - * @details - * @details Inputs: none - * @details Outputs: PC serial port - * @param dbgData Pointer to debug data - * @param len number of bytes of debug data - * @return TRUE if debug data was successfully queued for transmit, FALSE if not - *************************************************************************/ - BOOL sendDebugData( U08 *dbgData, U32 len ) - { - BOOL result; - - // add serialized message data to appropriate comm buffer - result = addToCommBuffer( COMM_BUFFER_OUT_UART_PC, dbgData, len ); - - return result; - } - - /*********************************************************************//** - * @brief - * The sendDebugDataToUI function sends debug string to the UI for logging. - * @details - * @details Inputs: none - * @details Outputs: Message constructed and queued for transmit - * @param str Pointer to debug string - * @return none - *************************************************************************/ - void sendDebugDataToUI( U08 *str ) - { - MESSAGE_T msg; - U32 txtLen = strlen( (char*)str ); - U08 *payloadPtr = msg.payload; - - // create a message record - blankMessage( &msg ); - msg.hdr.msgID = MSG_ID_DG_DEBUG_EVENT; - msg.hdr.payloadLen = DEBUG_EVENT_MAX_TEXT_LEN + 1; // add 1 byte for null terminator - if ( txtLen <= DEBUG_EVENT_MAX_TEXT_LEN ) - { - memcpy( payloadPtr, str, txtLen + 1 ); - - // serialize the message (w/ sync, CRC, and appropriate CAN padding) and add serialized message data to appropriate comm buffer - serializeMessage( msg, COMM_BUFFER_OUT_CAN_DG_2_UI, ACK_NOT_REQUIRED ); - } - } -#endif - /*********************************************************************//** * @brief * The isTestingActivated function determines whether a tester has successfully @@ -1702,12 +1693,14 @@ BOOL result = FALSE; // verify payload length - if ( sizeof( TEST_OVERRIDE_PAYLOAD_T ) == message->hdr.payloadLen ) + if ( 0 == message->hdr.payloadLen ) { memcpy( &payload, message->payload, sizeof( TEST_OVERRIDE_PAYLOAD_T ) ); if ( FALSE == payload.reset ) { - result = testSetSafetyShutdownOverride( payload.state.u32 ); + U32 command = 1; + + result = testSetSafetyShutdownOverride( command ); } else { @@ -3176,4 +3169,37 @@ sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } +/*********************************************************************//** + * @brief + * The handleTestFansRPMAlarmStartTimeOverrideRequest function handles a + * request to override the fan RPM alarm start time. + * @details Inputs: none + * @details Outputs: message handled + * @param message a pointer to the message to handle + * @return none + *************************************************************************/ +void handleTestFansRPMAlarmStartTimeOffsetOverrideRequest( 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 = testSetFanRPMAlarmStartTimeOffsetOverride( payload.state.u32, payload.index ); + } + else + { + result = testResetFanRPMAlarmStartTimeOffsetOverride(); + } + } + + // Respond to request + sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); +} + /**@}*/