yincheng.zhong
2024-08-28 385e42e51f493edb1db7948339a8316634987286
keil/include/main/main.c
@@ -168,7 +168,7 @@
            bat_percent = ((fVoltage_mv - 3300) /8);
        }
    }
    LOG_INFO(TRACE_MODULE_APP, "The voltage is %%%d \r\n",bat_percent);
  //  LOG_INFO(TRACE_MODULE_APP, "The voltage is %%%d \r\n",bat_percent);
}
//void UartInit(void)
//{
@@ -291,6 +291,7 @@
    // flag_4G_recdata = 1;
    // AIR780EUartInit();
}
extern uint16_t ip0,ip1,ip2,ip3,port;
void Program_Init(void)
{
    Usart1ParseDataCallback = UsartParseDataHandler;//需改为默认为gps处理,UsartParseDataHandler为升级处理当调试时候改为
@@ -315,6 +316,18 @@
    }else{
        UWB_work_state = SEARCH_DEV;
    }
    if(g_com_map[SEND_4G_SECOND]<60)
        g_com_map[SEND_4G_SECOND]=60;
    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]>>12&0xf)*1000+(g_com_map[TCP_PORT]>>8&0xf)*100+(g_com_map[TCP_PORT]>>4&0xf)*10+(g_com_map[TCP_PORT]&0xf);
    g_com_map[VERSION] = (1<<8)|1;
    LOG_INFO("设备ID: %x .\r\n",dev_id);
    LOG_INFO("固件版本:UWB-4G手环 V%d.%d. \r\n",g_com_map[VERSION]>>8,g_com_map[VERSION]&0xff);
    LOG_INFO("服务器地址: %d.%d.%d.%d:%d.\r\n",ip0,ip1,ip2,ip3,port);
}
@@ -436,7 +449,7 @@
//    board_5V_input_init(voltage_input_handler);
    board_acceleration_detection_init(move_handler);
    //AIR780E_Reset(); //4G模块重启,耗时1.5秒,这个是无法同步的关键
    AIR780E_Reset(); //4G模块重启,耗时1.5秒,这个是无法同步的关键
    while (1)
    {
        if(flag_TCP_reconnectting||IfTCPConnected())