Skip to content

Commit

Permalink
BlueFly: New protocol
Browse files Browse the repository at this point in the history
  • Loading branch information
pascallanger committed Nov 9, 2023
1 parent 10ec4dd commit ab5f75b
Show file tree
Hide file tree
Showing 7 changed files with 142 additions and 1 deletion.
118 changes: 118 additions & 0 deletions Multiprotocol/Bluefly_ccnrf.ino
Original file line number Diff line number Diff line change
@@ -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 <http://www.gnu.org/licenses/>.
*/
// 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;i<BLUEFLY_NUM_RF_CHANNELS;i++)
hopping_frequency[i] = start + i*2;
hopping_frequency_no=0;
}

uint16_t BLUEFLY_callback()
{
#ifdef MULTI_SYNC
telemetry_set_input_sync(BLUEFLY_PACKET_PERIOD);
#endif
if(bind_counter)
{
bind_counter--;
if (bind_counter == 0)
{
BIND_DONE;
NRF250K_SetTXAddr(rx_tx_addr, 5);
}
}
BLUEFLY_send_packet();
return BLUEFLY_PACKET_PERIOD;
}

void BLUEFLY_init(void)
{
BLUEFLY_initialize_txid();
BLUEFLY_RF_init();

bind_counter = IS_BIND_IN_PROGRESS ? BLUEFLY_BIND_COUNT : 1;
}

#endif
1 change: 1 addition & 0 deletions Multiprotocol/Multi.txt
Original file line number Diff line number Diff line change
Expand Up @@ -91,3 +91,4 @@
92,MT99xx,PA18
93,Kyosho2,KT-17
94,Scorpio
95,BlueFly
4 changes: 4 additions & 0 deletions Multiprotocol/Multi_Protos.ino
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ const char STR_LOSI[] ="Losi";
const char STR_MOULDKG[] ="MouldKg";
const char STR_XERALL[] ="Xerall";
const char STR_SCORPIO[] ="Scorpio";
const char STR_BLUEFLY[] ="BlueFly";

const char STR_SUBTYPE_FLYSKY[] = "\x04""Std\0""V9x9""V6x6""V912""CX20";
const char STR_SUBTYPE_HUBSAN[] = "\x04""H107""H301""H501";
Expand Down Expand Up @@ -222,6 +223,9 @@ const mm_protocol_definition multi_protocols[] = {
#if defined(BAYANG_RX_NRF24L01_INO)
{PROTO_BAYANG_RX, STR_BAYANG_RX, STR_CPPM, NBR_CPPM, OPTION_NONE, 0, 0, SW_NRF, BAYANG_RX_init, BAYANG_RX_callback },
#endif
#if defined(BLUEFLY_CCNRF_INO)
{PROTO_BLUEFLY, STR_BLUEFLY, NO_SUBTYPE, 0, OPTION_RFTUNE, 0, 0, SW_NRF, BLUEFLY_init, BLUEFLY_callback },
#endif
#if defined(BUGS_A7105_INO)
{PROTO_BUGS, STR_BUGS, NO_SUBTYPE, 0, OPTION_NONE, 0, 0, SW_A7105, BUGS_init, BUGS_callback },
#endif
Expand Down
4 changes: 3 additions & 1 deletion Multiprotocol/Multiprotocol.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#define VERSION_MAJOR 1
#define VERSION_MINOR 3
#define VERSION_REVISION 3
#define VERSION_PATCH_LEVEL 35
#define VERSION_PATCH_LEVEL 36

#define MODE_SERIAL 0

Expand Down Expand Up @@ -122,6 +122,8 @@ enum PROTOCOLS
PROTO_MT99XX2 = 92, // =>NRF24L01, 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
Expand Down
1 change: 1 addition & 0 deletions Multiprotocol/Validate.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions Multiprotocol/_Config.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
12 changes: 12 additions & 0 deletions Protocols_Details.md
Original file line number Diff line number Diff line change
Expand Up @@ -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|
Expand Down Expand Up @@ -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

Expand Down

0 comments on commit ab5f75b

Please sign in to comment.