Index: firmware/App/Services/SystemCommMessages.c =================================================================== diff -u -r8791132fbfcb8fa25fb11a9ab15d695686aaef75 -rf237976ac5eb469200dfd547252720e6ea7211c4 --- firmware/App/Services/SystemCommMessages.c (.../SystemCommMessages.c) (revision 8791132fbfcb8fa25fb11a9ab15d695686aaef75) +++ firmware/App/Services/SystemCommMessages.c (.../SystemCommMessages.c) (revision f237976ac5eb469200dfd547252720e6ea7211c4) @@ -3224,7 +3224,7 @@ payloadPtr += sizeof( U32 ); memcpy( payloadPtr, &service.serviceIntervalSeconds, sizeof( U32 ) ); payloadPtr += sizeof( U32 ); - memcpy( payloadPtr, &dgData.dgServiceRecord.lastServiceDateEpoch, sizeof( U32 ) ); + memcpy( payloadPtr, &dgData.dgServiceRecord.lastServiceEpochDate, sizeof( U32 ) ); payloadPtr += sizeof( U32 ); memcpy( payloadPtr, &dgData.dgServiceRecord.serviceIntervalSeconds, sizeof( U32 ) ); } @@ -5251,6 +5251,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.f32 ); @@ -7111,6 +7112,45 @@ } /*********************************************************************//** + * @brief + * The sendHDUsageRecord function sends out the HD service record. + * @details Inputs: none + * @details Outputs: HD 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 srvcRcrdAddress: start address of the usage record + * @return TRUE if msg successfully queued for transmit, FALSE if not + *************************************************************************/ +BOOL sendHDUsageRecord( U32 payloadCurrNum, U32 payloadTotalNum, U32 length, U08* sysRcrdAddress ) +{ + BOOL result; + MESSAGE_T msg; + U08 *payloadPtr = msg.payload; + + // Create a message record + blankMessage( &msg ); + msg.hdr.msgID = MSG_ID_HD_SEND_USAGE_INFO_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, sysRcrdAddress, 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; +} + +/*********************************************************************//** * @brief * The handleUIServiceModeRequest function handles a request to enter service * mode. @@ -7130,10 +7170,9 @@ { if ( ( MODE_STAN == currentMode ) || ( MODE_FAUL == currentMode ) ) { - requestNewOperationMode( MODE_SERV ); - if ( (DG_MODE_STAN == currentDGMode) || (DG_MODE_FAUL == currentDGMode) ) + if ( ( DG_MODE_STAN == currentDGMode ) || ( DG_MODE_FAUL == currentDGMode ) ) { status = TRUE; cmdSetDGToServiceMode(); @@ -7272,11 +7311,11 @@ *************************************************************************/ void handleDGServiceScheduleData( MESSAGE_T *message ) { - if ( message->hdr.payloadLen == sizeof( HD_VERSION_DG_SERVICE_RECORD_T ) ) + if ( message->hdr.payloadLen == sizeof( DG_SERVICE_RECORD_T ) ) { - HD_VERSION_DG_SERVICE_RECORD_T payload; + DG_SERVICE_RECORD_T payload; - memcpy( &payload, message->payload, sizeof( HD_VERSION_DG_SERVICE_RECORD_T ) ); + memcpy( &payload, message->payload, sizeof( DG_SERVICE_RECORD_T ) ); setHDVersionDGServiceRecord( &payload ); } } @@ -7292,16 +7331,37 @@ *************************************************************************/ void handleDGUsageInfoData( MESSAGE_T *message ) { - if ( message->hdr.payloadLen == sizeof( HD_VERSION_DG_USAGE_INFO_T ) ) + if ( message->hdr.payloadLen == sizeof( DG_USAGE_INFO_RECORD_T ) ) { - HD_VERSION_DG_USAGE_INFO_T payload; + DG_USAGE_INFO_RECORD_T payload; - memcpy( &payload, message->payload, sizeof( HD_VERSION_DG_USAGE_INFO_T ) ); + memcpy( &payload, message->payload, sizeof( DG_USAGE_INFO_RECORD_T ) ); setHDVersionDGUsageInfo( &payload ); } } /*********************************************************************//** + * @brief + * The handleSetHDServiceTime function sets the HD service time once the + * command is received from UI + * @details Inputs: none + * @details Outputs: message handled + * @param message a pointer to the message to handle + * @return none + *************************************************************************/ +void handleSetHDServiceTime( MESSAGE_T *message ) +{ + BOOL result = FALSE; + + if ( 0 == message->hdr.payloadLen ) + { + result = setServiceTime(); + } + + sendAckResponseMsg( (MSG_ID_T)message->hdr.msgID, COMM_BUFFER_OUT_CAN_HD_2_UI, result ); +} + +/*********************************************************************//** * @brief * The handleGetHDUsageInfoRecord function handles a request to get the HD * usage information record. @@ -7615,6 +7675,31 @@ sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } +/*********************************************************************//** +* @brief +* The handleTestHDNVRecordCRCOverride function handles a request to override +* the selected NV record's CRC. +* @details Inputs: none +* @details Outputs: message handled +* @param message a pointer to the message to handle +* @return none +*************************************************************************/ +void handleTestHDNVRecordCRCOverride( 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 ) ); + result = testSetNVRecordCRCOverride( payload.index, (U16)payload.state.u32 ); + } + + // respond to request + sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); +} + void handleAirPumpIntervalOverrideRequest( MESSAGE_T *message ) { TEST_OVERRIDE_PAYLOAD_T payload;