mirror of
https://github.com/pascallanger/DIY-Multiprotocol-TX-Module.git
synced 2026-01-13 04:03:15 +00:00
Compare commits
7 Commits
pascallang
...
pascallang
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
bb9f8fdfbf | ||
|
|
8e663f2531 | ||
|
|
8c2fe5f65e | ||
|
|
7549783741 | ||
|
|
e6bafaabb7 | ||
|
|
9286ac84f6 | ||
|
|
ede40ac598 |
@@ -209,3 +209,5 @@
|
|||||||
92,0,MT99xx2,PA18,0,MODE,FLIP,RTH
|
92,0,MT99xx2,PA18,0,MODE,FLIP,RTH
|
||||||
93,0,Kyosho2,KT-17,0
|
93,0,Kyosho2,KT-17,0
|
||||||
94,0,Scorpio
|
94,0,Scorpio
|
||||||
|
95,0,Bluefly,HP100,0,CH5,CH6,CH7,CH8
|
||||||
|
96,0,BumbleB
|
||||||
|
|||||||
196
Multiprotocol/BUMBLEB_ccnrf.ino
Normal file
196
Multiprotocol/BUMBLEB_ccnrf.ino
Normal file
@@ -0,0 +1,196 @@
|
|||||||
|
/*
|
||||||
|
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/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#if defined(BUMBLEB_CCNRF_INO)
|
||||||
|
|
||||||
|
#include "iface_xn297.h"
|
||||||
|
|
||||||
|
#define FORCE_BUMBLEB_ORIGINAL_ID
|
||||||
|
#define BUMBLEB_TELEM_DEBUG
|
||||||
|
|
||||||
|
#define BUMBLEB_PACKET_PERIOD 10200
|
||||||
|
#define BUMBLEB_RF_BIND_CHANNEL 42
|
||||||
|
#define BUMBLEB_RF_NUM_CHANNELS 2
|
||||||
|
#define BUMBLEB_PAYLOAD_SIZE 7
|
||||||
|
|
||||||
|
static void __attribute__((unused)) BUMBLEB_send_packet()
|
||||||
|
{
|
||||||
|
packet[6] = 0x00;
|
||||||
|
if(IS_BIND_IN_PROGRESS)
|
||||||
|
{
|
||||||
|
packet[0] = rx_tx_addr[0];
|
||||||
|
packet[1] = rx_tx_addr[1];
|
||||||
|
packet[2] = 0x54; //???
|
||||||
|
packet[3] = 0x58; //???
|
||||||
|
hopping_frequency_no ^= 0x01;
|
||||||
|
packet[4] = hopping_frequency[hopping_frequency_no];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//hopping frequency
|
||||||
|
XN297_Hopping(hopping_frequency_no);
|
||||||
|
hopping_frequency_no ^= 0x01;
|
||||||
|
packet[0] = 0x20
|
||||||
|
|GET_FLAG(CH6_SW,0x80); // High rate
|
||||||
|
packet[1] = convert_channel_8b_limit_deadband(AILERON,0xBF,0xA0,0x81,40); // Aileron: Max values:BD..A0..82
|
||||||
|
if(packet[1] < 0xA0)
|
||||||
|
packet[1] = 0x20 - packet[1]; // Reverse low part of aileron
|
||||||
|
packet[2] = convert_channel_8b(CH5)>>2; // 01..20..3F
|
||||||
|
if(CH7_SW) // Drive trim from aileron
|
||||||
|
{
|
||||||
|
uint8_t ch=convert_channel_8b(AILERON);
|
||||||
|
if(ch > 0x5A && ch < 0x80-0x07)
|
||||||
|
packet[2] = ch - 0x5A;
|
||||||
|
else if(ch < 0x5A)
|
||||||
|
{
|
||||||
|
if(ch < 0x5A-0x20)
|
||||||
|
packet[2] = 0;
|
||||||
|
else
|
||||||
|
packet[2] = ch - (0x5A-0x20);
|
||||||
|
}
|
||||||
|
else if(packet[1] == 0x89)
|
||||||
|
packet[2] = 0x20;
|
||||||
|
else if(ch > 0xA5)
|
||||||
|
{
|
||||||
|
if(ch > 0xA9+0x1F)
|
||||||
|
packet[2] = 0x3F;
|
||||||
|
else
|
||||||
|
packet[2] = ch - 0x89;
|
||||||
|
}
|
||||||
|
else if(ch > 0xA5-0x1F)
|
||||||
|
packet[2] = ch - (0xA5-0x1F-0x20);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
packet[2] = convert_channel_8b(CH5)>>2; // 01..20..3F
|
||||||
|
packet[3] = convert_channel_8b(THROTTLE)>>2; // 00..3F
|
||||||
|
packet[4] = hopping_frequency[hopping_frequency_no];
|
||||||
|
}
|
||||||
|
|
||||||
|
packet[5] = packet[0];
|
||||||
|
for(uint8_t i=1;i<BUMBLEB_PAYLOAD_SIZE-2;i++)
|
||||||
|
packet[5] += packet[i];
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
debug("P:");
|
||||||
|
for(uint8_t i=0;i<BUMBLEB_PAYLOAD_SIZE;i++)
|
||||||
|
debug(" %02X", packet[i]);
|
||||||
|
debugln("");
|
||||||
|
#endif
|
||||||
|
|
||||||
|
XN297_SetPower(); // Set tx_power
|
||||||
|
XN297_SetFreqOffset(); // Set frequency offset
|
||||||
|
XN297_SetTxRxMode(TX_EN);
|
||||||
|
XN297_WritePayload(packet, BUMBLEB_PAYLOAD_SIZE);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void __attribute__((unused)) BUMBLEB_RF_init()
|
||||||
|
{
|
||||||
|
//Config CC2500
|
||||||
|
XN297_Configure(XN297_CRCEN, XN297_SCRAMBLED, XN297_250K);
|
||||||
|
XN297_SetTXAddr((uint8_t*)"\x55\x55\x55\x55\x55", 5);
|
||||||
|
XN297_HoppingCalib(BUMBLEB_RF_NUM_CHANNELS); // Calibrate all channels
|
||||||
|
XN297_RFChannel(BUMBLEB_RF_BIND_CHANNEL); // Set bind channel
|
||||||
|
XN297_SetRXAddr(rx_tx_addr, BUMBLEB_PAYLOAD_SIZE);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void __attribute__((unused)) BUMBLEB_initialize_txid()
|
||||||
|
{
|
||||||
|
calc_fh_channels(BUMBLEB_RF_NUM_CHANNELS);
|
||||||
|
rx_tx_addr[0] = rx_tx_addr[2];
|
||||||
|
rx_tx_addr[1] = rx_tx_addr[3];
|
||||||
|
#ifdef FORCE_BUMBLEB_ORIGINAL_ID
|
||||||
|
rx_tx_addr[0] = 0x33;
|
||||||
|
rx_tx_addr[1] = 0x65;
|
||||||
|
hopping_frequency[0] = 2;
|
||||||
|
hopping_frequency[1] = 40;
|
||||||
|
#endif
|
||||||
|
rx_tx_addr[2] = rx_tx_addr[3] = rx_tx_addr[4] = 0x55;
|
||||||
|
}
|
||||||
|
|
||||||
|
enum {
|
||||||
|
BUMBLEB_BIND = 0x00,
|
||||||
|
BUMBLEB_BINDRX = 0x01,
|
||||||
|
BUMBLEB_DATA = 0x02,
|
||||||
|
};
|
||||||
|
|
||||||
|
#define BUMBLEB_WRITE_TIME 850
|
||||||
|
|
||||||
|
uint16_t BUMBLEB_callback()
|
||||||
|
{
|
||||||
|
bool rx;
|
||||||
|
switch(phase)
|
||||||
|
{
|
||||||
|
case BUMBLEB_BIND:
|
||||||
|
rx = XN297_IsRX(); // Needed for the NRF24L01 since otherwise the bit gets cleared
|
||||||
|
|
||||||
|
BUMBLEB_send_packet();
|
||||||
|
|
||||||
|
if( rx )
|
||||||
|
{ // a packet has been received
|
||||||
|
#ifdef BUMBLEB_TELEM_DEBUG
|
||||||
|
debug("RX :");
|
||||||
|
#endif
|
||||||
|
if(XN297_ReadPayload(packet_in, BUMBLEB_PAYLOAD_SIZE))
|
||||||
|
{ // packet with good CRC
|
||||||
|
#ifdef BUMBLEB_TELEM_DEBUG
|
||||||
|
debug("OK :");
|
||||||
|
for(uint8_t i=0;i<BUMBLEB_PAYLOAD_SIZE;i++)
|
||||||
|
debug(" %02X",packet_in[i]);
|
||||||
|
#endif
|
||||||
|
// packet_in = 4F 71 55 52 58 61 AA
|
||||||
|
rx_tx_addr[2] = packet_in[0];
|
||||||
|
rx_tx_addr[3] = packet_in[1];
|
||||||
|
//rx_tx_addr[4] = packet_in[2]; // to test with other planes...
|
||||||
|
XN297_SetTXAddr(rx_tx_addr, 5);
|
||||||
|
BIND_DONE;
|
||||||
|
phase = BUMBLEB_DATA;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
phase++;
|
||||||
|
return BUMBLEB_WRITE_TIME;
|
||||||
|
case BUMBLEB_BINDRX:
|
||||||
|
{
|
||||||
|
uint16_t start=(uint16_t)micros();
|
||||||
|
while ((uint16_t)((uint16_t)micros()-(uint16_t)start) < 500)
|
||||||
|
{
|
||||||
|
if(XN297_IsPacketSent())
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
XN297_SetTxRxMode(RX_EN);
|
||||||
|
phase = BUMBLEB_BIND;
|
||||||
|
return BUMBLEB_PACKET_PERIOD-BUMBLEB_WRITE_TIME;
|
||||||
|
case BUMBLEB_DATA:
|
||||||
|
#ifdef MULTI_SYNC
|
||||||
|
telemetry_set_input_sync(BUMBLEB_PACKET_PERIOD);
|
||||||
|
#endif
|
||||||
|
BUMBLEB_send_packet();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return BUMBLEB_PACKET_PERIOD;
|
||||||
|
}
|
||||||
|
|
||||||
|
void BUMBLEB_init()
|
||||||
|
{
|
||||||
|
BUMBLEB_initialize_txid();
|
||||||
|
BUMBLEB_RF_init();
|
||||||
|
hopping_frequency_no = 0;
|
||||||
|
|
||||||
|
BIND_IN_PROGRESS; // autobind protocol
|
||||||
|
phase = BUMBLEB_BIND;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -34,7 +34,7 @@ const uint8_t PROGMEM DSM_pncodes[][8] = {
|
|||||||
/* Col 6 */ {0xBF, 0x54, 0x98, 0xB9, 0xB7, 0x30, 0x5A, 0x88},
|
/* Col 6 */ {0xBF, 0x54, 0x98, 0xB9, 0xB7, 0x30, 0x5A, 0x88},
|
||||||
/* Col 7 */ {0x35, 0xD1, 0xFC, 0x97, 0x23, 0xD4, 0xC9, 0x88},
|
/* Col 7 */ {0x35, 0xD1, 0xFC, 0x97, 0x23, 0xD4, 0xC9, 0x88},
|
||||||
/* Row 4 */
|
/* Row 4 */
|
||||||
/* Col 0 */ {0xE1, 0xD6, 0x31, 0x26, 0x5F, 0xBD, 0x40, 0x93}, // Wrong values used by Orange TX/RX Col 8 */ {0x88, 0xE1, 0xD6, 0x31, 0x26, 0x5F, 0xBD, 0x40}
|
/* Col 0 */ {0xE1, 0xD6, 0x31, 0x26, 0x5F, 0xBD, 0x40, 0x93}, // Wrong values used by Orange TX/RX Row 3 Col 8: {0x88, 0xE1, 0xD6, 0x31, 0x26, 0x5F, 0xBD, 0x40}
|
||||||
/* Col 1 */ {0xDC, 0x68, 0x08, 0x99, 0x97, 0xAE, 0xAF, 0x8C},
|
/* Col 1 */ {0xDC, 0x68, 0x08, 0x99, 0x97, 0xAE, 0xAF, 0x8C},
|
||||||
/* Col 2 */ {0xC3, 0x0E, 0x01, 0x16, 0x0E, 0x32, 0x06, 0xBA},
|
/* Col 2 */ {0xC3, 0x0E, 0x01, 0x16, 0x0E, 0x32, 0x06, 0xBA},
|
||||||
/* Col 3 */ {0xE0, 0x83, 0x01, 0xFA, 0xAB, 0x3E, 0x8F, 0xAC},
|
/* Col 3 */ {0xE0, 0x83, 0x01, 0xFA, 0xAB, 0x3E, 0x8F, 0xAC},
|
||||||
|
|||||||
@@ -92,3 +92,4 @@
|
|||||||
93,Kyosho2,KT-17
|
93,Kyosho2,KT-17
|
||||||
94,Scorpio
|
94,Scorpio
|
||||||
95,BlueFly
|
95,BlueFly
|
||||||
|
96,BumbleB
|
||||||
|
|||||||
@@ -107,6 +107,7 @@ const char STR_MOULDKG[] ="MouldKg";
|
|||||||
const char STR_XERALL[] ="Xerall";
|
const char STR_XERALL[] ="Xerall";
|
||||||
const char STR_SCORPIO[] ="Scorpio";
|
const char STR_SCORPIO[] ="Scorpio";
|
||||||
const char STR_BLUEFLY[] ="BlueFly";
|
const char STR_BLUEFLY[] ="BlueFly";
|
||||||
|
const char STR_BUMBLEB[] ="BumbleB";
|
||||||
|
|
||||||
const char STR_SUBTYPE_FLYSKY[] = "\x04""Std\0""V9x9""V6x6""V912""CX20";
|
const char STR_SUBTYPE_FLYSKY[] = "\x04""Std\0""V9x9""V6x6""V912""CX20";
|
||||||
const char STR_SUBTYPE_HUBSAN[] = "\x04""H107""H301""H501";
|
const char STR_SUBTYPE_HUBSAN[] = "\x04""H107""H301""H501";
|
||||||
@@ -226,6 +227,9 @@ const mm_protocol_definition multi_protocols[] = {
|
|||||||
#if defined(BLUEFLY_CCNRF_INO)
|
#if defined(BLUEFLY_CCNRF_INO)
|
||||||
{PROTO_BLUEFLY, STR_BLUEFLY, NO_SUBTYPE, 0, OPTION_RFTUNE, 0, 0, SW_NRF, BLUEFLY_init, BLUEFLY_callback },
|
{PROTO_BLUEFLY, STR_BLUEFLY, NO_SUBTYPE, 0, OPTION_RFTUNE, 0, 0, SW_NRF, BLUEFLY_init, BLUEFLY_callback },
|
||||||
#endif
|
#endif
|
||||||
|
#if defined(BUMBLEB_CCNRF_INO)
|
||||||
|
{PROTO_BUMBLEB, STR_BUMBLEB, NO_SUBTYPE, 0, OPTION_RFTUNE, 0, 0, SW_NRF, BUMBLEB_init, BUMBLEB_callback },
|
||||||
|
#endif
|
||||||
#if defined(BUGS_A7105_INO)
|
#if defined(BUGS_A7105_INO)
|
||||||
{PROTO_BUGS, STR_BUGS, NO_SUBTYPE, 0, OPTION_NONE, 0, 0, SW_A7105, BUGS_init, BUGS_callback },
|
{PROTO_BUGS, STR_BUGS, NO_SUBTYPE, 0, OPTION_NONE, 0, 0, SW_A7105, BUGS_init, BUGS_callback },
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -19,7 +19,7 @@
|
|||||||
#define VERSION_MAJOR 1
|
#define VERSION_MAJOR 1
|
||||||
#define VERSION_MINOR 3
|
#define VERSION_MINOR 3
|
||||||
#define VERSION_REVISION 3
|
#define VERSION_REVISION 3
|
||||||
#define VERSION_PATCH_LEVEL 41
|
#define VERSION_PATCH_LEVEL 43
|
||||||
|
|
||||||
#define MODE_SERIAL 0
|
#define MODE_SERIAL 0
|
||||||
|
|
||||||
@@ -123,6 +123,7 @@ enum PROTOCOLS
|
|||||||
PROTO_KYOSHO2 = 93, // =>NRF24L01
|
PROTO_KYOSHO2 = 93, // =>NRF24L01
|
||||||
PROTO_SCORPIO = 94, // =>CYRF6936
|
PROTO_SCORPIO = 94, // =>CYRF6936
|
||||||
PROTO_BLUEFLY = 95, // =>CC2500 & NRF24L01
|
PROTO_BLUEFLY = 95, // =>CC2500 & NRF24L01
|
||||||
|
PROTO_BUMBLEB = 96, // =>CC2500 & NRF24L01
|
||||||
|
|
||||||
|
|
||||||
PROTO_NANORF = 126, // =>NRF24L01
|
PROTO_NANORF = 126, // =>NRF24L01
|
||||||
@@ -831,8 +832,9 @@ enum {
|
|||||||
#define FRSKYX2_CLONE_EEPROM_OFFSET 873 // (1) format + (3) TX ID, 4 bytes, end is 877
|
#define FRSKYX2_CLONE_EEPROM_OFFSET 873 // (1) format + (3) TX ID, 4 bytes, end is 877
|
||||||
#define DSM_RX_EEPROM_OFFSET 877 // (4) TX ID + format, 5 bytes, end is 882
|
#define DSM_RX_EEPROM_OFFSET 877 // (4) TX ID + format, 5 bytes, end is 882
|
||||||
#define MOULDKG_EEPROM_OFFSET 882 // RX ID, 3 bytes per model, end is 882+64*3=1074
|
#define MOULDKG_EEPROM_OFFSET 882 // RX ID, 3 bytes per model, end is 882+64*3=1074
|
||||||
#define DSM_CLONE_EEPROM_OFFSET 1074 // (4) TX ID, (1) Initialized, end is 1079
|
#define DSM_CLONE_EEPROM_OFFSET 1074 // (4) TX ID, (1) Initialized, end is 1079
|
||||||
//#define CONFIG_EEPROM_OFFSET 1079 // Current configuration of the multimodule
|
#define TRAXXAS_EEPROM_OFFSET 1079 // RX ID, 2 bytes per model id, end is 1079+128=1207
|
||||||
|
//#define CONFIG_EEPROM_OFFSET 1207 // Current configuration of the multimodule
|
||||||
|
|
||||||
/* STM32 Flash Size */
|
/* STM32 Flash Size */
|
||||||
#ifndef DISABLE_FLASH_SIZE_CHECK
|
#ifndef DISABLE_FLASH_SIZE_CHECK
|
||||||
|
|||||||
@@ -20,6 +20,7 @@
|
|||||||
#include "iface_cyrf6936.h"
|
#include "iface_cyrf6936.h"
|
||||||
|
|
||||||
//#define TRAXXAS_FORCE_ID
|
//#define TRAXXAS_FORCE_ID
|
||||||
|
//#define TRAXXAS_DEBUG
|
||||||
|
|
||||||
#define TRAXXAS_CHANNEL 0x05
|
#define TRAXXAS_CHANNEL 0x05
|
||||||
#define TRAXXAS_BIND_CHANNEL 0x2B
|
#define TRAXXAS_BIND_CHANNEL 0x2B
|
||||||
@@ -65,8 +66,9 @@ static void __attribute__((unused)) TRAXXAS_cyrf_data_config()
|
|||||||
CYRF_WriteRegister(CYRF_15_CRC_SEED_LSB, 0x1B);
|
CYRF_WriteRegister(CYRF_15_CRC_SEED_LSB, 0x1B);
|
||||||
CYRF_WriteRegister(CYRF_16_CRC_SEED_MSB, 0x3F);
|
CYRF_WriteRegister(CYRF_16_CRC_SEED_MSB, 0x3F);
|
||||||
#else
|
#else
|
||||||
CYRF_WriteRegister(CYRF_15_CRC_SEED_LSB, cyrfmfg_id[0]+0xB6);
|
uint16_t addr=TRAXXAS_EEPROM_OFFSET+RX_num*2;
|
||||||
CYRF_WriteRegister(CYRF_16_CRC_SEED_MSB, cyrfmfg_id[1]+0x5D);
|
CYRF_WriteRegister(CYRF_15_CRC_SEED_LSB, cyrfmfg_id[0] - eeprom_read_byte((EE_ADDR)(addr + 0)));
|
||||||
|
CYRF_WriteRegister(CYRF_16_CRC_SEED_MSB, cyrfmfg_id[1] - eeprom_read_byte((EE_ADDR)(addr + 1)));
|
||||||
#endif
|
#endif
|
||||||
CYRF_ConfigRFChannel(TRAXXAS_CHANNEL);
|
CYRF_ConfigRFChannel(TRAXXAS_CHANNEL);
|
||||||
CYRF_SetTxRxMode(TX_EN);
|
CYRF_SetTxRxMode(TX_EN);
|
||||||
@@ -76,6 +78,8 @@ static void __attribute__((unused)) TRAXXAS_send_data_packet()
|
|||||||
{
|
{
|
||||||
packet[0] = 0x01;
|
packet[0] = 0x01;
|
||||||
memset(&packet[1],0x00,TRAXXAS_PACKET_SIZE-1);
|
memset(&packet[1],0x00,TRAXXAS_PACKET_SIZE-1);
|
||||||
|
//Next RF channel ? 0x00 -> keep current, 0x0E change to F=15
|
||||||
|
//packet[1]
|
||||||
//Steering
|
//Steering
|
||||||
uint16_t ch = convert_channel_16b_nolimit(RUDDER,500,1000,false);
|
uint16_t ch = convert_channel_16b_nolimit(RUDDER,500,1000,false);
|
||||||
packet[2]=ch>>8;
|
packet[2]=ch>>8;
|
||||||
@@ -115,22 +119,35 @@ uint16_t TRAXXAS_callback()
|
|||||||
status = CYRF_ReadRegister(CYRF_07_RX_IRQ_STATUS);
|
status = CYRF_ReadRegister(CYRF_07_RX_IRQ_STATUS);
|
||||||
if((status & 0x03) == 0x02) // RXC=1, RXE=0 then 2nd check is required (debouncing)
|
if((status & 0x03) == 0x02) // RXC=1, RXE=0 then 2nd check is required (debouncing)
|
||||||
status |= CYRF_ReadRegister(CYRF_07_RX_IRQ_STATUS);
|
status |= CYRF_ReadRegister(CYRF_07_RX_IRQ_STATUS);
|
||||||
debugln("s=%02X",status);
|
#ifdef TRAXXAS_DEBUG
|
||||||
|
debugln("s=%02X",status);
|
||||||
|
#endif
|
||||||
CYRF_WriteRegister(CYRF_07_RX_IRQ_STATUS, 0x80); // need to set RXOW before data read
|
CYRF_WriteRegister(CYRF_07_RX_IRQ_STATUS, 0x80); // need to set RXOW before data read
|
||||||
if((status & 0x07) == 0x02)
|
if((status & 0x07) == 0x02)
|
||||||
{ // Data received with no errors
|
{ // Data received with no errors
|
||||||
len=CYRF_ReadRegister(CYRF_09_RX_COUNT);
|
len=CYRF_ReadRegister(CYRF_09_RX_COUNT);
|
||||||
debugln("L=%02X",len)
|
#ifdef TRAXXAS_DEBUG
|
||||||
|
debugln("L=%02X",len)
|
||||||
|
#endif
|
||||||
if(len==TRAXXAS_PACKET_SIZE)
|
if(len==TRAXXAS_PACKET_SIZE)
|
||||||
{
|
{
|
||||||
CYRF_ReadDataPacketLen(packet, TRAXXAS_PACKET_SIZE);
|
CYRF_ReadDataPacketLen(packet, TRAXXAS_PACKET_SIZE);
|
||||||
debug("RX=");
|
#ifdef TRAXXAS_DEBUG
|
||||||
for(uint8_t i=0;i<TRAXXAS_PACKET_SIZE;i++)
|
debug("RX=");
|
||||||
debug(" %02X",packet[i]);
|
for(uint8_t i=0;i<TRAXXAS_PACKET_SIZE;i++)
|
||||||
debugln("");
|
debug(" %02X",packet[i]);
|
||||||
|
debugln("");
|
||||||
|
#endif
|
||||||
|
// Store RX ID
|
||||||
|
uint16_t addr=TRAXXAS_EEPROM_OFFSET+RX_num*2;
|
||||||
|
for(uint8_t i=0;i<2;i++)
|
||||||
|
eeprom_write_byte((EE_ADDR)(addr+i),packet[i+1]);
|
||||||
|
// Replace RX ID by TX ID
|
||||||
for(uint8_t i=0;i<6;i++)
|
for(uint8_t i=0;i<6;i++)
|
||||||
packet[i+1]=cyrfmfg_id[i];
|
packet[i+1]=cyrfmfg_id[i];
|
||||||
packet[10]=0x01;
|
packet[7 ] = 0xEE; // Not needed ??
|
||||||
|
packet[10] = 0x01; // Must change otherwise bind doesn't complete
|
||||||
|
packet[13] = 0x05; // Not needed ??
|
||||||
packet_count=12;
|
packet_count=12;
|
||||||
CYRF_SetTxRxMode(TX_EN);
|
CYRF_SetTxRxMode(TX_EN);
|
||||||
phase=TRAXXAS_BIND_TX1;
|
phase=TRAXXAS_BIND_TX1;
|
||||||
@@ -150,10 +167,12 @@ uint16_t TRAXXAS_callback()
|
|||||||
return 700;
|
return 700;
|
||||||
case TRAXXAS_BIND_TX1:
|
case TRAXXAS_BIND_TX1:
|
||||||
CYRF_WriteDataPacketLen(packet, TRAXXAS_PACKET_SIZE);
|
CYRF_WriteDataPacketLen(packet, TRAXXAS_PACKET_SIZE);
|
||||||
debug("P=");
|
#ifdef TRAXXAS_DEBUG
|
||||||
for(uint8_t i=0;i<TRAXXAS_PACKET_SIZE;i++)
|
debug("P=");
|
||||||
debug(" %02X",packet[i]);
|
for(uint8_t i=0;i<TRAXXAS_PACKET_SIZE;i++)
|
||||||
debugln("");
|
debug(" %02X",packet[i]);
|
||||||
|
debugln("");
|
||||||
|
#endif
|
||||||
if(--packet_count==0) // Switch to normal mode
|
if(--packet_count==0) // Switch to normal mode
|
||||||
phase=TRAXXAS_PREP_DATA;
|
phase=TRAXXAS_PREP_DATA;
|
||||||
break;
|
break;
|
||||||
@@ -179,7 +198,7 @@ void TRAXXAS_init()
|
|||||||
|
|
||||||
//Read CYRF ID
|
//Read CYRF ID
|
||||||
CYRF_GetMfgData(cyrfmfg_id);
|
CYRF_GetMfgData(cyrfmfg_id);
|
||||||
cyrfmfg_id[0]+=RX_num;
|
//cyrfmfg_id[0]+=RX_num; // Not needed since the TX and RX have to match
|
||||||
|
|
||||||
#ifdef TRAXXAS_FORCE_ID // data taken from TX dump
|
#ifdef TRAXXAS_FORCE_ID // data taken from TX dump
|
||||||
cyrfmfg_id[0]=0x65; // CYRF MFG ID
|
cyrfmfg_id[0]=0x65; // CYRF MFG ID
|
||||||
@@ -197,6 +216,13 @@ void TRAXXAS_init()
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
phase = TRAXXAS_PREP_DATA;
|
phase = TRAXXAS_PREP_DATA;
|
||||||
|
|
||||||
|
//
|
||||||
|
// phase = TRAXXAS_BIND_TX1;
|
||||||
|
// TRAXXAS_cyrf_bind_config();
|
||||||
|
// CYRF_SetTxRxMode(TX_EN);
|
||||||
|
// memcpy(packet,(uint8_t *)"\x02\x4A\xA3\x2D\x1A\x49\xFE\x06\x00\x00\x02\x01\x06\x06\x00\x00",TRAXXAS_PACKET_SIZE);
|
||||||
|
// memcpy(packet,(uint8_t *)"\x02\xFF\xFF\xFF\xFF\xFF\xFF\x01\x01\x01\x02\x01\x06\x00\x00\x00",TRAXXAS_PACKET_SIZE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -207,7 +233,15 @@ CRC_SEED_LSB: 0x5A
|
|||||||
CRC_SEED_MSB: 0x5A
|
CRC_SEED_MSB: 0x5A
|
||||||
RX1: 0x02 0x4A 0xA3 0x2D 0x1A 0x49 0xFE 0x06 0x00 0x00 0x02 0x01 0x06 0x06 0x00 0x00
|
RX1: 0x02 0x4A 0xA3 0x2D 0x1A 0x49 0xFE 0x06 0x00 0x00 0x02 0x01 0x06 0x06 0x00 0x00
|
||||||
TX1: 0x02 0x65 0xE2 0x5E 0x55 0x4D 0xFE 0xEE 0x00 0x00 0x01 0x01 0x06 0x05 0x00 0x00
|
TX1: 0x02 0x65 0xE2 0x5E 0x55 0x4D 0xFE 0xEE 0x00 0x00 0x01 0x01 0x06 0x05 0x00 0x00
|
||||||
Note: RX cyrfmfg_id is 0x4A,0xA3,0x2D,0x1A,0x49,0xFE and TX cyrfmfg_id is 0x65,0xE2,0x5E,0x55,0x4D,0xFE
|
Notes:
|
||||||
|
- RX cyrfmfg_id is 0x4A,0xA3,0x2D,0x1A,0x49,0xFE and TX cyrfmfg_id is 0x65,0xE2,0x5E,0x55,0x4D,0xFE
|
||||||
|
- P[7] changes from 0x06 to 0xEE but not needed to complete the bind -> doesn't care??
|
||||||
|
- P[8..9]=0x00 unchanged??
|
||||||
|
- P[10] needs to be set to 0x01 to complete the bind -> normal packet P[0]??
|
||||||
|
- P[11] unchanged ?? -> no bind if set to 0x00 or 0x81
|
||||||
|
- P[12] unchanged ?? -> no bind if set to 0x05 or 0x86
|
||||||
|
- P[13] changes from 0x06 to 0x05 but not needed to complete the bind -> doesn't care??
|
||||||
|
- P[14..15]=0x00 unchanged??
|
||||||
|
|
||||||
Bind phase 2 (looks like normal mode?)
|
Bind phase 2 (looks like normal mode?)
|
||||||
CHANNEL: 0x05
|
CHANNEL: 0x05
|
||||||
@@ -231,5 +265,13 @@ SOP_CODE: 0xA1 0x78 0xDC 0x3C 0x9E 0x82 0xDC 0x3C
|
|||||||
CRC_SEED_LSB: 0x1B
|
CRC_SEED_LSB: 0x1B
|
||||||
CRC_SEED_MSB: 0x3F
|
CRC_SEED_MSB: 0x3F
|
||||||
TX3: 0x01 0x00 0x02 0xA8 0x03 0xE7 0x02 0x08 0x00 0x00 0x01 0x01 0x02 0xEE 0x00 0x00
|
TX3: 0x01 0x00 0x02 0xA8 0x03 0xE7 0x02 0x08 0x00 0x00 0x01 0x01 0x02 0xEE 0x00 0x00
|
||||||
|
|
||||||
|
CRC_SEED:
|
||||||
|
TX ID: \x65\xE2\x5E\x55\x4D\xFE
|
||||||
|
RX ID: \x4A\xA3\x2D\x1A\x49\xFE CRC 0x1B 0x3F => CRC: 65-4A=1B E2-A3=3F
|
||||||
|
RX ID: \x4B\xA3\x2D\x1A\x49\xFE CRC 0x1A 0x3F => CRC: 65-4B=1A E2-A3=3F
|
||||||
|
RX ID: \x00\x00\x2D\x1A\x49\xFE CRC 0x65 0xE2 => CRC: 65-00=65 E2-00=E2
|
||||||
|
RX ID: \x00\xFF\x2D\x1A\x49\xFE CRC 0x65 0xE3 => CRC: 65-00=65 E2-FF=E3
|
||||||
|
RX ID: \xFF\x00\x2D\x1A\x49\xFE CRC 0x66 0xE2 => CRC: 65-FF=66 E2-00=E2
|
||||||
*/
|
*/
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -35,6 +35,8 @@
|
|||||||
// flags going to packet[2]
|
// flags going to packet[2]
|
||||||
#define V911S_FLAG_CALIB 0x01
|
#define V911S_FLAG_CALIB 0x01
|
||||||
#define A220_FLAG_6G3D 0x04
|
#define A220_FLAG_6G3D 0x04
|
||||||
|
#define A280_FLAG_6GSENIOR 0x08
|
||||||
|
#define A280_FLAG_LIGHT 0x20
|
||||||
|
|
||||||
static void __attribute__((unused)) V911S_send_packet()
|
static void __attribute__((unused)) V911S_send_packet()
|
||||||
{
|
{
|
||||||
@@ -74,7 +76,9 @@ static void __attribute__((unused)) V911S_send_packet()
|
|||||||
{
|
{
|
||||||
packet[ 1]=GET_FLAG(!CH6_SW,E119_FLAG_EXPERT) // short press on left button
|
packet[ 1]=GET_FLAG(!CH6_SW,E119_FLAG_EXPERT) // short press on left button
|
||||||
|GET_FLAG( CH5_SW,E119_FLAG_CALIB); // short press on right button
|
|GET_FLAG( CH5_SW,E119_FLAG_CALIB); // short press on right button
|
||||||
packet[ 2]=GET_FLAG( CH7_SW,A220_FLAG_6G3D); // short press on right button
|
packet[ 2]=GET_FLAG( CH7_SW,A220_FLAG_6G3D) // short press on right button
|
||||||
|
|GET_FLAG( CH8_SW,A280_FLAG_6GSENIOR) // -100% - 6G, +100% - Senior mode (turn off gyro)
|
||||||
|
|GET_FLAG( CH9_SW,A280_FLAG_LIGHT); // cycle the light through on-flash-off when the CH9 value is changed from -100% to 100%
|
||||||
}
|
}
|
||||||
|
|
||||||
//packet[3..6]=trims TAER signed
|
//packet[3..6]=trims TAER signed
|
||||||
|
|||||||
@@ -341,6 +341,7 @@
|
|||||||
#endif
|
#endif
|
||||||
#if ( not defined(CC2500_INSTALLED) && not defined(NRF24L01_INSTALLED) ) || defined MULTI_EU
|
#if ( not defined(CC2500_INSTALLED) && not defined(NRF24L01_INSTALLED) ) || defined MULTI_EU
|
||||||
#undef BLUEFLY_CCNRF_INO
|
#undef BLUEFLY_CCNRF_INO
|
||||||
|
#undef BUMBLEB_CCNRF_INO
|
||||||
#undef GD00X_CCNRF_INO
|
#undef GD00X_CCNRF_INO
|
||||||
#undef KF606_CCNRF_INO
|
#undef KF606_CCNRF_INO
|
||||||
#undef MJXQ_CCNRF_INO
|
#undef MJXQ_CCNRF_INO
|
||||||
|
|||||||
@@ -1390,9 +1390,11 @@ Models: WLtoys V911S, XK A110
|
|||||||
### Sub_protocol E119 - *1*
|
### Sub_protocol E119 - *1*
|
||||||
Models: Eachine E119, JJRC W01-J3, XK A220 P-40, XK A800 R2, F959S R2, A160 R2, A280
|
Models: Eachine E119, JJRC W01-J3, XK A220 P-40, XK A800 R2, F959S R2, A160 R2, A280
|
||||||
|
|
||||||
CH1|CH2|CH3|CH4|CH5|CH6|CH7
|
CH1|CH2|CH3|CH4|CH5|CH6|CH7|CH8|CH9
|
||||||
---|---|---|---|---|---|---
|
---|---|---|---|---|---|---|---|---
|
||||||
A|E|T|R|CALIB|RATE|6G_3D
|
A|E|T|R|CALIB|RATE|6G_3D|6GSENIOR|LIGHT
|
||||||
|
|
||||||
|
A280 -> 6GSENIOR: -100% - 6G, +100% - Senior mode (turn off gyro), LIGHT: cycle the light through on-flash-off when the CH9 value is changed from -100% to 100%
|
||||||
|
|
||||||
## XK - *62*
|
## XK - *62*
|
||||||
|
|
||||||
@@ -1993,7 +1995,7 @@ AUTO: Land=-100% Takeoff=+100%
|
|||||||
The model can work with a none centered throttle.
|
The model can work with a none centered throttle.
|
||||||
|
|
||||||
## Tiger - *61*
|
## Tiger - *61*
|
||||||
Models: WLToys 124016, 124017, 144010 and Eachine EAT14
|
Models: Tiger Drone 1400782, WLToys 124016 / 124017 / 144010 and Eachine EAT14
|
||||||
|
|
||||||
Autobind protocol
|
Autobind protocol
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user