Index: NVDataMgmt.c =================================================================== diff -u -r2f7217131cfe6d5c53a7df934a6f202b00177811 -ra32bba33291b3c17704d5c1589a899ce7b13aa02 --- NVDataMgmt.c (.../NVDataMgmt.c) (revision 2f7217131cfe6d5c53a7df934a6f202b00177811) +++ NVDataMgmt.c (.../NVDataMgmt.c) (revision a32bba33291b3c17704d5c1589a899ce7b13aa02) @@ -1165,10 +1165,15 @@ break; case GET_SRR_RECORD: - nvDataStartPtr = (U08*)&dgScheduledRunsGroup; + nvDataStartPtr = (U08*)&dgScheduledRunsGroup.dgScheduledRun; nvDataLength = sizeof( dgScheduledRunsGroup.dgScheduledRun ); break; + case GET_USAGE_RECORD: + nvDataStartPtr = (U08*)&dgUsageInfoGroup.dgUsageInfo; + nvDataLength = sizeof( dgUsageInfoGroup.dgUsageInfo ); + break; + default: SET_ALARM_WITH_2_U32_DATA( ALARM_ID_DG_SOFTWARE_FAULT, SW_FAULT_ID_INVALID_NV_RECORD_SELECTED, nvData ); break; @@ -1655,7 +1660,7 @@ if ( powerOffIsImminent != TRUE ) { // Check if the service record has to be updated - //updateServiceRecord(); // TODO what is this doing here? un-comment in DEN-13834 + updateServiceRecord(); // If the record processing queue is not empty, process the queues if ( ( FALSE == isRecordQueueEmpty() ) && ( TRUE == areResourcesAvailableForNextJob() ) ) @@ -2577,7 +2582,7 @@ *************************************************************************/ static void updateServiceRecord( void ) { - // If a new calibration is available and the service record has not been updated, updated the service record + // If a new calibration is available and the service record has not been updated, update the service record // Right now, the last service date is updated once a new calibration record is received by the service personnel if ( ( TRUE == isNewCalAvailable ) && ( FALSE == hasServiceRecordBeenUpdated ) ) { @@ -2593,6 +2598,18 @@ hasServiceRecordBeenUpdated = TRUE; } #endif +#ifdef _DG_ + dgServiceGroup.dgServiceRecord.lastServiceEpochDate = getRTCTimestamp(); + dgServiceGroup.dgServiceRecord.serviceLoc = 0; + dgServiceGroup.dgServiceRecord.crc = crc16( (U08*)&dgServiceGroup.dgServiceRecord, sizeof( DG_SERVICE_RECORD_T ) - sizeof( U16 ) ); + dgServiceGroup.crc = crc16( (U08*)&dgServiceGroup, sizeof( DG_SERVICE_RECORD_T ) - sizeof( U16 ) ); + + if ( FALSE == isQueueFull() ) + { + enqueue( NVDATAMGMT_WRITE, NVDATAMGMT_RTC, SERVICE_RECORD_NV_MEM_START_ADDRESS, (U08*)&dgServiceGroup, 0, sizeof( DG_SERVICE_RECORD_T ) ); + hasServiceRecordBeenUpdated = TRUE; + } +#endif } } @@ -2720,22 +2737,20 @@ static BOOL isDGServiceRecordValid( void ) { BOOL status = TRUE; - U16 calcCRC = crc16( (U08*)&dgServiceGroup.dgServiceRecord, sizeof(DG_SERVICE_RECORD_T) - sizeof(U16) ); + U16 calcCRC = crc16( (U08*)&dgServiceGroup.dgServiceRecord, sizeof( DG_SERVICE_RECORD_T ) - sizeof( U16 ) ); U16 recordCRC = dgServiceGroup.dgServiceRecord.crc; if ( calcCRC != recordCRC ) { // CRC did not pass so set all values to default dgServiceGroup.dgServiceRecord.lastServiceEpochDate = 0; dgServiceGroup.dgServiceRecord.serviceIntervalSeconds = RECORD_DEFAULT_SERVICE_INTERVAL_S; - // Recalculate the CRC with the default values - dgServiceGroup.dgServiceRecord.crc = crc16 ( (U08*)&dgServiceGroup.dgServiceRecord, sizeof( DG_SERVICE_RECORD_T ) - sizeof( U16 ) ); + dgServiceGroup.dgServiceRecord.lastResetTimeEpoch = getRTCTimestamp(); + dgServiceGroup.dgServiceRecord.crc = crc16 ( (U08*)&dgServiceGroup.dgServiceRecord, sizeof( DG_SERVICE_RECORD_T ) - sizeof( U16 ) ); + status = FALSE; // Service record failure is also considered as RTC RAM failure activateAlarmNoData( ALARM_ID_DG_INVALID_SERVICE_RECORD_CRC ); - - // Set the to FALSE since the record is not valid - status = FALSE; } return status; @@ -2763,9 +2778,10 @@ dgUsageInfoGroup.dgUsageInfo.roWaterGenSinceLastServiceL = 0.0; dgUsageInfoGroup.dgUsageInfo.roWaterGenTotalL = 0.0; dgUsageInfoGroup.dgUsageInfo.lastResetTimeEpoch = getRTCTimestamp(); + dgUsageInfoGroup.dgUsageInfo.crc = crc16( (U08*)&dgUsageInfoGroup, sizeof( DG_USAGE_INFO_GROUP_T ) - sizeof( U16 ) ); status = FALSE; - //activateAlarmNoData( ALARM_ID_DG_INVALID_USAGE_RECORD ); // TODO remove when dialin is implemented + //activateAlarmNoData( ALARM_ID_DG_INVALID_USAGE_RECORD_CRC ); // TODO remove when dialin is implemented } return status; Index: NVDataMgmtDGRecords.h =================================================================== diff -u -r7a8126075d566078097485bf4757f2a380a1ef98 -ra32bba33291b3c17704d5c1589a899ce7b13aa02 --- NVDataMgmtDGRecords.h (.../NVDataMgmtDGRecords.h) (revision 7a8126075d566078097485bf4757f2a380a1ef98) +++ NVDataMgmtDGRecords.h (.../NVDataMgmtDGRecords.h) (revision a32bba33291b3c17704d5c1589a899ce7b13aa02) @@ -67,6 +67,7 @@ SW_CONFIG_DISABLE_MIXING_IN_FILL, ///< Software configuration disable mixing in fill. SW_CONFIG_DISABLE_TEMPERATURE_SENSORS_ALARM, ///< Software configuration disable temperature sensors alarm. SW_CONFIG_ENABLE_V3_SYSTEM, ///< Software configuration enable V3 system. + SW_CONFIG_DISABLE_SERVICE_AND_DISINFECT_CHECK, ///< Software configuration disable service and disinfect checks. NUM_OF_SW_CONFIGS ///< Number of software configurations. } SOFTWARE_CONFIG_T; #endif @@ -95,6 +96,7 @@ GET_SYS_RECORD, ///< Get system record. GET_SRV_RECORD, ///< Get service record. GET_SRR_RECORD, ///< Get scheduled runs record. + GET_USAGE_RECORD, ///< Get usage record. NUM_OF_NV_DG_DATA ///< Number of non-volatile data. } NV_DATA_T; @@ -461,6 +463,7 @@ U08 serviceLoc; ///< DG service location. U32 lastServiceEpochDate; ///< DG last service date in epoch. U32 serviceIntervalSeconds; ///< DG service interval in seconds. + U32 lastResetTimeEpoch; ///< Last time the record was reset in epoch. U16 crc; ///< CRC for the DG service record structure. } DG_SERVICE_RECORD_T; Index: RTC.c =================================================================== diff -u -rb6711400cf9f7239d7f9041da7c87d89d901b02a -ra32bba33291b3c17704d5c1589a899ce7b13aa02 --- RTC.c (.../RTC.c) (revision b6711400cf9f7239d7f9041da7c87d89d901b02a) +++ RTC.c (.../RTC.c) (revision a32bba33291b3c17704d5c1589a899ce7b13aa02) @@ -1298,7 +1298,7 @@ data.epochTime = lastEpochTime; #ifdef _DG_ - broadcastData( MSG_ID_RTC_EPOCH, COMM_BUFFER_OUT_CAN_DG_BROADCAST, (U08*)&data, sizeof( RTC_DATA_T ) ); + broadcastData( MSG_ID_DG_RTC_EPOCH, COMM_BUFFER_OUT_CAN_DG_BROADCAST, (U08*)&data, sizeof( RTC_DATA_T ) ); #endif #ifdef _HD_