This commit is contained in:
2026-03-20 21:19:53 +08:00
parent 9d3b4b836f
commit 6a749331db
125 changed files with 29972 additions and 23051 deletions

View File

@@ -1,18 +1,17 @@
#include "../main/SystemInclude.h"
//******************************************************************************
/******************************************************************************
recordTime must be define
*******************************************************************************/
// for save data
u16 historyPeriodSet;
static u16 lastState;
u16 saveTimeCounter;
/******************************************************************************/
void SaveParameterInit(void)
{
// history record period
// 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);
recordTime = (u16)ReadShortParameterFromMemory(RECORD_TIME, RECORD_TIME_DEFAULT);
}
/******************************************************************************/
@@ -99,12 +98,6 @@ 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;
@@ -126,7 +119,7 @@ u16 AlarmWrite(void)
void SetHistoryRecordTime(void)
{
/*
unsigned int wrt_base, pointer;
u16 wrt_base, pointer;
ReadMultiByteFromEEPROM(HISTORY_POINTER_H, temp, 2, DATA_EEPROM);
pointer = make16(temp[0], temp[1]);
@@ -188,12 +181,6 @@ 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;
@@ -267,14 +254,8 @@ u16 DateAccWrite(void)
#ifndef REC_DATE_DATA
#pragma message("[undefined] REC_DATE_DATA")
#elif(REC_DATE_DATA)
unsigned int wrt_base;
u16 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;
@@ -390,7 +371,7 @@ void ClearDateRecord(void)
/******************************************************************************/
void DataStorageManagement(void)
{
systemProcess.Bit.SaveHandle = 0;
systemProcessing.Bit.SaveHandle = 0;
if(alarmState != lastState)
{