forked from SZV10X_Software/SZV103_FM33A0xxEV_SiZhu

jinlicong
2024-06-19 6e3f1f560d618b37ee1a47fa2b0f682b70c3ef1c
CORE/main.c
@@ -26,6 +26,8 @@
#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;
@@ -35,7 +37,7 @@
int main(void)
{
   System_power_on_init();
   /*¸÷ÖÖ³õʼ»¯*/
   //Ó²¼þÇý¶¯³õʼ»¯
   hardwareDriversInit();
@@ -48,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);
         }
@@ -77,7 +82,7 @@
         
               
         /*²É¼¯¡¢Éϱ¨¡¢·§¿ØÈÎÎñ¿ØÖÆ*/
         //?ÈýÕß²»Í¬Ê±½øÐУ¬²É¼¯·ÅÔÚÉϱ¨Ö®Ç°£¬Í¬Ê±´¥·¢µÄ»°ÓÅÏȲɼ¯£¬
         //ÈýÕß²»Í¬Ê±½øÐУ¬²É¼¯·ÅÔÚÉϱ¨Ö®Ç°£¬Í¬Ê±´¥·¢µÄ»°ÓÅÏȲɼ¯£¬
         //±¨¾¯´¥·¢Éϱ¨ÅжÏÂß¼­·ÅÔڲɼ¯Ç°Ã棬ÏÈ´¥·¢²É¼¯£¬ÔÙ´¥·¢Éϱ¨
         sysRunFunCtrlPro(&sys_fun_run_ctrl_g,sys_clockBCD_g);
         
@@ -115,28 +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();
//         }
      }
      
      if(lcd_wake_up_flag_g)  //ΪÁ˰´¼üÏÔʾûÓÐÑÓ³Ù¸Ð
      /***************************ÒÔÏ·ÅÔÚ1ÃëÖÜÆÚÍ⣬Ìá¸ßÏìÓ¦ËÙ¶È***********************************************/
      if(lcd_wake_up_flag_g == SET)  //ΪÁ˰´¼üÏÔʾûÓÐÑÓ³Ù¸Ð
         lcdDisplayPro();
      
      /*ÉÏλ»ú½»»¥,º¬¼æÈÝmodbus±»²É¼¯´¦Àí*/
      upperComPro();
   }
}