Index: firmware/App/Services/SystemCommMessages.c =================================================================== diff -u -radb32ef196a2c56d54225caa47f6d50e811cfc68 -r11f666f254d9777558c332403557a3d94720b54a --- firmware/App/Services/SystemCommMessages.c (.../SystemCommMessages.c) (revision adb32ef196a2c56d54225caa47f6d50e811cfc68) +++ firmware/App/Services/SystemCommMessages.c (.../SystemCommMessages.c) (revision 11f666f254d9777558c332403557a3d94720b54a) @@ -477,6 +477,11 @@ DG_VERSIONS_T payload; U08 *payloadPtr = msg.payload; + // create a message record + blankMessage( &msg ); + msg.hdr.msgID = MSG_ID_DG_VERSION; + msg.hdr.payloadLen = sizeof( DG_VERSIONS_T ); + if ( message->hdr.payloadLen == sizeof( U08 ) + sizeof( U08 ) + sizeof( U08 ) + sizeof( U16 ) + sizeof( U32 ) ) { // populate payload @@ -487,11 +492,6 @@ payload.compatibilityRev = (U32)SW_COMPATIBILITY_REV; getFPGAVersions( &payload.fpgaId, &payload.fpgaMajor, &payload.fpgaMinor, &payload.fpgaLab ); - // create a message record - blankMessage( &msg ); - msg.hdr.msgID = MSG_ID_DG_VERSION; - msg.hdr.payloadLen = sizeof( DG_VERSIONS_T ); - // fill message payload memcpy( payloadPtr, &payload, sizeof( DG_VERSIONS_T ) ); } @@ -559,10 +559,13 @@ msg.hdr.msgID = MSG_ID_DG_SERVICE_SCHEDULE_DATA; msg.hdr.payloadLen = sizeof( U32 ) + sizeof( U32 ); - // Fill message payload - memcpy( payloadPtr, &service.lastServiceEpochDate, sizeof( U32 ) ); - payloadPtr += sizeof( U32 ); - memcpy( payloadPtr, &service.serviceIntervalSeconds, sizeof( U32 ) ); + if ( 0 == message->hdr.payloadLen ) + { + // Fill message payload + memcpy( payloadPtr, &service.lastServiceEpochDate, sizeof( U32 ) ); + payloadPtr += sizeof( U32 ); + memcpy( payloadPtr, &service.serviceIntervalSeconds, 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 ); @@ -724,49 +727,8 @@ return result; } -#if 0 /*********************************************************************//** * @brief - * The sendDGServiceRecord function sends out the DG service record. - * @details Inputs: none - * @details Outputs: DG system record msg constructed and queued - * @param msgCurrNum: current payload number - * @param msgTotalNum: total number of payloads - * @param length: buffer length to be written - * @param scheduledRcrdAddress: start address of the scheduled runs record - * @return TRUE if msg successfully queued for transmit, FALSE if not - *************************************************************************/ -BOOL sendDGScheduledRunsRecord( U32 payloadCurrNum, U32 payloadTotalNum, U32 length, U08* scheduledRcrdAddress ) -{ - BOOL result; - MESSAGE_T msg; - U08 *payloadPtr = msg.payload; - - // Create a message record - blankMessage( &msg ); - msg.hdr.msgID = MSG_ID_DG_SEND_SCHEDULED_RUNS_RECORD; - msg.hdr.payloadLen = sizeof( U32 ) + sizeof( U32 ) + sizeof( U32 ) + length; - - memcpy( payloadPtr, &payloadCurrNum, sizeof( U32 ) ); - payloadPtr += sizeof( U32 ); - - memcpy( payloadPtr, &payloadTotalNum, sizeof( U32 ) ); - payloadPtr += sizeof( U32 ); - - memcpy( payloadPtr, &length, sizeof( U32 ) ); - payloadPtr += sizeof( U32 ); - - memcpy( payloadPtr, scheduledRcrdAddress, length ); - - // 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_PC, ACK_NOT_REQUIRED ); - - return result; -} -#endif - -/*********************************************************************//** - * @brief * The sendPOSTTestResult function constructs an DG POST test result message * and queues the msg for transmit on the appropriate CAN channel. * @details Inputs: none @@ -865,39 +827,7 @@ return result; } -#if 0 -// For Phase 1B /*********************************************************************//** - * @brief - * The handleDGScheduledRunsRequest function handles a request for DG - * scheduled runs information. - * @details Inputs: none - * @details Outputs: message handled, response constructed and queued for - * transmit. - * @return none - *************************************************************************/ -void handleDGScheduledRunsRequest( MESSAGE_T *message ) -{ - MESSAGE_T msg; - DG_SCHEDULED_RUN_RECORD_T scheduledService; - - // Get the service record. There are no arrays of service to check and also, raise no alarm since the service record - // has been already checked in POST - getNVRecord2Driver( GET_SRR_RECORD, (U08*)&scheduledService, sizeof( DG_SCHEDULED_RUN_RECORD_T ), 0, ALARM_ID_NO_ALARM ); - - // Create a message record - blankMessage( &msg ); - msg.hdr.msgID = MSG_ID_DG_SCHEDULED_RUNS_DATA; - msg.hdr.payloadLen = sizeof( U32 ) + sizeof( U32 ); - - // Do nothing this message is for Phase 1B. - - // 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_REQUIRED ); -} -#endif - -/*********************************************************************//** * @brief * The handleStartStopDGFlush function handles a request to start or stop * DG flush mode. @@ -1453,8 +1383,8 @@ // HD mode broadcast is operations mode and submode so 8 bytes if ( message->hdr.payloadLen == sizeof( U32 ) + sizeof( U32 ) ) { - U32 mode; - U32 subMode; + U32 mode = 0; + U32 subMode = 0; memcpy( payloadPtr, &mode, sizeof( U32 ) ); payloadPtr += sizeof( U32 ); @@ -1480,25 +1410,27 @@ { MESSAGE_T msg; DG_USAGE_INFO_RECORD_T usageInfo; - - // Get the service record. There are no arrays of service to check and also, raise no alarm since the service record - // has been already checked in POST - getNVRecord2Driver( GET_USAGE_RECORD, (U08*)&usageInfo, sizeof( DG_USAGE_INFO_RECORD_T ), 0, ALARM_ID_NO_ALARM ); - U08 *payloadPtr = msg.payload; // Create a message record blankMessage( &msg ); msg.hdr.msgID = MSG_ID_DG_USAGE_DATA; msg.hdr.payloadLen = sizeof( U32 ) + sizeof( U32 ) + sizeof( BOOL ); - // Fill message payload - memcpy( payloadPtr, &usageInfo.lastHeatDisDateEpoch, sizeof( U32 ) ); - payloadPtr += sizeof( U32 ); - memcpy( payloadPtr, &usageInfo.lastChemicalDisDateEpoch, sizeof( U32 ) ); - payloadPtr += sizeof( U32 ); - memcpy( payloadPtr, &usageInfo.isDisinfected, sizeof( BOOL ) ); + // Get the service record. There are no arrays of service to check and also, raise no alarm since the service record + // has been already checked in POST + getNVRecord2Driver( GET_USAGE_RECORD, (U08*)&usageInfo, sizeof( DG_USAGE_INFO_RECORD_T ), 0, ALARM_ID_NO_ALARM ); + if ( 0 == message->hdr.payloadLen ) + { + // Fill message payload + memcpy( payloadPtr, &usageInfo.lastHeatDisDateEpoch, sizeof( U32 ) ); + payloadPtr += sizeof( U32 ); + memcpy( payloadPtr, &usageInfo.lastChemicalDisDateEpoch, sizeof( U32 ) ); + payloadPtr += sizeof( U32 ); + memcpy( payloadPtr, &usageInfo.isDisinfected, sizeof( BOOL ) ); + } + // 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 ); } @@ -3129,81 +3061,23 @@ U32 totalMessages; U32 payloadLength; - memcpy(¤tMessage, payloadPtr, sizeof(U32)); - payloadPtr += sizeof(U32); - - memcpy(&totalMessages, payloadPtr, sizeof(U32)); - payloadPtr += sizeof(U32); - - memcpy(&payloadLength, payloadPtr, sizeof(U32)); - payloadPtr += sizeof(U32); - - status = receiveRecordFromDialin( NVDATAMGMT_SERVICE_RECORD, currentMessage, totalMessages, payloadLength, payloadPtr ); - - // Respond to request - sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, status ); -} - -#if 0 -/*********************************************************************//** -* @brief -* The handleGetDGServiceRecord function handles a request to get the DG -* scheduled runs data record. -* @details Inputs: none -* @details Outputs: message handled -* @param message a pointer to the message to handle -* @return none -*************************************************************************/ -void handleGetDGScheduledRunsRecord( MESSAGE_T *message ) -{ - BOOL result = FALSE; - - // verify payload length if ( 0 == message->hdr.payloadLen ) { - // Tester must be logged in - if ( TRUE == isTestingActivated() ) - { - result = sendRecordToDialin( NVDATAMGMT_SCHEDULED_RUNS_RECORD ); - } - } + memcpy(¤tMessage, payloadPtr, sizeof(U32)); + payloadPtr += sizeof(U32); - // respond to request - sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); -} + memcpy(&totalMessages, payloadPtr, sizeof(U32)); + payloadPtr += sizeof(U32); -/*********************************************************************//** -* @brief -* The handleSetDGScheduledRunsRecord function handles a request to set the DG -* scheduled runs data record. -* @details Inputs: none -* @details Outputs: message handled -* @param message a pointer to the message to handle -* @return none -*************************************************************************/ -void handleSetDGScheduledRunsRecord( MESSAGE_T *message ) -{ - BOOL status = FALSE; - U08* payloadPtr = message->payload; - U32 currentMessage; - U32 totalMessages; - U32 payloadLength; + memcpy(&payloadLength, payloadPtr, sizeof(U32)); + payloadPtr += sizeof(U32); - memcpy(¤tMessage, payloadPtr, sizeof(U32)); - payloadPtr += sizeof(U32); + status = receiveRecordFromDialin( NVDATAMGMT_SERVICE_RECORD, currentMessage, totalMessages, payloadLength, payloadPtr ); + } - memcpy(&totalMessages, payloadPtr, sizeof(U32)); - payloadPtr += sizeof(U32); - - memcpy(&payloadLength, payloadPtr, sizeof(U32)); - payloadPtr += sizeof(U32); - - status = receiveRecordFromDialin( NVDATAMGMT_SCHEDULED_RUNS_RECORD, currentMessage, totalMessages, payloadLength, payloadPtr ); - // Respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, status ); } -#endif /*********************************************************************//** * @brief @@ -3609,7 +3483,7 @@ memcpy( &payload, message->payload, sizeof( TEST_OVERRIDE_PAYLOAD_T ) ); if ( FALSE == payload.reset ) { - result = testSetHDCommunicationStatus(payload.state.u32); + result = testSetHDCommunicationStatus( payload.state.u32 ); } else { @@ -3622,6 +3496,39 @@ } /*********************************************************************//** + * @brief + * The handleSetPrimaryAndTrimmerHeatersTargetTemperature function handles + * setting primary and trimmer heaters target temperature. + * @details Inputs: none + * @details Outputs: message handled + * @param message a pointer to the message to handle + * @return none + *************************************************************************/ +void handleSetPrimaryAndTrimmerHeatersTargetTemperature( MESSAGE_T *message ) +{ + BOOL status = FALSE; + U08* payloadPtr = message->payload; + + if ( message->hdr.payloadLen >= ( sizeof( F32 ) + sizeof( F32 ) ) ) + { + F32 primaryTargetTemp = 0.0F; + F32 trimmerTargetTemp = 0.0F; + status = TRUE; + + memcpy( &primaryTargetTemp, payloadPtr, sizeof( F32 ) ); + payloadPtr += sizeof( F32 ); + + memcpy( &trimmerTargetTemp, payloadPtr, sizeof( F32 ) ); + + setHeaterTargetTemperature( DG_PRIMARY_HEATER, primaryTargetTemp ); + setHeaterTargetTemperature( DG_TRIMMER_HEATER, trimmerTargetTemp ); + } + + // Respond to request + sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, status ); +} + +/*********************************************************************//** * @brief * The handleGetDGUsageInfoRecord function handles a request to get the DG * usage information record.