XK2 multi IDs

This commit is contained in:
pascallanger 2025-01-20 19:19:31 +01:00
parent fd150fa109
commit 546a962d96
3 changed files with 28 additions and 26 deletions

View File

@ -19,7 +19,7 @@
#define VERSION_MAJOR 1 #define VERSION_MAJOR 1
#define VERSION_MINOR 3 #define VERSION_MINOR 3
#define VERSION_REVISION 4 #define VERSION_REVISION 4
#define VERSION_PATCH_LEVEL 19 #define VERSION_PATCH_LEVEL 20
#define MODE_SERIAL 0 #define MODE_SERIAL 0

View File

@ -18,7 +18,7 @@ Multiprotocol is distributed in the hope that it will be useful,
#include "iface_xn297.h" #include "iface_xn297.h"
#define FORCE_XK2_ID //#define FORCE_XK2_ID
#define XK2_RF_BIND_CHANNEL 71 #define XK2_RF_BIND_CHANNEL 71
#define XK2_PAYLOAD_SIZE 9 #define XK2_PAYLOAD_SIZE 9
@ -75,15 +75,16 @@ static void __attribute__((unused)) XK2_send_packet()
//Telemetry not received=00, Telemetry received=01 but sometimes switch to 1 even if telemetry is not there... //Telemetry not received=00, Telemetry received=01 but sometimes switch to 1 even if telemetry is not there...
packet[6] = 0x00; packet[6] = 0x00;
//Unknown //Unknown
packet[7] = crc8; //?? RX_ID checksum ?? => sum RX_ID[0..2] packet[7] = crc8; //Sum RX_ID[0..2]
//Checksum seed //Checksum seed
packet[8] = num_ch; //Based on TX ID but calculation is unknown packet[8] = num_ch; //Based on TX ID
} }
//Checksum //Checksum
for(uint8_t i=0; i<XK2_PAYLOAD_SIZE-1; i++) for(uint8_t i=0; i<XK2_PAYLOAD_SIZE-1; i++)
packet[8] += packet[i]; packet[8] += packet[i];
// Send // Send
XN297_SetFreqOffset();
XN297_SetPower(); XN297_SetPower();
XN297_SetTxRxMode(TX_EN); XN297_SetTxRxMode(TX_EN);
XN297_WritePayload(packet, XK2_PAYLOAD_SIZE); XN297_WritePayload(packet, XK2_PAYLOAD_SIZE);
@ -109,28 +110,31 @@ static void __attribute__((unused)) XK2_RF_init()
static void __attribute__((unused)) XK2_initialize_txid() static void __attribute__((unused)) XK2_initialize_txid()
{ {
#ifdef FORCE_XK2_ID #ifdef FORCE_XK2_ID
if(rx_tx_addr[3]&1) if(rx_tx_addr[3]&1)
{ {//Pascal
rx_tx_addr[0] = 0x66; rx_tx_addr[0] = 0x66;
rx_tx_addr[1] = 0x4F; rx_tx_addr[1] = 0x4F;
rx_tx_addr[2] = 0x47; rx_tx_addr[2] = 0x47;
num_ch = 0x7F; // Must be based on the ID but calculation unknow yet num_ch = 0x7F;
//hopping frequencies 65=0x41, 69=0x45, 73=0x49, 77=0x4D //hopping frequencies 65=0x41, 69=0x45, 73=0x49, 77=0x4D
} }
else else
{ {//Marc
rx_tx_addr[0] = 0x36; rx_tx_addr[0] = 0x36;
rx_tx_addr[1] = 0x49; rx_tx_addr[1] = 0x49;
rx_tx_addr[2] = 0x6B; rx_tx_addr[2] = 0x6B;
num_ch = 0x79; // Must be based on the ID but calculation unknow yet num_ch = 0x79;
//hopping frequencies 65=0x41, 69=0x45, 73=0x49, 77=0x4D //hopping frequencies 65=0x41, 69=0x45, 73=0x49, 77=0x4D
} }
#endif #endif
for(uint8_t i=0;i<XK2_RF_NUM_CHANNELS;i++) // Are these RF frequencies always the same? rx_tx_addr[0] = rx_tx_addr[3]; // Use RX_num
rx_tx_addr[3] = rx_tx_addr[4] = 0xCC;
num_ch = 0x21 + rx_tx_addr[0] - rx_tx_addr[1] + rx_tx_addr[2];
for(uint8_t i=0;i<XK2_RF_NUM_CHANNELS;i++) // Are these RF frequencies always the same? It looks like yes...
hopping_frequency[i] = 65 + i*4; //65=0x41, 69=0x45, 73=0x49, 77=0x4D hopping_frequency[i] = 65 + i*4; //65=0x41, 69=0x45, 73=0x49, 77=0x4D
rx_tx_addr[3] = 0xCC;
rx_tx_addr[4] = 0xCC; debugln("ID: %02X %02X %02X %02X %02X, OFFSET: %02X, HOP: %02X %02X %02X %02X",rx_tx_addr[0],rx_tx_addr[1],rx_tx_addr[2],rx_tx_addr[3],rx_tx_addr[4],num_ch,hopping_frequency[0],hopping_frequency[1],hopping_frequency[2],hopping_frequency[3]);
debugln("ID: %02X %02X %02X %02X %02X , HOP: %02X %02X %02X %02X",rx_tx_addr[0],rx_tx_addr[1],rx_tx_addr[2],rx_tx_addr[3],rx_tx_addr[4],hopping_frequency[0],hopping_frequency[1],hopping_frequency[2],hopping_frequency[3]);
} }
uint16_t XK2_callback() uint16_t XK2_callback()

View File

@ -1517,8 +1517,6 @@ Models: WLtoys cars 284131/284161/284010/124016/124017/144010 and Eachine EAT14
### Sub_protocol X4 - *0* ### Sub_protocol X4 - *0*
Transmitter: XK X4-A160, X5S, model: XK A160S, XK A280 Transmitter: XK X4-A160, X5S, model: XK A160S, XK A280
**Only 2 IDs**
If a CC2500 is installed it will be used for this sub protocol. Option in this case is used for fine frequency tuning like any CC2500 protocols so check the [Frequency Tuning page](/docs/Frequency_Tuning.md). If a CC2500 is installed it will be used for this sub protocol. Option in this case is used for fine frequency tuning like any CC2500 protocols so check the [Frequency Tuning page](/docs/Frequency_Tuning.md).
If only a NRF24L01 is installed then this sub protocol might be problematic because it is using the xn297L emulation with a transmission speed of 250kbps which doesn't work very well with every NRF24L01, this is an hardware issue with the authenticity and accuracy of the components. If only a NRF24L01 is installed then this sub protocol might be problematic because it is using the xn297L emulation with a transmission speed of 250kbps which doesn't work very well with every NRF24L01, this is an hardware issue with the authenticity and accuracy of the components.