| | |
| | | { 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) |
| | | { |
| | |
| | | extern uint16_t ip0,ip1,ip2,ip3,port; |
| | | extern uint8_t gps_4g_flag; |
| | | extern uint8_t gps_need_data_flag,gps_open_flag; |
| | | uint8_t bat_bercent_hex; |
| | | void Program_Init(void) |
| | | { |
| | | Usart1ParseDataCallback = UsartParseDataHandler;//需改为默认为gps处理,UsartParseDataHandler为升级处理当调试时候改为 |
| | |
| | | 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)|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,程序复位"); |
| | | //LOG_INFO(TRACE_MODULE_APP, "程序卡死,看门狗复位"); |
| | | } |
| | | struct WDT_CFG_T app_wdt_cfg = { |
| | | .timeout = 32768 * 30, |
| | | .rst_en = true, |
| | | .int_en = true, |
| | | .callback = app_wdt_callback, |
| | | }; |
| | | int main(void) |
| | | { |
| | | board_clock_run(); |
| | |
| | | |
| | | // Disable watchdog timer |
| | | wdt_close(WDT_ID0); |
| | | wdt_open(WDT_ID0,&app_wdt_cfg);//30s检测喂狗 |
| | | LOG_INFO(TRACE_MODULE_APP, "UWB simple example\r\n"); |
| | | |
| | | // open system timer |
| | |
| | | |
| | | while (1) |
| | | { test4=gpio_pin_get_val(SCL_PIN); |
| | | |
| | | wdt_ping(WDT_ID0);//喂狗 |
| | | if(!power_low_flag)//确认是否休眠下才开启功能 |
| | | { |
| | | if(flag_TCP_reconnectting||IfTCPConnected()) |
| | | { |
| | | // if(flag_TCP_reconnectting) |
| | | // { |
| | | // link_error_time++; |
| | | // }//后加的 |
| | | // LOG_INFO(TRACE_MODULE_APP, "处理4G任务\r\n"); |
| | | |
| | | // if(flag_4guart_needinit) |