Merge branch 'master' into bayang-analog-aux

This commit is contained in:
BrianQuad 2019-03-02 06:50:35 -07:00
commit a9ec113cd3
9 changed files with 150 additions and 34 deletions

View File

@ -33,8 +33,14 @@
#define E015_PACKET_SIZE 10 #define E015_PACKET_SIZE 10
#define E015_BIND_PACKET_SIZE 9 #define E015_BIND_PACKET_SIZE 9
#define E016H_PACKET_PERIOD 4080
#define E016H_PACKET_SIZE 10
#define E016H_BIND_CHANNEL 80
#define E016H_NUM_CHANNELS 4
//Channels //Channels
#define E01X_ARM_SW CH5_SW #define E01X_ARM_SW CH5_SW
#define E016H_STOP_SW CH5_SW
#define E01X_FLIP_SW CH6_SW #define E01X_FLIP_SW CH6_SW
#define E01X_LED_SW CH7_SW #define E01X_LED_SW CH7_SW
#define E01X_HEADLESS_SW CH8_SW #define E01X_HEADLESS_SW CH8_SW
@ -58,6 +64,16 @@
#define E015_FLAG_EXPERT 0x02 #define E015_FLAG_EXPERT 0x02
#define E015_FLAG_INTERMEDIATE 0x01 #define E015_FLAG_INTERMEDIATE 0x01
// E016H flags packet[1]
#define E016H_FLAG_STOP 0x20
#define E016H_FLAG_FLIP 0x04
// E016H flags packet[3]
#define E016H_FLAG_HEADLESS 0x10
#define E016H_FLAG_RTH 0x04
// E016H flags packet[7]
#define E016H_FLAG_TAKEOFF 0x80
#define E016H_FLAG_HIGHRATE 0x08
static void __attribute__((unused)) E015_check_arming() static void __attribute__((unused)) E015_check_arming()
{ {
uint8_t arm_channel = E01X_ARM_SW; uint8_t arm_channel = E01X_ARM_SW;
@ -80,6 +96,7 @@ static void __attribute__((unused)) E015_check_arming()
static void __attribute__((unused)) E01X_send_packet(uint8_t bind) static void __attribute__((unused)) E01X_send_packet(uint8_t bind)
{ {
uint8_t can_flip = 0;
if(sub_protocol==E012) if(sub_protocol==E012)
{ {
packet_length=E012_PACKET_SIZE; packet_length=E012_PACKET_SIZE;
@ -114,7 +131,7 @@ static void __attribute__((unused)) E01X_send_packet(uint8_t bind)
packet[13] = 0x56; packet[13] = 0x56;
packet[14] = rx_tx_addr[2]; packet[14] = rx_tx_addr[2];
} }
else else if(sub_protocol==E015)
{ // E015 { // E015
if(bind) if(bind)
{ {
@ -152,8 +169,57 @@ static void __attribute__((unused)) E01X_send_packet(uint8_t bind)
packet_length=E015_PACKET_SIZE; packet_length=E015_PACKET_SIZE;
} }
} }
else
{ // E016H
packet_length=E016H_PACKET_SIZE;
if(bind)
{
rf_ch_num=E016H_BIND_CHANNEL;
memcpy(packet, &rx_tx_addr[1], 4);
memcpy(&packet[4], hopping_frequency, 4);
packet[8] = 0x23;
}
else
{
// trim commands
packet[0] = 0;
// aileron
uint16_t val = convert_channel_16b_limit(AILERON, 0x3ff, 0);
can_flip |= (val < 0x100) || (val > 0x300);
packet[1] = val >> 8;
packet[2] = val & 0xff;
// elevator
val = convert_channel_16b_limit(ELEVATOR, 0x3ff, 0);
can_flip |= (val < 0x100) || (val > 0x300);
packet[3] = val >> 8;
packet[4] = val & 0xff;
// throttle
val = convert_channel_16b_limit(THROTTLE, 0, 0x3ff);
packet[5] = val >> 8;
packet[6] = val & 0xff;
// rudder
val = convert_channel_16b_limit(RUDDER, 0x3ff, 0);
packet[7] = val >> 8;
packet[8] = val & 0xff;
// flags
packet[1] |= GET_FLAG(E016H_STOP_SW, E016H_FLAG_STOP)
| (can_flip ? GET_FLAG(E01X_FLIP_SW, E016H_FLAG_FLIP) : 0);
packet[3] |= GET_FLAG(E01X_HEADLESS_SW, E016H_FLAG_HEADLESS)
| GET_FLAG(E01X_RTH_SW, E016H_FLAG_RTH);
packet[7] |= E016H_FLAG_HIGHRATE;
// frequency hopping
rf_ch_num=hopping_frequency[hopping_frequency_no++ & 0x03];
}
// checksum
packet[9] = packet[0];
for (uint8_t i=1; i < E016H_PACKET_SIZE-1; i++)
packet[9] += packet[i];
}
// Power on, TX mode, CRC enabled // Power on, TX mode, CRC enabled
if(sub_protocol==E016H)
XN297_Configure(BV(NRF24L01_00_EN_CRC) | BV(NRF24L01_00_CRCO) | BV(NRF24L01_00_PWR_UP));
else //E012 & E015
HS6200_Configure(_BV(NRF24L01_00_EN_CRC) | _BV(NRF24L01_00_CRCO) | _BV(NRF24L01_00_PWR_UP)); HS6200_Configure(_BV(NRF24L01_00_EN_CRC) | _BV(NRF24L01_00_CRCO) | _BV(NRF24L01_00_PWR_UP));
NRF24L01_WriteReg(NRF24L01_05_RF_CH, rf_ch_num); NRF24L01_WriteReg(NRF24L01_05_RF_CH, rf_ch_num);
@ -175,8 +241,10 @@ static void __attribute__((unused)) E01X_init()
NRF24L01_SetTxRxMode(TX_EN); NRF24L01_SetTxRxMode(TX_EN);
if(sub_protocol==E012) if(sub_protocol==E012)
HS6200_SetTXAddr((uint8_t *)"\x55\x42\x9C\x8F\xC9", E01X_ADDRESS_LENGTH); HS6200_SetTXAddr((uint8_t *)"\x55\x42\x9C\x8F\xC9", E01X_ADDRESS_LENGTH);
else // E015 else if(sub_protocol==E015)
HS6200_SetTXAddr((uint8_t *)"\x62\x54\x79\x38\x53", E01X_ADDRESS_LENGTH); HS6200_SetTXAddr((uint8_t *)"\x62\x54\x79\x38\x53", E01X_ADDRESS_LENGTH);
else //E016H
XN297_SetTXAddr((uint8_t *)"\x5a\x53\x46\x30\x31", 5); // bind address
NRF24L01_FlushTx(); NRF24L01_FlushTx();
NRF24L01_FlushRx(); NRF24L01_FlushRx();
NRF24L01_WriteReg(NRF24L01_07_STATUS, 0x70); // Clear data ready, data sent, and retransmit NRF24L01_WriteReg(NRF24L01_07_STATUS, 0x70); // Clear data ready, data sent, and retransmit
@ -197,7 +265,10 @@ uint16_t E01X_callback()
{ {
if (bind_counter == 0) if (bind_counter == 0)
{ {
HS6200_SetTXAddr(rx_tx_addr, 5); if(sub_protocol==E016H)
XN297_SetTXAddr(rx_tx_addr, E01X_ADDRESS_LENGTH);
else
HS6200_SetTXAddr(rx_tx_addr, E01X_ADDRESS_LENGTH);
BIND_DONE; BIND_DONE;
} }
else else
@ -216,7 +287,25 @@ static void __attribute__((unused)) E012_initialize_txid()
// rf channels // rf channels
uint32_t lfsr=random(0xfefefefe); uint32_t lfsr=random(0xfefefefe);
for(uint8_t i=0; i<E012_NUM_RF_CHANNELS; i++) for(uint8_t i=0; i<E012_NUM_RF_CHANNELS; i++)
hopping_frequency[i] = 0x10 + (((lfsr >> (i*8)) & 0xff) % 0x32); {
hopping_frequency[i] = 0x10 + ((lfsr & 0xff) % 0x32);
lfsr>>=8;
}
}
static void __attribute__((unused)) E016H_initialize_txid()
{
// tx id
rx_tx_addr[0] = 0xa5;
rx_tx_addr[1] = 0x00;
// rf channels
uint32_t lfsr=random(0xfefefefe);
for(uint8_t i=0; i<E016H_NUM_CHANNELS; i++)
{
hopping_frequency[i] = (lfsr & 0xFF) % 80;
lfsr>>=8;
}
} }
uint16_t initE01X() uint16_t initE01X()
@ -227,14 +316,19 @@ uint16_t initE01X()
E012_initialize_txid(); E012_initialize_txid();
packet_period=E012_PACKET_PERIOD; packet_period=E012_PACKET_PERIOD;
} }
else else if(sub_protocol==E015)
{ // E015 {
packet_period=E015_PACKET_PERIOD; packet_period=E015_PACKET_PERIOD;
rf_ch_num=E015_RF_CHANNEL; rf_ch_num=E015_RF_CHANNEL;
armed = 0; armed = 0;
arm_flags = 0; arm_flags = 0;
arm_channel_previous = E01X_ARM_SW; arm_channel_previous = E01X_ARM_SW;
} }
else
{ // E016H
E016H_initialize_txid();
packet_period=E016H_PACKET_PERIOD;
}
E01X_init(); E01X_init();
bind_counter = E01X_BIND_COUNT; bind_counter = E01X_BIND_COUNT;
hopping_frequency_no = 0; hopping_frequency_no = 0;

