Browse Source

优化L3_new_rfid函数

bfysop-v2
mr.zhangsan 1 year ago
parent
commit
9a03c11bfb
  1. 33
      source/app/app_config.c
  2. 2
      source/app/app_config.h

33
source/app/app_config.c

@ -152,7 +152,7 @@ void L3_reg_init(void)
//L3_iap_2_reg(); //L3_iap_2_reg();
} }
U8 L3_new_rfid(U16 rfidno, U8 rssi, U8 ant) U8 L3_new_rfid_1(U16 rfidno, U8 rssi, U8 ant)
{ {
U8 i = 0; U8 i = 0;
for(i=0; i<4; i++) for(i=0; i<4; i++)
@ -175,6 +175,37 @@ U8 L3_new_rfid(U16 rfidno, U8 rssi, U8 ant)
return 0; return 0;
} }
U8 L3_new_rfid(U16 rfidno, U8 rssi, U8 ant)
{
U8 i = 0;
for(i=0; i<RFID_BUF_NUM; i++)
{
if(R.rfids[i].rfid_no[0] == 0 && R.rfids[i].rfid_no[1] == 0)
{
//空位置
break;
}
if(R.rfids[i].rfid_no[0] == (rfidno >> 8 & 0xFF) && R.rfids[i].rfid_no[1] == (rfidno >> 0 & 0xFF))
{
//该rfid已经存在
break;
}
}
if(i == RFID_BUF_NUM)
{
i = 0;
}
//放入RFID(空位置、已存在位置[替换为最新的rssi和ant]、0位置[放满了就从头开始放)
R.rfids[i].rfid_no[0] = rfidno >> 8 & 0xFF;
R.rfids[i].rfid_no[1] = rfidno >> 0 & 0xFF;
R.rfids[i].rssi = rssi;
R.rfids[i].ant = ant;
return 0;
}
U8 L3_find_rfid_table(U16 rfidno) U8 L3_find_rfid_table(U16 rfidno)
{ {
for(i=0; i<LED_BTN_NUM; i++) for(i=0; i<LED_BTN_NUM; i++)

2
source/app/app_config.h

@ -28,6 +28,8 @@
#define POWER_NORMAL 0 #define POWER_NORMAL 0
#define POWER_LOW 1 #define POWER_LOW 1
#define RFID_BUF_NUM 4
typedef struct global_register typedef struct global_register
{ {
//RFID对照表 //RFID对照表

Loading…
Cancel
Save