From 6e3f1f560d618b37ee1a47fa2b0f682b70c3ef1c Mon Sep 17 00:00:00 2001
From: jinlicong <493886250@qq.com>
Date: Wed, 19 Jun 2024 17:25:45 +0800
Subject: [PATCH] 增加OTA协议
---
CORE/main.c | 59 +++++++++++++++++++++++++++++++++++++----------------------
1 files changed, 37 insertions(+), 22 deletions(-)
diff --git a/CORE/main.c b/CORE/main.c
index c254364..05bb0c5 100644
--- a/CORE/main.c
+++ b/CORE/main.c
@@ -25,6 +25,9 @@
#include "pulse_and_alarm_line.h"
#include "billing.h"
#include "linked_list.h"
+#include "other_fun.h"
+#include "sys_sleep.h"
+#include "off_chip_flash.h"
FlagStatus key_awaken_flag_g = RESET;
@@ -34,7 +37,7 @@
int main(void)
{
System_power_on_init();
-
+
/*���ֳ�ʼ��*/
//Ӳ��������ʼ��
hardwareDriversInit();
@@ -47,16 +50,19 @@
allExtiIRQ();
IWDT_Clr();
+
+ lcdDisplayPro(); //��λ��ʾ�ȴ�
+
while(1)
- {
+ {
if(sys_run_period==SET)
{
sys_run_period = RESET;
IWDT_Clr();
-
+
if(Get_Extern_Rtc_Time(&sys_clockBCD_g) ==FAIL) //��ȡʱ��
{
- //?RTCʱ���쳣����
+ //RTCʱ���쳣����
if(__SYS_ALARM_CTL_BYTES_GET(rtc_err) == SET)
__SYS_STATUS_ALARM_BYTES_SET(rtc_err,ALARM_ID_RTC_BAT_LOW);
}
@@ -76,7 +82,7 @@
/*�ɼ����ϱ��������������*/
- //?���߲�ͬʱ���У��ɼ������ϱ�֮ǰ��ͬʱ�����Ļ����Ȳɼ���
+ //���߲�ͬʱ���У��ɼ������ϱ�֮ǰ��ͬʱ�����Ļ����Ȳɼ���
//���������ϱ��ж������ڲɼ�ǰ�棬�ȴ����ɼ����ٴ����ϱ�
sysRunFunCtrlPro(&sys_fun_run_ctrl_g,sys_clockBCD_g);
@@ -97,6 +103,9 @@
valveCtrlPro(&sys_fun_run_ctrl_g);
+ /*ϵͳ������ɢС���ܴ���*/
+ OtherFunPro();
+
/*״̬�֡������ִ���*/
SysAlarmCtrlPro();
@@ -111,24 +120,30 @@
- /*����*/
- //��������²������ߣ�Ҫ���жϣ���������硢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;
- }
- }
- //����
-
-
- }
-
-
+// /*����*/
+// //��������²������ߣ�Ҫ���жϣ���������硢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;
+// }
+// }
+// //����
+// DeepSleepMode();
+// }
}
+
+
+ /***************************���·���1�������⣬�����Ӧ�ٶ�***********************************************/
+ if(lcd_wake_up_flag_g == SET) //Ϊ�˰�����ʾû���ӳٸ�
+ lcdDisplayPro();
+
+ /*��λ������,������modbus���ɼ�����*/
+ upperComPro();
+
}
}
--
Gitblit v1.9.3