Bugfix and change of the handling of the RX Num.

If RX Num is 63, write a finetune value of 127 to the EEPROM.
A real finetune value of 127 means, the frequency of module is out of range and
the module should be replaced. This way the clone mode should not get unwanted
active by a module with a frequency drift arround 63.
This commit is contained in:
E1yot 2020-04-08 22:55:59 +02:00
parent b5bbc2cf5d
commit 856d1add1f
3 changed files with 9 additions and 9 deletions

View File

@ -113,12 +113,13 @@ void Frsky_init_clone(void)
temp++;
rx_tx_addr[3] = eeprom_read_byte((EE_ADDR)temp++);
rx_tx_addr[2] = eeprom_read_byte((EE_ADDR)temp++);
temp++;
hw_ver = eeprom_read_byte((EE_ADDR)temp++);
temp++;
for (uint8_t ch = 0; ch < 47; ch++)
{
hopping_frequency[ch] = eeprom_read_byte((EE_ADDR)temp++);
}
debugln("Clone mode");
}
#endif

View File

@ -385,8 +385,7 @@ uint16_t ReadFrSkyX()
uint16_t initFrSkyX()
{
set_rx_tx_addr(MProtocol_id_master);
if ((eeprom_read_byte((EE_ADDR)FRSKY_RX_EEPROM_OFFSET+3)==15) && (eeprom_read_byte((EE_ADDR)FRSKY_RX_EEPROM_OFFSET)<2))// bound in FRSKY-X RX-mode with num 63 -> use clone mode
if ((eeprom_read_byte((EE_ADDR)FRSKY_RX_EEPROM_OFFSET+4)==127) && (eeprom_read_byte((EE_ADDR)FRSKY_RX_EEPROM_OFFSET)<2))// bound in FRSKY-X RX-mode with RX Num 63 -> use clone mode
Frsky_init_clone();
else if(protocol==PROTO_FRSKYX)
Frsky_init_hop();

View File

@ -314,8 +314,7 @@ uint16_t FrSky_Rx_callback()
if(packet[1] == 0x03 && packet[2] == 0x01 && frskyx_rx_check_crc()) {
rx_tx_addr[0] = packet[3]; // TXID
rx_tx_addr[1] = packet[4]; // TXID
rx_tx_addr[2] = packet[12]; // TXID
rx_tx_addr[3] = packet[11]; // HW-Version #
rx_tx_addr[2] = packet[11]; // TXID
frsky_rx_finetune = -127;
CC2500_WriteReg(CC2500_0C_FSCTRL0, frsky_rx_finetune);
phase = FRSKY_RX_TUNE_LOW;
@ -393,15 +392,16 @@ uint16_t FrSky_Rx_callback()
eeprom_write_byte((EE_ADDR)temp++, rx_tx_addr[2]);
debug("addr[2]=%02X, ", rx_tx_addr[2]);
debug("rx_num=%02X, ", packet[12]); // RX # (D16)
if (rx_tx_addr[2]==15)
if (packet[12]==63)
{
eeprom_write_byte((EE_ADDR)temp++, rx_tx_addr[3]);
debug("hw_ver=%02X, ", rx_tx_addr[3]);
// If RX Num is 63, write a finetune value of 127 to the EEPROM
// A real finetune value of 127 means, the frequency of module is out of range and the module should be replaced.
eeprom_write_byte((EE_ADDR)temp++, 127);
}
else
{
eeprom_write_byte((EE_ADDR)temp++, frsky_rx_finetune);
debugln("tune=%d", (int8_t)frsky_rx_finetune);
debugln("tune=%d", (int8_t)frsky_rx_finetune);
}
for (ch = 0; ch < 47; ch++)
{