From ebde0915cd4127795195caad30ff7c9b11a1c4d6 Mon Sep 17 00:00:00 2001 From: Pascal Langer Date: Thu, 26 Aug 2021 22:33:38 +0200 Subject: [PATCH] MT99xx/F949G: new sub protocol --- Lua_scripts/MultiChan.txt | 1 + Multiprotocol/MT99xx_ccnrf.ino | 41 ++++++++++++++++++++++++++++------ Multiprotocol/Multi.txt | 6 +++-- Multiprotocol/Multi_Protos.ino | 8 +++++-- Multiprotocol/Multiprotocol.h | 5 ++++- Multiprotocol/Validate.h | 1 + Multiprotocol/_Config.h | 4 ++++ Protocols_Details.md | 7 ++++++ 8 files changed, 61 insertions(+), 12 deletions(-) diff --git a/Lua_scripts/MultiChan.txt b/Lua_scripts/MultiChan.txt index 12c5a62..37fa31a 100644 --- a/Lua_scripts/MultiChan.txt +++ b/Lua_scripts/MultiChan.txt @@ -131,6 +131,7 @@ 17,4,MT99XX,FY805,1,Flip,n-a,n-a,n-a,HLess 17,5,MT99XX,A180,0,3D_6G 17,6,MT99XX,Dragon,0,Mode,RTH +17,7,MT99XX,F949G,0,6G_3D,Light 44,0,NCC1701,Std,1,Warp 77,0,OMP,M2,0,THold,IdleUp,6G_3D 60,0,Pelikan,PRO_V4,0,CH5,CH6,CH7,CH8 diff --git a/Multiprotocol/MT99xx_ccnrf.ino b/Multiprotocol/MT99xx_ccnrf.ino index af2f27e..c70a0ad 100644 --- a/Multiprotocol/MT99xx_ccnrf.ino +++ b/Multiprotocol/MT99xx_ccnrf.ino @@ -26,11 +26,13 @@ #define MT99XX_PACKET_PERIOD_A180 3400 // timing changes between the packets 2 x 27220 then 1x 26080, it seems that it is only on the first RF channel which jitters by 1.14ms but hard to pinpoint with XN297dump #define MT99XX_PACKET_PERIOD_DRAGON 1038 // there is a pause of 2x1038 between two packets, no idea why and how since it is not even stable on a same dump... #define MT99XX_PACKET_PERIOD_DRAGON_TELEM 10265 // long pause to receive the telemetry packets, 3 are sent by the RX one after the other +#define MT99XX_PACKET_PERIOD_F949G 3450 #define MT99XX_INITIAL_WAIT 500 #define MT99XX_PACKET_SIZE 9 //#define FORCE_A180_ID //#define FORCE_DRAGON_ID +//#define FORCE_F949G_ID enum { MT99XX_DATA, @@ -75,6 +77,12 @@ enum{ FLAG_DRAGON_UNK = 0x04, }; +enum{ + // flags going to packet[6] (F949G) + FLAG_F949G_LIGHT = 0x01, + FLAG_F949G_3D6G = 0x20, +}; + const uint8_t h7_mys_byte[] = { 0x01, 0x11, 0x02, 0x12, 0x03, 0x13, 0x04, 0x14, 0x05, 0x15, 0x06, 0x16, 0x07, 0x17, 0x00, 0x10 @@ -120,9 +128,10 @@ static void __attribute__((unused)) MT99XX_send_packet() packet[2] = 0x12; packet[3] = 0x17; break; + case F949G: case A180: packet_period = MT99XX_PACKET_PERIOD_A180; - default: // MT99 & H7 & A180 & DRAGON + default: // MT99 & H7 & A180 & DRAGON & F949G packet[1] = 0x14; packet[2] = 0x03; packet[3] = 0x25; @@ -132,12 +141,15 @@ static void __attribute__((unused)) MT99XX_send_packet() packet[5] = rx_tx_addr[1]; packet[6] = rx_tx_addr[2]; packet[7] = crc8; // checksum offset - packet[8] = 0xAA; // fixed + if(sub_protocol != F949G) + packet[8] = 0xAA; // fixed + else + packet[8] = 0x00; } else { if(sub_protocol != YZ) - { // MT99XX & H7 & LS & FY805 & A180 & DRAGON + { // MT99XX & H7 & LS & FY805 & A180 & DRAGON & F949G packet[0] = convert_channel_16b_limit(THROTTLE,0xE1,0x00); // throttle packet[1] = convert_channel_16b_limit(RUDDER ,0x00,0xE1); // rudder packet[2] = convert_channel_16b_limit(AILERON ,0xE1,0x00); // aileron @@ -212,6 +224,12 @@ static void __attribute__((unused)) MT99XX_send_packet() packet[7] = 0x20; #endif break; + case F949G: + packet[6] = 0x02 + | GET_FLAG( CH5_SW, FLAG_F949G_3D6G ) + | GET_FLAG( CH6_SW, FLAG_F949G_LIGHT ); + packet[7] = 0x00; + break; } uint8_t result=crc8; for(uint8_t i=0; i<8; i++) @@ -251,11 +269,11 @@ static void __attribute__((unused)) MT99XX_send_packet() else if(sub_protocol==FY805) XN297_RFChannel(0x4B); // FY805 always transmits on the same channel - else // MT99 & H7 & YZ & A180 & DRAGON + else // MT99 & H7 & YZ & A180 & DRAGON & F949G XN297_Hopping(hopping_frequency_no); hopping_frequency_no++; - if(sub_protocol == YZ || sub_protocol == A180 || sub_protocol == DRAGON ) + if(sub_protocol == YZ || sub_protocol == A180 || sub_protocol == DRAGON || sub_protocol == F949G) hopping_frequency_no++; // skip every other channel if(hopping_frequency_no > 15) hopping_frequency_no = 0; @@ -318,7 +336,16 @@ static void __attribute__((unused)) MT99XX_initialize_txid() //channel_offset = 0x06 break; #endif - default: //MT99 & H7 & A180 & DRAGON + #ifdef FORCE_F949G_ID + case F949G: + rx_tx_addr[0] = 0x7E; // LilTeo14 ID + rx_tx_addr[1] = 0x2F; + rx_tx_addr[2] = 0x29; + //crc8 = 0xD6 + //channel_offset = 0x03 + break; + #endif + default: //MT99 & H7 & A180 & DRAGON & F949G rx_tx_addr[2] = 0x00; break; } @@ -409,7 +436,7 @@ uint16_t MT99XX_callback() void MT99XX_init(void) { - if(sub_protocol != A180 && sub_protocol != DRAGON) + if(sub_protocol != A180 && sub_protocol != DRAGON && sub_protocol != F949G) BIND_IN_PROGRESS; // autobind protocol bind_counter = MT99XX_BIND_COUNT; diff --git a/Multiprotocol/Multi.txt b/Multiprotocol/Multi.txt index 97087fd..8f78189 100644 --- a/Multiprotocol/Multi.txt +++ b/Multiprotocol/Multi.txt @@ -14,7 +14,7 @@ 14,Bayang,Bayang,H8S3D,X16_AH,IRDRONE,DHD_D4,QX100 15,FrskyX,CH_16,CH_8,EU_16,EU_8,Cloned,Clon_8 16,ESky,Std,ET4 -17,MT99xx,MT,H7,YZ,LS,FY805,A180,Dragon +17,MT99xx,MT,H7,YZ,LS,FY805,A180,Dragon,F949G 18,MJXq,WLH08,X600,X800,H26D,E010,H26WH,PHOENIX 19,Shenqi 20,FY326,FY326,FY319 @@ -84,5 +84,7 @@ 84,JOYSWAY 85,E016H 87,IKEA +88,WILLIFM 89,Losi -90,MouldKg,Analog,Digit \ No newline at end of file +90,MouldKg,Analog,Digit +91,XERALL \ No newline at end of file diff --git a/Multiprotocol/Multi_Protos.ino b/Multiprotocol/Multi_Protos.ino index 9c4628f..d3f589e 100644 --- a/Multiprotocol/Multi_Protos.ino +++ b/Multiprotocol/Multi_Protos.ino @@ -102,6 +102,7 @@ const char STR_IKEAANSLUTA[]="Ansluta"; const char STR_CONFIG[] ="Config"; const char STR_LOSI[] ="Losi"; const char STR_MOULDKG[] ="MouldKg"; +const char STR_XERALL[] ="XERALL"; const char STR_SUBTYPE_FLYSKY[] = "\x04""Std\0""V9x9""V6x6""V912""CX20"; const char STR_SUBTYPE_HUBSAN[] = "\x04""H107""H301""H501"; @@ -118,7 +119,7 @@ const char STR_SUBTYPE_SLT[] = "\x06""V1_6ch""V2_8ch""Q100\0 ""Q200\0 ""M const char STR_SUBTYPE_CX10[] = "\x07""Green\0 ""Blue\0 ""DM007\0 ""-\0 ""JC3015a""JC3015b""MK33041"; const char STR_SUBTYPE_CG023[] = "\x05""Std\0 ""YD829"; const char STR_SUBTYPE_BAYANG[] = "\x07""Std\0 ""H8S3D\0 ""X16 AH\0""IRDrone""DHD D4\0""QX100\0 "; -const char STR_SUBTYPE_MT99[] = "\x06""MT99\0 ""H7\0 ""YZ\0 ""LS\0 ""FY805\0""A180\0 ""Dragon"; +const char STR_SUBTYPE_MT99[] = "\x06""MT99\0 ""H7\0 ""YZ\0 ""LS\0 ""FY805\0""A180\0 ""Dragon""F949G\0"; const char STR_SUBTYPE_MJXQ[] = "\x07""WLH08\0 ""X600\0 ""X800\0 ""H26D\0 ""E010\0 ""H26WH\0 ""Phoenix"; const char STR_SUBTYPE_FY326[] = "\x05""Std\0 ""FY319"; const char STR_SUBTYPE_HONTAI[] = "\x07""Std\0 ""JJRC X1""X5C1\0 ""FQ_951"; @@ -371,7 +372,7 @@ const mm_protocol_definition multi_protocols[] = { {PROTO_MOULDKG, STR_MOULDKG, STR_SUBTYPE_MOULKG, 2, OPTION_OPTION, 0, 0, SW_NRF, MOULDKG_init, MOULDKG_callback }, #endif #if defined(MT99XX_CCNRF_INO) - {PROTO_MT99XX, STR_MT99XX, STR_SUBTYPE_MT99, 7, OPTION_NONE, 0, 0, SW_NRF, MT99XX_init, MT99XX_callback }, + {PROTO_MT99XX, STR_MT99XX, STR_SUBTYPE_MT99, 8, OPTION_NONE, 0, 0, SW_NRF, MT99XX_init, MT99XX_callback }, #endif #if defined(NCC1701_NRF24L01_INO) {PROTO_NCC1701, STR_NCC1701, NO_SUBTYPE, 0, OPTION_NONE, 0, 0, SW_NRF, NCC_init, NCC_callback }, @@ -446,6 +447,9 @@ const mm_protocol_definition multi_protocols[] = { {PROTO_WFLY2, STR_WFLY2, STR_SUBTYPE_WFLY2, 1, OPTION_OPTION, 1, 0, SW_A7105, WFLY2_init, WFLY2_callback }, // {PROTO_WFLY2, STR_WFLY2, STR_SUBTYPE_WFLY2, 1, OPTION_WBUS, 1, 0, SW_A7105, WFLY2_init, WFLY2_callback },// crash OpenTX... #endif + #if defined(XERALL_NRF24L01_INO) + {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, 2, OPTION_RFTUNE, 0, 0, SW_NRF, XK_init, XK_callback }, #endif diff --git a/Multiprotocol/Multiprotocol.h b/Multiprotocol/Multiprotocol.h index 898ddb2..61bcc60 100644 --- a/Multiprotocol/Multiprotocol.h +++ b/Multiprotocol/Multiprotocol.h @@ -19,7 +19,7 @@ #define VERSION_MAJOR 1 #define VERSION_MINOR 3 #define VERSION_REVISION 2 -#define VERSION_PATCH_LEVEL 89 +#define VERSION_PATCH_LEVEL 91 #define MODE_SERIAL 0 @@ -117,6 +117,7 @@ enum PROTOCOLS PROTO_WILLIFM = 88, // 27/35ab/40/41/72 MHz module external project PROTO_LOSI = 89, // =>CYRF6936 PROTO_MOULDKG = 90, // =>NRF24L01 + PROTO_XERALL = 91, // =>NRF24L01 PROTO_NANORF = 126, // =>NRF24L01 PROTO_TEST = 127, // =>CC2500 @@ -230,6 +231,7 @@ enum MT99XX FY805 = 4, A180 = 5, DRAGON = 6, + F949G = 7, }; enum MJXQ { @@ -921,6 +923,7 @@ Serial: 100000 Baud 8e2 _ xxxx xxxx p -- E129 83 JOYSWAY 84 E016H 85 + XERALL 91 BindBit=> 0x80 1=Bind/0=No AutoBindBit=> 0x40 1=Yes /0=No RangeCheck=> 0x20 1=Yes /0=No diff --git a/Multiprotocol/Validate.h b/Multiprotocol/Validate.h index f98b903..2aa7c13 100644 --- a/Multiprotocol/Validate.h +++ b/Multiprotocol/Validate.h @@ -318,6 +318,7 @@ #undef TIGER_NRF24L01_INO #undef V2X2_NRF24L01_INO #undef V761_NRF24L01_INO + #undef XERALL_NRF24L01_INO #undef YD717_NRF24L01_INO #undef ZSX_NRF24L01_INO #endif diff --git a/Multiprotocol/_Config.h b/Multiprotocol/_Config.h index 3a93562..8bb25f9 100644 --- a/Multiprotocol/_Config.h +++ b/Multiprotocol/_Config.h @@ -248,6 +248,7 @@ #define TIGER_NRF24L01_INO #define V2X2_NRF24L01_INO #define V761_NRF24L01_INO +#define XERALL_NRF24L01_INO #define YD717_NRF24L01_INO #define ZSX_NRF24L01_INO @@ -742,6 +743,7 @@ const PPM_Parameters PPM_prot[14*NBR_BANKS]= { FY805 A180 DRAGON + F949G PROTO_NCC1701 NONE PROTO_OMP @@ -816,6 +818,8 @@ const PPM_Parameters PPM_prot[14*NBR_BANKS]= { W6_6_1 W6_HEL W6_HEL_I + PROTO_XERALL + NONE PROTO_XK X450 X420 diff --git a/Protocols_Details.md b/Protocols_Details.md index df98b56..92d43f2 100644 --- a/Protocols_Details.md +++ b/Protocols_Details.md @@ -1117,6 +1117,13 @@ A|E|T|R|MODE|RTH MODE: -100%=Beginner, 0%=Intermediate, +100%=Advanced +### Sub_protocol F949G - *7* +Model: F949G + +CH1|CH2|CH3|CH4|CH5|CH6 +---|---|---|---|---|--- +A|E|T|R|6G3D|Light + ## OMP - *77* Model: OMPHOBBY M1 & M2 Helis, T720 RC Glider