51uwb.cn

标题: 多标签修改代码 [打印本页]

作者: 毕业设计    时间: 2021-9-22 10:43
标题: 多标签修改代码
  增加一个从标签,只需要修改TAG_ID就可以了吗,得到的距离数据存放在哪个变量里面。可不可以直接在从标签的显示板上进行显示。

作者: 蓝点无限    时间: 2021-9-23 08:03
按照用户手册如下部分修改,默认是可以只修改TAG_ID即可,但是默认只有两个slave_tag,如果添加再多slave tag,需要修改MAX_SLAVE_TAG
注意SLAVE_TAG 地址必须从0x01 开始,如果有多个,依次为0x01 0x02 ……

(, 下载次数: 619)
距离信息在TAG 代码如下,默认如果slave_tag 有液晶屏幕,是直接可以显示的。
  1. static void distance_mange(void)
  2. {
  3.     {
  4.         int Anchor_Index = 0;
  5.         while(Anchor_Index < ANCHOR_MAX_NUM)
  6.         {
  7.             if(Anthordistance_count[Anchor_Index] > 0 )
  8.             {
  9.                 Anthordistance[Anchor_Index] =filter((int)(Anthordistance[Anchor_Index]/Anthordistance_count[Anchor_Index]),Anchor_Index);
  10.                 // Anthordistance[Anchor_Index] =(int)(Anthordistance[Anchor_Index]/Anthordistance_count[Anchor_Index]);
  11.             }
  12.             Anchor_Index++;
  13.         }
  14.     }
  15.     compute_angle_send_to_anthor0(Anthordistance[0], Anthordistance[1],Anthordistance[2]);

  16.     if(first_distance == 1)
  17.                 {
  18.                          first_distance = 0;
  19.                          LCD_ClearLines();
  20.                 }
  21.     if(Anthordistance_count[0]>0)
  22.     {
  23.         sprintf(dist_str, "an0:%3.2fm", (float)Anthordistance[0]/1000);      
  24.         OLED_ShowString(0, 2,dist_str);
  25.     }

  26.     if(Anthordistance_count[1]>0)
  27.     {
  28.         sprintf(dist_str, "an1:%3.2fm", (float)Anthordistance[1]/1000);      
  29.         OLED_ShowString(0, 4,dist_str);
  30.     }

  31.     if(Anthordistance_count[2]>0)
  32.     {
  33.         sprintf(dist_str, "an2:%3.2fm", (float)Anthordistance[2]/1000);      
  34.         OLED_ShowString(0, 6,dist_str);
  35.     }
  36. }
复制代码





作者: Aran    时间: 2021-10-19 10:30
支持支持支持支持支持支持支持支持支持
作者: 毕业设计    时间: 2021-10-26 15:35

第二个标签的设置:
#define TAG
#define TAG_ID 0x01   
#define MASTER_TAG 0x0F
#define MAX_SLAVE_TAG 0x02
#define SLAVE_TAG_START_INDEX 0x01



但是在下面的slave tag 程序中的if(rx_buffer[ALL_MSG_TAG_IDX] == TAG_ID)判断中,rx_buffer[ALL_MSG_TAG_IDX]一直等于0x0F。
作者: 蓝点无限    时间: 2021-10-26 21:53
毕业设计 发表于 2021-10-26 15:35
第二个标签的设置:
#define TAG
#define TAG_ID 0x01   

把 MAX_SLAVE_TAG 2改为3,目前有个小bug,这个参数最小需要设置为3
第二个标签的设置:
#define TAG
#define TAG_ID 0x01   
#define MASTER_TAG 0x0F
#define MAX_SLAVE_TAG 0x03
#define SLAVE_TAG_START_INDEX 0x01




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