Index: NVDataMgmt.c =================================================================== diff -u -ra7a02bc7f05ca6b400db99501fcd37b56510519d -re053a222c52e84f31503ed106cf64c2ca920029e --- NVDataMgmt.c (.../NVDataMgmt.c) (revision a7a02bc7f05ca6b400db99501fcd37b56510519d) +++ NVDataMgmt.c (.../NVDataMgmt.c) (revision e053a222c52e84f31503ed106cf64c2ca920029e) @@ -95,10 +95,16 @@ #define CAL_RECORD_NV_MEM_START_ADDRESS BANK7_SECTOR0_START_ADDRESS + 4096 ///< Calibration record storage start address in NV memory. #define RECORD_BYTE_SIZE(r) (sizeof(r) + sizeof(U16)) ///< Record byte size macro. -// Padding length calculation: (DG struct size % bytes to write(16) == 0 ? 0 : (DG struct size / bytes to write(16)) + 1) * bytes to write(16) -/// DG padding length macro that is calculated with the size of the provided structure. -#define RECORD_PADDING_LENGTH(rcrd, buf) (RECORD_BYTE_SIZE(rcrd) % buf == 0 ? 0 : ((U32)(RECORD_BYTE_SIZE(rcrd) / buf) + 1)) * buf +// Padding length calculation: (DG struct size % bytes to write(16) == 0 ? 0 : ((DG struct size / bytes to write(16)) + 1) * bytes to write(16)) - DG struct size. +// NOTE: assuming the macro is calculating the padding length for a non-volatile memory. For NV, 16 bytes is used and buffer and for the RTC RAM 64 bytes is used. +// If the size of the structure + a 2-byte crc mod 16 is 0, then the size of the padding is 0 +// Otherwise, the (((structure size + crc) / 16) + 1) * 16. In the calculations, a + 1 is added since the division has a decimal so + 1 is used +// to round up. The result is then multiplied by 16 bytes to get the number of bytes needed and is subtracted from the size of the structure and CRC. +#define RECORD_PADDING_LENGTH(rcrd, buf) (RECORD_BYTE_SIZE(rcrd) % buf == 0 ? 0 : \ + ((((RECORD_BYTE_SIZE(rcrd) / buf) + 1)) * buf) \ + - RECORD_BYTE_SIZE(rcrd)) /// DG padding length macro. + #define RECORD_DEFAULT_TIME 0U ///< Record default time (calibration/set). #define RECORD_FOURTH_ORDER_COEFF 0.0 ///< Record fourth order coefficient. #define RECORD_THIRD_ORDER_COEFF 0.0 ///< Record third order coefficient. @@ -365,7 +371,6 @@ HD_PUMPS_CAL_RECORD_T pumpsCalRecord; ///< HD pumps. HD_VALVES_CAL_RECORD_T valvesCalRecord; ///< HD valves. HD_OCCLUSION_SENSORS_CAL_RECORD_T occlusionSensorsCalRecord; ///< HD occlusion sensors. - HD_FLOW_SENSORS_CAL_RECORD_T flowSensorsCalRecord; ///< HD flow sensors. HD_PRESSURE_SENSORS_CAL_RECORD_T pressureSensorsCalRecord; ///< HD pressure sensors. HD_TEMP_SENSORS_CAL_RECORD_T tempSensorsCalRecord; ///< HD temperature sensors. HD_HEPARIN_FORCE_SENSOR_CAL_RECORD_T heparinForceSensorCalRecord; ///< HD heparin force sensor. @@ -377,35 +382,31 @@ typedef struct { HD_CALIBRATION_GROUPS hdCalibrationGroups; ///< HD calibration groups. - U08 padding[ RECORD_PADDING_LENGTH(HD_CALIBRATION_GROUPS, MAX_EEPROM_WRITE_BUFFER_BYTES) - - RECORD_BYTE_SIZE(HD_CALIBRATION_GROUPS) ]; ///< HD calibration record padding byte array. + U08 padding[ RECORD_PADDING_LENGTH(HD_CALIBRATION_GROUPS, MAX_EEPROM_WRITE_BUFFER_BYTES) ]; ///< HD calibration record padding byte array. U16 crc; ///< CRC for the DG calibration record structure. } HD_CALIBRATION_RECORD_T; /// HD system group structure typedef struct { HD_SYSTEM_RECORD_T hdsystemRecord; ///< HD system record. - U08 padding[ RECORD_PADDING_LENGTH(HD_SYSTEM_RECORD_T, MAX_EEPROM_WRITE_BUFFER_BYTES) - - RECORD_BYTE_SIZE(HD_SYSTEM_RECORD_T) ]; ///< HD system group padding. + U08 padding[ RECORD_PADDING_LENGTH(HD_SYSTEM_RECORD_T, MAX_EEPROM_WRITE_BUFFER_BYTES) ]; ///< HD system group padding. U16 crc; ///< CRC for the HD system group structure. } HD_SYSTEM_GROUP_T; /// HD service record structure typedef struct { HD_SERVICE_RECORD_T hdServiceRecord; ///< HD service record. - U08 padding[ RECORD_PADDING_LENGTH(HD_SERVICE_RECORD_T, MAX_RTC_RAM_OPS_BUFFER_BYTES) - - RECORD_BYTE_SIZE(HD_SERVICE_RECORD_T) ]; ///< HD service group padding. + U08 padding[ RECORD_PADDING_LENGTH(HD_SERVICE_RECORD_T, MAX_RTC_RAM_OPS_BUFFER_BYTES) ]; ///< HD service group padding. U16 crc; ///< CRC for the HD service structure. } HD_SERVICE_GROUP_T; /// HD usage info record structure typedef struct { HD_USAGE_INFO_RECORD_T hdUsageInfo; ///< HD usage info record. - U08 padding[ RECORD_PADDING_LENGTH(HD_USAGE_INFO_RECORD_T, MAX_RTC_RAM_OPS_BUFFER_BYTES) - - RECORD_BYTE_SIZE(HD_USAGE_INFO_RECORD_T) ]; ///< HD scheduled run group padding. + U08 padding[ RECORD_PADDING_LENGTH(HD_USAGE_INFO_RECORD_T, MAX_RTC_RAM_OPS_BUFFER_BYTES) ]; ///< HD scheduled run group padding. U16 crc; ///< CRC for the HD usage info structure. } HD_USAGE_INFO_GROUP_T; @@ -414,8 +415,7 @@ { HD_SW_CONFIG_RECORD_T hdSWConfigsRecord; ///< Software configurations record. // Since the software configurations are one byte, Num_of was used for the length of the lists - U08 padding[ RECORD_PADDING_LENGTH(HD_SW_CONFIG_RECORD_T, MAX_RTC_RAM_OPS_BUFFER_BYTES) - - RECORD_BYTE_SIZE(HD_SW_CONFIG_RECORD_T) ]; ///< Software configurations group padding. + U08 padding[ RECORD_PADDING_LENGTH(HD_SW_CONFIG_RECORD_T, MAX_RTC_RAM_OPS_BUFFER_BYTES) ]; ///< Software configurations group padding. U16 crc; ///< Software configurations CRC. } HD_SW_CONFIG_GROUP_T; @@ -826,331 +826,6 @@ /*********************************************************************//** * @brief - * The getDGCalibrationRecord function sets the calibration state machine - * to read and publish calibration record. - * @details Inputs: hasPublishRecordBeenRequested, recordToPublish - * nvDataMgmtExecProcessRecordState - * @details Outputs: hasPublishRecordBeenRequested, recordToPublish - * @return TRUE if the request was successfully registered - *************************************************************************/ -BOOL getCalibrationRecord( void ) -{ - BOOL status = FALSE; - - // Check if the state machine is in idle state and then set the request - if ( nvDataMgmtExecProcessRecordState == NVDATAMGMT_PROCESS_RECORD_STATE_IDLE ) - { - hasPublishRecordBeenRequested = TRUE; - recordToPublish = NVDATAMGMT_CALIBRATION_RECORD; - status = TRUE; - } - - return status; -} - -/*********************************************************************//** - * @brief - * The setCalibrationRecord function writes the calibration record that - * is received from Dialin into the calibration structure. - * @details Inputs: nvDataMgmtExecReceiveRecordState, recordUpdateAddress - * recordReceiveStartTime, previousCalMessageNum - * @details Outputs: nvDataMgmtExecReceiveRecordState, recordUpdateAddress - * recordReceiveStartTime, previousCalMessageNum - * @param currentMessage: current message number that is received from - * Dialin - * @param totalMessages: total number of messages from Dialin - * @param length: message length in bytes - * @param *addressPtr: address to the beginning of the calibration data from Dialin - * @return TRUE if the request was successfully registered - *************************************************************************/ -BOOL setCalibrationRecord( U32 currentMessage, U32 totalMessages, U32 length, U08 *addressPtr ) -{ - BOOL status = TRUE; - - // If the calibration message number is the first message number and receive exec state is idle, switch to idle - if ( ( RECORD_DATA_FIRST_RECEIVING_MSG_NUM == currentMessage ) && ( NVDATAMGMT_RECEIVE_RECORD_IDLE == nvDataMgmtExecReceiveRecordState ) ) - { - nvDataMgmtExecReceiveRecordState = NVDATAMGMT_RECEIVE_RECORD_RECEIVE; - recordReceiveStartTime = getMSTimerCount(); - previousCalMessageNum = 0; - recordUpdateAddress = 0; - } - - // Check if there is still a message left to be received - if ( ( NVDATAMGMT_RECEIVE_RECORD_RECEIVE == nvDataMgmtExecReceiveRecordState ) && ( currentMessage <= totalMessages ) ) - { - // Check if the current message is different from the previous message by 1 - if ( RECORD_DATA_MAX_MESSAGE_DFFIRENCE == ( currentMessage - previousCalMessageNum ) ) - { - // Define a pointer that points to the DG calibration record - PROCESS_RECORD_SPECS_T recordSpec = RECORDS_SPECS[ NVDATAMGMT_CALIBRATION_RECORD ]; - U08* ptr = recordSpec.structAddressPtr; - - // Offset the pointer to length that we should start writing from - ptr += recordUpdateAddress; - - // Copy the data into the buffer - memcpy(ptr, addressPtr, length); - - // Check if the current message is total messages - // and 0 everything out since we are done writing - if ( currentMessage == totalMessages ) - { - U16 calcCRC = crc16( recordSpec.structAddressPtr, recordSpec.sizeofJob - sizeof(U16) ); - U16 recordCRC = *(U16*)recordSpec.structCRCPtr; - - if ( calcCRC != recordCRC ) - { - // CRC failed, request a read to read the data back from NV memory and update the structure - enqueueRecordJob( NVDATAMGMT_READ, NVDATAMGMT_EEPROM, NVDATAMGMT_CALIBRATION_RECORD ); - nvDataMgmtExecReceiveRecordState = NVDATAMGMT_RECEIVE_RECORD_IDLE; - status = FALSE; - } - else - { - // CRC passed, enqueue an erase, a write of calibration data and a write of service record - BOOL scheduleStatus = enqueueSector0Records(); - - // Signal that there is a new calibration record available. - newCalStartTimer = getMSTimerCount(); - isNewCalAvailable = TRUE; - } - // Done with receiving data, go back to idle - nvDataMgmtExecReceiveRecordState = NVDATAMGMT_RECEIVE_RECORD_IDLE; - } - else - { - // Update the length as it has successfully been written - recordUpdateAddress += length; - - // Now the current message is the previous message - previousCalMessageNum = currentMessage; - } - } - else - { - status = FALSE; - nvDataMgmtExecReceiveRecordState = NVDATAMGMT_RECEIVE_RECORD_IDLE; - } - } - - return status; -} - -/*********************************************************************//** - * @brief - * The getSystemRecord function sets the system state machine to read - * and publish system record. - * @details Inputs: hasPublishRecordBeenRequested, recordToPublish - * nvDataMgmtExecProcessRecordState - * @details Outputs: hasPublishRecordBeenRequested, recordToPublish - * @return TRUE if the request was successfully registered - *************************************************************************/ -BOOL getSystemRecord( void ) -{ - BOOL status = FALSE; - - // Check if the state machine is in idle state and then set the request - if ( nvDataMgmtExecProcessRecordState == NVDATAMGMT_PROCESS_RECORD_STATE_IDLE ) - { - hasPublishRecordBeenRequested = TRUE; - recordToPublish = NVDATAMGMT_SYSTEM_RECORD; - status = TRUE; - } - - return status; -} - -/*********************************************************************//** - * @brief - * The setSystemRecord function writes the system record that is received - * from Dialin into the system structure. - * @details Inputs: nvDataMgmtExecReceiveRecordState, recordUpdateAddress - * recordReceiveStartTime, previousCalMessageNum - * @details Outputs: nvDataMgmtExecReceiveRecordState, recordUpdateAddress - * recordReceiveStartTime, previousCalMessageNum - * @param currentMessage: current message number that is received from - * Dialin - * @param totalMessages: total number of messages from Dialin - * @param length: message length in bytes - * @param *addressPtr: address to the beginning of the calibration data - * from Dialin - * @return TRUE if the request was successfully registered - *************************************************************************/ -BOOL setSystemRecord( U32 currentMessage, U32 totalMessages, U32 length, U08 *addressPtr ) -{ - BOOL status = TRUE; - - // If the calibration message number is the first message number and receive exec state is idle, switch to idle - if ( ( RECORD_DATA_FIRST_RECEIVING_MSG_NUM == currentMessage ) && ( NVDATAMGMT_RECEIVE_RECORD_IDLE == nvDataMgmtExecReceiveRecordState ) ) - { - nvDataMgmtExecReceiveRecordState = NVDATAMGMT_RECEIVE_RECORD_RECEIVE; - recordReceiveStartTime = getMSTimerCount(); - previousCalMessageNum = 0; - recordUpdateAddress = 0; - } - - // Check if there is still a message left to be received - if ( ( NVDATAMGMT_RECEIVE_RECORD_RECEIVE == nvDataMgmtExecReceiveRecordState ) && ( currentMessage <= totalMessages ) ) - { - // Check if the current message is different from the previous message by 1 - if ( RECORD_DATA_MAX_MESSAGE_DFFIRENCE == ( currentMessage - previousCalMessageNum ) ) - { - // Define a pointer that points to the DG calibration record - PROCESS_RECORD_SPECS_T recordSpec = RECORDS_SPECS [ NVDATAMGMT_SYSTEM_RECORD ]; - U08* ptr = recordSpec.structAddressPtr; - - // Offset the pointer to length that we should start writing from - ptr += recordUpdateAddress; - - memcpy(ptr, addressPtr, length); - - // Check if the current message is total messages - // and 0 everything out since we are done writing - if ( currentMessage == totalMessages ) - { - U16 calcCRC = crc16 ( recordSpec.structAddressPtr, recordSpec.sizeofJob - sizeof(U16) ); - // Get the CRC of the structure without the last 16 bits which is the CRC as well as the padding values - U16 recordCRC = *(U16*)recordSpec.structCRCPtr; - - if ( calcCRC != recordCRC ) - { - // CRC failed, request a read to read the data back from NV memory and update the structure - enqueueRecordJob( NVDATAMGMT_READ, NVDATAMGMT_EEPROM, NVDATAMGMT_SYSTEM_RECORD ); - nvDataMgmtExecReceiveRecordState = NVDATAMGMT_RECEIVE_RECORD_IDLE; - status = FALSE; - } - else - { - // CRC passed, enqueue an erase, a write of calibration data and a write of service record - BOOL scheduleStatus = enqueueSector0Records(); - - // Done with receiving data, go back to idle - nvDataMgmtExecReceiveRecordState = NVDATAMGMT_RECEIVE_RECORD_IDLE; - } - } - else - { - // Update the length as it has successfully been written - recordUpdateAddress += length; - - // Now the current message is the previous message - previousCalMessageNum = currentMessage; - } - } - } - - return status; -} - -/*********************************************************************//** - * @brief - * The getServiceRecord function sets the system state machine to read - * and publish service record. - * @details Inputs: hasPublishRecordBeenRequested, recordToPublish - * hasPublishRecordBeenRequested - * @details Outputs: hasPublishRecordBeenRequested, recordToPublish - * @return TRUE if the request was successfully registered - *************************************************************************/ -BOOL getServiceRecord( void ) -{ - BOOL status = FALSE; - - // Check if the state machine is in idle state and then set the request - if ( NVDATAMGMT_PROCESS_RECORD_STATE_IDLE == nvDataMgmtExecProcessRecordState ) - { - hasPublishRecordBeenRequested = TRUE; - recordToPublish = NVDATAMGMT_SERVICE_RECORD; - status = TRUE; - } - - return status; -} - -/*********************************************************************//** - * @brief - * The setServiceRecord function writes the service record that - * is received from Dialin into the service structure. - * @details Inputs: nvDataMgmtExecReceiveRecordState, recordUpdateAddress - * recordReceiveStartTime, previousCalMessageNum - * @details Outputs: nvDataMgmtExecReceiveRecordState, recordUpdateAddress - * recordReceiveStartTime, previousCalMessageNum - * @param currentMessage: current message number that is received from - * Dialin - * @param totalMessages: total number of messages from Dialin - * @param length: message length in bytes - * @param *addressPtr: address to the beginning of the calibration data - * from Dialin - * @return TRUE if the request was successfully registered - *************************************************************************/ -BOOL setServiceRecord( U32 currentMessage, U32 totalMessages, U32 length, U08 *addressPtr ) -{ - BOOL status = TRUE; - - // If the calibration message number is the first message number and receive exec state is idle, switch to idle - if ( RECORD_DATA_FIRST_RECEIVING_MSG_NUM == currentMessage && nvDataMgmtExecReceiveRecordState == NVDATAMGMT_RECEIVE_RECORD_IDLE ) - { - nvDataMgmtExecReceiveRecordState = NVDATAMGMT_RECEIVE_RECORD_RECEIVE; - recordReceiveStartTime = getMSTimerCount(); - previousCalMessageNum = 0; - recordUpdateAddress = 0; - } - - // Check if there is still a message left to be received - if ( nvDataMgmtExecReceiveRecordState == NVDATAMGMT_RECEIVE_RECORD_RECEIVE && currentMessage <= totalMessages ) - { - // Check if the current message is different from the previous message by 1 - if ( RECORD_DATA_MAX_MESSAGE_DFFIRENCE == ( currentMessage - previousCalMessageNum ) ) - { - // Define a pointer that points to the DG calibration record - PROCESS_RECORD_SPECS_T recordSpec = RECORDS_SPECS [ NVDATAMGMT_SERVICE_RECORD ]; - U08* ptr = recordSpec.structAddressPtr; - - // Offset the pointer to length that we should start writing from - ptr += recordUpdateAddress; - - memcpy(ptr, addressPtr, length); - - // Check if the current message is total messages - // and 0 everything out since we are done writing - if ( currentMessage == totalMessages ) - { - U16 calcCRC = crc16 ( recordSpec.structAddressPtr, recordSpec.sizeofJob - sizeof(U16) ); - // Get the CRC of the structure without the last 16 bits which is the CRC as well as the padding values - U16 recordCRC = *(U16*)recordSpec.structCRCPtr; - - if ( calcCRC != recordCRC ) - { - // CRC failed, request a read to read the data back from NV memory and update the structure - enqueueRecordJob( NVDATAMGMT_READ, NVDATAMGMT_RTC, NVDATAMGMT_SERVICE_RECORD ); - nvDataMgmtExecReceiveRecordState = NVDATAMGMT_RECEIVE_RECORD_IDLE; - status = FALSE; - } - else - { - // CRC passed write the last service record to the RTC RAM - enqueueRecordJob( NVDATAMGMT_WRITE, NVDATAMGMT_RTC, NVDATAMGMT_SERVICE_RECORD ); - - // Done with receiving data, go back to idle - nvDataMgmtExecReceiveRecordState = NVDATAMGMT_RECEIVE_RECORD_IDLE; - } - } - else - { - // Update the length as it has successfully been written - recordUpdateAddress += length; - - // Now the current message is the previous message - previousCalMessageNum = currentMessage; - } - } - } - - return status; -} - -/*********************************************************************//** - * @brief * The sendRecordToDialin function prepares the process record state machine * to send a record to Dialin. * @details Inputs: nvDataMgmtExecProcessRecordState @@ -1438,6 +1113,34 @@ isNVDataValid = ( 0 == hdCalibrationRecord.hdCalibrationGroups.heparinForceSensorCalRecord.hdHeparinForceSensor.calibrationTime ? FALSE : TRUE ); break; + case GET_CAL_PUMPS: + nvDataStartPtr = (U08*)&hdCalibrationRecord.hdCalibrationGroups.pumpsCalRecord; + nvDataLength = sizeof( hdCalibrationRecord.hdCalibrationGroups.pumpsCalRecord ); + for ( i = 0; i < NUM_OF_CAL_DATA_HD_PUMPS; i++ ) + isNVDataValid = ( 0 == hdCalibrationRecord.hdCalibrationGroups.pumpsCalRecord.hdPumps[ i ].calibrationTime ? FALSE : TRUE ); + break; + + case GET_CAL_PRESSURE_SENSORS: + nvDataStartPtr = (U08*)&hdCalibrationRecord.hdCalibrationGroups.pressureSensorsCalRecord; + nvDataLength = sizeof( hdCalibrationRecord.hdCalibrationGroups.pressureSensorsCalRecord ); + for ( i = 0; i < NUM_OF_CAL_DATA_HD_PRESSURE_SESNSORS; i++ ) + isNVDataValid = ( 0 == hdCalibrationRecord.hdCalibrationGroups.pressureSensorsCalRecord.hdPressureSensors[ i ].calibrationTime ? FALSE : TRUE ); + break; + + case GET_CAL_OCCLUSION_SESNSORS: + nvDataStartPtr = (U08*)&hdCalibrationRecord.hdCalibrationGroups.occlusionSensorsCalRecord; + nvDataLength = sizeof( hdCalibrationRecord.hdCalibrationGroups.occlusionSensorsCalRecord ); + for ( i = 0; i < NUM_OF_CAL_DATA_OCCLUSION_SENSORS; i++ ) + isNVDataValid = ( 0 == hdCalibrationRecord.hdCalibrationGroups.occlusionSensorsCalRecord.hdOcclusionSensors[ i ].calibrationTime ? FALSE : TRUE ); + break; + + case GET_CAL_VALVES: + nvDataStartPtr = (U08*)&hdCalibrationRecord.hdCalibrationGroups.valvesCalRecord; + nvDataLength = sizeof( hdCalibrationRecord.hdCalibrationGroups.valvesCalRecord ); + for ( i = 0; i < NUM_OF_CAL_DATA_HD_VALVES; i++ ) + isNVDataValid = ( 0 == hdCalibrationRecord.hdCalibrationGroups.valvesCalRecord.hdvalves[ i ].calibrationTime ? FALSE : TRUE ); + break; + case GET_SYS_RECORD: nvDataStartPtr = (U08*)&hdSystemGroup.hdsystemRecord; nvDataLength = sizeof( hdSystemGroup.hdsystemRecord ); @@ -1684,89 +1387,8 @@ } #endif -#ifdef _HD_ /*********************************************************************//** * @brief - * The getHDPumpsCalibrationRecord function returns the HD pumps calibration - * record. - * @details Inputs: none - * @details Outputs: none - * @return HD pumps calibration record - *************************************************************************/ -HD_PUMPS_CAL_RECORD_T getHDPumpsCalibrationRecord( void ) -{ - return hdCalibrationRecord.hdCalibrationGroups.pumpsCalRecord; -} - -/*********************************************************************//** - * @brief - * The getHDValvesCalibrationRecord function returns the HD valves calibration - * record. - * @details Inputs: none - * @details Outputs: none - * @return HD valves calibration record - *************************************************************************/ -HD_VALVES_CAL_RECORD_T getHDValvesCalibrationRecord( void ) -{ - return hdCalibrationRecord.hdCalibrationGroups.valvesCalRecord; -} - -/*********************************************************************//** - * @brief - * The getHDOcclusionSensrosCalibrationRecord function returns the HD - * occlusion sensors calibration record. - * @details Inputs: none - * @details Outputs: none - * @return HD occlusion sensors calibration record - *************************************************************************/ -HD_OCCLUSION_SENSORS_CAL_RECORD_T getHDOcclusionSensrosCalibrationRecord( void ) -{ - return hdCalibrationRecord.hdCalibrationGroups.occlusionSensorsCalRecord; -} - -/*********************************************************************//** - * @brief - * The getHDFlowSensorsCalibrationRecord function returns the HD flow - * sensors calibration record. - * @details Inputs: none - * @details Outputs: none - * @return HD flow sensors calibration record - *************************************************************************/ -HD_FLOW_SENSORS_CAL_RECORD_T getHDFlowSensorsCalibrationRecord( void ) -{ - return hdCalibrationRecord.hdCalibrationGroups.flowSensorsCalRecord; -} - -/*********************************************************************//** - * @brief - * The getHDPressureSensorsCalibrationRecord function returns the HD pressure - * sensors calibration record. - * @details Inputs: none - * @details Outputs: none - * @return HD pressure sensors calibration record - *************************************************************************/ -HD_PRESSURE_SENSORS_CAL_RECORD_T getHDPressureSensorsCalibrationRecord( void ) -{ - return hdCalibrationRecord.hdCalibrationGroups.pressureSensorsCalRecord; -} - -/*********************************************************************//** - * @brief - * The getHDTemperatureSensorsCalibrationRecord function returns the HD - * temperature sensors calibration record. - * @details Inputs: none - * @details Outputs: none - * @return HD temperature sensors calibration record - *************************************************************************/ -HD_TEMP_SENSORS_CAL_RECORD_T getHDTemperatureSensorsCalibrationRecord( void ) -{ - return hdCalibrationRecord.hdCalibrationGroups.tempSensorsCalRecord; -} - -#endif - -/*********************************************************************//** - * @brief * The writeLogData checks if the queue is not full and if it is not, it calls * enqueue to schedule a job for writing the log data. * @details Inputs: logRecord @@ -2301,7 +1923,7 @@ // If any of the records did not pass, they should be filled // with benign values. After that, schedule a write to sector 0 // to re-write the records with the benign values - if ( FALSE == haveCalGroupsPassed ) + if ( ( FALSE == haveRecordsPassed ) || ( FALSE == haveCalGroupsPassed ) || ( FALSE == hasSystemRecordPassed ) ) { enqueueSector0Records(); } @@ -4144,14 +3766,6 @@ isCalRecordValid = isCalRecordValid == FALSE ? FALSE : isHardwareRecordValid; } - HD_FLOW_SENSORS_CAL_RECORD_T* flow = &hdCalibrationRecord.hdCalibrationGroups.flowSensorsCalRecord; - for ( i = 0; i < NUM_OF_CAL_DATA_HD_FLOW_SENSORS; i++ ) - { - record = (POLYNOMIAL_CAL_PAYLOAD_T*)&flow->hdFlowSensors[ i ]; - isHardwareRecordValid = isPolynomialRecordValid( record ); - isCalRecordValid = isCalRecordValid == FALSE ? FALSE : isHardwareRecordValid; - } - HD_PRESSURE_SENSORS_CAL_RECORD_T* pressure = &hdCalibrationRecord.hdCalibrationGroups.pressureSensorsCalRecord; for ( i = 0; i < NUM_OF_CAL_DATA_HD_PRESSURE_SESNSORS; i++ ) {