XK/MoFly: New sub protocol

This commit is contained in:
pascallanger
2026-08-16 16:12:11 +02:00
parent d6a969ee28
commit 780b4d9bcb
7 changed files with 82 additions and 42 deletions

View File

@@ -201,6 +201,7 @@
62,0,XK,X450,1,FMode,TakeOf,Emerg,3D_6G,Pict,Video
62,1,XK,X420,1,FMode,TakeOf,Emerg,3D_6G,Pict,Video,Flip,Light
62,2,XK,Cars,0,FMode,TakeOf,Emerg,3D_6G,Pict,Video,Flip,Light
62,3,XK,MoFly,0,FMode,Rate,BFlip,LRoll,RRoll,Invert
99,0,XK2,X4,0,Rate,Mode,Hover,Light,Stunt
99,1,XK2,P10,0,Rate,Mode,Hover,Light,Stunt
8,0,YD717,Std,1,Flip,Light,Pict,Video,HLess

View File

@@ -59,7 +59,7 @@
59,Bayang_RX,Multi,CPPM
60,Pelikan,Pro,Lite,SCX24
61,EazyRC
62,XK,X450,X420,Cars
62,XK,X450,X420,Cars,MoFly
63,XN_DUMP,250K,1M,2M,AUTO
64,FrskyX2,CH_16,CH_8,EU_16,EU_8,Cloned
65,FrSkyR9,915MHz,868MHz,915_8ch,868_8ch,FCC,--,FCC_8ch,--_8ch

View File

