From ce67a065cd893a5c5447f9a4c83cc6277b0c6c1d Mon Sep 17 00:00:00 2001 From: Pascal Langer Date: Fri, 26 Jun 2020 17:54:56 +0200 Subject: [PATCH] V761 - Eachine sub protocol --- Multiprotocol/Multi_Names.ino | 7 ++++++- Multiprotocol/Multiprotocol.h | 12 +++++++++++- Multiprotocol/Multiprotocol.ino | 6 ++++++ Multiprotocol/V761_nrf24l01.ino | 32 ++++++++++++++++++++++++-------- Multiprotocol/_Config.h | 3 ++- Protocols_Details.md | 15 +++++++++++++-- 6 files changed, 62 insertions(+), 13 deletions(-) diff --git a/Multiprotocol/Multi_Names.ino b/Multiprotocol/Multi_Names.ino index c24a6dc..19cc5cd 100644 --- a/Multiprotocol/Multi_Names.ino +++ b/Multiprotocol/Multi_Names.ino @@ -87,6 +87,7 @@ const char STR_FRSKYR9[] ="FrSkyR9"; const char STR_PROPEL[] ="Propel"; const char STR_SKYARTEC[] ="Skyartc"; const char STR_TEST[] ="Test"; +const char STR_FAKE[] ="Fake"; const char STR_SUBTYPE_FLYSKY[] = "\x04""Std\0""V9x9""V6x6""V912""CX20"; const char STR_SUBTYPE_HUBSAN[] = "\x04""H107""H301""H501"; @@ -137,6 +138,7 @@ const char STR_SUBTYPE_FRSKYL[] = "\x08""LR12\0 ""LR12 6ch"; const char STR_SUBTYPE_WFLY[] = "\x06""WFR0xS"; const char STR_SUBTYPE_HOTT[] = "\x07""Sync\0 ""No_Sync"; const char STR_SUBTYPE_PELIKAN[] = "\x04""Pro\0""Lite"; +const char STR_SUBTYPE_V761[] = "\x07""Std\0 ""Eachine"; enum { @@ -346,7 +348,7 @@ const mm_protocol_definition multi_protocols[] = { {PROTO_V2X2, STR_V2X2, 3, STR_SUBTYPE_V2X2, OPTION_NONE }, #endif #if defined(V761_NRF24L01_INO) - {PROTO_V761, STR_V761, 0, NO_SUBTYPE, OPTION_NONE }, + {PROTO_V761, STR_V761, 2, STR_SUBTYPE_V761, OPTION_NONE }, #endif #if defined(V911S_NRF24L01_INO) {PROTO_V911S, STR_V911S, 2, STR_SUBTYPE_V911S, OPTION_RFTUNE }, @@ -371,6 +373,9 @@ const mm_protocol_definition multi_protocols[] = { #endif #if defined(TEST_CC2500_INO) {PROTO_TEST, STR_TEST, 0, NO_SUBTYPE, OPTION_RFTUNE }, + #endif + #if defined(FAKE_NRF24L01_INO) + {PROTO_FAKE, STR_FAKE, 0, NO_SUBTYPE, OPTION_NONE }, #endif {0x00, nullptr, 0, nullptr, 0 } }; diff --git a/Multiprotocol/Multiprotocol.h b/Multiprotocol/Multiprotocol.h index d6aa3f0..c651916 100644 --- a/Multiprotocol/Multiprotocol.h +++ b/Multiprotocol/Multiprotocol.h @@ -19,7 +19,7 @@ #define VERSION_MAJOR 1 #define VERSION_MINOR 3 #define VERSION_REVISION 1 -#define VERSION_PATCH_LEVEL 22 +#define VERSION_PATCH_LEVEL 23 //****************** // Protocols @@ -100,6 +100,7 @@ enum PROTOCOLS PROTO_JJRC345 = 71, // =>NRF24L01 PROTO_Q90C = 72, // =>NRF24L01 or CC2500 + PROTO_FAKE = 126, // =>CC2500+NRF24L01 PROTO_TEST = 127, // =>CC2500 }; @@ -374,6 +375,12 @@ enum PELIKAN PELIKAN_LITE= 1, }; +enum V761 +{ + V761_STD = 0, + V761_EACHINE= 1, +}; + #define NONE 0 #define P_HIGH 1 #define P_LOW 0 @@ -966,6 +973,9 @@ Serial: 100000 Baud 8e2 _ xxxx xxxx p -- sub_protocol==PELIKAN PELIKAN_PRO 0 PELIKAN_LITE 1 + sub_protocol==V761 + V761_STD 0 + V761_EACHINE 1 Power value => 0x80 0=High/1=Low Stream[3] = option_protocol; diff --git a/Multiprotocol/Multiprotocol.ino b/Multiprotocol/Multiprotocol.ino index 103e16e..7b75908 100644 --- a/Multiprotocol/Multiprotocol.ino +++ b/Multiprotocol/Multiprotocol.ino @@ -1579,6 +1579,12 @@ static void protocol_init() remote_callback = TEST_callback; break; #endif + #if defined(FAKE_NRF24L01_INO) + case PROTO_FAKE: + next_callback=initFAKE(); + remote_callback = FAKE_callback; + break; + #endif #endif #ifdef SX1276_INSTALLED #if defined(FRSKYR9_SX1276_INO) diff --git a/Multiprotocol/V761_nrf24l01.ino b/Multiprotocol/V761_nrf24l01.ino index 07bb675..6142341 100644 --- a/Multiprotocol/V761_nrf24l01.ino +++ b/Multiprotocol/V761_nrf24l01.ino @@ -66,23 +66,39 @@ static void __attribute__((unused)) V761_send_packet() } else { - packet[0] = convert_channel_8b(THROTTLE); // throttle - packet[1] = convert_channel_8b(RUDDER)>>1; // rudder - packet[2] = convert_channel_8b(ELEVATOR)>>1; // elevator - packet[3] = convert_channel_8b(AILERON)>>1; // aileron + packet[0] = convert_channel_8b(THROTTLE); // Throttle + packet[2] = convert_channel_8b(ELEVATOR)>>1; // Elevator + + if(sub_protocol==V761_STD) + { + packet[1] = convert_channel_8b(RUDDER)>>1; // Rudder + packet[3] = convert_channel_8b(AILERON)>>1; // Aileron + } + else + { + packet[1] = convert_channel_8b(AILERON)>>1; // Aileron + packet[3] = convert_channel_8b(RUDDER)>>1; // Rudder + } + packet[5] = (packet_count++ / 3)<<6; packet[4] = (packet[5] == 0x40) ? 0x1a : 0x20; // Channel 5 - Gyro mode is packet 5 - if(CH5_SW) // Mode Expert Gyro off + if(CH5_SW) // Mode Expert Gyro off flags = 0x0c; else if(Channel_data[CH5] < CHANNEL_MIN_COMMAND) - flags = 0x08; // Beginer mode (Gyro on, yaw and pitch rate limited) + flags = 0x08; // Beginer mode (Gyro on, yaw and pitch rate limited) else - flags = 0x0a; // Mid Mode ( Gyro on no rate limits) + flags = 0x0a; // Mid Mode ( Gyro on no rate limits) packet[5] |= flags; - packet[6] = 0x80; // unknown + if(sub_protocol==V761_STD) + packet[6] = 0x80; // unknown + else + { + packet[6] = GET_FLAG(CH5_SW, 0x20); // Flip + // RTH??? + } //packet counter if(packet_count >= 12) diff --git a/Multiprotocol/_Config.h b/Multiprotocol/_Config.h index 12fb400..2209b62 100644 --- a/Multiprotocol/_Config.h +++ b/Multiprotocol/_Config.h @@ -715,7 +715,8 @@ const PPM_Parameters PPM_prot[14*NBR_BANKS]= { JXD506 V2X2_MR101 PROTO_V761 - NONE + V761_STD + V761_EACHINE PROTO_V911S V911S_STD V911S_E119 diff --git a/Protocols_Details.md b/Protocols_Details.md index b191fdb..902d6c5 100644 --- a/Protocols_Details.md +++ b/Protocols_Details.md @@ -1463,9 +1463,11 @@ CH1|CH2|CH3|CH4|CH5|CH6 A|E|T|R|FLIP|LIGHT ## V761 - *48* -Model: Volantex V761 and may be other -Warning: Only 3 IDs, you can cycle through them using RX_Num. +Warning: **Only 3 IDs**, you can cycle through them using RX_Num. + +### Sub_protocol Std - *0* +Model: Volantex V761 and may be other CH1|CH2|CH3|CH4|CH5 ---|---|---|---|--- @@ -1473,6 +1475,15 @@ 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 +### Sub_protocol Eachine - *1* +Model: Eachine P51-D, F4U, F22 and may be other + +CH1|CH2|CH3|CH4|CH5|CH6 +---|---|---|---|---|--- +A|E|T|R|GYRO|FLIP + +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* 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.