| | |
| | | #include "power_manage.h" |
| | | #include "pulse_and_alarm_line.h" |
| | | #include "tim.h" |
| | | #include "wireless_remote_comm.h" |
| | | #include "main.h" |
| | | #include "lcd.h" |
| | | |
| | | void NMI_Handler(void) |
| | | { |
| | |
| | | { |
| | | // if(__SYS_DELAY_SEC_FLAG_GET(sys_active_time) == SET && LargeCurrent_LimitingProcess() == 3) |
| | | SysWakeUp_ClockCfg(); |
| | | |
| | | if(GPIO_EXTI_EXTIISR_ChkEx(EXT_RTC_INT_PORT, EXT_RTC_INT_PIN) == SET) //RTCÖÐ¶Ï |
| | | { |
| | | GPIO_EXTI_EXTIISR_ClrEx(EXT_RTC_INT_PORT, EXT_RTC_INT_PIN); |
| | |
| | | } |
| | | |
| | | // ÅжÏGPRS³¬Ê±Ê±¼ä |
| | | if (sys_delay_sec_para_g.gprs_timeout_para.delay_time) |
| | | if (sys_delay_sec_para_g.wrc_timeout_para.delay_time) |
| | | { |
| | | if (!(--sys_delay_sec_para_g.gprs_timeout_para.delay_time)) |
| | | sys_delay_sec_para_g.gprs_timeout_para.delay_flag = SET; |
| | | if (!(--sys_delay_sec_para_g.wrc_timeout_para.delay_time)) |
| | | sys_delay_sec_para_g.wrc_timeout_para.delay_flag = SET; |
| | | } |
| | | |
| | | //wrcÖØ±¨Ê±¼äµ¹¼ÆÊ± |
| | | if (wrc_ctrl_para_g.wrc_restart_time_sec_cnt) |
| | | { |
| | | if (!(--wrc_ctrl_para_g.wrc_restart_time_sec_cnt)) |
| | | ; |
| | | } |
| | | |
| | | } |
| | | |
| | |
| | | |
| | | if(KEY1_IO_READ==Bit_RESET) |
| | | { |
| | | if(KEY3_IO_READ==Bit_RESET) |
| | | if((KEY3_IO_READ==Bit_RESET)&&(__SYS_DELAY_SEC_TIME_GET_(sys_active_time) >0)) |
| | | { |
| | | //¿ª·§ |
| | | |
| | | }else if(KEY2_IO_READ==Bit_RESET) |
| | | if(__SYS_STATUS_BYTES_GET(account_state) == RESET ||__SYS_STATUS_BYTES_GET(valve_lock) == RESET ) |
| | | ValveCtrlOrder(VC_OPEN); |
| | | }else if((KEY2_IO_READ==Bit_RESET)&&(__SYS_DELAY_SEC_TIME_GET_(sys_active_time) >0)) |
| | | { |
| | | //¹Ø·§ |
| | | |
| | | if(__SYS_STATUS_BYTES_GET(account_state) == RESET) |
| | | ValveCtrlOrder(VC_CLOSE); |
| | | }else |
| | | { |
| | | //µ¥»÷µçÔ´ |
| | | if(__SYS_DELAY_SEC_TIME_GET_(sys_active_time) ==0){ |
| | | //Ê״λ½ÐÑ£¬LCD°åÏÈÉϵ磬ʹµÄkey2ºÍkey3ÀÉÏÉúЧ£¬²¢ÇÒÊ״λ½ÐÑÐèÒª³õʼ»¯Òº¾§Çý¶¯£¬Öñê־λ |
| | | lcd_first_wake_up_flag_g = SET; |
| | | Lcd_GPIO_Init(); |
| | | LCD_PWR_ON; |
| | | } |
| | | |
| | | __SYS_DELAY_SEC_TIME_SET_(sys_active_time,SYS_WAKE_UP_TIME); |
| | | lcd_wake_up_flag_g = SET; |
| | | Key_GPIO_Init(); |
| | | |
| | | pwr_vol_g.lith_flag = LMS_KEY; //°´µçÔ´¼ü²É¼¯Ò»´Îµç³Øµçѹ |
| | | pwr_vol_g.alka_flag = AMS_KEY; |
| | | } |
| | | |
| | | } |
| | |
| | | GPIO_EXTI_EXTIISR_ClrEx(KEY2_PORT, KEY2_PIN); |
| | | if(KEY2_IO_READ==Bit_RESET) |
| | | { |
| | | |
| | | lcd_wake_up_flag_g = SET; |
| | | if(__SYS_DELAY_SEC_TIME_GET_(sys_active_time) >0){ //¼¤»îºóÈÎÒâ°´¼üÖØÖü¤»îʱ¼ä |
| | | __SYS_DELAY_SEC_TIME_SET_(sys_active_time,SYS_WAKE_UP_TIME); |
| | | } |
| | | } |
| | | } |
| | | |
| | |
| | | //²É¼¯Á÷Á¿¼ÆÊý¾Ý²¢´¥·¢Éϱ¨ |
| | | start_rs485_g = RS485_START_REASON_KEY; |
| | | start_wrc_g = WRC_MEANS_KEY; |
| | | }else{ |
| | | lcd_wake_up_flag_g = SET; |
| | | } |
| | | |
| | | if(__SYS_DELAY_SEC_TIME_GET_(sys_active_time) >0){ //¼¤»îºóÈÎÒâ°´¼üÖØÖü¤»îʱ¼ä |
| | | __SYS_DELAY_SEC_TIME_SET_(sys_active_time,SYS_WAKE_UP_TIME); |
| | | } |
| | | |
| | | } |
| | | } |
| | | |
| | | if(GPIO_EXTI_EXTIISR_ChkEx(KEY4_PORT, KEY4_PIN) == SET) //key4ÖÐ¶Ï |
| | | { |
| | | GPIO_EXTI_EXTIISR_ClrEx(KEY4_PORT, KEY4_PIN); |
| | | // if(GPIO_EXTI_EXTIISR_ChkEx(KEY4_PORT, KEY4_PIN) == SET) //key4ÖÐ¶Ï |
| | | // { |
| | | // GPIO_EXTI_EXTIISR_ClrEx(KEY4_PORT, KEY4_PIN); |
| | | |
| | | } |
| | | // } |
| | | |
| | | if(GPIO_EXTI_EXTIISR_ChkEx(Motor_OP_PORT, Motor_OP_PIN) == SET) //·§ÃÅ¿ªµ½Î»ÖÐ¶Ï |
| | | { |
| | |
| | | if(((flow_meter_para_g.broken_line_multiplex & BROKEN_LINE_MUTIPLEX_PULSE)!=BROKEN_LINE_MUTIPLEX_PULSE)&& \ |
| | | ((flow_meter_para_g.flow_meter_conn_type==FLOW_METER_CONN_PULSE)||(flow_meter_para_g.flow_meter_conn_type==FLOW_METER_CONN_RS485_AND_PULSE))){ |
| | | pulse_exti_flag = SET; |
| | | BTx_CR1_CHEN_Setable(BT1,ENABLE); //¿ªÆô¶¨Ê±Æ÷ |
| | | |
| | | BTx_CR1_CHEN_Setable(BT1,ENABLE); //¿ªÆô¶¨Ê±Æ÷ |
| | | } |
| | | } |
| | | |
| | | if(GPIO_EXTI_EXTIISR_ChkEx(HWIDO_EX_PWR_PORT, HWIDO_EX_PWR_PIN) == SET) //ÍâµçÒÆ³ýÖÐ¶Ï |
| | | { |
| | | GPIO_EXTI_EXTIISR_ClrEx(HWIDO_EX_PWR_PORT, HWIDO_EX_PWR_PIN); |
| | | //ÍâµçÒÆ³ýÁËÁ¢¼´¹Ø±ÕÍâµç¿ØÖÆ |
| | | EX_PWR_OFF; |
| | | // __SYS_STATUS_BYTES_STATUS(power_state, RESET, ALARM_ID_NORMAL); |
| | | |
| | | } |
| | | |
| | | |
| | | if(GPIO_EXTI_EXTIISR_ChkEx(LIMIT_TRIGGER_PORT, LIMIT_TRIGGER_PIN) == SET) //ÏÞÁ÷´¥·¢ |
| | | { |
| | | GPIO_EXTI_EXTIISR_ClrEx(LIMIT_TRIGGER_PORT, LIMIT_TRIGGER_PIN); |
| | | //¼Ç¼ÏÞÁ÷´¥·¢Ê±µÄÐÅÏ¢ |
| | | arrayA_2_arrayB((uint8_t *)&sys_clockBCD_g.year,&limit_trigger_record_para_g.record_time_BCD.year,sizeof(sys_clockBCD_g),LITTLE_ENDIAN); |
| | | limit_trigger_record_para_g.trigger_times ++; |
| | | limit_trigger_record_para_g.RS485_running_flag = sys_fun_run_ctrl_g.rs485_ctrl_flag.running_flag; |
| | | limit_trigger_record_para_g.valve_running_flag = sys_fun_run_ctrl_g.valve_ctrl_flag.running_flag; |
| | | limit_trigger_record_para_g.wrc_running_flag = sys_fun_run_ctrl_g.wrc_ctrl_flag.running_flag; |
| | | limit_trigger_record_para_g.EXPWR_check_status = HWIDO_EX_PWR_IO_READ; |
| | | limit_trigger_record_para_g.EXPWR_ctrl_status = __SYS_STATUS_BYTES_GET(power_state); |
| | | } |
| | | |
| | | |
| | | // if(GPIO_EXTI_EXTIISR_ChkEx(VALVE_FORCED_OPEN_PORT, VALVE_FORCED_OPEN_PIN) == SET) |
| | | // { |
| | | // GPIO_EXTI_EXTIISR_ClrEx(VALVE_FORCED_OPEN_PORT, VALVE_FORCED_OPEN_PIN); |