@@ -170,7 +170,7 @@ const char STR_SUBTYPE_XN297DUMP[] = "\x07""250Kbps""1Mbps\0 ""2Mbps\0 ""Auto\0
const char STR_SUBTYPE_ESKY150[] = "\x03""4ch""7ch";
const char STR_SUBTYPE_ESKY150V2[] = "\x05""150V2";
const char STR_SUBTYPE_V911S[] = "\x05""V911S""E119\0";
const char STR_SUBTYPE_XK[] = "\x04""X450""X420""Cars";
const char STR_SUBTYPE_XK[] = "\x05""X450\0""X420\0""Cars\0""MoFly";
const char STR_SUBTYPE_XK2[] = "\x03""X4\0""P10";
const char STR_SUBTYPE_FRSKYR9[] = "\x07""915MHz\0""868MHz\0""915 8ch""868 8ch""FCC\0 ""--\0 ""FCC 8ch""-- 8ch\0";
const char STR_SUBTYPE_ESKY[] = "\x03""Std""ET4";
@@ -532,7 +532,7 @@ const mm_protocol_definition multi_protocols[] = {
{PROTO_XERALL, STR_XERALL, NO_SUBTYPE, 0, OPTION_NONE, 0, 0, SW_NRF, XERALL_init, XERALL_callback },
#endif
#if defined(XK_CCNRF_INO)
{PROTO_XK, STR_XK, STR_SUBTYPE_XK, 3, OPTION_RFTUNE, 0, 0, SW_NRF, XK_init, XK_callback },
{PROTO_XK, STR_XK, STR_SUBTYPE_XK, 4, OPTION_RFTUNE, 0, 0, SW_NRF, XK_init, XK_callback },
#endif
#if defined(XK2_CCNRF_INO)
{PROTO_XK2, STR_XK2, STR_SUBTYPE_XK2, 2, OPTION_RFTUNE, 0, 0, SW_NRF, XK2_init, XK2_callback },

View File

@@ -19,7 +19,7 @@
#define VERSION_MAJOR 1
#define VERSION_MINOR 3
#define VERSION_REVISION 4
#define VERSION_PATCH_LEVEL 66
#define VERSION_PATCH_LEVEL 67
#define MODE_SERIAL 0
@@ -393,6 +393,7 @@ enum XK
X450 = 0,
X420 = 1,
XK_CARS = 2,
MOFLY = 3,
};
enum XN297DUMP
{
@@ -1173,6 +1174,8 @@ Serial: 100000 Baud 8e2 _ xxxx xxxx p --
sub_protocol==XK
X450 0
X420 1
Cars 2
MoFly 3
sub_protocol==FRSKY_R9
R9_915 0
R9_868 1

View File

@@ -68,6 +68,8 @@ static void __attribute__((unused)) XK_send_packet()
memset(packet,0x00,7);
memset(&packet[10],0x00,5);
if(sub_protocol != MOFLY)
{
packet[12]=0x40;
packet[13]=0x40;
if(IS_BIND_IN_PROGRESS)
@@ -89,7 +91,7 @@ static void __attribute__((unused)) XK_send_packet()
memset(&packet[4],0x40,3); // Trims
if(Channel_data[CH5] > CHANNEL_MAX_COMMAND)
if(CH5_SW)
packet[10] = 0x10; // V-Mode
else
if(Channel_data[CH5] > CHANNEL_MIN_COMMAND)
@@ -106,6 +108,26 @@ static void __attribute__((unused)) XK_send_packet()
|GET_FLAG(CH12_SW,0x10); // Light
//debugln("P1:%02X,P12:%02X",packet[1],packet[12]);
}
}
else
{
packet[0] = convert_channel_8b(THROTTLE);
packet[1] = convert_channel_s8b(RUDDER);
packet[2] = convert_channel_s8b(ELEVATOR);
packet[3] = convert_channel_s8b(AILERON);
memset(&packet[4],0x40,3); // Trims centered
//0x00 default MM Mode
if(CH5_SW)
packet[10] = 0x02; // 6G Mode
else
if(Channel_data[CH5] > CHANNEL_MIN_COMMAND)
packet[10] = 0x01; // 3D-Mode
packet[10] |= GET_FLAG(CH6_SW ,0x08); // Low/High rate
packet[11] = GET_FLAG(CH7_SW ,0x10) // Back Flip - momentary switch
|GET_FLAG(CH8_SW ,0x20) // Left Roll - momentary switch
|GET_FLAG(CH9_SW ,0x40) // Right Roll - momentary switch
|GET_FLAG(CH10_SW,0x80); // Inverted Flight - latching switch
}
crc=packet[0];
for(uint8_t i=1; i<XK_PAYLOAD_SIZE-1;i++)
@@ -128,7 +150,7 @@ const uint8_t PROGMEM XK_bind_hop[XK_RF_BIND_NUM_CHANNELS]= { 0x07, 0x24, 0x3E,
const uint8_t PROGMEM XK_tx_addr[]= { 0xB3, 0x67, 0xE9, 0x98, 0x3A, 0xEC, 0xA6, 0x59, 0xB2, 0x94, 0x2B, 0xA5, 0x37, 0xC5, 0x4A, 0xD3,
0x49, 0xA6, 0x83, 0xEB, 0x4B, 0xC9, 0x59, 0xD2, 0x65, 0x34, 0x6A, 0xD3, 0x2C, 0x96, 0x2A, 0xA9,
0x32, 0xB2, 0xB4, 0x49, 0xD3, 0x37, 0xE9 };
0x32, 0xB2, 0xB4, 0x49, 0xD3, 0x37, 0xE9 }; // last one in the table is 0x68 but not reachable
const uint8_t PROGMEM XK_hop[]= { 0x47, 0x3A, 0x4C, 0x39, 0x4D, 0x34, 0x4A, 0x3F, 0x45, 0x3E, 0x4B, 0x3D, 0x3B, 0x48, 0x40, 0x49,
0x46, 0x3C, 0x43, 0x38, 0x35, 0x42, 0x33, 0x44, 0x4E, 0x37, 0x44, 0x35, 0x37, 0x4E, 0x36, 0x41 };
@@ -196,7 +218,7 @@ static void __attribute__((unused)) XK_initialize_txid()
static void __attribute__((unused)) XK_RF_init()
{
XN297_Configure(XN297_CRCEN, XN297_SCRAMBLED, sub_protocol==X450 ? XN297_250K : XN297_1M );
XN297_Configure(XN297_CRCEN, XN297_SCRAMBLED, (sub_protocol==X450||sub_protocol==MOFLY) ? XN297_250K : XN297_1M );
XN297_SetTXAddr((uint8_t*)"\x68\x94\xA6\xD5\xC3", 5); // Bind address
XN297_HoppingCalib(XK_RF_BIND_NUM_CHANNELS+XK_RF_NUM_CHANNELS); // Calibrate all channels
}

