From 69519bdf147242c4dacd0e1c20e360d666642807 Mon Sep 17 00:00:00 2001 From: Goebish Date: Thu, 28 Nov 2019 20:02:59 +0100 Subject: [PATCH] Add skeleton for Bayang RX protocol --- Multiprotocol/Bayang_Rx_nrf24l01.ino | 34 ++++++++++++++++++++++++++++ Multiprotocol/Multi_Names.ino | 4 ++++ Multiprotocol/Multiprotocol.h | 5 +++- Multiprotocol/Multiprotocol.ino | 6 +++++ Multiprotocol/Telemetry.ino | 6 ++--- Multiprotocol/Validate.h | 9 +++++++- Multiprotocol/_Config.h | 4 ++++ 7 files changed, 63 insertions(+), 5 deletions(-) create mode 100644 Multiprotocol/Bayang_Rx_nrf24l01.ino diff --git a/Multiprotocol/Bayang_Rx_nrf24l01.ino b/Multiprotocol/Bayang_Rx_nrf24l01.ino new file mode 100644 index 0000000..759100e --- /dev/null +++ b/Multiprotocol/Bayang_Rx_nrf24l01.ino @@ -0,0 +1,34 @@ +/* + 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 EAchine H8 mini, H10, BayangToys X6/X7/X9, JJRC JJ850 ... + // Last sync with hexfet new_protocols/bayang_nrf24l01.c dated 2015-12-22 + +#if defined(BAYANG_NRF24L01_INO) + +#include "iface_nrf24l01.h" + +uint16_t Bayang_Rx_callback() +{ + return 1000; +} + +uint16_t initBayang_Rx() +{ + return 1000; +} + + +#endif + diff --git a/Multiprotocol/Multi_Names.ino b/Multiprotocol/Multi_Names.ino index c9ffe7a..802eea2 100644 --- a/Multiprotocol/Multi_Names.ino +++ b/Multiprotocol/Multi_Names.ino @@ -72,6 +72,7 @@ const char STR_FRSKY_RX[] ="FrSkyRX"; const char STR_AFHDS2A_RX[] ="FS2A_RX"; const char STR_HOTT[] ="HoTT"; const char STR_FX816[] ="FX816"; +const char STR_BAYANG_RX[] ="BayanRX"; const char STR_XN297DUMP[] ="XN297DP"; const char STR_SUBTYPE_FLYSKY[] = "\x04""Std\0""V9x9""V6x6""V912""CX20"; @@ -300,6 +301,9 @@ const mm_protocol_definition multi_protocols[] = { #if defined(FX816_NRF24L01_INO) {PROTO_FX816, STR_FX816, 1, STR_SUBTYPE_FX816, OPTION_NONE }, #endif +#if defined(BAYANG_RX_NRF24L01_INO) + {PROTO_BAYANG_RX, STR_BAYANG_RX, 0, NO_SUBTYPE, OPTION_NONE }, +#endif #if defined(XN297DUMP_NRF24L01_INO) {PROTO_XN297DUMP, STR_XN297DUMP, 3, STR_SUBTYPE_XN297DUMP, OPTION_RFCHAN }, #endif diff --git a/Multiprotocol/Multiprotocol.h b/Multiprotocol/Multiprotocol.h index d246b7a..92182cd 100644 --- a/Multiprotocol/Multiprotocol.h +++ b/Multiprotocol/Multiprotocol.h @@ -85,6 +85,7 @@ enum PROTOCOLS PROTO_AFHDS2A_RX= 56, // =>A7105 PROTO_HOTT = 57, // =>CC2500 PROTO_FX816 = 58, // =>NRF24L01 + PROTO_BAYANG_RX = 59, // =>NRF24L01 PROTO_XN297DUMP = 63, // =>NRF24L01 }; @@ -601,7 +602,8 @@ enum { #define AFHDS2A_RX_EEPROM_OFFSET 230 // (4) TX ID + (16) channels, 20 bytes, end is 230+20=250 #define AFHDS2A_EEPROM_OFFSET2 250 // RX ID, 4 bytes per model id, end is 250+192=442 #define HOTT_EEPROM_OFFSET 442 // RX ID, 5 bytes per model id, end is 320+442=762 -//#define CONFIG_EEPROM_OFFSET 762 // Current configuration of the multimodule +#define BAYANG_RX_EEPROM_OFFSET 762 // (5) TX ID + (4) channels + (1) extra AUX, 10 bytes, end is 772 +//#define CONFIG_EEPROM_OFFSET 772 // Current configuration of the multimodule //**************************************** //*** MULTI protocol serial definition *** @@ -678,6 +680,7 @@ Serial: 100000 Baud 8e2 _ xxxx xxxx p -- AFHDS2A_RX 56 HOTT 57 FX816 58 + BAYANG_RX 59 BindBit=> 0x80 1=Bind/0=No AutoBindBit=> 0x40 1=Yes /0=No RangeCheck=> 0x20 1=Yes /0=No diff --git a/Multiprotocol/Multiprotocol.ino b/Multiprotocol/Multiprotocol.ino index e9ba01c..b58eb97 100644 --- a/Multiprotocol/Multiprotocol.ino +++ b/Multiprotocol/Multiprotocol.ino @@ -1421,6 +1421,12 @@ static void protocol_init() remote_callback = FX816_callback; break; #endif + #if defined(BAYANG_RX_NRF24L01_INO) + case PROTO_BAYANG_RX: + next_callback=initBayang_Rx(); + remote_callback = Bayang_Rx_callback; + break; + #endif #if defined(XN297DUMP_NRF24L01_INO) case PROTO_XN297DUMP: next_callback=initXN297Dump(); diff --git a/Multiprotocol/Telemetry.ino b/Multiprotocol/Telemetry.ino index 1eb60bd..cb6fc7a 100644 --- a/Multiprotocol/Telemetry.ino +++ b/Multiprotocol/Telemetry.ino @@ -258,7 +258,7 @@ static void multi_send_status() } #endif -#if defined (FRSKY_RX_TELEMETRY) || defined (AFHDS2A_RX_TELEMETRY) +#if defined (FRSKY_RX_TELEMETRY) || defined (AFHDS2A_RX_TELEMETRY) || defined (BAYANG_RX_TELEMETRY) void receiver_channels_frame() { uint16_t len = packet_in[3] * 11; // 11 bit per channel @@ -930,8 +930,8 @@ void TelemetryUpdate() } #endif - #if defined (FRSKY_RX_TELEMETRY) || defined(AFHDS2A_RX_TELEMETRY) - if (telemetry_link && (protocol == PROTO_FRSKY_RX || protocol == PROTO_AFHDS2A_RX)) + #if defined (FRSKY_RX_TELEMETRY) || defined(AFHDS2A_RX_TELEMETRY) || defined (BAYANG_RX_TELEMETRY) + if (telemetry_link && (protocol == PROTO_FRSKY_RX || protocol == PROTO_AFHDS2A_RX || protocol == PROTO_BAYANG_RX)) { receiver_channels_frame(); telemetry_link = 0; diff --git a/Multiprotocol/Validate.h b/Multiprotocol/Validate.h index 01be5fe..611672d 100644 --- a/Multiprotocol/Validate.h +++ b/Multiprotocol/Validate.h @@ -239,6 +239,7 @@ #undef XN297L_CC2500_EMU #undef POTENSIC_NRF24L01_INO #undef ZSX_NRF24L01_INO + #undef BAYANG_RX_NRF24L01_INO #endif //Make sure telemetry is selected correctly @@ -266,6 +267,8 @@ #undef AFHDS2A_RX_TELEMETRY #undef AFHDS2A_RX_A7105_INO #undef HOTT_FW_TELEMETRY + #undef BAYANG_RX_TELEMETRY + #undef BAYANG_RX_NRF24L01_INO #else #if defined(MULTI_TELEMETRY) && defined(MULTI_STATUS) #error You should choose either MULTI_TELEMETRY or MULTI_STATUS but not both. @@ -282,6 +285,10 @@ #undef AFHDS2A_RX_TELEMETRY #undef AFHDS2A_RX_A7105_INO #endif + #if not defined(BAYANG_RX_NRF24L01_INO) || not defined(BAYANG_RX_TELEMETRY) + #undef BAYANG_RX_TELEMETRY + #undef BAYANG_RX_NRF24L01_INO + #endif #if not defined(BAYANG_NRF24L01_INO) #undef BAYANG_HUB_TELEMETRY #endif @@ -321,7 +328,7 @@ #if not defined(HOTT_CC2500_INO) #undef HOTT_FW_TELEMETRY #endif - #if not defined(HOTT_FW_TELEMETRY) && not defined(DSM_TELEMETRY) && not defined(SPORT_TELEMETRY) && not defined(HUB_TELEMETRY) && not defined(HUBSAN_HUB_TELEMETRY) && not defined(BUGS_HUB_TELEMETRY) && not defined(NCC1701_HUB_TELEMETRY) && not defined(BAYANG_HUB_TELEMETRY) && not defined(CABELL_HUB_TELEMETRY) && not defined(AFHDS2A_HUB_TELEMETRY) && not defined(AFHDS2A_FW_TELEMETRY) && not defined(MULTI_TELEMETRY) && not defined(MULTI_STATUS) && not defined(HITEC_HUB_TELEMETRY) && not defined(HITEC_FW_TELEMETRY) && not defined(SCANNER_TELEMETRY) && not defined(FRSKY_RX_TELEMETRY) && not defined(AFHDS2A_RX_TELEMETRY) + #if not defined(HOTT_FW_TELEMETRY) && not defined(DSM_TELEMETRY) && not defined(SPORT_TELEMETRY) && not defined(HUB_TELEMETRY) && not defined(HUBSAN_HUB_TELEMETRY) && not defined(BUGS_HUB_TELEMETRY) && not defined(NCC1701_HUB_TELEMETRY) && not defined(BAYANG_HUB_TELEMETRY) && not defined(CABELL_HUB_TELEMETRY) && not defined(AFHDS2A_HUB_TELEMETRY) && not defined(AFHDS2A_FW_TELEMETRY) && not defined(MULTI_TELEMETRY) && not defined(MULTI_STATUS) && not defined(HITEC_HUB_TELEMETRY) && not defined(HITEC_FW_TELEMETRY) && not defined(SCANNER_TELEMETRY) && not defined(FRSKY_RX_TELEMETRY) && not defined(AFHDS2A_RX_TELEMETRY) && not defined(BAYANG_RX_TELEMETRY) #undef TELEMETRY #undef INVERT_TELEMETRY #undef MULTI_TELEMETRY diff --git a/Multiprotocol/_Config.h b/Multiprotocol/_Config.h index 1d90cd3..717e5be 100644 --- a/Multiprotocol/_Config.h +++ b/Multiprotocol/_Config.h @@ -187,6 +187,7 @@ //The protocols below need a NRF24L01 to be installed #define ASSAN_NRF24L01_INO #define BAYANG_NRF24L01_INO +#define BAYANG_RX_NRF24L01_INO #define BUGSMINI_NRF24L01_INO #define CABELL_NRF24L01_INO #define CFLIE_NRF24L01_INO @@ -304,6 +305,7 @@ #define FRSKY_RX_TELEMETRY // Forward channels data to TX #define AFHDS2A_RX_TELEMETRY // Forward channels data to TX #define HOTT_FW_TELEMETRY // Forward received telemetry packets to be decoded by erskyTX and OpenTX +#define BAYANG_RX_TELEMETRY // Forward channels data to TX /****************************/ /*** SERIAL MODE SETTINGS ***/ @@ -501,6 +503,8 @@ const PPM_Parameters PPM_prot[14*NBR_BANKS]= { X16_AH IRDRONE DHD_D4 + PROTO_BAYANG_RX + NONE PROTO_BUGS NONE PROTO_BUGSMINI