| | |
| | | HIDO_TimerTick(); |
| | | nomove_count++; |
| | | } |
| | | uint8_t tt=1; |
| | | uint8_t flag_sleeptimer,flag_secondtask,secondtask_count; |
| | | static void sleep_timer_callback(void *dev, uint32_t time) |
| | | { |
| | | IO_control_init(); |
| | | if(tt) |
| | | UWBPoll(); |
| | | |
| | | //车载poll |
| | | UWB_Tag_Poll(); |
| | | |
| | | MotorPoll(); |
| | | |
| | |
| | | ip2 = (g_com_map[TCP_IP_2]>>12&0xf)*1000+(g_com_map[TCP_IP_2]>>8&0xf)*100+(g_com_map[TCP_IP_2]>>4&0xf)*10+(g_com_map[TCP_IP_2]&0xf); |
| | | ip3 = (g_com_map[TCP_IP_3]>>12&0xf)*1000+(g_com_map[TCP_IP_3]>>8&0xf)*100+(g_com_map[TCP_IP_3]>>4&0xf)*10+(g_com_map[TCP_IP_3]&0xf); |
| | | port = g_com_map[TCP_PORT]; |
| | | g_com_map[VERSION] = (1<<8)|7; |
| | | g_com_map[VERSION] = (1<<8)|1; |
| | | LOG_INFO(TRACE_MODULE_APP,"设备ID: %x .\r\n",dev_id); |
| | | LOG_INFO(TRACE_MODULE_APP,"固件版本:UWB-4G手环 V%d.%d. \r\n",g_com_map[VERSION]>>8,g_com_map[VERSION]&0xff); |
| | | LOG_INFO(TRACE_MODULE_APP,"服务器地址: %d.%d.%d.%d:%d.\r\n",ip0,ip1,ip2,ip3,port); |
| | |
| | | io_pin_mux_set(SCL_PIN, IO_FUNC0);//测试测距波形 |
| | | gpio_pin_set_dir(SCL_PIN , GPIO_DIR_OUT, 0); |
| | | io_pull_set(SCL_PIN , IO_PULL_DOWN, IO_PULL_UP_LEVEL4); |
| | | gps_air780_power_change(0,1);//开启gps,4G |
| | | gps_air780_power_change(1,1);//开启gps,4G |
| | | //加速度计初始化必须在IO_control_init之前因为复用SDA引脚 |
| | | adc_get(&sample[0], NUM_SAMPLES, adc_callback);//adc采样 |
| | | Program_Init(); |
| | |
| | | { |
| | | flag_secondtask = 0; |
| | | SecondTask(); |
| | | |
| | | } |
| | | IdleTask(); |
| | | //3种情况后都要发包和休眠 |
| | |
| | | //blink_led(&air780_success_state);//成功测距闪烁4G状态灯 |
| | | //air780_success_state=0; |
| | | //} |
| | | input_5v_flag=!gpio_pin_get_val(INPUT_5V_Pin); |
| | | air780e_flag2,air780e_flag3,air780e_flag4; |
| | | air780e_flag1=((IfTCPConnected()&&Socket_IsSendQueueEmpty(0))||!flag_TCP_reconnectting&&!IfTCPConnected()); |
| | | |
| | | #ifndef DEBUG_MODE |
| | | //if(flag_sleeptimer) |
| | | if(!gpio_pin_get_val(INPUT_5V_Pin)&&((IfTCPConnected()&&Socket_IsSendQueueEmpty(0))||!flag_TCP_reconnectting&&!IfTCPConnected())) //进入休眠条件(与关系,全满足才进):1.没有5V输入 2 TCP已连接时发送队列为空||TCP无连接时不在重连状态。 |