View File

@@ -901,6 +901,7 @@ const PPM_Parameters PPM_prot[14*NBR_BANKS]= {
X450
X420
XK_CARS
MOFLY
PROTO_XK2
XK2_X4
XK2_P10

View File

@@ -159,7 +159,7 @@ CFlie|AIR|38|CFlie||||||||NRF24L01|
[WL91X](Protocols_Details.md#WL91X---106)||106|||||||||NRF24L01&CC2500|XN297
[WPL](Protocols_Details.md#WPL---107)||107|||||||||NRF24L01|XN297
[XERALL](Protocols_Details.md#XERALL---91)||91|Tank||||||||NRF24L01|XN297
[XK](Protocols_Details.md#XK---62)||62|X450|X420|Cars||||||NRF24L01&CC2500|XN297
[XK](Protocols_Details.md#XK---62)||62|X450|X420|Cars|MoFly|||||NRF24L01&CC2500|XN297
[XK2](Protocols_Details.md#XK2---99)||99|X4|P10|||||||NRF24L01&CC2500|XN297
[YD717](Protocols_Details.md#YD717---8)||8|YD717|SKYWLKR|SYMAX4|XINXUN|NIHUI||||NRF24L01|
[YuXiang](Protocols_Details.md#YuXiang---100)||100|||||||||NRF24L01|XN297
@@ -1605,7 +1605,7 @@ CH1|CH2|CH3|CH4|CH5|CH6|CH7|CH8|CH9|CH10
---|---|---|---|---|---|---|---|---|----
A|E|T|R|Flight_modes|Take_off|Emerg stop|3D/6G|Picture|Video
Flight_modes: -100%=M-Mode, 0%=6G-Mode, +100%=V-Mode. CH6-CH10 are mementary switches.
Flight_modes: -100%=M-Mode, 0%=6G-Mode, +100%=V-Mode. CH6-CH10 are momentary switches.
### Sub_protocol X420 - *1*
Models: XK X420/X520 (TX=X4)
@@ -1614,7 +1614,7 @@ CH1|CH2|CH3|CH4|CH5|CH6|CH7|CH8|CH9|CH10
---|---|---|---|---|---|---|---|---|----
A|E|T|R|Flight_modes|Take_off|Emerg stop|3D/6G|Picture|Video
Flight_modes: -100%=M-Mode, 0%=6G-Mode, +100%=V-Mode. CH6-CH10 are mementary switches.
Flight_modes: -100%=M-Mode, 0%=6G-Mode, +100%=V-Mode. CH6-CH10 are momentary switches.
Model: Tiger Drone 1400782
@@ -1625,6 +1625,19 @@ A|E|T|R|FLIP|LIGHT
### Sub_protocol Cars - *2*
Models: WLtoys cars 284131/284161/284010/124016/124017/144010 and Eachine EAT14
### Sub_protocol MoFly - *3*
Models: MoFly planes
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.
CH1|CH2|CH3|CH4|CH5|CH6|CH7|CH8|CH9|CH10
---|---|---|---|---|---|---|---|---|----
A|E|T|R|Flight_modes|Rate_L/H|Back_Flip|Left_Roll|Right_Roll|Inverted
Flight_modes: -100%=MM-Mode, 0%=3D-Mode, +100%=6G-Mode. CH7-CH9 are momentary switches. CH10 is a toggle switch.
## XK2 - *99*
You must assign a different RX number for each receiver/plane. Otherwise the new receiver/plane ID will overwrite the previous one.