This commit is contained in:
2026-03-20 21:19:04 +08:00
parent 90c3d919df
commit 9d3b4b836f
247 changed files with 22127 additions and 30305 deletions

35
user/Compute/SavingData.c Executable file → Normal file
View File

@@ -1,17 +1,18 @@
#include "../main/SystemInclude.h"
/******************************************************************************
recordTime must be define
*******************************************************************************/
//******************************************************************************
// for save data
u16 historyPeriodSet;
static u16 lastState;
u16 saveTimeCounter;
/******************************************************************************/
void SaveParameterInit(void)
{
// history record period
recordTime = (u16)ReadShortParameterFromMemory(RECORD_TIME, RECORD_TIME_DEFAULT);
// ReadMultiByteFromEEPROM(HISTORY_PERIOD, tempL.Byte, HISTORY_PERIOD_WIDTH, PARA_EEPROM);
// if(tempL.Byte[HISTORY_PERIOD_CRC] != CRC8(tempL.Byte, HISTORY_PERIOD_CRC)) historyPeriod = HISTORY_PERIOD_DEFAULT;
// else historyPeriod = tempL.Word[0];
historyPeriod = (u16)ReadParameterFromMemory(HISTORY_PERIOD, HISTORY_PERIOD_WIDTH, HISTORY_PERIOD_DEFAULT);
}
/******************************************************************************/
@@ -98,6 +99,12 @@ u16 AlarmWrite(void)
#pragma message("[undefined] REC_ALARM_DATA")
#elif(REC_ALARM_DATA)
#ifndef ENABLE_EXT_RTC
#pragma message("[undefined] ENABLE_EXT_RTC")
#elif(ENABLE_EXT_RTC)
ExtRTCTimeRead();
#endif
// The Zero record: Factory initial state
ReadMultiByteFromEEPROM(ALARM_POINTER, tempL.Byte, ALARM_POINTER_WIDTH, DATA_EEPROM);
if(tempL.Byte[ALARM_POINTER_CRC] != CRC8(tempL.Byte, ALARM_POINTER_CRC)) tempL.Word[0] = 1;
@@ -119,7 +126,7 @@ u16 AlarmWrite(void)
void SetHistoryRecordTime(void)
{
/*
u16 wrt_base, pointer;
unsigned int wrt_base, pointer;
ReadMultiByteFromEEPROM(HISTORY_POINTER_H, temp, 2, DATA_EEPROM);
pointer = make16(temp[0], temp[1]);
@@ -181,6 +188,12 @@ u16 HistoryRecordWrite(void)
#pragma message("[undefined] REC_HISTORY_DATA")
#elif(REC_HISTORY_DATA)
#ifndef ENABLE_EXT_RTC
#pragma message("[undefined] ENABLE_EXT_RTC")
#elif(ENABLE_EXT_RTC)
ExtRTCTimeRead();
#endif
ReadMultiByteFromEEPROM(HISTORY_POINTER, tempL.Byte, HISTORY_POINTER_WIDTH, DATA_EEPROM);
if(tempL.Byte[HISTORY_POINTER_CRC] != CRC8(tempL.Byte, HISTORY_POINTER_CRC)) tempL.Word[0] = 1;
else if(tempL.Word[0] >= HISTORY_DEPTH) tempL.Word[0] = 1;
@@ -254,8 +267,14 @@ u16 DateAccWrite(void)
#ifndef REC_DATE_DATA
#pragma message("[undefined] REC_DATE_DATA")
#elif(REC_DATE_DATA)
u16 wrt_base;
unsigned int wrt_base;
unsigned char buffer[DATE_WIDTH];
#ifndef ENABLE_EXT_RTC
#pragma message("[undefined] ENABLE_EXT_RTC")
#elif(ENABLE_EXT_RTC)
ExtRTCTimeRead();
#endif
ReadMultiByteFromEEPROM(DATE_POINTER, tempL.Byte, DATE_POINTER_WIDTH, DATA_EEPROM);
if(tempL.Byte[DATE_POINTER_CRC] != CRC8(tempL.Byte, DATE_POINTER_CRC)) tempL.Word[0] = 1;
@@ -371,7 +390,7 @@ void ClearDateRecord(void)
/******************************************************************************/
void DataStorageManagement(void)
{
systemProcessing.Bit.SaveHandle = 0;
systemProcess.Bit.SaveHandle = 0;
if(alarmState != lastState)
{