From af548df2969d4ea695979abc5fb97afae0c0c4d4 Mon Sep 17 00:00:00 2001 From: chen <15335560115@163.com> Date: 星期三, 18 十二月 2024 18:06:22 +0800 Subject: [PATCH] uwb发射的delay极限时间确定 --- keil/include/main/main.c | 45 ++++++++++++++++++++++++++++++++++----------- 1 files changed, 34 insertions(+), 11 deletions(-) diff --git a/keil/include/main/main.c b/keil/include/main/main.c index e267301..fa0621d 100644 --- a/keil/include/main/main.c +++ b/keil/include/main/main.c @@ -215,7 +215,7 @@ uint8_t TCP_reconnect_timer,flag_TCP_reconnectting = 1,flag_alam_state = 0,userkey_state; uint8_t gps_enable_flag,motor_open_air_flag,moter_open_uwb_flag,flag_fenli_alarm = 0,fenli_alarm_count,delaysleep_count,enbale_blink_flag; int need_open_gps_count; -uint32_t keystarttime,keystarttime2; +uint32_t keystarttime,keystarttime2,keystarttime3; extern uint32_t get_in_num,get_out_num; void MotorPoll(void) { @@ -300,25 +300,46 @@ } } void UserKeyTask(void) - { - if(!GET_USERKEY) +{ +if(!read_userkey_input_pca()) { - if(HIDO_TimerGetTick() - keystarttime>3) + if(HIDO_TimerGetTick() - keystarttime3>2) { userkey_state = 1; - keystarttime = HIDO_TimerGetTick(); - UDPClient_UploadGPS(); + keystarttime3 = HIDO_TimerGetTick(); + //UDPClient_UploadGPS(); } - if(HIDO_TimerGetTick() - keystarttime2>10) +// if(HIDO_TimerGetTick() - keystarttime2>10) +// { +// +// g_com_map[CNT_RESTART] = 1; +// } + }else + { + keystarttime3 = HIDO_TimerGetTick(); + } +} +void PowerTask(void) +{ + if(read_powerkey_input_pca()) + { + if(HIDO_TimerGetTick() - keystarttime>2) { - g_com_map[CNT_RESTART] = 1; + keystarttime = HIDO_TimerGetTick(); + PCA9555_Set_One_Value_Output(PWR_ENABLE,0);//低电平关闭 + PCA9555_Set_One_Value_Output(GPS_LED,0);//输出低电平关闭LED } +// if(HIDO_TimerGetTick() - keystarttime2>10) +// { +// +// g_com_map[CNT_RESTART] = 1; +// } }else { keystarttime = HIDO_TimerGetTick(); keystarttime2 = HIDO_TimerGetTick(); } - } +} void MinuteTask(void) { PCA9555_Set_One_Value_Output(ADC_MINIUS,0);//拉低 @@ -605,7 +626,7 @@ delay_ms(500); Set4LEDColor(RED,WHITE,RED,WHITE); delay_ms(500); - Set4LEDColor(LEDOFF,LEDOFF,LEDOFF,LEDOFF); + //Set4LEDColor(LEDOFF,LEDOFF,LEDOFF,LEDOFF); } //IO_control_init(); // io_pin_mux_set(SCL_PIN, IO_FUNC0);//测试测距波形 @@ -638,6 +659,7 @@ while (1) { uwb_app_poll(); + //test4=gpio_pin_get_val(SCL_PIN); //UWBPoll(); // if(!power_low_flag)//确认是否休眠下才开启功能 @@ -672,8 +694,9 @@ SecondTask(); } -// UserKeyTask(); + PowerTask(); // IMUTask(); + UserKeyTask(); IdleTask(); #ifndef DEBUG_MODE //if(flag_sleeptimer) -- Gitblit v1.9.3