From 8d96066215b72c9b79251cca9907a7d98246b2ae Mon Sep 17 00:00:00 2001 From: pascallanger Date: Wed, 21 Feb 2024 11:38:31 +0100 Subject: [PATCH] Merge XK and Tiger protocols --- Lua_scripts/MultiChan.txt | 5 +- Multiprotocol/Multi.txt | 1 - Multiprotocol/Multi_Protos.ino | 4 - Multiprotocol/Multiprotocol.h | 4 +- Multiprotocol/Tiger_nrf24l01.ino | 163 ------------------------------- Multiprotocol/XK_ccnrf.ino | 12 ++- Multiprotocol/_Config.h | 3 - Protocols_Details.md | 41 ++++---- 8 files changed, 31 insertions(+), 202 deletions(-) delete mode 100644 Multiprotocol/Tiger_nrf24l01.ino diff --git a/Lua_scripts/MultiChan.txt b/Lua_scripts/MultiChan.txt index ed15054..fc33678 100644 --- a/Lua_scripts/MultiChan.txt +++ b/Lua_scripts/MultiChan.txt @@ -170,7 +170,6 @@ 11,4,SLT,MR100,0,Rates,n-a,CH7,CH8,Mode,Flip,Video,Pict 10,0,Symax,Std,1,Flip,Rates,Pict,Video,HLess 10,1,Symax,X5C,1,Flip,Rates,Pict,Video,HLess -61,0,Tiger,Std,1,Flip,Light 43,0,Traxxas,6519,0 5,0,V2x2,Std,1,Flip,Light,Pict,Video,HLess,CalX,CalY 5,1,V2x2,JXD506,1,Flip,Light,Pict,Video,HLess,StaSto,Emerg,Cam_UD @@ -187,8 +186,8 @@ 30,4,WK2x01,W6HEL,0,Gear,Col,Gyro 30,5,WK2x01,W6HEL_I,0,Gear,Col,Gyro 62,0,XK,X450,1,FMode,TakeOf,Emerg,3D_6G,Pict,Video -62,1,XK,X420,1,FMode,TakeOf,Emerg,3D_6G,Pict,Video -62,2,XK,Cars,0,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 8,0,YD717,Std,1,Flip,Light,Pict,Video,HLess 8,1,YD717,SkyWlkr,1,Flip,Light,Pict,Video,HLess 8,2,YD717,Simax4,1,Flip,Light,Pict,Video,HLess diff --git a/Multiprotocol/Multi.txt b/Multiprotocol/Multi.txt index ba78de7..a49f205 100644 --- a/Multiprotocol/Multi.txt +++ b/Multiprotocol/Multi.txt @@ -58,7 +58,6 @@ 58,FX,816,620,9630 59,Bayang_RX,Multi,CPPM 60,Pelikan,Pro,Lite,SCX24 -61,Tiger 62,XK,X450,X420,Cars 63,XN_DUMP,250K,1M,2M,AUTO 64,FrskyX2,CH_16,CH_8,EU_16,EU_8,Cloned diff --git a/Multiprotocol/Multi_Protos.ino b/Multiprotocol/Multi_Protos.ino index a8a13df..2f29992 100644 --- a/Multiprotocol/Multi_Protos.ino +++ b/Multiprotocol/Multi_Protos.ino @@ -81,7 +81,6 @@ const char STR_HOTT[] ="HoTT"; const char STR_FX[] ="FX"; const char STR_BAYANG_RX[] ="BayanRX"; const char STR_PELIKAN[] ="Pelikan"; -const char STR_TIGER[] ="Tiger"; const char STR_XK[] ="XK"; const char STR_XN297DUMP[] ="XN297DP"; const char STR_FRSKYR9[] ="FrSkyR9"; @@ -460,9 +459,6 @@ const mm_protocol_definition multi_protocols[] = { #if defined(SYMAX_NRF24L01_INO) {PROTO_SYMAX, STR_SYMAX, STR_SUBTYPE_SYMAX, 2, OPTION_NONE, 0, 0, SW_NRF, SYMAX_init, SYMAX_callback }, #endif - #if defined(TIGER_NRF24L01_INO) - {PROTO_TIGER, STR_TIGER, NO_SUBTYPE, 0, OPTION_NONE, 0, 0, SW_NRF, TIGER_init, TIGER_callback }, - #endif #if defined(TRAXXAS_CYRF6936_INO) {PROTO_TRAXXAS, STR_TRAXXAS, STR_SUBTYPE_TRAXXAS, 1, OPTION_NONE, 0, 0, SW_CYRF, TRAXXAS_init, TRAXXAS_callback }, #endif diff --git a/Multiprotocol/Multiprotocol.h b/Multiprotocol/Multiprotocol.h index 711d04e..35d902e 100644 --- a/Multiprotocol/Multiprotocol.h +++ b/Multiprotocol/Multiprotocol.h @@ -19,7 +19,7 @@ #define VERSION_MAJOR 1 #define VERSION_MINOR 3 #define VERSION_REVISION 3 -#define VERSION_PATCH_LEVEL 48 +#define VERSION_PATCH_LEVEL 49 #define MODE_SERIAL 0 @@ -89,7 +89,6 @@ enum PROTOCOLS PROTO_FX = 58, // =>NRF24L01 PROTO_BAYANG_RX = 59, // =>NRF24L01 PROTO_PELIKAN = 60, // =>A7105 - PROTO_TIGER = 61, // =>NRF24L01 PROTO_XK = 62, // =>NRF24L01 PROTO_XN297DUMP = 63, // =>NRF24L01 PROTO_FRSKYX2 = 64, // =>CC2500 @@ -926,7 +925,6 @@ Serial: 100000 Baud 8e2 _ xxxx xxxx p -- FX 58 BAYANG_RX 59 PELIKAN 60 - TIGER 61 XK 62 XN297DUMP 63 FRSKYX2 64 diff --git a/Multiprotocol/Tiger_nrf24l01.ino b/Multiprotocol/Tiger_nrf24l01.ino deleted file mode 100644 index ed69332..0000000 --- a/Multiprotocol/Tiger_nrf24l01.ino +++ /dev/null @@ -1,163 +0,0 @@ -/* - This project is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - -Multiprotocol is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with Multiprotocol. If not, see . - */ -// Compatible with Tiger Drone 1400782. - -#if defined(TIGER_NRF24L01_INO) - -#include "iface_xn297.h" - -#define TIGER_FORCE_ID - -#define TIGER_INITIAL_WAIT 500 -#define TIGER_PACKET_PERIOD 3940 -#define TIGER_RF_NUM_CHANNELS 4 -#define TIGER_BIND_RF_NUM_CHANNELS 8 -#define TIGER_PAYLOAD_SIZE 16 -#define TIGER_BIND_COUNT 761 //3sec - - -static uint8_t __attribute__((unused)) TIGER_convert_channel(uint8_t num) -{ - uint8_t val=convert_channel_8b(num); - // 7F..01=left, 00=center, 80..FF=right - if(val==0x80) - val=0; // 0 - else - if(val>0x80) - val--; // 80..FE - else - { - val=0x80-val; // 80..01 - if(val==0x80) - val--; // 7F..01 - } - return val; -} - -static void __attribute__((unused)) TIGER_send_packet() -{ - if(IS_BIND_DONE) - { - //Channels - packet[0]=convert_channel_8b(THROTTLE); // 00..FF - packet[1]=TIGER_convert_channel(RUDDER); // 7F..01=left, 00=center, 80..FF=right - packet[2]=TIGER_convert_channel(ELEVATOR); // 7F..01=down, 00=center, 80..FF=up - packet[3]=TIGER_convert_channel(AILERON); // 7F..01=left, 00=center, 80..FF=right - //Flags - packet[14]= GET_FLAG(CH5_SW, 0x04) //FLIP - | GET_FLAG(CH6_SW, 0x10); //LIGHT - } - //Check - crc8=0; - for(uint8_t i=0;i>1); - hopping_frequency_no++; - if(IS_BIND_IN_PROGRESS) - { - if(hopping_frequency_no>=2*TIGER_BIND_RF_NUM_CHANNELS) - hopping_frequency_no=0; - } - else - { - if(hopping_frequency_no>=2*(TIGER_BIND_RF_NUM_CHANNELS+TIGER_RF_NUM_CHANNELS)) - hopping_frequency_no=2*TIGER_BIND_RF_NUM_CHANNELS; - } - - //Send - XN297_SetPower(); - XN297_SetTxRxMode(TX_EN); - XN297_WritePayload(packet, TIGER_PAYLOAD_SIZE); -} - -static void __attribute__((unused)) TIGER_RF_init() -{ - XN297_Configure(XN297_CRCEN, XN297_SCRAMBLED, XN297_1M); - XN297_SetTXAddr((uint8_t *)"\x68\x94\xA6\xD5\xC3", 5); -} - -static void __attribute__((unused)) TIGER_initialize_txid() -{ -#ifdef TIGER_FORCE_ID - rx_tx_addr[0]=0x64; - rx_tx_addr[1]=0x39; - rx_tx_addr[2]=0x12; - rx_tx_addr[3]=0x00; - rx_tx_addr[4]=0x00; - memcpy(hopping_frequency,"\x0E\x39\x1C\x07\x24\x3E\x2B\x47",TIGER_BIND_RF_NUM_CHANNELS); - memcpy(&hopping_frequency[TIGER_BIND_RF_NUM_CHANNELS],"\x36\x41\x37\x4E",TIGER_RF_NUM_CHANNELS); -#endif - //prepare bind packet - memset(&packet[0], 0x00, 4); - memset(&packet[4], 0x40, 10); - memcpy(&packet[7], rx_tx_addr, 5); - packet[14]=0xC0; -} - -uint16_t TIGER_callback() -{ - #ifdef MULTI_SYNC - telemetry_set_input_sync(TIGER_PACKET_PERIOD); - #endif - if(bind_counter) - if(--bind_counter==0) - { - BIND_DONE; - XN297_SetTXAddr((uint8_t *)"\x49\xA6\x83\xEB\x4B", 5); - } - TIGER_send_packet(); - return TIGER_PACKET_PERIOD; -} - -void TIGER_init() -{ - BIND_IN_PROGRESS; // autobind protocol - TIGER_initialize_txid(); - TIGER_RF_init(); - hopping_frequency_no = 0; - bind_counter=TIGER_BIND_COUNT; -} - -#endif -/*Bind -- RF setup: 1Mbps, scrambled, CRC -- TX addr: 0x68 0x94 0xA6 0xD5 0xC3 -- 8 RF channels: 0x0E 0x39 0x1C 0x07 0x24 0x3E 0x2B 0x47 -- 2 packets per RF channel, 3940µs between packets -- payload 16 bytes: 0x00 0x00 0x00 0x00 0x40 0x40 0x40 0x64 0x39 0x12 0x00 0x00 0x40 0x40 0xC0 0xAF -- payload[15]=sum of payload[0..14] -- the only difference with normal packets is the payload[14]=0xC0 -- ??? payload[7..11] TX ID ??? - -Normal -- RF setup: 1Mbps -- TX addr: 0x49 0xA6 0x83 0xEB 0x4B -- 4 RF channels: 0x36 0x41 0x37 0x4E -- 2 packets per RF channel, 3940µs between packets -- payload 16 bytes: 0x00 0x00 0x00 0x00 0x40 0x40 0x40 0x64 0x39 0x12 0x00 0x00 0x40 0x40 0x00 0xEF -- payload[15]=sum of payload[0..14] -- throttle is on payload[0] 00..FF -- rudder is on payload[1] 00=center, 80..FF=right, 01..7F=left -- elevator is on payload[2] 00=center, 80..FF=up, 01..7F=down -- aileron is on payload[3] 00=center, 80..FF=right, 01..7F=left -- trims payload[4..6] -- ??? payload[7..11] TX ID ??? -- ??? payload[12..13] ??? -- flip is on payload[14] and flag 0x04 -- light is on payload[14] and flag 0x10 -*/ \ No newline at end of file diff --git a/Multiprotocol/XK_ccnrf.ino b/Multiprotocol/XK_ccnrf.ino index e369d99..0286a8e 100644 --- a/Multiprotocol/XK_ccnrf.ino +++ b/Multiprotocol/XK_ccnrf.ino @@ -96,12 +96,14 @@ static void __attribute__((unused)) XK_send_packet() packet[10] = 0x04; // 6G-Mode //0x00 default M-Mode - packet[10] |= GET_FLAG(CH7_SW,0x80); // Emergency stop momentary switch + packet[10] |= GET_FLAG(CH7_SW ,0x80); // Emergency stop momentary switch - packet[11] = GET_FLAG(CH8_SW,0x03) // 3D/6G momentary switch - |GET_FLAG(CH6_SW,0x40); // Take off momentary switch - packet[14] = GET_FLAG(CH9_SW,0x01) // Photo momentary switch - |GET_FLAG(CH10_SW,0x2); // Video momentary switch + packet[11] = GET_FLAG(CH8_SW ,0x03) // 3D/6G momentary switch + |GET_FLAG(CH6_SW ,0x40); // Take off momentary switch + packet[14] = GET_FLAG(CH9_SW ,0x01) // Photo momentary switch + |GET_FLAG(CH10_SW,0x02) // Video momentary switch + |GET_FLAG(CH11_SW,0x04) // Flip + |GET_FLAG(CH12_SW,0x10); // Light //debugln("P1:%02X,P12:%02X",packet[1],packet[12]); } diff --git a/Multiprotocol/_Config.h b/Multiprotocol/_Config.h index b36876e..e6394bc 100644 --- a/Multiprotocol/_Config.h +++ b/Multiprotocol/_Config.h @@ -248,7 +248,6 @@ #define SGF22_NRF24L01_INO #define SHENQI_NRF24L01_INO #define SYMAX_NRF24L01_INO -#define TIGER_NRF24L01_INO #define V2X2_NRF24L01_INO #define V761_NRF24L01_INO #define XERALL_NRF24L01_INO @@ -816,8 +815,6 @@ const PPM_Parameters PPM_prot[14*NBR_BANKS]= { PROTO_SYMAX SYMAX SYMAX5C - PROTO_TIGER - NONE PROTO_TRAXXAS RX6519 PROTO_V2X2 diff --git a/Protocols_Details.md b/Protocols_Details.md index ea51470..1aa1ef5 100644 --- a/Protocols_Details.md +++ b/Protocols_Details.md @@ -141,7 +141,6 @@ CFlie|38|CFlie||||||||NRF24L01| [Skyartec](Protocols_Details.md#Skyartec---68)|68|||||||||CC2500|CC2500 [SLT](Protocols_Details.md#SLT---11)|11|SLT_V1|SLT_V2|Q100|Q200|MR100||||NRF24L01|CC2500 [SymaX](Protocols_Details.md#Symax---10)|10|SYMAX|SYMAX5C|||||||NRF24L01| -[Tiger](Protocols_Details.md#Tiger---61)|61|||||||||NRF24L01|XN297 [Traxxas](Protocols_Details.md#Traxxas---43)|43|6519 RX||||||||CYRF6936| [V2x2](Protocols_Details.md#V2X2---5)|5|V2x2|JXD506|MR101||||||NRF24L01| [V761](Protocols_Details.md#V761---48)|48|3CH|4CH|TOPRC||||||NRF24L01|XN297 @@ -1412,12 +1411,6 @@ A280 -> 6GSENIOR: -100% - 6G, +100% - Senior mode (turn off gyro), LIGHT: cycle ## XK - *62* -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. - CC2500: only X450 is supported. ### Sub_protocol X450 - *0* @@ -1427,11 +1420,30 @@ If a CC2500 is installed it will be used for this sub protocol. Option in this c 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|Take_off|Emerg stop|3D/6G|Picture|Video + +Flight_modes: -100%=M-Mode, 0%=6G-Mode, +100%=V-Mode. CH6-CH10 are mementary switches. + ### Sub_protocol X420 - *1* -Models: XK X420/X520 (TX=X4), WLtoys 284131/284161/284010 +Models: XK X420/X520 (TX=X4) + +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. + +Model: Tiger Drone 1400782 + +CH1|CH2|CH3|CH4|CH11|CH12 +---|---|---|---|---|--- +A|E|T|R|FLIP|LIGHT ### Sub_protocol Cars - *2* -Models: WLtoys cars 284131/284161/284010/... +Models: WLtoys cars 284131/284161/284010/124016/124017/144010 and Eachine EAT14 + *** # NRF24L01 RF Module @@ -2020,17 +2032,6 @@ AUTO: Land=-100% Takeoff=+100% The model can work with a none centered throttle. -## Tiger - *61* -Models: Tiger Drone 1400782, WLToys 124016 / 124017 / 144010 and Eachine EAT14 - -Autobind protocol - -**Only 1 ID** - -CH1|CH2|CH3|CH4|CH5|CH6 ----|---|---|---|---|--- -A|E|T|R|FLIP|LIGHT - ## V761 - *48* Gyro: -100%=Beginner mode (Gyro on, yaw and pitch rate limited), 0%=Mid Mode ( Gyro on no rate limits), +100%=Mode Expert Gyro off