| | |
| | | { gpio_pin_clr(ADC_GND_ENABLE);//拉低 |
| | | adc_get(&sample[0], NUM_SAMPLES, adc_callback);//adc采样 |
| | | } |
| | | uint8_t link_error_time; |
| | | void SecondTask(void) |
| | | {static uint8_t second_count; |
| | | if(second_count++>60) |
| | |
| | | { |
| | | if(IfTCPConnected()) |
| | | { |
| | | link_error_time=0; |
| | | TCP_reconnect_timer =0; |
| | | flag_TCP_reconnectting = 0; |
| | | } else { |
| | |
| | | { |
| | | flag_TCP_reconnectting = 1; |
| | | } else { |
| | | flag_TCP_reconnectting = 0; |
| | | //flag_TCP_reconnectting = 0; |
| | | sys_reset(4);//重连不上就复位 |
| | | } |
| | | if(TCP_reconnect_timer++>600) |
| | | { |
| | |
| | | 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)|8; |
| | | g_com_map[VERSION] = (1<<8)|10; |
| | | LOG_INFO(TRACE_MODULE_APP,"设备ID: %x .\r\n",dev_id); |
| | | LOG_INFO(TRACE_MODULE_APP,"固件版本:4G-GPS定位手环 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); |
| | |
| | | int test1,test3; |
| | | uint32_t test4; |
| | | uint32_t time_count; |
| | | |
| | | static void app_wdt_callback(void *dev, uint32_t status) |
| | | { |
| | | ASSERT(status, "WDT TIMEOUT,程序复位"); |
| | |
| | | { |
| | | if(flag_TCP_reconnectting||IfTCPConnected()) |
| | | { |
| | | // if(flag_TCP_reconnectting) |
| | | // { |
| | | // link_error_time++; |
| | | // }//后加的 |
| | | // LOG_INFO(TRACE_MODULE_APP, "处理4G任务\r\n"); |
| | | |
| | | // if(flag_4guart_needinit) |