yincheng.zhong
2022-12-20 c6338b964effd7b5283ce74097dd84eabbd884d0
Src/main.c
@@ -924,11 +924,19 @@
  /*Enter the Standby mode*/
  HAL_PWR_EnterSTANDBYMode();   
}
extern u16 tagslotpos;
extern uint8_t tx_near_msg[80],stationary_flag,gotosleep_flag,current_sync_sec,tagpoll_sync_sec;
extern u16 tagslotpos,current_slotpos;
extern uint8_t tx_near_msg[80],stationary_flag,gotosleep_flag,current_sync_sec,tagpoll_sync_sec,flag_tagnewpos;
float key_keeptime;
extern float motor_ontime;
extern  uint16_t rec_tagperiod;
void GetRandomPos(void)
{
    current_slotpos = HAL_LPTIM_ReadCounter(&hlptim1)%max_slotpos;  //如果丢失连接超过5次就随机换个时间片
    tagpoll_sync_sec = current_slotpos/200;
    tagslotpos = current_slotpos%200;
    flag_tagnewpos = 0;
}
void HAL_LPTIM_CompareMatchCallback(LPTIM_HandleTypeDef *hlptim)
{
   static uint8_t i=0;
@@ -936,7 +944,10 @@
   
//   current_slotnum++;
//   SetNextPollTime(tagslotpos);
   if(current_slotpos>=max_slotpos)
   {
    GetRandomPos();
   }
    if(current_sync_sec==tagpoll_sync_sec)
    {
        g_start_send_flag=1;