From f03cf3ae7a36954e64fc014e6bb7afd20c5a5247 Mon Sep 17 00:00:00 2001
From: jinlicong <493886250@qq.com>
Date: Wed, 12 Jun 2024 17:22:08 +0800
Subject: [PATCH] 增加IAP功能,准备测试上位机升级

---
 Function/STORAGE/sizhu_history_record.c |   43 ++++++++++++++++++++++++++++++++++++++-----
 1 files changed, 38 insertions(+), 5 deletions(-)

diff --git a/Function/STORAGE/sizhu_history_record.c b/Function/STORAGE/sizhu_history_record.c
index c0a1840..e294304 100644
--- a/Function/STORAGE/sizhu_history_record.c
+++ b/Function/STORAGE/sizhu_history_record.c
@@ -89,7 +89,7 @@
 {
 	SIZHU_HISTORY_INTERVAL_T	sizhu_history_interval_l;
 	
-	return;  //?û�������ԣ�������
+//	return;  //?û�������ԣ�������
 	
 	arrayA_2_arrayB((uint8_t *)&sys_clockBCD_g,(uint8_t *)&sizhu_history_interval_l.record_time_BCD,sizeof(sys_clockBCD_g), LITTLE_ENDIAN);
 	
@@ -175,12 +175,45 @@
 void HistoryRecordTest(void)
 {
 	static uint8_t  test_start_flag =0;
-		ErrorStatus	test_Status = PASS;
+	ErrorStatus	test_Status = PASS;
+	uint16_t	count_i = 0;
+	uint16_t	record_num = 0;
+	uint16_t	have_record_num = 0;
+	uint32_t	read_addr;
+	uint32_t	err_addr;
+	uint32_t	err_count;
+	
+	SIZHU_HISTORY_INTERVAL_T	history_interval_l;
+	
+	
 	
 	if(test_start_flag == 1){
+		test_start_flag = 0;
+		//�����¼����
+		have_record_num = 0;
+		record_num = log_sizhu_history_ctrl_g.per_interval_log.log_count;
+		read_addr = log_sizhu_history_ctrl_g.per_interval_log.log_addr_save;
+		for(count_i = 0;count_i < record_num;count_i++){
+				have_record_num ++;
+			
+			if(read_addr <= HISTORY_INTERVAL_START_ADDR)
+				read_addr = HISTORY_INTERVAL_END_ADDR;
+			else
+				read_addr -= HISTORY_INTERVAL_LENGTH;
+			
+			if(FlashMultipleReadAndCrcCheck((uint8_t *)&history_interval_l,read_addr,HISTORY_INTERVAL_LENGTH)== PASS){
+				
+			}else{
+				test_Status = FAIL;
+				break;
+			}
+			
+		}
 		
-		
-		
+		if(test_Status == FAIL){
+			err_addr = read_addr;
+			err_count = log_sizhu_history_ctrl_g.per_interval_log.log_count - count_i;
+		}
 		
 	}
 	
@@ -245,7 +278,7 @@
 	}
 	
 	
-	HistoryRecordTest();
+	HistoryRecordTest(); //?���Ժ�������������Ҫע��
 	
 }
 

--
Gitblit v1.9.3