忽略已对码遥控器的重复写入
This commit is contained in:
@@ -112,17 +112,24 @@ static uint8_t Pairing_Address_IsEmpty(uint8_t high, uint8_t low)
|
|||||||
(high == 0xffU && low == 0xffU));
|
(high == 0xffU && low == 0xffU));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void Pairing_Address_Touch(uint8_t high, uint8_t low)
|
static uint8_t Pairing_Address_AddNew(uint8_t high, uint8_t low)
|
||||||
{
|
{
|
||||||
uint8_t next_h[5];
|
uint8_t next_h[5];
|
||||||
uint8_t next_l[5];
|
uint8_t next_l[5];
|
||||||
uint8_t count = 0U;
|
uint8_t count = 0U;
|
||||||
uint8_t i;
|
uint8_t i;
|
||||||
|
|
||||||
|
for(i = 0U; i < 5U; i++)
|
||||||
|
{
|
||||||
|
if(adress_H_array[i] == high && adress_L_array[i] == low)
|
||||||
|
{
|
||||||
|
return 0U;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
for(i = 0U; i < 5U; i++)
|
for(i = 0U; i < 5U; i++)
|
||||||
{
|
{
|
||||||
if(Pairing_Address_IsEmpty(adress_H_array[i], adress_L_array[i])) continue;
|
if(Pairing_Address_IsEmpty(adress_H_array[i], adress_L_array[i])) continue;
|
||||||
if(adress_H_array[i] == high && adress_L_array[i] == low) continue;
|
|
||||||
|
|
||||||
next_h[count] = adress_H_array[i];
|
next_h[count] = adress_H_array[i];
|
||||||
next_l[count] = adress_L_array[i];
|
next_l[count] = adress_L_array[i];
|
||||||
@@ -156,6 +163,8 @@ static void Pairing_Address_Touch(uint8_t high, uint8_t low)
|
|||||||
adress_L_array[i] = 0xffU;
|
adress_L_array[i] = 0xffU;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return 1U;
|
||||||
}
|
}
|
||||||
static void Pairing_Feedback_Apply(uint8_t on)
|
static void Pairing_Feedback_Apply(uint8_t on)
|
||||||
{
|
{
|
||||||
@@ -247,6 +256,7 @@ static void Pairing_Candidate_Reset(void)
|
|||||||
|
|
||||||
static void Encoder_key_NoCode(){
|
static void Encoder_key_NoCode(){
|
||||||
uint16_t times_s=0;
|
uint16_t times_s=0;
|
||||||
|
uint8_t pairing_data_changed=0U;
|
||||||
|
|
||||||
if(pair_frame_silence_ticks < 0xffU) pair_frame_silence_ticks++;
|
if(pair_frame_silence_ticks < 0xffU) pair_frame_silence_ticks++;
|
||||||
if(pair_frame_silence_ticks > PAIR_FRAME_SILENCE_TICKS)
|
if(pair_frame_silence_ticks > PAIR_FRAME_SILENCE_TICKS)
|
||||||
@@ -313,12 +323,20 @@ static void Encoder_key_NoCode(){
|
|||||||
adress=receive_data >>8;
|
adress=receive_data >>8;
|
||||||
adress_H = (receive_data >> 16) & 0xff;
|
adress_H = (receive_data >> 16) & 0xff;
|
||||||
adress_L = (receive_data >> 8) & 0xff;
|
adress_L = (receive_data >> 8) & 0xff;
|
||||||
Pairing_Address_Touch(adress_H, adress_L);
|
if(Pairing_Address_AddNew(adress_H, adress_L))
|
||||||
|
{
|
||||||
|
pairing_data_changed=1U;
|
||||||
|
}
|
||||||
|
else if(match_success==0U)
|
||||||
|
{
|
||||||
|
pairing_data_changed=1U;
|
||||||
|
}
|
||||||
times_s=300;
|
times_s=300;
|
||||||
match_success=1;
|
match_success=1;
|
||||||
Pairing_Feedback_Start(times_s);
|
Pairing_Feedback_Start(times_s);
|
||||||
}
|
}
|
||||||
else if(res_data==Brightness_L||res_data==B_Brightness_L||res_data==F_Brightness_100){
|
else if(res_data==Brightness_L||res_data==B_Brightness_L||res_data==F_Brightness_100){
|
||||||
|
pairing_data_changed=1U;
|
||||||
adress_H_array[0] = 0xff;
|
adress_H_array[0] = 0xff;
|
||||||
adress_L_array[0] = 0xff;
|
adress_L_array[0] = 0xff;
|
||||||
adress_H_array[1] = 0xff;
|
adress_H_array[1] = 0xff;
|
||||||
@@ -337,7 +355,7 @@ static void Encoder_key_NoCode(){
|
|||||||
}
|
}
|
||||||
|
|
||||||
ssse=1;
|
ssse=1;
|
||||||
set_TaskComps_timer(2,2000);
|
if(pairing_data_changed) set_TaskComps_timer(2,2000);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user