From 70db505dd9bd0f1db43bdde77bda032414711953 Mon Sep 17 00:00:00 2001 From: Pascal Langer Date: Wed, 3 Jan 2018 13:04:58 +0100 Subject: [PATCH] New Corona protocol and autobind bug fix --- Multiprotocol/A7105_SPI.ino | 2 +- Multiprotocol/AFHDS2A_a7105.ino | 2 +- Multiprotocol/ASSAN_nrf24l01.ino | 2 +- Multiprotocol/Bayang_nrf24l01.ino | 2 +- Multiprotocol/CABELL_nrf224l01.ino | 8 +- Multiprotocol/CC2500_SPI.ino | 2 +- Multiprotocol/CG023_nrf24l01.ino | 2 +- Multiprotocol/CYRF6936_SPI.ino | 2 +- Multiprotocol/Corona_cc2500.ino | 230 +++++++++++++++++++++++++++++ Multiprotocol/DM002_nrf24l01.ino | 2 +- Multiprotocol/DSM_cyrf6936.ino | 3 +- Multiprotocol/Devo_cyrf6936.ino | 4 +- Multiprotocol/ESky150_nrf24l01.ino | 4 +- Multiprotocol/ESky_nrf24l01.ino | 4 +- Multiprotocol/FlySky_a7105.ino | 2 +- Multiprotocol/FrSkyD_cc2500.ino | 4 +- Multiprotocol/FrSkyV_cc2500.ino | 2 +- Multiprotocol/FrSkyX_cc2500.ino | 4 +- Multiprotocol/H8_3D_nrf24l01.ino | 2 +- Multiprotocol/Hisky_nrf24l01.ino | 2 +- Multiprotocol/Hubsan_a7105.ino | 2 +- Multiprotocol/J6Pro_cyrf6936.ino | 2 +- Multiprotocol/KN_nrf24l01.ino | 2 +- Multiprotocol/MJXQ_nrf24l01.ino | 2 +- Multiprotocol/MT99xx_nrf24l01.ino | 2 +- Multiprotocol/Multi.txt | 2 + Multiprotocol/Multiprotocol.h | 15 +- Multiprotocol/Multiprotocol.ino | 87 +++++++---- Multiprotocol/NRF24l01_SPI.ino | 2 +- Multiprotocol/Q303_nrf24l01.ino | 2 +- Multiprotocol/SHENQI_nrf24l01.ino | 2 +- Multiprotocol/SPI.ino | 7 + Multiprotocol/Telemetry.ino | 3 +- Multiprotocol/V2X2_nrf24l01.ino | 2 +- Multiprotocol/Validate.h | 6 + Multiprotocol/WK2x01_cyrf6936.ino | 4 +- Multiprotocol/YD717_nrf24l01.ino | 2 +- Multiprotocol/_Config.h | 14 +- 38 files changed, 366 insertions(+), 77 deletions(-) create mode 100644 Multiprotocol/Corona_cc2500.ino diff --git a/Multiprotocol/A7105_SPI.ino b/Multiprotocol/A7105_SPI.ino index a8da2ad..2a92464 100644 --- a/Multiprotocol/A7105_SPI.ino +++ b/Multiprotocol/A7105_SPI.ino @@ -145,7 +145,7 @@ static void A7105_SetPower_Value(int power) void A7105_SetPower() { uint8_t power=A7105_BIND_POWER; - if(IS_BIND_DONE_on) + if(IS_BIND_DONE) #ifdef A7105_ENABLE_LOW_POWER power=IS_POWER_FLAG_on?A7105_HIGH_POWER:A7105_LOW_POWER; #else diff --git a/Multiprotocol/AFHDS2A_a7105.ino b/Multiprotocol/AFHDS2A_a7105.ino index 15fa0cf..773c15a 100644 --- a/Multiprotocol/AFHDS2A_a7105.ino +++ b/Multiprotocol/AFHDS2A_a7105.ino @@ -350,7 +350,7 @@ uint16_t initAFHDS2A() AFHDS2A_calc_channels(); packet_count = 0; bind_phase = 0; - if(IS_AUTOBIND_FLAG_on) + if(IS_BIND_IN_PROGRESS) phase = AFHDS2A_BIND1; else { diff --git a/Multiprotocol/ASSAN_nrf24l01.ino b/Multiprotocol/ASSAN_nrf24l01.ino index 2435bab..aa34ac0 100644 --- a/Multiprotocol/ASSAN_nrf24l01.ino +++ b/Multiprotocol/ASSAN_nrf24l01.ino @@ -175,7 +175,7 @@ uint16_t initASSAN() ASSAN_init(); hopping_frequency_no = 0; - if(IS_AUTOBIND_FLAG_on) + if(IS_BIND_IN_PROGRESS) phase=ASSAN_BIND0; else phase=ASSAN_DATA0; diff --git a/Multiprotocol/Bayang_nrf24l01.ino b/Multiprotocol/Bayang_nrf24l01.ino index 0661625..92241e8 100644 --- a/Multiprotocol/Bayang_nrf24l01.ino +++ b/Multiprotocol/Bayang_nrf24l01.ino @@ -247,7 +247,7 @@ static void __attribute__((unused)) BAYANG_init() uint16_t BAYANG_callback() { - if(IS_BIND_DONE_on) + if(IS_BIND_DONE) { if(packet_count==0) BAYANG_send_packet(0); diff --git a/Multiprotocol/CABELL_nrf224l01.ino b/Multiprotocol/CABELL_nrf224l01.ino index 6c50ba8..2741feb 100644 --- a/Multiprotocol/CABELL_nrf224l01.ino +++ b/Multiprotocol/CABELL_nrf224l01.ino @@ -332,7 +332,7 @@ static void __attribute__((unused)) CABELL_setAddress() // Serial.print("NORM ID: ");Serial.print((uint32_t)(CABELL_normal_addr>>32)); Serial.print(" ");Serial.println((uint32_t)((CABELL_normal_addr<<32)>>32)); - if (IS_BIND_DONE_on) + if (IS_BIND_DONE) { CABELL_addr = (((uint64_t)rx_tx_addr[0]) << 32) + (((uint64_t)rx_tx_addr[1]) << 24) + @@ -386,7 +386,7 @@ static void CABELL_SetPower() // This over-ride the standard Set Power to all // Note that on many modules max power may actually be worse than the normal high power setting // test and only use max if it helps the range { - if(IS_BIND_DONE_on && !IS_RANGE_FLAG_on && ((option & CABELL_OPTION_MASK_MAX_POWER_OVERRIDE) != 0)) + if(IS_BIND_DONE && !IS_RANGE_FLAG_on && ((option & CABELL_OPTION_MASK_MAX_POWER_OVERRIDE) != 0)) { // If we are not in range or bind mode and power setting override is in effect, then set max power, else standard power logic if(prev_power != NRF_POWER_3) // prev_power is global variable for NRF24L01; NRF_POWER_3 is max power { @@ -403,7 +403,7 @@ static void CABELL_SetPower() // This over-ride the standard Set Power to all //----------------------------------------------------------------------------------------- uint16_t CABELL_callback() { - if (IS_BIND_DONE_on) + if (IS_BIND_DONE) { CABELL_send_packet(0); // packet_period is set/adjusted in CABELL_send_packet return packet_period; @@ -424,7 +424,7 @@ uint16_t CABELL_callback() //----------------------------------------------------------------------------------------- uint16_t initCABELL(void) { - if (IS_BIND_DONE_on) + if (IS_BIND_DONE) bind_counter = 0; else bind_counter = CABELL_BIND_COUNT; diff --git a/Multiprotocol/CC2500_SPI.ino b/Multiprotocol/CC2500_SPI.ino index 00fa551..af726ca 100644 --- a/Multiprotocol/CC2500_SPI.ino +++ b/Multiprotocol/CC2500_SPI.ino @@ -144,7 +144,7 @@ static void CC2500_SetPower_Value(uint8_t power) void CC2500_SetPower() { uint8_t power=CC2500_BIND_POWER; - if(IS_BIND_DONE_on) + if(IS_BIND_DONE) #ifdef CC2500_ENABLE_LOW_POWER power=IS_POWER_FLAG_on?CC2500_HIGH_POWER:CC2500_LOW_POWER; #else diff --git a/Multiprotocol/CG023_nrf24l01.ino b/Multiprotocol/CG023_nrf24l01.ino index 870fda6..6cd4a96 100644 --- a/Multiprotocol/CG023_nrf24l01.ino +++ b/Multiprotocol/CG023_nrf24l01.ino @@ -137,7 +137,7 @@ static void __attribute__((unused)) CG023_init() uint16_t CG023_callback() { - if(IS_BIND_DONE_on) + if(IS_BIND_DONE) CG023_send_packet(0); else { diff --git a/Multiprotocol/CYRF6936_SPI.ino b/Multiprotocol/CYRF6936_SPI.ino index 276e8bb..bcc0d6c 100644 --- a/Multiprotocol/CYRF6936_SPI.ino +++ b/Multiprotocol/CYRF6936_SPI.ino @@ -136,7 +136,7 @@ static void CYRF_SetPower_Value(uint8_t power) void CYRF_SetPower(uint8_t val) { uint8_t power=CYRF_BIND_POWER; - if(IS_BIND_DONE_on) + if(IS_BIND_DONE) #ifdef CYRF6936_ENABLE_LOW_POWER power=IS_POWER_FLAG_on?CYRF_HIGH_POWER:CYRF_LOW_POWER; #else diff --git a/Multiprotocol/Corona_cc2500.ino b/Multiprotocol/Corona_cc2500.ino new file mode 100644 index 0000000..c3a46ee --- /dev/null +++ b/Multiprotocol/Corona_cc2500.ino @@ -0,0 +1,230 @@ +/* + 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 . + */ + +#if defined(CORONA_CC2500_INO) + +#include "iface_cc2500.h" + +//#define CORONA_FORCE_ID + +#define CORONA_RF_NUM_CHANNELS 3 +#define CORONA_ADDRESS_LENGTH 4 +#define CORONA_BIND_CHANNEL_V1 0xD1 +#define CORONA_BIND_CHANNEL_V2 0xB8 +#define CORONA_COARSE 0x00 + + +const PROGMEM uint8_t CORONA_init_values[] = { + /* 00 */ 0x29, 0x2E, 0x06, 0x07, 0xD3, 0x91, 0xFF, 0x04, + /* 08 */ 0x05, 0x00, CORONA_BIND_CHANNEL_V1, 0x06, 0x00, 0x5C, 0x4E, 0xC4 + CORONA_COARSE, + /* 10 */ 0x5B, 0xF8, 0x03, 0x23, 0xF8, 0x47, 0x07, 0x30, + /* 18 */ 0x18, 0x16, 0x6C, 0x43, 0x40, 0x91, 0x87, 0x6B, + /* 20 */ 0xF8, 0x56, 0x10, 0xA9, 0x0A, 0x00, 0x11, 0x41, + /* 28 */ 0x00, 0x59, 0x7F, 0x3F, 0x81, 0x35, 0x0B +}; + +static void __attribute__((unused)) CORONA_rf_init() +{ + CC2500_Strobe(CC2500_SIDLE); + + for (uint8_t i = 0; i <= 0x2E; ++i) + CC2500_WriteReg(i, pgm_read_byte_near(&CORONA_init_values[i])); + if(sub_protocol!=COR_V1) + { + CC2500_WriteReg(CC2500_0A_CHANNR, CORONA_BIND_CHANNEL_V2); + CC2500_WriteReg(CC2500_0E_FREQ1, 0x80); + CC2500_WriteReg(CC2500_0F_FREQ0, 0x00 + CORONA_COARSE); + CC2500_WriteReg(CC2500_15_DEVIATN, 0x50); + CC2500_WriteReg(CC2500_17_MCSM1, 0x00); + CC2500_WriteReg(CC2500_1B_AGCCTRL2, 0x67); + CC2500_WriteReg(CC2500_1C_AGCCTRL1, 0xFB); + CC2500_WriteReg(CC2500_1D_AGCCTRL0, 0xDC); + } + + prev_option = option; + CC2500_WriteReg(CC2500_0C_FSCTRL0, option); + + //not sure what they are doing to the PATABLE since basically only the first byte is used and it's only 8 bytes long. So I think they end up filling the PATABLE fully with 0xFF + CC2500_WriteRegisterMulti(CC2500_3E_PATABLE,(const uint8_t *)"\x08\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF", 13); + + CC2500_SetTxRxMode(TX_EN); + CC2500_SetPower(); +} + +// Generate id and hopping freq +static void __attribute__((unused)) CORONA_init() +{ + #ifdef CORONA_FORCE_ID + // Example of ID and channels taken from dumps + if(sub_protocol==COR_V1) + { + memcpy((void *)rx_tx_addr,(void *)"\x1F\xFE\x6C\x35",CORONA_ADDRESS_LENGTH); + memcpy((void *)hopping_frequency,(void *)"\x17\x0D\x03\x49",CORONA_RF_NUM_CHANNELS+1); + } + else + { + memcpy((void *)rx_tx_addr,(void *)"\xFE\xFE\x02\xFB",CORONA_ADDRESS_LENGTH); + memcpy((void *)hopping_frequency,(void *)"\x14\x3D\x35",CORONA_RF_NUM_CHANNELS); + } + #else + // From dumps channels are anything between 0x00 and 0xC5 on V1. + // But 0x00 and 0xB8 should be avoided on V2 since they are used for bind. + // Below code make sure channels are between 0x02 and 0xA0, spaced with a minimum of 2 and not ordered (RX only use the 1st channel unless there is an issue). + uint8_t order=rx_tx_addr[3]&0x03; + for(uint8_t i=0; i>1)] |= (i&0x01)?(Servo_data[i]>>4)&0xF0:(Servo_data[i]>>8)&0x0F; + } + + //TX ID + for(uint8_t i=0; iNRF24L01 MODE_ESKY150 = 35, // =>NRF24L01 MODE_H8_3D = 36, // =>NRF24L01 + MODE_CORONA = 37, // =>CC2500 }; enum Flysky @@ -219,6 +220,11 @@ enum H8_3D H20MINI = 2, H30MINI = 3, }; +enum CORONA +{ + COR_V1 = 0, + COR_V2 = 1, +}; #define NONE 0 #define P_HIGH 1 @@ -287,7 +293,8 @@ enum MultiPacketTypes //Bind flag #define BIND_IN_PROGRESS protocol_flags &= ~_BV(7) #define BIND_DONE protocol_flags |= _BV(7) -#define IS_BIND_DONE_on ( ( protocol_flags & _BV(7) ) !=0 ) +#define IS_BIND_DONE ( ( protocol_flags & _BV(7) ) !=0 ) +#define IS_BIND_IN_PROGRESS ( ( protocol_flags & _BV(7) ) ==0 ) // #define FAILSAFE_VALUES_off protocol_flags2 &= ~_BV(0) #define FAILSAFE_VALUES_on protocol_flags2 |= _BV(0) @@ -540,6 +547,7 @@ Serial: 100000 Baud 8e2 _ xxxx xxxx p -- CABELL 34 ESKY150 35 H8_3D 36 + CORONA 37 BindBit=> 0x80 1=Bind/0=No AutoBindBit=> 0x40 1=Yes /0=No RangeCheck=> 0x20 1=Yes /0=No @@ -656,6 +664,9 @@ Serial: 100000 Baud 8e2 _ xxxx xxxx p -- H20H 1 H20MINI 2 H30MINI 3 + sub_protocol==CORONA + COR_V1 0 + COR_V2 1 Power value => 0x80 0=High/1=Low Stream[3] = option_protocol; diff --git a/Multiprotocol/Multiprotocol.ino b/Multiprotocol/Multiprotocol.ino index 01e186e..05988e9 100644 --- a/Multiprotocol/Multiprotocol.ino +++ b/Multiprotocol/Multiprotocol.ino @@ -338,7 +338,12 @@ void setup() // Read status of bind button if( IS_BIND_BUTTON_on ) - BIND_BUTTON_FLAG_on; // If bind button pressed save the status for protocol id reset under hubsan + { + BIND_BUTTON_FLAG_on; // If bind button pressed save the status + BIND_IN_PROGRESS; // Request bind + } + else + BIND_DONE; // Read status of mode select binary switch // after this mode_select will be one of {0000, 0001, ..., 1111} @@ -397,28 +402,37 @@ void setup() //Forced frequency tuning values for CC2500 protocols #if defined(FORCE_FRSKYD_TUNING) && defined(FRSKYD_CC2500_INO) if(protocol==MODE_FRSKYD) - option = FORCE_FRSKYD_TUNING; // Use config-defined tuning value for FrSkyD + option = FORCE_FRSKYD_TUNING; // Use config-defined tuning value for FrSkyD else #endif #if defined(FORCE_FRSKYV_TUNING) && defined(FRSKYV_CC2500_INO) if(protocol==MODE_FRSKYV) - option = FORCE_FRSKYV_TUNING; // Use config-defined tuning value for FrSkyV + option = FORCE_FRSKYV_TUNING; // Use config-defined tuning value for FrSkyV else #endif #if defined(FORCE_FRSKYX_TUNING) && defined(FRSKYX_CC2500_INO) if(protocol==MODE_FRSKYX) - option = FORCE_FRSKYX_TUNING; // Use config-defined tuning value for FrSkyX + option = FORCE_FRSKYX_TUNING; // Use config-defined tuning value for FrSkyX else #endif #if defined(FORCE_SFHSS_TUNING) && defined(SFHSS_CC2500_INO) if (protocol==MODE_SFHSS) - option = FORCE_SFHSS_TUNING; // Use config-defined tuning value for SFHSS + option = FORCE_SFHSS_TUNING; // Use config-defined tuning value for SFHSS else #endif - option = PPM_prot[mode_select].option; // Use radio-defined option value + #if defined(FORCE_CORONA_TUNING) && defined(CORONA_CC2500_INO) + if (protocol==MODE_CORONA) + option = FORCE_CORONA_TUNING; // Use config-defined tuning value for CORONA + else + #endif + option = PPM_prot[mode_select].option; // Use radio-defined option value if(PPM_prot[mode_select].power) POWER_FLAG_on; - if(PPM_prot[mode_select].autobind) AUTOBIND_FLAG_on; + if(PPM_prot[mode_select].autobind) + { + AUTOBIND_FLAG_on; + BIND_IN_PROGRESS; // Force a bind at protocol startup + } mode_select++; servo_max_100=PPM_MAX_100; servo_min_100=PPM_MIN_100; servo_max_125=PPM_MAX_125; servo_min_125=PPM_MIN_125; @@ -594,12 +608,14 @@ uint8_t Update_All() #ifdef ENABLE_BIND_CH if(IS_AUTOBIND_FLAG_on && IS_BIND_CH_PREV_off && Servo_data[BIND_CH-1]>PPM_MAX_COMMAND && Servo_data[THROTTLE]<(servo_min_100+25)) { // Autobind is on and BIND_CH went up and Throttle is low - CHANGE_PROTOCOL_FLAG_on; //reload protocol to rebind + CHANGE_PROTOCOL_FLAG_on; //reload protocol + BIND_IN_PROGRESS; //enable bind BIND_CH_PREV_on; } - if(IS_BIND_CH_PREV_on && Servo_data[BIND_CH-1]>4)& 0x07; //subprotocol no (0-7) bits 4-6 RX_num=rx_ok_buff[2]& 0x0F; // rx_num bits 0---3 @@ -1136,10 +1162,13 @@ void update_serial_data() } else if( ((rx_ok_buff[1]&0x80)!=0) && ((cur_protocol[1]&0x80)==0) ) // Bind flag has been set - CHANGE_PROTOCOL_FLAG_on; //restart protocol with bind + { // Restart protocol with bind + CHANGE_PROTOCOL_FLAG_on; + BIND_IN_PROGRESS; + } else if( ((rx_ok_buff[1]&0x80)==0) && ((cur_protocol[1]&0x80)!=0) ) // Bind flag has been reset - { + { // Request protocol to end bind #if defined(FRSKYD_CC2500_INO) || defined(FRSKYX_CC2500_INO) || defined(FRSKYV_CC2500_INO) if(protocol==MODE_FRSKYD || protocol==MODE_FRSKYX || protocol==MODE_FRSKYV) BIND_DONE; diff --git a/Multiprotocol/NRF24l01_SPI.ino b/Multiprotocol/NRF24l01_SPI.ino index bbe2ed0..c66f14b 100644 --- a/Multiprotocol/NRF24l01_SPI.ino +++ b/Multiprotocol/NRF24l01_SPI.ino @@ -161,7 +161,7 @@ void NRF24L01_SetBitrate(uint8_t bitrate) void NRF24L01_SetPower() { uint8_t power=NRF_BIND_POWER; - if(IS_BIND_DONE_on) + if(IS_BIND_DONE) #ifdef NRF24L01_ENABLE_LOW_POWER power=IS_POWER_FLAG_on?NRF_HIGH_POWER:NRF_LOW_POWER; #else diff --git a/Multiprotocol/Q303_nrf24l01.ino b/Multiprotocol/Q303_nrf24l01.ino index 9026931..2d22eb1 100644 --- a/Multiprotocol/Q303_nrf24l01.ino +++ b/Multiprotocol/Q303_nrf24l01.ino @@ -354,7 +354,7 @@ static void __attribute__((unused)) Q303_initialize_txid() uint16_t Q303_callback() { - if(IS_BIND_DONE_on) + if(IS_BIND_DONE) Q303_send_packet(0); else { diff --git a/Multiprotocol/SHENQI_nrf24l01.ino b/Multiprotocol/SHENQI_nrf24l01.ino index 2ffc2fc..4f34f4b 100644 --- a/Multiprotocol/SHENQI_nrf24l01.ino +++ b/Multiprotocol/SHENQI_nrf24l01.ino @@ -90,7 +90,7 @@ void SHENQI_send_packet() uint16_t SHENQI_callback() { - if(IS_BIND_DONE_on) + if(IS_BIND_DONE) SHENQI_send_packet(); else { diff --git a/Multiprotocol/SPI.ino b/Multiprotocol/SPI.ino index 093674e..b097127 100644 --- a/Multiprotocol/SPI.ino +++ b/Multiprotocol/SPI.ino @@ -17,6 +17,10 @@ /********************/ #ifdef STM32_BOARD +#ifdef DEBUG_SERIAL +// #define DEBUG_SPI +#endif + SPIClass SPI_2(2); //Create an instance of the SPI Class called SPI_2 that uses the 2nd SPI Port void initSPI2() @@ -35,6 +39,9 @@ void initSPI2() void SPI_Write(uint8_t command) {//working OK SPI2_BASE->DR = command; //Write the first data item to be transmitted into the SPI_DR register (this clears the TXE flag). + #ifdef DEBUG_SPI + debug("%02X ",command); + #endif while (!(SPI2_BASE->SR & SPI_SR_RXNE)); command = SPI2_BASE->DR; // ... and read the last received data. } diff --git a/Multiprotocol/Telemetry.ino b/Multiprotocol/Telemetry.ino index 77f5a36..58bae07 100644 --- a/Multiprotocol/Telemetry.ino +++ b/Multiprotocol/Telemetry.ino @@ -107,7 +107,7 @@ static void multi_send_status() if (IS_WAIT_BIND_on) flags |= 0x10; else - if (!IS_BIND_DONE_on) + if (IS_BIND_IN_PROGRESS) flags |= 0x08; #ifdef FAILSAFE_ENABLE //Is failsafe supported? @@ -1052,7 +1052,6 @@ void TelemetryUpdate() #endif if(USART3_BASE->SR & USART_SR_TXE) { - USART3_BASE->SR &= ~USART_SR_TXE; #endif if(tx_head!=tx_tail) { diff --git a/Multiprotocol/V2X2_nrf24l01.ino b/Multiprotocol/V2X2_nrf24l01.ino index 23cf69b..d9a84a8 100644 --- a/Multiprotocol/V2X2_nrf24l01.ino +++ b/Multiprotocol/V2X2_nrf24l01.ino @@ -275,7 +275,7 @@ uint16_t initV2x2() { v202_init(); // - if (IS_AUTOBIND_FLAG_on) + if (IS_BIND_IN_PROGRESS) { bind_counter = V2X2_BIND_COUNT; phase = V202_INIT2; diff --git a/Multiprotocol/Validate.h b/Multiprotocol/Validate.h index f350587..bf1e8c3 100644 --- a/Multiprotocol/Validate.h +++ b/Multiprotocol/Validate.h @@ -81,6 +81,11 @@ #error "The SFHSS forced frequency tuning value is outside of the range -127..127." #endif #endif +#ifdef FORCE_CORONA_TUNING + #if ( FORCE_CORONA_TUNING < -127 ) || ( FORCE_CORONA_TUNING > 127 ) + #error "The CORONA forced frequency tuning value is outside of the range -127..127." + #endif +#endif //Change/Force configuration if OrangeTX #ifdef ORANGE_TX @@ -113,6 +118,7 @@ #undef FRSKYV_CC2500_INO #undef FRSKYX_CC2500_INO #undef SFHSS_CC2500_INO + #undef CORONA_CC2500_INO #endif #ifndef NRF24L01_INSTALLED #undef BAYANG_NRF24L01_INO diff --git a/Multiprotocol/WK2x01_cyrf6936.ino b/Multiprotocol/WK2x01_cyrf6936.ino index 6d4b46e..58aadb8 100644 --- a/Multiprotocol/WK2x01_cyrf6936.ino +++ b/Multiprotocol/WK2x01_cyrf6936.ino @@ -288,7 +288,7 @@ static void __attribute__((unused)) WK_build_beacon_pkt_2801() uint8_t bind_state; #ifdef ENABLE_PPM - if(mode_select && option==0 && IS_BIND_DONE_on) //PPM mode and option not already set and bind is finished + if(mode_select && option==0 && IS_BIND_DONE) //PPM mode and option not already set and bind is finished { BIND_SET_INPUT; BIND_SET_PULLUP; // set pullup @@ -300,7 +300,7 @@ static void __attribute__((unused)) WK_build_beacon_pkt_2801() BIND_SET_OUTPUT; } #endif //ENABLE_PPM - if(prev_option!=option && IS_BIND_DONE_on) + if(prev_option!=option && IS_BIND_DONE) { set_rx_tx_addr(MProtocol_id); rx_tx_addr[2]=rx_tx_addr[3]<<4; // Make use of RX_Num diff --git a/Multiprotocol/YD717_nrf24l01.ino b/Multiprotocol/YD717_nrf24l01.ino index ba51eec..3af6e44 100644 --- a/Multiprotocol/YD717_nrf24l01.ino +++ b/Multiprotocol/YD717_nrf24l01.ino @@ -154,7 +154,7 @@ static void __attribute__((unused)) yd717_init() uint16_t yd717_callback() { - if(IS_BIND_DONE_on) + if(IS_BIND_DONE) yd717_send_packet(0); else { diff --git a/Multiprotocol/_Config.h b/Multiprotocol/_Config.h index 987b415..882ec7b 100644 --- a/Multiprotocol/_Config.h +++ b/Multiprotocol/_Config.h @@ -133,6 +133,7 @@ #define FRSKYD_CC2500_INO #define FRSKYX_CC2500_INO #define SFHSS_CC2500_INO +#define CORONA_CC2500_INO //The protocols below need a NRF24L01 to be installed #define BAYANG_NRF24L01_INO @@ -159,6 +160,7 @@ #define ESKY150_NRF24L01_INO #define H8_3D_NRF24L01_INO + /**************************/ /*** FAILSAFE SETTINGS ***/ /**************************/ @@ -188,10 +190,11 @@ //Once a good tuning value is found it can be set here and will override the radio's 'option' setting for all existing and new models which use that protocol. //For more information: https://github.com/pascallanger/DIY-Multiprotocol-TX-Module/tree/master/docs/Frequency_Tuning.md //Uncomment the lines below (remove the "//") and set an appropriate value (replace the "0") to enable. Valid range is -127 to +127. -//#define FORCE_FRSKYD_TUNING 0 -//#define FORCE_FRSKYV_TUNING 0 -//#define FORCE_FRSKYX_TUNING 0 -//#define FORCE_SFHSS_TUNING 0 +//#define FORCE_FRSKYD_TUNING 0 +//#define FORCE_FRSKYV_TUNING 0 +//#define FORCE_FRSKYX_TUNING 0 +//#define FORCE_SFHSS_TUNING 0 +//#define FORCE_CORONA_TUNING 0 /**************************/ /*** TELEMETRY SETTINGS ***/ @@ -437,6 +440,9 @@ const PPM_Parameters PPM_prot[15]= { H20H H20 Mini H30 Mini + MODE_CORONA + COR_V1 + COR_V2 */ // RX_Num is used for model match. Using RX_Num values different for each receiver will prevent starting a model with the false config loaded...