View File

@ -42,7 +42,7 @@
42,BUGSMINI 42,BUGSMINI
43,Traxxas 43,Traxxas
44,NCC1701 44,NCC1701
45,E01X,E012,E015 45,E01X,E012,E015,E016H
46,V911S 46,V911S
47,GD00X 47,GD00X
63,Test 63,Test

View File

@ -19,7 +19,7 @@
#define VERSION_MAJOR 1 #define VERSION_MAJOR 1
#define VERSION_MINOR 2 #define VERSION_MINOR 2
#define VERSION_REVISION 1 #define VERSION_REVISION 1
#define VERSION_PATCH_LEVEL 23 #define VERSION_PATCH_LEVEL 27
//****************** //******************
// Protocols // Protocols
@ -254,6 +254,7 @@ enum E01X
{ {
E012 = 0, E012 = 0,
E015 = 1, E015 = 1,
E016H = 2,
}; };
#define NONE 0 #define NONE 0
@ -727,6 +728,7 @@ Serial: 100000 Baud 8e2 _ xxxx xxxx p --
sub_protocol==E01X sub_protocol==E01X
E012 0 E012 0
E015 1 E015 1
E016H 2
Power value => 0x80 0=High/1=Low Power value => 0x80 0=High/1=Low
Stream[3] = option_protocol; Stream[3] = option_protocol;

