From 693f9f58eb7da3254fc86e93b112b51890ec9bc2 Mon Sep 17 00:00:00 2001 From: Pascal Langer Date: Sun, 16 Feb 2020 20:05:29 +0100 Subject: [PATCH] V911S: new sub protocol E119 Model: Eachine E119 Protocol: V911S -> 46 Sub protocol: E119 -> 1 CH5: left button ??? CH6: right button ??? --- Multiprotocol/Multi_Names.ino | 4 +- Multiprotocol/Multiprotocol.h | 5 +-- Multiprotocol/V911S_xn297l.ino | 57 ++++++++++++++++++---------- Multiprotocol/XN297Dump_nrf24l01.ino | 4 ++ Multiprotocol/XN297L_EMU.ino | 8 ++-- Multiprotocol/_Config.h | 3 +- Protocols_Details.md | 13 ++++++- 7 files changed, 61 insertions(+), 33 deletions(-) diff --git a/Multiprotocol/Multi_Names.ino b/Multiprotocol/Multi_Names.ino index f5e0fe9..35d67ae 100644 --- a/Multiprotocol/Multi_Names.ino +++ b/Multiprotocol/Multi_Names.ino @@ -117,7 +117,7 @@ const char STR_SUBTYPE_FLYZONE[] = "\x05""FZ410"; const char STR_SUBTYPE_FX816[] = "\x03""P38"; 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_V911S[] = "\x04""Std\0""E119"; +const char STR_SUBTYPE_V911S[] = "\x05""V911S""E119\0"; const char STR_SUBTYPE_XK[] = "\x04""X450""X420"; const char STR_SUBTYPE_FRSKYR9[] = "\x07""915MHz\0""868MHz\0""915 8ch""868 8ch"; @@ -274,7 +274,7 @@ const mm_protocol_definition multi_protocols[] = { {PROTO_E01X, STR_E01X, 3, STR_SUBTYPE_E01X, OPTION_OPTION }, #endif #if defined(V911S_NRF24L01_INO) - {PROTO_V911S, STR_V911S, 1, STR_SUBTYPE_V911S, OPTION_RFTUNE }, + {PROTO_V911S, STR_V911S, 2, STR_SUBTYPE_V911S, OPTION_RFTUNE }, #endif #if defined(GD00X_NRF24L01_INO) {PROTO_GD00X, STR_GD00X, 2, STR_SUBTYPE_GD00X, OPTION_RFTUNE }, diff --git a/Multiprotocol/Multiprotocol.h b/Multiprotocol/Multiprotocol.h index 6823672..443d53f 100644 --- a/Multiprotocol/Multiprotocol.h +++ b/Multiprotocol/Multiprotocol.h @@ -19,7 +19,7 @@ #define VERSION_MAJOR 1 #define VERSION_MINOR 3 #define VERSION_REVISION 0 -#define VERSION_PATCH_LEVEL 67 +#define VERSION_PATCH_LEVEL 68 //****************** // Protocols @@ -879,9 +879,6 @@ Serial: 100000 Baud 8e2 _ xxxx xxxx p -- sub_protocol==XK X450 0 X420 1 - sub_protocol==V911S - V911S_STD 0 - V911S_E119 1 sub_protocol==FRSKY_R9 R9_915 0 R9_868 1 diff --git a/Multiprotocol/V911S_xn297l.ino b/Multiprotocol/V911S_xn297l.ino index 664e240..08cf41e 100644 --- a/Multiprotocol/V911S_xn297l.ino +++ b/Multiprotocol/V911S_xn297l.ino @@ -30,6 +30,8 @@ // flags going to packet[1] #define V911S_FLAG_EXPERT 0x04 +#define E119_FLAG_1 0x08 +#define E119_FLAG_2 0x40 // flags going to packet[2] #define V911S_FLAG_CALIB 0x01 @@ -56,10 +58,21 @@ static void __attribute__((unused)) V911S_send_packet(uint8_t bind) } if(rf_ch_num&2) channel=7-channel; + XN297L_Hopping(channel); + hopping_frequency_no++; + hopping_frequency_no&=7; // 8 RF channels + packet[ 0]=(rf_ch_num<<3)|channel; - packet[ 1]=V911S_FLAG_EXPERT; // short press on left button - packet[ 2]=GET_FLAG(CH5_SW,V911S_FLAG_CALIB); // long press on right button - memset(packet+3, 0x00, V911S_PACKET_SIZE - 3); + memset(packet+1, 0x00, V911S_PACKET_SIZE - 1); + if(sub_protocol==V911S_STD) + { + packet[ 1]=V911S_FLAG_EXPERT; // short press on left button + packet[ 2]=GET_FLAG(CH5_SW,V911S_FLAG_CALIB); // long press on right button + } + else + packet[ 1]=GET_FLAG(CH5_SW,E119_FLAG_1) // short press on left button + |GET_FLAG(CH6_SW,E119_FLAG_2); // short press on right button + //packet[3..6]=trims TAER signed uint16_t ch=convert_channel_16b_limit(THROTTLE ,0,0x7FF); packet[ 7] = ch; @@ -68,25 +81,31 @@ static void __attribute__((unused)) V911S_send_packet(uint8_t bind) packet[ 8]|= ch<<3; packet[ 9] = ch>>5; ch=convert_channel_16b_limit(ELEVATOR,0,0x7FF); - packet[10] = ch; - packet[11] = ch>>8; - ch=convert_channel_16b_limit(RUDDER ,0x7FF,0); - packet[11]|= ch<<3; - packet[12] = ch>>5; + if(sub_protocol==V911S_STD) + { + packet[10] = ch; + packet[11] = ch>>8; + ch=convert_channel_16b_limit(RUDDER ,0x7FF,0); + packet[11]|= ch<<3; + packet[12] = ch>>5; + } + else + { + ch=0x7FF-ch; + packet[ 9]|= ch<<6; + packet[10] = ch>>2; + packet[11] = ch>>10; + ch=convert_channel_16b_limit(RUDDER ,0x7FF,0); + packet[11]|= ch<<1; + packet[12] = ch>>7; + } } - if (!bind) - { - XN297L_Hopping(channel); - hopping_frequency_no++; - hopping_frequency_no&=7; // 8 RF channels - } - if(sub_protocol==V911S_STD) XN297L_WritePayload(packet, V911S_PACKET_SIZE); else - XN297L_WriteEnhancedPayload(packet, V911S_PACKET_SIZE, bind); - + XN297L_WriteEnhancedPayload(packet, V911S_PACKET_SIZE, bind?0:1); + XN297L_SetPower(); // Set tx_power XN297L_SetFreqOffset(); // Set frequency offset } @@ -95,9 +114,9 @@ static void __attribute__((unused)) V911S_init() { XN297L_Init(); if(sub_protocol==V911S_STD) - XN297L_SetTXAddr((uint8_t *)"KNBND",5); // V911S Bind address + XN297L_SetTXAddr((uint8_t *)"KNBND",5); // V911S Bind address else - XN297L_SetTXAddr((uint8_t *)"XPBND",5); // E119 Bind address + XN297L_SetTXAddr((uint8_t *)"XPBND",5); // E119 Bind address XN297L_HoppingCalib(V911S_NUM_RF_CHANNELS); // Calibrate all channels XN297L_RFChannel(V911S_RF_BIND_CHANNEL); // Set bind channel } diff --git a/Multiprotocol/XN297Dump_nrf24l01.ino b/Multiprotocol/XN297Dump_nrf24l01.ino index 81aca45..b04c333 100644 --- a/Multiprotocol/XN297Dump_nrf24l01.ino +++ b/Multiprotocol/XN297Dump_nrf24l01.ino @@ -84,6 +84,10 @@ static boolean __attribute__((unused)) XN297Dump_process_packet(void) // init crc crc = 0xb5d2; + /*debug("P: 71 0F 55 "); + for(uint8_t i=0; i> 8) << 6) | ((crc & 0xff) >> 2); buf[last++] = (crc & 0xff) << 6; } - NRF24L01_WritePayload(packet, last); pid++; - if(pid>3) - pid=0; + pid &= 3; // stop TX/RX CC2500_Strobe(CC2500_SIDLE); @@ -262,7 +260,7 @@ static void __attribute__((unused)) XN297L_WriteEnhancedPayload(uint8_t* msg, ui // packet length CC2500_WriteReg(CC2500_3F_TXFIFO, last + 3); // xn297L preamble - CC2500_WriteRegisterMulti(CC2500_3F_TXFIFO, (uint8_t*)"\x71\x0f\x55", 3); + CC2500_WriteRegisterMulti(CC2500_3F_TXFIFO, (uint8_t*)"\x71\x0F\x55", 3); // xn297 packet CC2500_WriteRegisterMulti(CC2500_3F_TXFIFO, buf, last); // transmit diff --git a/Multiprotocol/_Config.h b/Multiprotocol/_Config.h index 5a907b4..5b4a89a 100644 --- a/Multiprotocol/_Config.h +++ b/Multiprotocol/_Config.h @@ -139,6 +139,7 @@ //If you have 2 Multi modules which you want to share the same ID so you can use either to control the same RC model // then you can force the ID to a certain known value using the lines below. //Default is commented, you should uncoment only for test purpose or if you know exactly what you are doing!!! +//The 8 numbers below can be anything between 0...9 and A..F //#define FORCE_GLOBAL_ID 0x12345678 //Protocols using the CYRF6936 (DSM, Devo, Walkera...) are using the CYRF ID instead which should prevent duplicated IDs. @@ -244,7 +245,7 @@ //Some models (X-Vert, Blade 230S...) require a special value to instant stop the motor(s). // You can disable this feature by adding "//" on the line below. You have to specify which channel (14 by default) will be used to kill the throttle channel. // If the channel 14 is above -50% the throttle is untouched but if it is between -50% and -100%, the throttle output will be forced between -100% and -150%. -// For example, a value of -80% applied on channel 15 will instantly kill the motors on the X-Vert. +// For example, a value of -80% applied on channel 14 will instantly kill the motors on the X-Vert. #define DSM_THROTTLE_KILL_CH 14 //AFHDS2A specific settings diff --git a/Protocols_Details.md b/Protocols_Details.md index 0960a5f..b710b28 100644 --- a/Protocols_Details.md +++ b/Protocols_Details.md @@ -123,7 +123,7 @@ CFlie|38|CFlie||||||||NRF24L01| [Traxxas](Protocols_Details.md#Traxxas---43)|43|RX6519||||||||CYRF6936| [V2x2](Protocols_Details.md#V2X2---5)|5|V2x2|JXD506|||||||NRF24L01| [V761](Protocols_Details.md#V761---48)|48|V761||||||||NRF24L01|XN297 -[V911S](Protocols_Details.md#V911S---46)|46|V911S*||||||||NRF24L01|XN297 +[V911S](Protocols_Details.md#V911S---46)|46|V911S*|E119*|||||||NRF24L01|XN297 [WFly](Protocols_Details.md#WFLY---40)|40|WFLY||||||||CYRF6936| [WK2x01](Protocols_Details.md#WK2X01---30)|30|WK2801|WK2401|W6_5_1|W6_6_1|W6_HEL|W6_HEL_I|||CYRF6936| [YD717](Protocols_Details.md#YD717---8)|8|YD717|SKYWLKR|SYMAX4|XINXUN|NIHUI||||NRF24L01| @@ -1306,16 +1306,25 @@ CH1|CH2|CH3|CH4|CH5 Gyro: -100%=Beginer mode (Gyro on, yaw and pitch rate limited), 0%=Mid Mode ( Gyro on no rate limits), +100%=Mode Expert Gyro off ## V911S - *46* -Models: WLtoys V911S, XK A110 This protocol is known to be problematic because it's using the xn297L emulation with a transmission speed of 250kbps therefore it doesn't work very well with every modules, this is an hardware issue with the accuracy of the components. If the model does not respond well to inputs or hard to bind, you can try to switch the emulation from the default NRF24L01 RF component to the CC2500 by using an option value (freq tuning) different from 0. Option in this case is used for fine frequency tuning like any CC2500 protocols so check the [Frequency Tuning page](/docs/Frequency_Tuning.md). +### Sub_protocol V911S - *0* +Models: WLtoys V911S, XK A110 + CH1|CH2|CH3|CH4|CH5 ---|---|---|---|--- A|E|T|R|CALIB +### Sub_protocol E119 - *1* +Models: Eachine E119 + +CH1|CH2|CH3|CH4|CH5|CH6 +---|---|---|---|---|--- +A|E|T|R|L_BUT|R_BUT + ## YD717 - *8* Autobind protocol