| | |
| | | #include "HIDO_ATLite.h" |
| | | #include "HIDO_Timer.h" |
| | | #include "TCPClient.h" |
| | | #include "DBG.h" |
| | | #include "Shell.h" |
| | | |
| | | //#define DEBUG_MODE |
| | | extern int simple_main(void); |
| | |
| | | } |
| | | g_com_map[MODBUS_MODE] = 0; |
| | | log_4g_enable_flag=g_com_map[LOG_4G_ENABLE]; |
| | | ip0 = (g_com_map[TCP_IP_0]>>12&0xf)*1000+(g_com_map[TCP_IP_0]>>8&0xf)*100+(g_com_map[TCP_IP_0]>>4&0xf)*10+(g_com_map[TCP_IP_0]&0xf); |
| | | ip1 = (g_com_map[TCP_IP_1]>>12&0xf)*1000+(g_com_map[TCP_IP_1]>>8&0xf)*100+(g_com_map[TCP_IP_1]>>4&0xf)*10+(g_com_map[TCP_IP_1]&0xf); |
| | | 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]; |
| | | ip0 = g_com_map[IP_0]; |
| | | ip1 = g_com_map[IP_1]; |
| | | ip2 = g_com_map[IP_2]; |
| | | ip3 = g_com_map[IP_3]; |
| | | port = g_com_map[PORT]; |
| | | g_com_map[VERSION] = (1<<8)|20; |
| | | 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); |
| | |
| | | //UartInit(); |
| | | } |
| | | |
| | | //检测到5V输入 |
| | | while(1) |
| | | { |
| | | nomove_count = 0; |
| | | wdt_ping(WDT_ID0);//喂狗 |
| | | if(DBG_GetMode() == DBG_MODE_SHELL) |
| | | { |
| | | |
| | | // if(flag_secondtask) |
| | | // { |
| | | // flag_secondtask = 0; |
| | | // SecondTask(); |
| | | // } |
| | | } |
| | | if(flag_TCP_reconnectting||IfTCPConnected()) |
| | | { |
| | | if(flag_4G_recdata==1) |
| | | { |
| | | flag_4G_recdata = 2; |
| | | Socket_RecvAll(); |
| | | } |
| | | Internet_Poll(); |
| | | HIDO_ATLitePoll(); |
| | | HIDO_TimerPoll(); |
| | | TCPClient_Poll(); |
| | | } |
| | | UART_CheckReceive(); |
| | | UserKeyTask(); |
| | | IMUTask(); |
| | | if(flag_secondtask) |
| | | { |
| | | flag_secondtask = 0; |
| | | SecondTask(); |
| | | } |
| | | if(DBG_GetMode() == DBG_MODE_SHELL) |
| | | { |
| | | if(g_com_map[CNT_RESTART]==1) |
| | | { |
| | | g_com_map[CNT_RESTART]=0; |
| | | save_com_map_to_flash(); |
| | | NVIC_SystemReset(); |
| | | |
| | | } |
| | | } |
| | | else |
| | | { |
| | | |
| | | } |
| | | // if(input5v_time) |
| | | // { |
| | | if(!gpio_pin_get_val(INPUT_5V_Pin)) |
| | | { |
| | | break; |
| | | } |
| | | |
| | | // } |
| | | } |
| | | //NVIC_SystemReset();//重启 |
| | | //UART_CheckSend(); |
| | | } else { |
| | | if(state5v==1) |
| | |
| | | |
| | | // TODO 4G |
| | | Uart_Register(UART_ID_4G, UART_ID0); |
| | | Uart_Register(UART_ID_DBG_GPS, UART_ID1); |
| | | DBG_Init(); |
| | | Internet_Init(); |
| | | TCPClient_Init(); |
| | | |