View File

@ -618,7 +618,7 @@ void HS6200_WritePayload(uint8_t* msg, uint8_t len)
} }
NRF24L01_WritePayload(payload, pos); NRF24L01_WritePayload(payload, pos);
delayMicroseconds(option); delayMicroseconds(option+20);
NRF24L01_WritePayload(payload, pos); NRF24L01_WritePayload(payload, pos);
} }
// //

View File

@ -59,7 +59,7 @@ static void __attribute__((unused)) V911S_send_packet(uint8_t bind)
packet[ 0]=(rf_ch_num<<3)|channel; packet[ 0]=(rf_ch_num<<3)|channel;
packet[ 1]=V911S_FLAG_EXPERT; // short press on left button packet[ 1]=V911S_FLAG_EXPERT; // short press on left button
packet[ 2]=GET_FLAG(CH5_SW,V911S_FLAG_CALIB); // long press on right button packet[ 2]=GET_FLAG(CH5_SW,V911S_FLAG_CALIB); // long press on right button
memset(packet+3,0x00,14); memset(packet+3, 0x00, V911S_PACKET_SIZE - 3);
//packet[3..6]=trims TAER signed //packet[3..6]=trims TAER signed
uint16_t ch=convert_channel_16b_limit(THROTTLE ,0,0x7FF); uint16_t ch=convert_channel_16b_limit(THROTTLE ,0,0x7FF);
packet[ 7] = ch; packet[ 7] = ch;

View File

