51uwb.cn

标题: bp50中哪里是标签发给基站的数据 [打印本页]

作者: uwblove    时间: 2024-3-21 16:20
标题: bp50中哪里是标签发给基站的数据
请问bp50的代码中关于基站的部分,哪一部分存的是标签发给基站的数据呢?

作者: 蓝点无限    时间: 2024-3-24 21:22
定位结果最终通过如下代码段发送给基站,如果是中间通信过程,请仔细阅读固件代码
  1.     //location
  2.     {
  3.         uint8 len = 0;
  4.         angle_msg[LOCATION_FLAG_IDX] = 1;

  5.         angle_msg[LOCATION_INFO_START_IDX + (len++)] = 'm';
  6.         angle_msg[LOCATION_INFO_START_IDX + (len++)] = 'r';

  7.         angle_msg[LOCATION_INFO_START_IDX + (len++)] = 0x02;
  8.         angle_msg[LOCATION_INFO_START_IDX + (len++)] = TAG_ID;//TAG ID

  9.         angle_msg[LOCATION_INFO_START_IDX + (len++)] = (uint8)(framenum&0xFF);
  10.         angle_msg[LOCATION_INFO_START_IDX + (len++)] = (uint8)((framenum>>8)&0xFF);

  11.         angle_msg[LOCATION_INFO_START_IDX + (len++)] = (uint8)((distance1/10)&0xFF);
  12.         angle_msg[LOCATION_INFO_START_IDX + (len++)] = (uint8)((distance1/10 >>8)&0xFF);

  13.         angle_msg[LOCATION_INFO_START_IDX + (len++)] =  (uint8)((distance2/10)&0xFF);
  14.         angle_msg[LOCATION_INFO_START_IDX + (len++)] =  (uint8)((distance2/10 >>8)&0xFF);

  15.         angle_msg[LOCATION_INFO_START_IDX + (len++)] =  (uint8)((distance3/10)&0xFF);
  16.         angle_msg[LOCATION_INFO_START_IDX + (len++)] =  (uint8)((distance3/10 >>8)&0xFF);

  17.         if(ANCHOR_MAX_NUM > 3)
  18.         {
  19.             angle_msg[LOCATION_INFO_START_IDX + (len++)] = (uint8)((Anthordistance[3]/10)&0xFF);
  20.             angle_msg[LOCATION_INFO_START_IDX + (len++)] = (uint8)((Anthordistance[3]/10 >>8)&0xFF);
  21.         }
  22.         else
  23.         {
  24.             angle_msg[LOCATION_INFO_START_IDX + (len++)] = (uint8)((distance1/10)&0xFF);
  25.             angle_msg[LOCATION_INFO_START_IDX + (len++)] = (uint8)((distance1/10 >>8)&0xFF);
  26.         }

  27.         angle_msg[LOCATION_INFO_START_IDX + (len++)] = '\n';
  28.         angle_msg[LOCATION_INFO_START_IDX + (len++)] = '\r';


  29.         angle_msg[LOCATION_INFO_LEN_IDX] = len;
  30.         //MAX LEN
  31.         if(LOCATION_INFO_START_IDX + len -2 >ANGLE_MSG_MAX_LEN)
  32.         {
  33.             while(1);
  34.         }
  35.         //USART_puts((char*)angle_msg,len);
  36.     }
  37. #endif
  38.     //only anthor0 recive angle message
  39.     angle_msg[ALL_MSG_SN_IDX] = framenum;
  40.     angle_msg[ALL_MSG_TAG_IDX] = TAG_ID;

  41.     dwt_writetxdata(sizeof(angle_msg), angle_msg, 0);
  42.     dwt_writetxfctrl(sizeof(angle_msg), 0);

  43.     /* Start transmission, indicating that a response is expected so that reception is enabled automatically after the frame is sent and the delay
  44.      * set by dwt_setrxaftertxdelay() has elapsed. */
  45.     dwt_starttx(DWT_START_TX_IMMEDIATE );
  46.     while (!(dwt_read32bitreg(SYS_STATUS_ID) & SYS_STATUS_TXFRS))
  47.     { };
复制代码









欢迎光临 51uwb.cn (http://51uwb.cn/) Powered by Discuz! X3.3