From a1810b89e66f184c62a0588ae7d57c91d0c376e8 Mon Sep 17 00:00:00 2001
From: jinlicong <493886250@qq.com>
Date: Thu, 30 May 2024 20:06:09 +0800
Subject: [PATCH] 继续测试修改

---
 Soft/system_run_fun.c |   36 +++++++++++++++++++++++++++++++-----
 1 files changed, 31 insertions(+), 5 deletions(-)

diff --git a/Soft/system_run_fun.c b/Soft/system_run_fun.c
index 8da9f96..c7849d5 100644
--- a/Soft/system_run_fun.c
+++ b/Soft/system_run_fun.c
@@ -11,6 +11,7 @@
 #include "power_manage.h"
 #include "pulse_and_alarm_line.h"
 #include "valve_control.h"
+#include "linked_list.h"
 
 
 RS485_START_REASON	start_rs485_g = RS485_START_REASON_NONE;
@@ -69,10 +70,12 @@
 	GPIO_EXTI_Init( KEY1_PORT, KEY1_PIN, EXTI_FALLING, ENABLE);
 	GPIO_EXTI_Init( KEY2_PORT, KEY2_PIN, EXTI_FALLING, ENABLE);
 	GPIO_EXTI_Init( KEY3_PORT, KEY3_PIN, EXTI_FALLING, ENABLE);
-	GPIO_EXTI_Init( KEY4_PORT, KEY4_PIN, EXTI_FALLING, ENABLE);
+//	GPIO_EXTI_Init( KEY4_PORT, KEY4_PIN, EXTI_FALLING, ENABLE);
 	
 	GPIO_EXTI_Init( LITH_PWR_LOSE_PORT, LITH_PWR_LOSE_PIN, EXTI_FALLING, ENABLE);
 	GPIO_EXTI_Init( ALKA_PWR_LOSE_PORT, ALKA_PWR_LOSE_PIN, EXTI_FALLING, ENABLE);
+	
+	GPIO_EXTI_Init( LIMIT_TRIGGER_PORT, LIMIT_TRIGGER_PIN, EXTI_FALLING, ENABLE);
 	
 	/*�������ж�����ѡ��,û���������ҿ���������*/
 	if(((flow_meter_para_g.broken_line_multiplex & BROKEN_LINE_MUTIPLEX_PULSE)!=BROKEN_LINE_MUTIPLEX_PULSE)&&   \
@@ -146,14 +149,24 @@
 {
 	//���ֹ���ģ����������IJ�����ʼ��
 	
+	/*״̬�ֳ�ʼ*/
+	system_status_word_g.status_word.account_state = (system_function_ctrl_word_g.fun_ctrl_word.account_open == 1)?1:0;
+	system_status_word_g.status_word.valve_lock = (save_valve_para_g.valve_lock_state == VL_LOCK)?1:0;
+	system_status_word_g.status_word.virtual_billing = (system_function_ctrl_word_g.fun_ctrl_word.virtual_billing == 1)?1:0;
+	system_status_word_g.status_word.billing_type = system_function_ctrl_word_g.fun_ctrl_word.billing_type;
+	system_status_word_g.status_word.lcd_mode = system_function_ctrl_word_g.fun_ctrl_word.lcd_mode;
+	
 	/****�ⲿRTC���ü�������ʼ��***********/
 	Set_Rtc_UpdataInterrupt(); //����RTCΪ���ж�
 	//��ȡ�ⲿRTCʱ�䣬
 	if(Get_Extern_Rtc_Time(&sys_clockBCD_g) ==FAIL)
 	{
 		//���ô�洢��ȡ��ʱ�����õ�RTC
-		Set_Extern_Rtc_Time(save_realtime_data_g.record_time_BCD.year,save_realtime_data_g.record_time_BCD.month,save_realtime_data_g.record_time_BCD.day,   \
-												1,save_realtime_data_g.record_time_BCD.hour,save_realtime_data_g.record_time_BCD.min,save_realtime_data_g.record_time_BCD.sec); 
+		if(Set_Extern_Rtc_Time(save_realtime_data_g.record_time_BCD.year,save_realtime_data_g.record_time_BCD.month,save_realtime_data_g.record_time_BCD.day,   \
+												1,save_realtime_data_g.record_time_BCD.hour,save_realtime_data_g.record_time_BCD.min,save_realtime_data_g.record_time_BCD.sec) ==FAIL){
+			//�洢��ʱ�����������Ĭ��ֵ
+			Set_Extern_Rtc_Time(sys_clockBCD_g.year,sys_clockBCD_g.month,sys_clockBCD_g.day, 1,sys_clockBCD_g.hour,sys_clockBCD_g.min,sys_clockBCD_g.sec)	;							
+		}													
 	}
 	
 	//�������г�ʼ��
@@ -201,7 +214,12 @@
 		start_rs485_g = RS485_START_REASON_RECORD;
 	
 	
-	if(start_rs485_g  != RS485_START_REASON_NONE){
+	//�ϱ�֮ǰ�����ɼ�
+	if(start_wrc_g != WRC_MEANS_NONE){
+		start_rs485_g = RS485_START_REASON_REPORT;
+	}
+	
+	if(start_rs485_g != RS485_START_REASON_NONE){
 		start_rs485_g = RS485_START_REASON_NONE;
 		sys_fun_run_ctrl_p->rs485_ctrl_flag.start_flag = SET;
 	}
@@ -210,7 +228,7 @@
 	
 	
 	
-	/*Զ��ͨѶ�������ƣ���������������ڡ��쳣������*/
+	/*Զ��ͨѶ�������ƣ���������������ڡ��쳣�������ر���*/
 	if((wrc_para_sizhu_g.time_start_type&WRC_TIME_START_INTERVAL)==WRC_TIME_START_INTERVAL){
 		for(uint16_t count_i=0;count_i<wrc_para_sizhu_g.timing_send_num;count_i++){
 			if(count_i>=12)
@@ -231,6 +249,14 @@
 			start_wrc_g = WRC_MEANS_RTC_INTERVAL;
 	}
 	
+	if((wrc_ctrl_para_g.wrc_restart_num_cnt > 0)&&(wrc_ctrl_para_g.wrc_restart_time_sec_cnt == 0)){
+		if(start_wrc_g == WRC_MEANS_NONE){
+			//�����ر��ϱ�
+			start_wrc_g = WRC_MEANS_AGAIN;
+			wrc_ctrl_para_g.wrc_restart_num_cnt -- ;
+		}
+	}
+	
 	
 	if(start_wrc_g  != WRC_MEANS_NONE){
 		wrc_ctrl_para_g.wrc_start_flag = start_wrc_g;

--
Gitblit v1.9.3