FrSkyD: clone mode - additional ID byte

This commit is contained in:
Pascal Langer 2020-07-03 16:15:47 +02:00
parent 15395de579
commit 9e0bd29cee
2 changed files with 7 additions and 3 deletions

View File

@ -54,7 +54,7 @@ static void __attribute__((unused)) frsky2way_build_bind_packet()
packet[14] = 0x00; packet[14] = 0x00;
packet[15] = 0x00; packet[15] = 0x00;
packet[16] = 0x00; packet[16] = 0x00;
packet[17] = 0x01; packet[17] = rx_tx_addr[1];
} }
static void __attribute__((unused)) frsky2way_data_frame() static void __attribute__((unused)) frsky2way_data_frame()
@ -71,7 +71,7 @@ static void __attribute__((unused)) frsky2way_data_frame()
packet[4] = 0x00; packet[4] = 0x00;
#endif #endif
packet[5] = 0x01; packet[5] = rx_tx_addr[1];
// //
packet[10] = 0; packet[10] = 0;
packet[11] = 0; packet[11] = 0;
@ -100,6 +100,7 @@ uint16_t initFrSky_2way()
if (sub_protocol==DCLONE) if (sub_protocol==DCLONE)
Frsky_init_clone(); Frsky_init_clone();
else else
{
for(uint8_t i=0;i<50;i++) for(uint8_t i=0;i<50;i++)
{ {
uint8_t freq = (i * 0x1e) % 0xeb; uint8_t freq = (i * 0x1e) % 0xeb;
@ -109,6 +110,8 @@ uint16_t initFrSky_2way()
freq=0; freq=0;
hopping_frequency[i]=freq; hopping_frequency[i]=freq;
} }
rx_tx_addr[1]=1; // keep compatibility with already bound RXs
}
packet_count=0; packet_count=0;
if(IS_BIND_IN_PROGRESS) if(IS_BIND_IN_PROGRESS)

View File

@ -201,9 +201,10 @@ static uint8_t __attribute__((unused)) frskyx_rx_check_crc_id(bool bind,bool ini
{//Save TXID {//Save TXID
rx_tx_addr[3] = packet[3]; rx_tx_addr[3] = packet[3];
rx_tx_addr[2] = packet[4]; rx_tx_addr[2] = packet[4];
rx_tx_addr[1] = packet[17];
} }
else else
if(rx_tx_addr[3] != packet[offset] || rx_tx_addr[2] != packet[offset+1]) if(rx_tx_addr[3] != packet[offset] || rx_tx_addr[2] != packet[offset+1] || rx_tx_addr[1] != packet[bind?17:5])
return false; // Bad address return false; // Bad address
return true; // Full match return true; // Full match
} }