WXK
2023-09-04 01a4770ea1b96c1006e5a84d133001b229f950b4
Core/Src/main.c
@@ -230,11 +230,9 @@
    if(lp_time-uwb_timer>=UWB_WORK_TIME_S) //是否到uwb工作时间了。
    {
    uwbled=BLUE;
    powerled=LEDOFF;
    loraled=LEDOFF;
    gpsled=LEDOFF;
    Set4LEDColor(powerled,loraled,gpsled,uwbled);
    Tag_App();
//    Lora_Sendfinalbag_Poll()
    uwb_timer=lp_time;
    uwb_work_num++;
        if(youxiao_ceju>=3)
@@ -247,7 +245,8 @@
        {GPS_ON_flag=0;}
        HIDO_Debug("有效测距%d\r\n",youxiao_ceju);
    youxiao_ceju=0;
        Set4LEDColor_Off();
    uwbled=LEDOFF;
    Set4LEDColor(powerled,loraled,gpsled,uwbled);
    }
    }
}
@@ -265,22 +264,7 @@
}
void LEDON_POLL(void)
{
    if(nomove_flag==0)
    {
//    if(lp_time-led_timer>=1)
//    {
    Set4LEDColor(powerled,loraled,gpsled,uwbled);
    uwbled=LEDOFF;
    gpsled=LEDOFF;
    loraled=LEDOFF;
    powerled=LEDOFF;
    if(bat_percent>=20)
    {powerled=BLUE;}
    else
    {powerled=RED;}
//    led_timer=lp_time;
//    }
    }
}
void Time_to_restart_Poll (void)
{
@@ -330,10 +314,13 @@
  MX_IWDG_Init();
  /* USER CODE BEGIN 2 */
  Program_Init();
  #ifndef UWB_OFF_FANGCHAI_ON
  Dw1000_Init();
  Dw1000_App_Init();
  dwt_configuresleep(DWT_PRESRV_SLEEP | DWT_CONFIG, DWT_WAKE_CS | DWT_WAKE_WK| DWT_SLP_EN);
  dwt_entersleep();
  #else
  #endif
  BSP_Init();
  APL_Init();
  Set4LEDColor_Off();  //关一下led总电源
@@ -353,7 +340,11 @@
  {
    HAL_IWDG_Refresh(&hiwdg);
    APL_Poll();//lora接收,gps接收时间判断,单片机休眠函数,蜂鸣器判断函数。
    #ifndef UWB_OFF_FANGCHAI_ON
    Uwb_Poll();
    #else
    {GPS_ON_flag=1;}
    #endif
    Battery_Poll();//检测电量函数,每60s测一次电量。
    Time_to_restart_Poll();//防止出现意外情况,或则不考虑翻转问提,20000000s重启一次设备。
    /* USER CODE END WHILE */