zhangbo
2025-07-11 7e660c15e78e77b12d98d97852cee50a2bd0479a
keil/include/main/main.c
@@ -359,11 +359,46 @@
//      nomove_count=g_com_map[NOMOVESLEEP_TIME]+1;
//      }
}
void led_offtask()
{
    if(ledonflag==1)
    {
        ledonflag=0;
        uwbled=0;
        rtkled=0;
        led4g=0;
        powerled=0;
        Set4LEDColor(LEDOFF,LEDOFF,LEDOFF,LEDOFF);
    }
}
uint16_t led_flag;
void Led_Task()
{
    if(led_flag==1)
    {
       led_flag=0;
        if(DBG_GetMode() == DBG_MODE_SHELL)
        {
            if(bat_percent>15)
            {
                powerled = BLUE;
            } else {
                powerled = RED;
            }
            ledonflag=1;
            Set4LEDColor(uwbled,rtkled,led4g,powerled);
        }
    }
}
uint8_t tt=1;
uint8_t flag_sleeptimer,flag_secondtask,secondtask_count,log_4g_enable_flag;
uint8_t uwb_offtime_count=0;
uint8_t input5v_time;
extern uint8_t taglist_num;
uint8_t gps_ntripsend;
extern uint8_t uwb_OpenClose_flag;
static void sleep_timer_callback(void *dev, uint32_t time)
@@ -373,6 +408,7 @@
    {
        input5v_time=1;
        flag_secondtask = 1;
        led_flag=1;
        if(g_com_map[UWBFrequency]>1)
        {
            uwb_time_count++;
@@ -397,6 +433,7 @@
            Set4LEDColor(uwbled,rtkled,led4g,powerled);
//        uart_send(UART_ID1, ceshidata, 50,NULL);
        }
        input5v_time=1;
        if(taglist_num==0&&g_com_map[UWBFrequency]==1&&g_com_map[UWBENBLE]==1&&uwb_OpenClose_flag==1)
        {
@@ -534,38 +571,6 @@
    {
        g_com_map[URT_BQ]=0;
    }
//    g_com_map[IP_0]=111;
//    g_com_map[IP_1]=198;
//    g_com_map[IP_2]=60;
//    g_com_map[IP_3]=6;
//    g_com_map[PORT]=6666;
//    g_com_map[IP_0]=117;
//    g_com_map[IP_1]=72;
//    g_com_map[IP_2]=111;
//    g_com_map[IP_3]=237;
//    g_com_map[PORT]=7000;
//
//    g_com_map[TCP_IP_0]=111;
//    g_com_map[TCP_IP_1]=198;
//    g_com_map[TCP_IP_2]=60;
//    g_com_map[TCP_IP_3]=6;
//    g_com_map[TCP_PORT]=1234;
    /*
    RTCMMODE_NONE,
    RTCMMODE_TCP,
    RTCMMODE_NTRIP,
    */
//    g_com_map[RTCMMODE_INDEX] = RTCMMODE_NTRIP;
//    snprintf((char *)&g_com_map[NTRIP_HOST_INDEX], 32, "140.143.212.42");
//    g_com_map[NTRIP_PORT_INDEX] = HIDO_UtilStrToInt("8005");
////    snprintf((char *)&g_com_map[NTRIP_PORT_INDEX], 32, "8005");
//    snprintf((char *)&g_com_map[NTRIP_USERNANME_INDEX], 32, "test005");
//    snprintf((char *)&g_com_map[NTRIP_PASSWORD_INDEX], 32, "Hxzk0228");
//    snprintf((char *)&g_com_map[NTRIP_SOURCENAME_INDEX], 32, "RTCM32_GNSS2");
    if(g_com_map[BIND_DEV_ID]==0)
    {
@@ -573,16 +578,10 @@
    } else {
        UWB_work_state = SEARCH_DEV;
    }
    //g_com_map[SEND_4G_SECOND]
//    if(g_com_map[SEND_4G_SECOND]<30)
//      {
//      gps_open_flag=0;
//      }else{
//      gps_open_flag=1;
//      }
    g_com_map[MODBUS_MODE] = 0;
    log_4g_enable_flag=g_com_map[LOG_4G_ENABLE];
    g_com_map[VERSION] = (1<<8)|33;
    log_4g_enable_flag =1;//g_com_map[LOG_4G_ENABLE];
    g_com_map[VERSION] = (2<<8)|10;
    LOG_INFO(TRACE_MODULE_APP,"设备ID: %x .\r\n",dev_id);
@@ -688,8 +687,10 @@
                }
                Internet_Poll();
                HIDO_TimerPoll();
                HIDO_ATLitePoll();
                HIDO_ATLitePoll();
                TCPClient_Poll();
                Led_Task();
                if(g_com_map[RTCMMODE_INDEX] == RTCMMODE_TCP)
                {
                    TCPClient_Poll_1();
@@ -699,6 +700,8 @@
                    flag_secondtask = 0;
                    SecondTask();
                }
                led_offtask();
                UserKeyTask();
            }
            UART_CheckReceive();
@@ -709,7 +712,7 @@
            }
            if(DBG_GetMode() == DBG_MODE_SHELL)
            {
                Set4LEDColor(uwbled,rtkled,led4g,powerled);
//                Set4LEDColor(uwbled,rtkled,led4g,powerled);
                if(g_com_map[CNT_RESTART]==1)
                {
                    g_com_map[CNT_RESTART]=0;
@@ -784,15 +787,15 @@
        NVIC_SystemReset();
    }
    HIDO_TimerPoll();
    if(ledonflag==1)
    {
        ledonflag=0;
        uwbled=0;
        rtkled=0;
        led4g=0;
        powerled=0;
        Set4LEDColor(LEDOFF,LEDOFF,LEDOFF,LEDOFF);
    }
//    if(ledonflag==1)
//    {
//        ledonflag=0;
//        uwbled=0;
//        rtkled=0;
//        led4g=0;
//        powerled=0;
//        Set4LEDColor(LEDOFF,LEDOFF,LEDOFF,LEDOFF);
//    }
    if(bat_percent<5&&jiancebat_percent_flag)
    {
        WT588E_PLAY(14);
@@ -1067,5 +1070,6 @@
        IMUTask();
        IdleTask();
        check_step_and_update_state();
        led_offtask();
    }
}