XK2 2nd ID

This commit is contained in:
pascallanger
2025-01-20 16:28:48 +01:00
parent 9b66711052
commit fd150fa109
4 changed files with 27 additions and 11 deletions

View File

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

View File

@@ -70,13 +70,14 @@ static void __attribute__((unused)) XK2_send_packet()
//Flags
packet[5] = GET_FLAG(CH5_SW, 0x01) //Rate
| GET_FLAG(CH6_SW, 0x08) //Mode
| GET_FLAG(CH7_SW, 0x20); //Hover
| GET_FLAG(CH7_SW, 0x20) //Hover
| GET_FLAG(CH8_SW, 0x40); //Light
//Telemetry not received=00, Telemetry received=01 but sometimes switch to 1 even if telemetry is not there...
packet[6] = 0x00;
//Unknown
packet[7] = crc8; //?? RX_ID checksum ?? => sum RX_ID[0..2]
//Checksum seed
packet[8] = 0x7F; //Constant?
packet[8] = num_ch; //Based on TX ID but calculation is unknown
}
//Checksum
for(uint8_t i=0; i<XK2_PAYLOAD_SIZE-1; i++)
@@ -108,14 +109,28 @@ static void __attribute__((unused)) XK2_RF_init()
static void __attribute__((unused)) XK2_initialize_txid()
{
#ifdef FORCE_XK2_ID
if(rx_tx_addr[3]&1)
{
rx_tx_addr[0] = 0x66;
rx_tx_addr[1] = 0x4F;
rx_tx_addr[2] = 0x47;
for(uint8_t i=0;i<XK2_RF_NUM_CHANNELS;i++)
hopping_frequency[i] = 65 + i*4; //65=0x41, 69=0x45, 73=0x49, 77=0x4D
num_ch = 0x7F; // Must be based on the ID but calculation unknow yet
//hopping frequencies 65=0x41, 69=0x45, 73=0x49, 77=0x4D
}
else
{
rx_tx_addr[0] = 0x36;
rx_tx_addr[1] = 0x49;
rx_tx_addr[2] = 0x6B;
num_ch = 0x79; // Must be based on the ID but calculation unknow yet
//hopping frequencies 65=0x41, 69=0x45, 73=0x49, 77=0x4D
}
#endif
for(uint8_t i=0;i<XK2_RF_NUM_CHANNELS;i++) // Are these RF frequencies always the same?
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 , 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()
@@ -271,6 +286,7 @@ P[4] = alternates 20,60,A0,E0
P[5] = flags
01=high rate
20=hover=long_press_left
40=light -> temporary
08=6g/3d=short_press_right sequece also switches for a few packets to C1 if 8 C0 if 0
P[6] = 00 telemetry nok
01 telemetry ok but sometimes switch to 1 also when telemetry is nok...