From 6b0d1f644233b2984d2a87553de598879cf05caf Mon Sep 17 00:00:00 2001
From: jinlicong <493886250@qq.com>
Date: Tue, 28 May 2024 17:24:59 +0800
Subject: [PATCH] 继续完善

---
 CORE/main.c |   48 +++++++++++++++++++++++++++++++++++-------------
 1 files changed, 35 insertions(+), 13 deletions(-)

diff --git a/CORE/main.c b/CORE/main.c
index 0eb7dfd..9dce0d5 100644
--- a/CORE/main.c
+++ b/CORE/main.c
@@ -21,7 +21,11 @@
 #include "wireless_remote_comm.h"
 #include "sizhu_ctrl_word.h"
 #include "sizhu_history_record.h"
-
+#include "power_manage.h"
+#include "pulse_and_alarm_line.h"
+#include "billing.h"
+#include "linked_list.h"
+#include "other_fun.h"
 
 
 FlagStatus key_awaken_flag_g = RESET;
@@ -37,16 +41,12 @@
 	hardwareDriversInit();
 	//�洢�IJ�����ʼ��
 	sysStoredParaInit();
-	//���й��ܲ�����ʼ��
+	//���й��ܲ�����ʼ����������ʼ״̬���
 	sysRunFunParaInit();
-	
-	//ϵͳ��ʼ״̬���
-	
-	
-	
 	
 	//����Ҫһֱ�������ⲿ�����ж�
 	allExtiIRQ();
+	
 	IWDT_Clr();
 	while(1)
 	{
@@ -58,7 +58,8 @@
 			if(Get_Extern_Rtc_Time(&sys_clockBCD_g) ==FAIL) //��ȡʱ��
 			{
 				//?RTCʱ���쳣����
-				__SYS_STATUS_ALARM_BYTES_SET(rtc_err);
+				if(__SYS_ALARM_CTL_BYTES_GET(rtc_err) == SET)
+					__SYS_STATUS_ALARM_BYTES_SET(rtc_err,ALARM_ID_RTC_BAT_LOW);
 			}
 			
 			/*����ʶ��*/
@@ -68,13 +69,13 @@
 			/*LCD��ʾ*/
 			lcdDisplayPro();
 			
-			/*�������*/
+			/*��λ������,������modbus���ɼ�����*/
 			upperComPro();
 			
-			/*�����ɼ�*/
+			/*�Խ��豸����״̬���*/
+			PulseAndAlarmLineCheck();
 			
-			
-			
+					
 			/*�ɼ����ϱ��������������*/
 			//?���߲�ͬʱ���У��ɼ������ϱ�֮ǰ��ͬʱ�����Ļ����Ȳɼ���
 			//���������ϱ��ж��߼����ڲɼ�ǰ�棬�ȴ����ɼ����ٴ����ϱ�
@@ -83,17 +84,25 @@
 			/*485�ɼ�*/
 			rs485ReadDataPro(&sys_fun_run_ctrl_g);
 			
+			/*���㣬�����������*/
+			SettlementPro();
+			
 			/*������ʷ��¼�洢*/
 			//������ʷ��¼�洢��������ɼ��У����Ӻ�ȴ��ɼ�����ٴ洢
 			sizhuHistoryRecord(sys_clockBCD_g);
 			
+			/*��Դ״̬��ȡ*/ //���ڷ���֮ǰ����Ϊ�����н����ƣ�����ǰ�����粻�㣬����Ҫ���
+			GetPwrStatusPro(&pwr_vol_g);
 			
 			/*����*/
 			valveCtrlPro(&sys_fun_run_ctrl_g);
 			
 			
-			/*״̬�֡������ִ���*/
+			/*ϵͳ������ɢС���ܴ���*/
+			OtherFunPro();
 			
+			/*״̬�֡������ִ���*/
+			SysAlarmCtrlPro();
 			
 			
 			/*����������ͨѶ��Ԥ��*/
@@ -110,11 +119,24 @@
 			//��������²������ߣ�Ҫ���жϣ��������⹩�硢RS485�ɼ������С�Զ��������
 			if(SysKeepRunningStatusGet(sys_fun_run_ctrl_g)==RESET){
 				//���ߴ���
+				if(pulse_exti_flag==SET){ //�ȴ����������
+					for(uint8_t count_i=0;count_i<(PULSE_CHECK_DELAY_MS &0xff);count_i++){
+						delay_ms(1);
+						if(pulse_exti_flag == RESET) 
+							break;						
+					}				
+				}
+				//����
+				
 				
 			}
 				
 			
 		}
+		
+		if(lcd_wake_up_flag_g)  //Ϊ�˰�����ʾû���ӳٸ�
+			lcdDisplayPro();
+		
 	}
 }
 

--
Gitblit v1.9.3