@ -502,6 +502,7 @@ const PPM_Parameters PPM_prot[14*NBR_BANKS]= {
PROTO_E01X PROTO_E01X
E012 E012
E015 E015
E016H
PROTO_ESKY PROTO_ESKY
NONE NONE
PROTO_ESKY150 PROTO_ESKY150

View File

@ -79,7 +79,7 @@ CFlie|38|CFlie||||||||NRF24L01
[Devo](Protocols_Details.md#DEVO---7)|7|Devo||||||||CYRF6936 [Devo](Protocols_Details.md#DEVO---7)|7|Devo||||||||CYRF6936
[DM002](Protocols_Details.md#DM002---33)|33|DM002||||||||NRF24L01 [DM002](Protocols_Details.md#DM002---33)|33|DM002||||||||NRF24L01
[DSM](Protocols_Details.md#DSM---6)|6|DSM2-22|DSM2-11|DSMX-22|DSMX-11|AUTO||||CYRF6936 [DSM](Protocols_Details.md#DSM---6)|6|DSM2-22|DSM2-11|DSMX-22|DSMX-11|AUTO||||CYRF6936
[E01X](Protocols_Details.md#E01X---45)|45|E012|E015|||||||NRF24L01 [E01X](Protocols_Details.md#E01X---45)|45|E012|E015|E016H||||||NRF24L01
[ESky](Protocols_Details.md#ESKY---16)|16|ESky||||||||NRF24L01 [ESky](Protocols_Details.md#ESKY---16)|16|ESky||||||||NRF24L01
[ESky150](Protocols_Details.md#ESKY150---35)|35|ESKY150||||||||NRF24L01 [ESky150](Protocols_Details.md#ESKY150---35)|35|ESKY150||||||||NRF24L01
[Flysky](Protocols_Details.md#FLYSKY---1)|1|Flysky|V9x9|V6x6|V912|CX20||||A7105 [Flysky](Protocols_Details.md#FLYSKY---1)|1|Flysky|V9x9|V6x6|V912|CX20||||A7105
@ -674,6 +674,8 @@ Autobind protocol
### Sub_protocol E012 - *0* ### Sub_protocol E012 - *0*
Models: Eachine E012 Models: Eachine E012
This protocol has been reported to not work properly due to the emulation of the HS6200 RF component using the NRF24L01. The option value is used to adjust the timing, try every values between -127 and +127. If it works please report which value you've used.
CH1|CH2|CH3|CH4|CH5|CH6|CH7|CH8|CH9 CH1|CH2|CH3|CH4|CH5|CH6|CH7|CH8|CH9
---|---|---|---|---|---|---|---|--- ---|---|---|---|---|---|---|---|---
A|E|T|R||FLIP||HEADLESS|RTH A|E|T|R||FLIP||HEADLESS|RTH
@ -681,10 +683,19 @@ A|E|T|R||FLIP||HEADLESS|RTH
### Sub_protocol E015 - *1* ### Sub_protocol E015 - *1*
Models: Eachine E015 Models: Eachine E015
This protocol has been reported to not work properly due to the emulation of the HS6200 RF component using the NRF24L01. The option value is used to adjust the timing, try every values between -127 and +127. If it works please report which value you've used.
CH1|CH2|CH3|CH4|CH5|CH6|CH7|CH8|CH9 CH1|CH2|CH3|CH4|CH5|CH6|CH7|CH8|CH9
---|---|---|---|---|---|---|---|--- ---|---|---|---|---|---|---|---|---
A|E|T|R|ARM|FLIP|LED|HEADLESS|RTH A|E|T|R|ARM|FLIP|LED|HEADLESS|RTH
### Sub_protocol E016H - *2*
Models: Eachine E016H
CH1|CH2|CH3|CH4|CH5|CH6|CH7|CH8|CH9
---|---|---|---|---|---|---|---|---
A|E|T|R|STOP|FLIP|-|HEADLESS|RTH
## ESKY - *16* ## ESKY - *16*
CH1|CH2|CH3|CH4|CH5|CH6 CH1|CH2|CH3|CH4|CH5|CH6
@ -718,6 +729,8 @@ A|E|T|R|FLIP|RTH|HEADLESS|EXPERT
## GD00X - *47* ## GD00X - *47*
Model: GD005 C-17 Transport and GD006 DA62 Model: GD005 C-17 Transport and GD006 DA62
If the model does not respond well to inputs or hard to bind, you can try to set Power to Low. But 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 used and nothing we can do about it in the firmware.
CH1|CH2|CH3|CH4|CH5|CH6 CH1|CH2|CH3|CH4|CH5|CH6
---|---|---|---|---|--- ---|---|---|---|---|---
A||T||TRIM|LED A||T||TRIM|LED
@ -823,7 +836,8 @@ Only 3 TX IDs available, change RX_Num value 0..2 to cycle through them
### Sub_protocol E010 - *4* ### Sub_protocol E010 - *4*
15 TX IDs available, change RX_Num value 0..14 to cycle through them 15 TX IDs available, change RX_Num value 0..14 to cycle through them
If the E010 does not respond well to inputs or hard to bind, set Power to Low. If the model does not respond well to inputs or hard to bind, you can try to set Power to Low. But 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 used and nothing we can do about it in the firmware.
### Sub_protocol H26WH - *5* ### Sub_protocol H26WH - *5*
CH6| CH6|
---| ---|
@ -845,6 +859,9 @@ Models: Eachine H7, Cheerson CX023
### Sub_protocol YZ - *2* ### Sub_protocol YZ - *2*
Model: Yi Zhan i6S Model: Yi Zhan i6S
Only one model can be flown at the same time since the ID is hardcoded. Only one model can be flown at the same time since the ID is hardcoded.
If the model does not respond well to inputs or hard to bind, you can try to set Power to Low. But 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 used and nothing we can do about it in the firmware.
### Sub_protocol LS - *3* ### Sub_protocol LS - *3*
Models: LS114, 124, 215 Models: LS114, 124, 215
@ -898,7 +915,7 @@ CH1|CH2|CH3|CH4
A|E|T|R A|E|T|R
### Sub_protocol Q303 - *0* ### Sub_protocol Q303 - *0*
Q303 warning: this sub_protocol is known to not work at all/properly with 4in1 RF modules. If the model does not respond well to inputs or hard to bind, you can try to set Power to Low. But 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 used and nothing we can do about it in the firmware.
CH5|CH6|CH7|CH8|CH9|CH10|CH11 CH5|CH6|CH7|CH8|CH9|CH10|CH11
---|---|---|---|---|---|--- ---|---|---|---|---|---|---
@ -1042,7 +1059,9 @@ CH10|CH11|CH12
Start/Stop|EMERGENCY|CAMERA_UP/DN Start/Stop|EMERGENCY|CAMERA_UP/DN
## V911S - *46* ## V911S - *46*
Model: WLtoys V911S Models: WLtoys V911S, XK A110
If the model does not respond well to inputs or hard to bind, you can try to set Power to Low. But 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 used and nothing we can do about it in the firmware.
CH1|CH2|CH3|CH4|CH5 CH1|CH2|CH3|CH4|CH5
---|---|---|---|--- ---|---|---|---|---

View File

@ -192,7 +192,7 @@ In order for the module to be correctly identified it is necessary and only once
##### Windows XP or older ##### Windows XP or older
1. Download and install the legacy Windows XP drivers from [here](https://github.com/rogerclarkmelbourne/Arduino_STM32/tree/master/drivers/win/win_xp_legacy) 1. Download and install the legacy Windows XP drivers from [here](https://github.com/rogerclarkmelbourne/Arduino_STM32/tree/master/drivers/win/win_xp_legacy)
**NOTE:** If you have installed the drivers and your module is not detected as a Maple device it most likely does not have a USB bootloader installed. Ready-made modules from Banggood **do not** come with a USB bootloader installed. You will need to follow the procedure to [Burn a USB bootloader](#burn-the-bootloader) before you can upload firmware. **NOTE:** If you have installed the drivers and your module is not detected as a Maple device it most likely does not have a USB bootloader installed. Ready-made modules from Banggood **do not** come with a USB bootloader installed. You will need to follow the procedure to [Burn a USB bootloader](#upload-via-serial-inc-bootloader-ftdi) before you can upload firmware.
##### Mac OS X ##### Mac OS X
Uploading via USB requires the [libusb library](https://libusb.info/) to be installed. The easiest way to install the library is using the [Homebrew package manager for macOS](https://brew.sh/) by executing the two lines given below in a Terminal. Uploading via USB requires the [libusb library](https://libusb.info/) to be installed. The easiest way to install the library is using the [Homebrew package manager for macOS](https://brew.sh/) by executing the two lines given below in a Terminal.