From ab5f75b1b3101ba97a6f4abfd2c3a11bc37320f6 Mon Sep 17 00:00:00 2001 From: pascallanger Date: Thu, 9 Nov 2023 18:02:21 +0100 Subject: [PATCH] BlueFly: New protocol --- Multiprotocol/Bluefly_ccnrf.ino | 118 ++++++++++++++++++++++++++++++++ Multiprotocol/Multi.txt | 1 + Multiprotocol/Multi_Protos.ino | 4 ++ Multiprotocol/Multiprotocol.h | 4 +- Multiprotocol/Validate.h | 1 + Multiprotocol/_Config.h | 3 + Protocols_Details.md | 12 ++++ 7 files changed, 142 insertions(+), 1 deletion(-) create mode 100644 Multiprotocol/Bluefly_ccnrf.ino diff --git a/Multiprotocol/Bluefly_ccnrf.ino b/Multiprotocol/Bluefly_ccnrf.ino new file mode 100644 index 000000000..cd97b7390 --- /dev/null +++ b/Multiprotocol/Bluefly_ccnrf.ino @@ -0,0 +1,118 @@ +/* + 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 BLUEFLY HP100 + +#if defined(BLUEFLY_CCNRF_INO) + +#include "iface_nrf250k.h" + +#define BLUEFLY_PACKET_PERIOD 7000 +#define BLUEFLY_PACKET_SIZE 12 +#define BLUEFLY_RF_BIND_CHANNEL 81 +#define BLUEFLY_NUM_RF_CHANNELS 15 +#define BLUEFLY_BIND_COUNT 800 +#define BLUEFLY_TXID_SIZE 5 + +static void __attribute__((unused)) BLUEFLY_send_packet() +{ + if(IS_BIND_IN_PROGRESS) + { + memset(packet, 0x55, BLUEFLY_PACKET_SIZE); + memcpy(packet, rx_tx_addr, BLUEFLY_TXID_SIZE); + packet[5] = hopping_frequency[0]; + } + else + { + NRF250K_Hopping(hopping_frequency_no); + hopping_frequency_no++; + if(hopping_frequency_no >= BLUEFLY_NUM_RF_CHANNELS); + hopping_frequency_no = 0; + + packet[8] = packet[9] = 0; + for(uint8_t i=0; i<8 ; i++) + { + uint16_t ch = convert_channel_16b_limit(CH_AETR[i], 0, 1000); + packet[ i] = ch; + ch &= 0x300; + ch >>= 2; + packet[8 + (i>3?0:1)] = (packet[8 + (i>3?0:1)] >> 2) | ch; + } + uint8_t l, h, t; + l = h = 0xff; + for (uint8_t i=0; i<10; ++i) + { + h ^= packet[i]; + h ^= h >> 4; + t = h; + h = l; + l = t; + t = (l<<4) | (l>>4); + h ^= ((t<<2) | (t>>6)) & 0x1f; + h ^= t & 0xf0; + l ^= ((t<<1) | (t>>7)) & 0xe0; + } + // Checksum + packet[10] = h; + packet[11] = l; + } + + NRF250K_WritePayload(packet, BLUEFLY_PACKET_SIZE); + NRF250K_SetPower(); // Set tx_power + NRF250K_SetFreqOffset(); // Set frequency offset +} + +static void __attribute__((unused)) BLUEFLY_RF_init() +{ + NRF250K_Init(); + NRF250K_SetTXAddr((uint8_t *)"\x32\xAA\x45\x45\x78", 5); // BLUEFLY Bind address + NRF250K_HoppingCalib(BLUEFLY_NUM_RF_CHANNELS); // Calibrate all channels + NRF250K_RFChannel(BLUEFLY_RF_BIND_CHANNEL); // Set bind channel +} + +static void __attribute__((unused)) BLUEFLY_initialize_txid() +{ + uint8_t start = (rx_tx_addr[3] % 47) + 2; + for(uint8_t i=0;iNRF24L01, extension of MT99XX protocol PROTO_KYOSHO2 = 93, // =>NRF24L01 PROTO_SCORPIO = 94, // =>CYRF6936 + PROTO_BLUEFLY = 95, // =>CC2500 & NRF24L01 + PROTO_NANORF = 126, // =>NRF24L01 PROTO_TEST = 127, // =>CC2500 diff --git a/Multiprotocol/Validate.h b/Multiprotocol/Validate.h index 3a20e35d8..8cc99e28f 100644 --- a/Multiprotocol/Validate.h +++ b/Multiprotocol/Validate.h @@ -340,6 +340,7 @@ #undef ZSX_NRF24L01_INO #endif #if ( not defined(CC2500_INSTALLED) && not defined(NRF24L01_INSTALLED) ) || defined MULTI_EU + #undef BLUEFLY_CCNRF_INO #undef GD00X_CCNRF_INO #undef KF606_CCNRF_INO #undef MJXQ_CCNRF_INO diff --git a/Multiprotocol/_Config.h b/Multiprotocol/_Config.h index c18cbc485..bbf619fca 100644 --- a/Multiprotocol/_Config.h +++ b/Multiprotocol/_Config.h @@ -255,6 +255,7 @@ #define ZSX_NRF24L01_INO //The protocols below need either a CC2500 or NRF24L01 to be installed +#define BLUEFLY_CCNRF_INO #define GD00X_CCNRF_INO #define KF606_CCNRF_INO #define MJXQ_CCNRF_INO @@ -567,6 +568,8 @@ const PPM_Parameters PPM_prot[14*NBR_BANKS]= { QX100 PROTO_BAYANG_RX NONE + PROTO_BLUEFLY + NONE PROTO_BUGS NONE PROTO_BUGSMINI diff --git a/Protocols_Details.md b/Protocols_Details.md index 954410ea5..6b219a56f 100644 --- a/Protocols_Details.md +++ b/Protocols_Details.md @@ -65,6 +65,7 @@ Protocol Name|Protocol Number|Sub_Proto 0|Sub_Proto 1|Sub_Proto 2|Sub_Proto 3|Su [Assan](Protocols_Details.md#ASSAN---24)|24|||||||||NRF24L01| [Bayang](Protocols_Details.md#BAYANG---14)|14|Bayang|H8S3D|X16_AH|IRDRONE|DHD_D4|QX100|||NRF24L01|XN297 [Bayang RX](Protocols_Details.md#BAYANG-RX---59)|59|Multi|CPPM|||||||NRF24L01|XN297 +[BlueFly](Protocols_Details.md#BLUEFLY---95)|95|||||||||NRF24L01| [Bugs](Protocols_Details.md#BUGS---41)|41|||||||||A7105| [BugsMini](Protocols_Details.md#BUGSMINI---42)|42|BUGSMINI|BUGS3H|||||||NRF24L01|XN297 [Cabell](Protocols_Details.md#Cabell---34)|34|Cabell_V3|C_TELEM|-|-|-|-|F_SAFE|UNBIND|NRF24L01| @@ -1034,6 +1035,17 @@ If a CC2500 is installed it will be used for all the below protocols. Option in If only a NRF24L01 is installed then these protocols might be problematic because they are 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. +## BLUEFLY - *95* +Model: HP100 + +CH1|CH2|CH3|CH4|CH5|CH6|CH7|CH8 +---|---|---|---|---|---|---|--- +A|E|T|R|CH5|CH6|CH7|CH8 + +TRIM: either use this channel for trim only or add a mixer with aileron to increase the roll rate. + +RATE: -100% high rate, +100% low rate + ## GD00X - *47* Model: GD005 C-17 Transport, GD006 DA62 and ZC-Z50