Index: firmware/App/Services/NVMessagingDD.c =================================================================== diff -u -rc49f9ed931d60e5bd1d0a406fde6c9fe1437f73b -r7362b089e676aadfaa614cca148e2aed007bae95 --- firmware/App/Services/NVMessagingDD.c (.../NVMessagingDD.c) (revision c49f9ed931d60e5bd1d0a406fde6c9fe1437f73b) +++ firmware/App/Services/NVMessagingDD.c (.../NVMessagingDD.c) (revision 7362b089e676aadfaa614cca148e2aed007bae95) @@ -47,13 +47,6 @@ #pragma pack(push, 1) -/// DD NVM Record Payload -typedef struct -{ - U08 idx; ///< Index of sensor / pump / concentrates - U08 data[ NUM_OF_BYTES_PER_RECORD_PAYLOAD ]; ///< Data to be sent -} DD_NVM_RECORD_PAYLOAD_T; - /// DD NVM Get System Record Response Payload typedef struct { @@ -343,16 +336,24 @@ // ********** private data ********** -static SEND_RECORD_STATE_T nvMExecSendRecordState; ///< NVM exec process record state. -static U32 newRecordStartTimer; ///< New record availability start timer. -static BOOL isNewCalRecordAvailable; ///< Signal to indicate whether a new NVM data is available. -static NV_DATA_T recordToPublish; ///< Record type which is being processed currently for sending -static NV_DATA_T nvPublishRecordType; ///< Used to index over isPublishRecordRequested in the idle state -static U32 recordSendDataIntervalCounter; ///< Record data send to CAN bust interval counter. -static U32 sendRetryCount; ///< Counter for number of retries to send a record -static U08 sendCalIdx; ///< Current Index of sensor calibration data to be sent -static BOOL isPublishRecordRequested[ NUM_OF_NV_DD_DATA ]; ///< Record state machine publish request flag. +static SEND_RECORD_STATE_T nvMExecSendRecordState; ///< NVM exec process record state. +static U32 newRecordStartTimer; ///< New record availability start timer. +static BOOL isNewCalRecordAvailable; ///< Signal to indicate whether a new NVM data is available. +static NV_DATA_T recordToPublish; ///< Record type which is being processed currently for sending +static NV_DATA_T nvPublishRecordType; ///< Used to index over isPublishRecordRequested in the idle state +static U32 recordSendDataIntervalCounter; ///< Record data send to CAN bust interval counter. +static U32 sendRetryCount; ///< Counter for number of retries to send a record +static U08 sendCalIdx; ///< Current Index of sensor calibration data to be sent +static BOOL isPublishRecordRequested[ NUM_OF_NV_DD_DATA ]; ///< Record state machine publish request flag. +// Calibration Record Publish Flag for index of each component +static BOOL isGetPressureCalRequested[ NUM_OF_PRESSURE_SENSORS ]; ///< Pressure Sensors Get Calibration Request Flag +static BOOL isGetTempCalRequested[ NUM_OF_TEMPERATURE_SENSORS ]; ///< Temperature Sensors Get Calibration Request Flag +static BOOL isGetConcPumpCalRequested[ NUM_OF_CONCENTRATE_PUMPS ]; ///< Concentrate Pumps Get Calibration Request Flag +static BOOL isGetAcidConcCalRequested[ NUM_OF_ACID_TYPE ]; ///< Acid Concentrates Get Calibration Request Flag +static BOOL isGetBicarbConcCalRequested[ NUM_OF_BICARB_TYPE ]; ///< Bicarb Concentrates Get Calibration Request Flag +static BOOL isGetCondSensCalRequested[ NUM_OF_CONDUCTIVITY_SENSORS ]; ///< Conductivity Sensor Get Calibration Request Flag + // ********** private function prototypes ********** // Process record functions @@ -1694,13 +1695,33 @@ BOOL handleDDGetPressureSensorCalRecRequest( MESSAGE_T *message ) { - BOOL result = FALSE; + BOOL result = FALSE; + U08* payloadPtr = message->payload; + U08 expectedPayloadLen = sizeof( U32 ) DD_NVM_GET_LINEAR_CAL_REC_PAYLOAD_T response; + U32 idx; if ( NVM_SEND_RECORD_STATE_IDLE == nvMExecSendRecordState ) { - isPublishRecordRequested[ NV_DD_DATA_CAL_PRESSURE_SENOSRS ] = TRUE; - result = TRUE; + if ( message->hdr.payloadLen == expectedPayloadLen ) + { + memcpy( &idx, &message->payload, sizeof(U32)); + + if( idx < NUM_OF_PRESSURE_SENSORS ) + { + isPublishRecordRequested[ NV_DD_DATA_CAL_PRESSURE_SENOSRS ] = TRUE; + isGetPressureCalRequested[ idx ] = TRUE; + result = TRUE; + } + else + { + response.rejectionReason = REQUEST_REJECT_REASON_INDEX_OUT_OF_RANGE; + } + } + else + { + response.rejectionReason = REQUEST_REJECT_REASON_INVALID_REQUEST_FORMAT; + } } else { @@ -1720,18 +1741,18 @@ BOOL result = FALSE; U08* payloadPtr = message->payload; U08 recordSize = sizeof( LINEAR_CAL_PAYLOAD_T ) - sizeof( U16 ); // Data - CRC - U08 expectedPayloadLen = sizeof( U08 ) + recordSize; // Index + Data - CRC + U08 expectedPayloadLen = sizeof( U32 ) + recordSize; // Index + Data - CRC DD_NVM_SET_LINEAR_CAL_REC_PAYLOAD_T response = { 0 }; - U08 idx; + U32 idx; LINEAR_CAL_PAYLOAD_T record; // Calibration record can be updated only in service mode if ( DD_MODE_SERV == getCurrentOperationMode() ) { if ( message->hdr.payloadLen == expectedPayloadLen ) { - memcpy( &idx, payloadPtr, sizeof(U08)); - payloadPtr += sizeof(U08); + memcpy( &idx, payloadPtr, sizeof(U32)); + payloadPtr += sizeof(U32); if( idx < NUM_OF_PRESSURE_SENSORS ) {