Introduction of Banks for the switch protocol selection

This commit is contained in:
Pascal Langer 2018-01-30 12:02:45 +01:00
parent f4a4f67453
commit ab27ee50b0
12 changed files with 449 additions and 280 deletions

View File

@ -27,7 +27,7 @@ void A7105_WriteData(uint8_t len, uint8_t channel)
for (i = 0; i < len; i++) for (i = 0; i < len; i++)
SPI_Write(packet[i]); SPI_Write(packet[i]);
A7105_CSN_on; A7105_CSN_on;
if(protocol!=MODE_FLYSKY) if(protocol!=PROTO_FLYSKY)
{ {
A7105_Strobe(A7105_STANDBY); //Force standby mode, ie cancel any TX or RX... A7105_Strobe(A7105_STANDBY); //Force standby mode, ie cancel any TX or RX...
A7105_SetTxRxMode(TX_EN); //Switch to PA A7105_SetTxRxMode(TX_EN); //Switch to PA
@ -177,17 +177,17 @@ void A7105_AdjustLOBaseFreq(uint8_t cmd)
old_offset=2048; old_offset=2048;
switch(protocol) switch(protocol)
{ {
case MODE_HUBSAN: case PROTO_HUBSAN:
#ifdef FORCE_HUBSAN_TUNING #ifdef FORCE_HUBSAN_TUNING
offset=(int16_t)FORCE_HUBSAN_TUNING; offset=(int16_t)FORCE_HUBSAN_TUNING;
#endif #endif
break; break;
case MODE_FLYSKY: case PROTO_FLYSKY:
#ifdef FORCE_FLYSKY_TUNING #ifdef FORCE_FLYSKY_TUNING
offset=(int16_t)FORCE_FLYSKY_TUNING; offset=(int16_t)FORCE_FLYSKY_TUNING;
#endif #endif
break; break;
case MODE_AFHDS2A: case PROTO_AFHDS2A:
#ifdef FORCE_AFHDS2A_TUNING #ifdef FORCE_AFHDS2A_TUNING
offset=(int16_t)FORCE_AFHDS2A_TUNING; offset=(int16_t)FORCE_AFHDS2A_TUNING;
#endif #endif
@ -255,7 +255,7 @@ void A7105_Init(void)
uint8_t *A7105_Regs=0; uint8_t *A7105_Regs=0;
#ifdef HUBSAN_A7105_INO #ifdef HUBSAN_A7105_INO
if(protocol==MODE_HUBSAN) if(protocol==PROTO_HUBSAN)
{ {
A7105_WriteID(ID_NORMAL); A7105_WriteID(ID_NORMAL);
A7105_Regs=(uint8_t*)HUBSAN_A7105_regs; A7105_Regs=(uint8_t*)HUBSAN_A7105_regs;
@ -265,7 +265,7 @@ void A7105_Init(void)
{ {
A7105_WriteID(0x5475c52A);//0x2Ac57554 A7105_WriteID(0x5475c52A);//0x2Ac57554
#ifdef FLYSKY_A7105_INO #ifdef FLYSKY_A7105_INO
if(protocol==MODE_FLYSKY) if(protocol==PROTO_FLYSKY)
A7105_Regs=(uint8_t*)FLYSKY_A7105_regs; A7105_Regs=(uint8_t*)FLYSKY_A7105_regs;
else else
#endif #endif
@ -280,7 +280,7 @@ void A7105_Init(void)
{ {
uint8_t val=pgm_read_byte_near(&A7105_Regs[i]); uint8_t val=pgm_read_byte_near(&A7105_Regs[i]);
#ifdef FLYSKY_A7105_INO #ifdef FLYSKY_A7105_INO
if(protocol==MODE_FLYSKY && sub_protocol==CX20) if(protocol==PROTO_FLYSKY && sub_protocol==CX20)
{ {
if(i==0x0E) val=0x01; if(i==0x0E) val=0x01;
if(i==0x1F) val=0x1F; if(i==0x1F) val=0x1F;
@ -298,7 +298,7 @@ void A7105_Init(void)
// A7105_ReadReg(A7105_22_IF_CALIB_I); // A7105_ReadReg(A7105_22_IF_CALIB_I);
// A7105_ReadReg(A7105_24_VCO_CURCAL); // A7105_ReadReg(A7105_24_VCO_CURCAL);
if(protocol!=MODE_HUBSAN) if(protocol!=PROTO_HUBSAN)
{ {
//VCO Current Calibration //VCO Current Calibration
A7105_WriteReg(A7105_24_VCO_CURCAL,0x13); //Recommended calibration from A7105 Datasheet A7105_WriteReg(A7105_24_VCO_CURCAL,0x13); //Recommended calibration from A7105 Datasheet
@ -319,8 +319,8 @@ void A7105_Init(void)
// A7105_ReadReg(A7105_25_VCO_SBCAL_I); // A7105_ReadReg(A7105_25_VCO_SBCAL_I);
//Reset VCO Band calibration //Reset VCO Band calibration
if(protocol!=MODE_HUBSAN) if(protocol!=PROTO_HUBSAN)
A7105_WriteReg(A7105_25_VCO_SBCAL_I,protocol==MODE_FLYSKY?0x08:0x0A); A7105_WriteReg(A7105_25_VCO_SBCAL_I,protocol==PROTO_FLYSKY?0x08:0x0A);
A7105_SetTxRxMode(TX_EN); A7105_SetTxRxMode(TX_EN);
A7105_SetPower(); A7105_SetPower();

View File

@ -12,7 +12,7 @@
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with Multiprotocol. If not, see <http://www.gnu.org/licenses/>. along with Multiprotocol. If not, see <http://www.gnu.org/licenses/>.
*/ */
// compatible with Cheerson CX-10 blue & newer red pcb, CX-10A, CX11, CX-10 green pcb, DM007, Floureon FX-10, JXD 509 (Q282) // compatible with Cheerson CX-10 blue & newer red pcb, CX-10A, CX11, CX-10 green pcb, DM007, Floureon FX-10, JXD 509 (Q282), Q222, Q242 and Q282
// Last sync with hexfet new_protocols/cx10_nrf24l01.c dated 2015-11-26 // Last sync with hexfet new_protocols/cx10_nrf24l01.c dated 2015-11-26
#if defined(CX10_NRF24L01_INO) #if defined(CX10_NRF24L01_INO)
@ -81,9 +81,9 @@ static void __attribute__((unused)) CX10_Write_Packet(uint8_t bind)
flags |= GET_FLAG(!CH7_SW, 0x10) // Channel 7 - picture flags |= GET_FLAG(!CH7_SW, 0x10) // Channel 7 - picture
|GET_FLAG( CH8_SW, 0x08); // Channel 8 - video |GET_FLAG( CH8_SW, 0x08); // Channel 8 - video
break; break;
case Q282: case F_Q282:
case Q242: case F_Q242:
case Q222: case F_Q222:
memcpy(&packet[15], "\x10\x10\xaa\xaa\x00\x00", 6); memcpy(&packet[15], "\x10\x10\xaa\xaa\x00\x00", 6);
//FLIP|LED|PICTURE|VIDEO|HEADLESS|RTH|XCAL|YCAL //FLIP|LED|PICTURE|VIDEO|HEADLESS|RTH|XCAL|YCAL
flags2 = GET_FLAG(CH5_SW, 0x80) // Channel 5 - FLIP flags2 = GET_FLAG(CH5_SW, 0x80) // Channel 5 - FLIP
@ -92,7 +92,7 @@ static void __attribute__((unused)) CX10_Write_Packet(uint8_t bind)
|GET_FLAG(CH11_SW, 0x04) // Channel 11 - XCAL |GET_FLAG(CH11_SW, 0x04) // Channel 11 - XCAL
|GET_FLAG(CH12_SW, 0x02); // Channel 12 - YCAL or Start/Stop motors on JXD 509 |GET_FLAG(CH12_SW, 0x02); // Channel 12 - YCAL or Start/Stop motors on JXD 509
if(sub_protocol==Q242) if(sub_protocol==F_Q242)
{ {
flags=2; flags=2;
flags2|= GET_FLAG(CH7_SW,0x01) // Channel 7 - picture flags2|= GET_FLAG(CH7_SW,0x01) // Channel 7 - picture
@ -101,16 +101,16 @@ static void __attribute__((unused)) CX10_Write_Packet(uint8_t bind)
packet[18]=0x00; packet[18]=0x00;
} }
else else
{ // Q282 & Q222 { // F_Q282 & F_Q222
flags=3; // expert flags=3; // expert
if(CH8_SW) // Channel 8 - Q282 video / Q222 Module 1 if(CH8_SW) // Channel 8 - F_Q282 video / F_Q222 Module 1
{ {
if (!(video_state & 0x20)) video_state ^= 0x21; if (!(video_state & 0x20)) video_state ^= 0x21;
} }
else else
if (video_state & 0x20) video_state &= 0x01; if (video_state & 0x20) video_state &= 0x01;
flags2 |= video_state flags2 |= video_state
|GET_FLAG(CH7_SW,0x10); // Channel 7 - Q282 picture / Q222 Module 2 |GET_FLAG(CH7_SW,0x10); // Channel 7 - F_Q282 picture / F_Q222 Module 2
} }
if(CH10_SW) flags |=0x80; // Channel 10 - RTH if(CH10_SW) flags |=0x80; // Channel 10 - RTH
break; break;
@ -238,12 +238,12 @@ uint16_t CX10_callback()
static void __attribute__((unused)) CX10_initialize_txid() static void __attribute__((unused)) CX10_initialize_txid()
{ {
rx_tx_addr[1]%= 0x30; rx_tx_addr[1]%= 0x30;
if(sub_protocol&0x08) //Q2X2 protocols if(sub_protocol&0x08) //F_Q2X2 protocols
{ {
uint8_t offset=0; //Q282 uint8_t offset=0; //F_Q282
if(sub_protocol==Q242) if(sub_protocol==F_Q242)
offset=2; offset=2;
if(sub_protocol==Q222) if(sub_protocol==F_Q222)
offset=3; offset=3;
for(uint8_t i=0;i<4;i++) for(uint8_t i=0;i<4;i++)
hopping_frequency[i]=0x46+2*i+offset; hopping_frequency[i]=0x46+2*i+offset;
@ -272,7 +272,7 @@ uint16_t initCX10(void)
} }
else else
{ {
if(sub_protocol&0x08) //Q2X2 protocols if(sub_protocol&0x08) //F_Q2X2 protocols
packet_length = Q2X2_PACKET_SIZE; packet_length = Q2X2_PACKET_SIZE;
else else
packet_length = CX10_PACKET_SIZE; packet_length = CX10_PACKET_SIZE;

View File

@ -63,7 +63,7 @@ static void __attribute__((unused)) DEVO_add_pkt_suffix()
BIND_SET_PULLUP; // set pullup BIND_SET_PULLUP; // set pullup
if(IS_BIND_BUTTON_on) if(IS_BIND_BUTTON_on)
{ {
eeprom_write_byte((EE_ADDR)(MODELMODE_EEPROM_OFFSET+mode_select),0x01); // Set fixed id mode for the current model eeprom_write_byte((EE_ADDR)(MODELMODE_EEPROM_OFFSET+RX_num),0x01); // Set fixed id mode for the current model
option=1; option=1;
} }
BIND_SET_OUTPUT; BIND_SET_OUTPUT;

View File

@ -73,18 +73,18 @@ static void __attribute__((unused)) HONTAI_send_packet(uint8_t bind)
packet[4] = convert_channel_16b_limit(AILERON, 63, 0); // Aileron packet[4] = convert_channel_16b_limit(AILERON, 63, 0); // Aileron
packet[5] = convert_channel_16b_limit(ELEVATOR, 0, 63); // Elevator packet[5] = convert_channel_16b_limit(ELEVATOR, 0, 63); // Elevator
packet[6] = convert_channel_16b_limit(RUDDER, 0, 63); // Rudder packet[6] = convert_channel_16b_limit(RUDDER, 0, 63); // Rudder
if(sub_protocol == FORMAT_X5C1) if(sub_protocol == X5C1)
packet[7] = convert_channel_16b_limit(AILERON, 0, 63)-31; // Aileron trim packet[7] = convert_channel_16b_limit(AILERON, 0, 63)-31; // Aileron trim
else else
packet[7] = convert_channel_16b_limit(AILERON, 0, 32)-16; // Aileron trim packet[7] = convert_channel_16b_limit(AILERON, 0, 32)-16; // Aileron trim
packet[8] = convert_channel_16b_limit(RUDDER, 0, 32)-16; // Rudder trim packet[8] = convert_channel_16b_limit(RUDDER, 0, 32)-16; // Rudder trim
if (sub_protocol == FORMAT_X5C1) if (sub_protocol == X5C1)
packet[9] = convert_channel_16b_limit(ELEVATOR, 0, 63)-31; // Elevator trim packet[9] = convert_channel_16b_limit(ELEVATOR, 0, 63)-31; // Elevator trim
else else
packet[9] = convert_channel_16b_limit(ELEVATOR, 0, 32)-16; // Elevator trim packet[9] = convert_channel_16b_limit(ELEVATOR, 0, 32)-16; // Elevator trim
switch(sub_protocol) switch(sub_protocol)
{ {
case FORMAT_HONTAI: case HONTAI:
packet[0] = 0x0B; packet[0] = 0x0B;
packet[3] |= GET_FLAG(CH7_SW, 0x01); // Picture packet[3] |= GET_FLAG(CH7_SW, 0x01); // Picture
packet[4] |= GET_FLAG(CH10_SW, 0x80) // RTH packet[4] |= GET_FLAG(CH10_SW, 0x80) // RTH
@ -93,7 +93,7 @@ static void __attribute__((unused)) HONTAI_send_packet(uint8_t bind)
| GET_FLAG(CH5_SW, 0x40); // Flip | GET_FLAG(CH5_SW, 0x40); // Flip
packet[6] |= GET_FLAG(CH8_SW, 0x80); // Video packet[6] |= GET_FLAG(CH8_SW, 0x80); // Video
break; break;
case FORMAT_JJRCX1: case JJRCX1:
packet[0] = GET_FLAG(CH6_SW, 0x02); // Arm packet[0] = GET_FLAG(CH6_SW, 0x02); // Arm
packet[3] |= GET_FLAG(CH7_SW, 0x01); // Picture packet[3] |= GET_FLAG(CH7_SW, 0x01); // Picture
packet[4] |= 0x80; // unknown packet[4] |= 0x80; // unknown
@ -104,7 +104,7 @@ static void __attribute__((unused)) HONTAI_send_packet(uint8_t bind)
| GET_FLAG(CH10_SW, 0x02) // RTH | GET_FLAG(CH10_SW, 0x02) // RTH
| GET_FLAG(CH9_SW, 0x01); // Headless | GET_FLAG(CH9_SW, 0x01); // Headless
break; break;
case FORMAT_X5C1: case X5C1:
packet[0] = 0x0B; packet[0] = 0x0B;
packet[3] |= GET_FLAG(CH7_SW, 0x01); // Picture packet[3] |= GET_FLAG(CH7_SW, 0x01); // Picture
packet[4] = 0x80 // unknown packet[4] = 0x80 // unknown
@ -116,7 +116,7 @@ static void __attribute__((unused)) HONTAI_send_packet(uint8_t bind)
| GET_FLAG(CH10_SW, 0x02) // RTH | GET_FLAG(CH10_SW, 0x02) // RTH
| GET_FLAG(CH9_SW, 0x01); // Headless | GET_FLAG(CH9_SW, 0x01); // Headless
break; break;
case FORMAT_FQ777_951: case FQ777_951:
packet[0] = GET_FLAG(CH7_SW, 0x01) // Picture packet[0] = GET_FLAG(CH7_SW, 0x01) // Picture
| GET_FLAG(CH8_SW, 0x02); // Video | GET_FLAG(CH8_SW, 0x02); // Video
packet[3] |= GET_FLAG(CH5_SW, 0x01); // Flip packet[3] |= GET_FLAG(CH5_SW, 0x01); // Flip
@ -129,7 +129,7 @@ static void __attribute__((unused)) HONTAI_send_packet(uint8_t bind)
crc16(packet, bind ? HONTAI_BIND_PACKET_SIZE:HONTAI_PACKET_SIZE); crc16(packet, bind ? HONTAI_BIND_PACKET_SIZE:HONTAI_PACKET_SIZE);
// Power on, TX mode, 2byte CRC // Power on, TX mode, 2byte CRC
if(sub_protocol == FORMAT_JJRCX1) if(sub_protocol == JJRCX1)
NRF24L01_SetTxRxMode(TX_EN); NRF24L01_SetTxRxMode(TX_EN);
else else
XN297_Configure(_BV(NRF24L01_00_EN_CRC) | _BV(NRF24L01_00_CRCO) | _BV(NRF24L01_00_PWR_UP)); XN297_Configure(_BV(NRF24L01_00_EN_CRC) | _BV(NRF24L01_00_CRCO) | _BV(NRF24L01_00_PWR_UP));
@ -140,7 +140,7 @@ static void __attribute__((unused)) HONTAI_send_packet(uint8_t bind)
NRF24L01_WriteReg(NRF24L01_07_STATUS, 0x70); NRF24L01_WriteReg(NRF24L01_07_STATUS, 0x70);
NRF24L01_FlushTx(); NRF24L01_FlushTx();
if(sub_protocol == FORMAT_JJRCX1) if(sub_protocol == JJRCX1)
NRF24L01_WritePayload(packet, bind ? HONTAI_BIND_PACKET_SIZE:HONTAI_PACKET_SIZE); NRF24L01_WritePayload(packet, bind ? HONTAI_BIND_PACKET_SIZE:HONTAI_PACKET_SIZE);
else else
XN297_WritePayload(packet, bind ? HONTAI_BIND_PACKET_SIZE:HONTAI_PACKET_SIZE); XN297_WritePayload(packet, bind ? HONTAI_BIND_PACKET_SIZE:HONTAI_PACKET_SIZE);
@ -154,7 +154,7 @@ static void __attribute__((unused)) HONTAI_init()
NRF24L01_SetTxRxMode(TX_EN); NRF24L01_SetTxRxMode(TX_EN);
if(sub_protocol == FORMAT_JJRCX1) if(sub_protocol == JJRCX1)
NRF24L01_WriteRegisterMulti(NRF24L01_10_TX_ADDR, (uint8_t*)"\xd2\xb5\x99\xb3\x4a", 5); NRF24L01_WriteRegisterMulti(NRF24L01_10_TX_ADDR, (uint8_t*)"\xd2\xb5\x99\xb3\x4a", 5);
else else
XN297_SetTXAddr((const uint8_t*)"\xd2\xb5\x99\xb3\x4a", 5); XN297_SetTXAddr((const uint8_t*)"\xd2\xb5\x99\xb3\x4a", 5);
@ -166,7 +166,7 @@ static void __attribute__((unused)) HONTAI_init()
NRF24L01_SetBitrate(NRF24L01_BR_1M); // 1Mbps NRF24L01_SetBitrate(NRF24L01_BR_1M); // 1Mbps
NRF24L01_SetPower(); NRF24L01_SetPower();
NRF24L01_Activate(0x73); // Activate feature register NRF24L01_Activate(0x73); // Activate feature register
if(sub_protocol == FORMAT_JJRCX1) if(sub_protocol == JJRCX1)
{ {
NRF24L01_WriteReg(NRF24L01_04_SETUP_RETR, 0xff); // JJRC uses dynamic payload length NRF24L01_WriteReg(NRF24L01_04_SETUP_RETR, 0xff); // JJRC uses dynamic payload length
NRF24L01_WriteReg(NRF24L01_1C_DYNPD, 0x3f); // match other stock settings even though AA disabled... NRF24L01_WriteReg(NRF24L01_1C_DYNPD, 0x3f); // match other stock settings even though AA disabled...
@ -201,21 +201,21 @@ static void __attribute__((unused)) HONTAI_init2()
data_tx_addr[2] = pgm_read_byte_near( &HONTAI_addr_vals[2][ rx_tx_addr[4] & 0x0f]); data_tx_addr[2] = pgm_read_byte_near( &HONTAI_addr_vals[2][ rx_tx_addr[4] & 0x0f]);
data_tx_addr[3] = pgm_read_byte_near( &HONTAI_addr_vals[3][(rx_tx_addr[4] >> 4) & 0x0f]); data_tx_addr[3] = pgm_read_byte_near( &HONTAI_addr_vals[3][(rx_tx_addr[4] >> 4) & 0x0f]);
data_tx_addr[4] = 0x24; data_tx_addr[4] = 0x24;
if(sub_protocol == FORMAT_JJRCX1) if(sub_protocol == JJRCX1)
NRF24L01_WriteRegisterMulti(NRF24L01_10_TX_ADDR, data_tx_addr, sizeof(data_tx_addr)); NRF24L01_WriteRegisterMulti(NRF24L01_10_TX_ADDR, data_tx_addr, sizeof(data_tx_addr));
else else
XN297_SetTXAddr(data_tx_addr, sizeof(data_tx_addr)); XN297_SetTXAddr(data_tx_addr, sizeof(data_tx_addr));
//Hopping frequency table //Hopping frequency table
for(uint8_t i=0;i<3;i++) for(uint8_t i=0;i<3;i++)
hopping_frequency[i]=pgm_read_byte_near( &HONTAI_hopping_frequency_nonels[sub_protocol == FORMAT_JJRCX1?1:0][i] ); hopping_frequency[i]=pgm_read_byte_near( &HONTAI_hopping_frequency_nonels[sub_protocol == JJRCX1?1:0][i] );
hopping_frequency_no=0; hopping_frequency_no=0;
} }
static void __attribute__((unused)) HONTAI_initialize_txid() static void __attribute__((unused)) HONTAI_initialize_txid()
{ {
rx_tx_addr[4] = rx_tx_addr[2]; rx_tx_addr[4] = rx_tx_addr[2];
if(sub_protocol == FORMAT_HONTAI || sub_protocol == FORMAT_FQ777_951) if(sub_protocol == HONTAI || sub_protocol == FQ777_951)
{ {
rx_tx_addr[0] = 0x4c; // first three bytes some kind of model id? - set same as stock tx rx_tx_addr[0] = 0x4c; // first three bytes some kind of model id? - set same as stock tx
rx_tx_addr[1] = 0x4b; rx_tx_addr[1] = 0x4b;
@ -244,7 +244,7 @@ uint16_t HONTAI_callback()
else else
HONTAI_send_packet(0); HONTAI_send_packet(0);
return sub_protocol == FORMAT_FQ777_951 ? FQ777_951_PACKET_PERIOD : HONTAI_PACKET_PERIOD; return sub_protocol == FQ777_951 ? FQ777_951_PACKET_PERIOD : HONTAI_PACKET_PERIOD;
} }
uint16_t initHONTAI() uint16_t initHONTAI()

View File

@ -19,50 +19,50 @@
#define VERSION_MAJOR 1 #define VERSION_MAJOR 1
#define VERSION_MINOR 2 #define VERSION_MINOR 2
#define VERSION_REVISION 0 #define VERSION_REVISION 0
#define VERSION_PATCH_LEVEL 15 #define VERSION_PATCH_LEVEL 16
//****************** //******************
// Protocols // Protocols
//****************** //******************
enum PROTOCOLS enum PROTOCOLS
{ {
MODE_SERIAL = 0, // Serial commands MODE_SERIAL = 0, // Serial commands
MODE_FLYSKY = 1, // =>A7105 PROTO_FLYSKY = 1, // =>A7105
MODE_HUBSAN = 2, // =>A7105 PROTO_HUBSAN = 2, // =>A7105
MODE_FRSKYD = 3, // =>CC2500 PROTO_FRSKYD = 3, // =>CC2500
MODE_HISKY = 4, // =>NRF24L01 PROTO_HISKY = 4, // =>NRF24L01
MODE_V2X2 = 5, // =>NRF24L01 PROTO_V2X2 = 5, // =>NRF24L01
MODE_DSM = 6, // =>CYRF6936 PROTO_DSM = 6, // =>CYRF6936
MODE_DEVO = 7, // =>CYRF6936 PROTO_DEVO = 7, // =>CYRF6936
MODE_YD717 = 8, // =>NRF24L01 PROTO_YD717 = 8, // =>NRF24L01
MODE_KN = 9, // =>NRF24L01 PROTO_KN = 9, // =>NRF24L01
MODE_SYMAX = 10, // =>NRF24L01 PROTO_SYMAX = 10, // =>NRF24L01
MODE_SLT = 11, // =>NRF24L01 PROTO_SLT = 11, // =>NRF24L01
MODE_CX10 = 12, // =>NRF24L01 PROTO_CX10 = 12, // =>NRF24L01
MODE_CG023 = 13, // =>NRF24L01 PROTO_CG023 = 13, // =>NRF24L01
MODE_BAYANG = 14, // =>NRF24L01 PROTO_BAYANG = 14, // =>NRF24L01
MODE_FRSKYX = 15, // =>CC2500 PROTO_FRSKYX = 15, // =>CC2500
MODE_ESKY = 16, // =>NRF24L01 PROTO_ESKY = 16, // =>NRF24L01
MODE_MT99XX = 17, // =>NRF24L01 PROTO_MT99XX = 17, // =>NRF24L01
MODE_MJXQ = 18, // =>NRF24L01 PROTO_MJXQ = 18, // =>NRF24L01
MODE_SHENQI = 19, // =>NRF24L01 PROTO_SHENQI = 19, // =>NRF24L01
MODE_FY326 = 20, // =>NRF24L01 PROTO_FY326 = 20, // =>NRF24L01
MODE_SFHSS = 21, // =>CC2500 PROTO_SFHSS = 21, // =>CC2500
MODE_J6PRO = 22, // =>CYRF6936 PROTO_J6PRO = 22, // =>CYRF6936
MODE_FQ777 = 23, // =>NRF24L01 PROTO_FQ777 = 23, // =>NRF24L01
MODE_ASSAN = 24, // =>NRF24L01 PROTO_ASSAN = 24, // =>NRF24L01
MODE_FRSKYV = 25, // =>CC2500 PROTO_FRSKYV = 25, // =>CC2500
MODE_HONTAI = 26, // =>NRF24L01 PROTO_HONTAI = 26, // =>NRF24L01
MODE_OPENLRS = 27, // =>OpenLRS hardware PROTO_OPENLRS = 27, // =>OpenLRS hardware
MODE_AFHDS2A = 28, // =>A7105 PROTO_AFHDS2A = 28, // =>A7105
MODE_Q2X2 = 29, // =>NRF24L01, extension of CX-10 protocol PROTO_Q2X2 = 29, // =>NRF24L01, extension of CX-10 protocol
MODE_WK2x01 = 30, // =>CYRF6936 PROTO_WK2x01 = 30, // =>CYRF6936
MODE_Q303 = 31, // =>NRF24L01 PROTO_Q303 = 31, // =>NRF24L01
MODE_GW008 = 32, // =>NRF24L01 PROTO_GW008 = 32, // =>NRF24L01
MODE_DM002 = 33, // =>NRF24L01 PROTO_DM002 = 33, // =>NRF24L01
MODE_CABELL = 34, // =>NRF24L01 PROTO_CABELL = 34, // =>NRF24L01
MODE_ESKY150 = 35, // =>NRF24L01 PROTO_ESKY150 = 35, // =>NRF24L01
MODE_H8_3D = 36, // =>NRF24L01 PROTO_H8_3D = 36, // =>NRF24L01
MODE_CORONA = 37, // =>CC2500 PROTO_CORONA = 37, // =>CC2500
}; };
enum Flysky enum Flysky
@ -133,9 +133,12 @@ enum CX10
}; };
enum Q2X2 enum Q2X2
{ {
Q222 = 8, Q222 = 0,
Q242 = 9, Q242 = 1,
Q282 = 10, Q282 = 2,
F_Q222 = 8,
F_Q242 = 9,
F_Q282 = 10,
}; };
enum CG023 enum CG023
{ {
@ -175,10 +178,10 @@ enum FRSKYX
}; };
enum HONTAI enum HONTAI
{ {
FORMAT_HONTAI = 0, HONTAI = 0,
FORMAT_JJRCX1 = 1, JJRCX1 = 1,
FORMAT_X5C1 = 2, X5C1 = 2,
FORMAT_FQ777_951 =3 FQ777_951 =3
}; };
enum V2X2 enum V2X2
{ {
@ -359,6 +362,9 @@ enum MultiPacketTypes
#define BLINK_BAD_PROTO_TIME_LOW 1000 #define BLINK_BAD_PROTO_TIME_LOW 1000
#define BLINK_WAIT_BIND_TIME_HIGH 1000 #define BLINK_WAIT_BIND_TIME_HIGH 1000
#define BLINK_WAIT_BIND_TIME_LOW 100 #define BLINK_WAIT_BIND_TIME_LOW 100
#define BLINK_BANK_TIME_HIGH 50
#define BLINK_BANK_TIME_LOW 500
#define BLINK_BANK_REPEAT 1500
//******************* //*******************
//*** AUX flags *** //*** AUX flags ***
@ -490,12 +496,12 @@ enum {
/** EEPROM Layout */ /** EEPROM Layout */
#define EEPROM_ID_OFFSET 10 // Module ID (4 bytes) #define EEPROM_ID_OFFSET 10 // Module ID (4 bytes)
#define EEPROM_BANK_OFFSET 15 // Current bank number (1 byte)
#define EEPROM_ID_VALID_OFFSET 20 // 1 byte flag that ID is valid #define EEPROM_ID_VALID_OFFSET 20 // 1 byte flag that ID is valid
#define MODELMODE_EEPROM_OFFSET 30 // Autobind mode, 1 byte per model, end is 46 #define MODELMODE_EEPROM_OFFSET 30 // Autobind mode, 1 byte per model, end is 46
#define AFHDS2A_EEPROM_OFFSET 50 // RX ID, 4 byte per model id, end is 114 #define AFHDS2A_EEPROM_OFFSET 50 // RX ID, 4 byte per model id, end is 114
#define CONFIG_EEPROM_OFFSET 120 // Current configuration of the multimodule #define CONFIG_EEPROM_OFFSET 120 // Current configuration of the multimodule
//**************************************** //****************************************
//*** MULTI protocol serial definition *** //*** MULTI protocol serial definition ***
//**************************************** //****************************************
@ -629,10 +635,10 @@ Serial: 100000 Baud 8e2 _ xxxx xxxx p --
EU_16 2 EU_16 2
EU_8 3 EU_8 3
sub_protocol==HONTAI sub_protocol==HONTAI
FORMAT_HONTAI 0 HONTAI 0
FORMAT_JJRCX1 1 JJRCX1 1
FORMAT_X5C1 2 X5C1 2
FORMAT_FQ777_951 3 FQ777_951 3
sub_protocol==AFHDS2A sub_protocol==AFHDS2A
PWM_IBUS 0 PWM_IBUS 0
PPM_IBUS 1 PPM_IBUS 1

View File

@ -38,7 +38,7 @@
#include "_Config.h" #include "_Config.h"
//Personal config file //Personal config file
#if __has_include("_MyConfig.h") || defined(USE_MY_CONFIG) #if defined(USE_MY_CONFIG)
#include "_MyConfig.h" #include "_MyConfig.h"
#endif #endif
@ -300,10 +300,10 @@ void setup()
SERIAL_TX_output; SERIAL_TX_output;
// pullups // pullups
MODE_DIAL1_port |= _BV(MODE_DIAL1_pin); PROTO_DIAL1_port |= _BV(PROTO_DIAL1_pin);
MODE_DIAL2_port |= _BV(MODE_DIAL2_pin); PROTO_DIAL2_port |= _BV(PROTO_DIAL2_pin);
MODE_DIAL3_port |= _BV(MODE_DIAL3_pin); PROTO_DIAL3_port |= _BV(PROTO_DIAL3_pin);
MODE_DIAL4_port |= _BV(MODE_DIAL4_pin); PROTO_DIAL4_port |= _BV(PROTO_DIAL4_pin);
BIND_port |= _BV(BIND_pin); BIND_port |= _BV(BIND_pin);
// Timer1 config // Timer1 config
@ -357,13 +357,17 @@ void setup()
mode_select= 0x0F -(uint8_t)(((GPIOA->regs->IDR)>>4)&0x0F); mode_select= 0x0F -(uint8_t)(((GPIOA->regs->IDR)>>4)&0x0F);
#else #else
mode_select = mode_select =
((MODE_DIAL1_ipr & _BV(MODE_DIAL1_pin)) ? 0 : 1) + ((PROTO_DIAL1_ipr & _BV(PROTO_DIAL1_pin)) ? 0 : 1) +
((MODE_DIAL2_ipr & _BV(MODE_DIAL2_pin)) ? 0 : 2) + ((PROTO_DIAL2_ipr & _BV(PROTO_DIAL2_pin)) ? 0 : 2) +
((MODE_DIAL3_ipr & _BV(MODE_DIAL3_pin)) ? 0 : 4) + ((PROTO_DIAL3_ipr & _BV(PROTO_DIAL3_pin)) ? 0 : 4) +
((MODE_DIAL4_ipr & _BV(MODE_DIAL4_pin)) ? 0 : 8); ((PROTO_DIAL4_ipr & _BV(PROTO_DIAL4_pin)) ? 0 : 8);
#endif #endif
//mode_select=1; //mode_select=1;
debugln("Mode switch reads as %d", mode_select); debugln("Protocol selection switch reads as %d", mode_select);
#ifdef ENABLE_PPM
uint8_t bank=bank_switch();
#endif
// Set default channels' value // Set default channels' value
InitChannel(); InitChannel();
@ -373,7 +377,7 @@ void setup()
// Update LED // Update LED
LED_off; LED_off;
LED_output; LED_output;
//Init RF modules //Init RF modules
modules_reset(); modules_reset();
@ -396,47 +400,47 @@ void setup()
//Protocol and interrupts initialization //Protocol and interrupts initialization
if(mode_select != MODE_SERIAL) if(mode_select != MODE_SERIAL)
{ // PPM { // PPM
mode_select--; uint8_t line=bank*14+mode_select-1;
protocol = PPM_prot[mode_select].protocol; protocol = PPM_prot[line].protocol;
cur_protocol[1] = protocol; cur_protocol[1] = protocol;
sub_protocol = PPM_prot[mode_select].sub_proto; sub_protocol = PPM_prot[line].sub_proto;
RX_num = PPM_prot[mode_select].rx_num; RX_num = PPM_prot[line].rx_num;
//Forced frequency tuning values for CC2500 protocols //Forced frequency tuning values for CC2500 protocols
#if defined(FORCE_FRSKYD_TUNING) && defined(FRSKYD_CC2500_INO) #if defined(FORCE_FRSKYD_TUNING) && defined(FRSKYD_CC2500_INO)
if(protocol==MODE_FRSKYD) if(protocol==PROTO_FRSKYD)
option = FORCE_FRSKYD_TUNING; // Use config-defined tuning value for FrSkyD option = FORCE_FRSKYD_TUNING; // Use config-defined tuning value for FrSkyD
else else
#endif #endif
#if defined(FORCE_FRSKYV_TUNING) && defined(FRSKYV_CC2500_INO) #if defined(FORCE_FRSKYV_TUNING) && defined(FRSKYV_CC2500_INO)
if(protocol==MODE_FRSKYV) if(protocol==PROTO_FRSKYV)
option = FORCE_FRSKYV_TUNING; // Use config-defined tuning value for FrSkyV option = FORCE_FRSKYV_TUNING; // Use config-defined tuning value for FrSkyV
else else
#endif #endif
#if defined(FORCE_FRSKYX_TUNING) && defined(FRSKYX_CC2500_INO) #if defined(FORCE_FRSKYX_TUNING) && defined(FRSKYX_CC2500_INO)
if(protocol==MODE_FRSKYX) if(protocol==PROTO_FRSKYX)
option = FORCE_FRSKYX_TUNING; // Use config-defined tuning value for FrSkyX option = FORCE_FRSKYX_TUNING; // Use config-defined tuning value for FrSkyX
else else
#endif #endif
#if defined(FORCE_SFHSS_TUNING) && defined(SFHSS_CC2500_INO) #if defined(FORCE_SFHSS_TUNING) && defined(SFHSS_CC2500_INO)
if (protocol==MODE_SFHSS) if (protocol==PROTO_SFHSS)
option = FORCE_SFHSS_TUNING; // Use config-defined tuning value for SFHSS option = FORCE_SFHSS_TUNING; // Use config-defined tuning value for SFHSS
else else
#endif #endif
#if defined(FORCE_CORONA_TUNING) && defined(CORONA_CC2500_INO) #if defined(FORCE_CORONA_TUNING) && defined(CORONA_CC2500_INO)
if (protocol==MODE_CORONA) if (protocol==PROTO_CORONA)
option = FORCE_CORONA_TUNING; // Use config-defined tuning value for CORONA option = FORCE_CORONA_TUNING; // Use config-defined tuning value for CORONA
else else
#endif #endif
option = PPM_prot[mode_select].option; // Use radio-defined option value option = PPM_prot[line].option; // Use radio-defined option value
if(PPM_prot[mode_select].power) POWER_FLAG_on; if(PPM_prot[line].power) POWER_FLAG_on;
if(PPM_prot[mode_select].autobind) if(PPM_prot[line].autobind)
{ {
AUTOBIND_FLAG_on; AUTOBIND_FLAG_on;
BIND_IN_PROGRESS; // Force a bind at protocol startup BIND_IN_PROGRESS; // Force a bind at protocol startup
} }
mode_select++; line++;
protocol_init(); protocol_init();
@ -601,7 +605,7 @@ uint8_t Update_All()
update_led_status(); update_led_status();
#if defined(TELEMETRY) #if defined(TELEMETRY)
#if ( !( defined(MULTI_TELEMETRY) || defined(MULTI_STATUS) ) ) #if ( !( defined(MULTI_TELEMETRY) || defined(MULTI_STATUS) ) )
if( (protocol==MODE_FRSKYD) || (protocol==MODE_BAYANG) || (protocol==MODE_HUBSAN) || (protocol==MODE_AFHDS2A) || (protocol==MODE_FRSKYX) || (protocol==MODE_DSM) || (protocol==MODE_CABELL) ) if( (protocol==PROTO_FRSKYD) || (protocol==PROTO_BAYANG) || (protocol==PROTO_HUBSAN) || (protocol==PROTO_AFHDS2A) || (protocol==PROTO_FRSKYX) || (protocol==PROTO_DSM) || (protocol==PROTO_CABELL) )
#endif #endif
TelemetryUpdate(); TelemetryUpdate();
#endif #endif
@ -617,7 +621,7 @@ uint8_t Update_All()
BIND_CH_PREV_off; BIND_CH_PREV_off;
//Request protocol to terminate bind //Request protocol to terminate bind
#if defined(FRSKYD_CC2500_INO) || defined(FRSKYX_CC2500_INO) || defined(FRSKYV_CC2500_INO) #if defined(FRSKYD_CC2500_INO) || defined(FRSKYX_CC2500_INO) || defined(FRSKYV_CC2500_INO)
if(protocol==MODE_FRSKYD || protocol==MODE_FRSKYX || protocol==MODE_FRSKYV) if(protocol==PROTO_FRSKYD || protocol==PROTO_FRSKYX || protocol==PROTO_FRSKYV)
BIND_DONE; BIND_DONE;
else else
#endif #endif
@ -700,6 +704,88 @@ static void update_led_status(void)
} }
} }
#ifdef ENABLE_PPM
uint8_t bank_switch(void)
{
uint8_t bank=eeprom_read_byte((EE_ADDR)EEPROM_BANK_OFFSET);
if(bank>=NBR_BANKS)
{ // Wrong number of bank
eeprom_write_byte((EE_ADDR)EEPROM_BANK_OFFSET,0x00); // set bank to 0
bank=0;
}
debugln("Using bank %d", bank);
phase=3;
uint32_t check=millis();
blink=millis();
while(mode_select==15)
{ //loop here if the dial is on position 15 for user to select the bank
if(blink<millis())
{
switch(phase & 0x03)
{ // Flash bank number of times
case 0:
LED_on;
blink+=BLINK_BANK_TIME_HIGH;
phase++;
break;
case 1:
LED_off;
blink+=BLINK_BANK_TIME_LOW;
phase++;
break;
case 2:
if( (phase>>2) >= bank)
{
phase=0;
blink+=BLINK_BANK_REPEAT;
}
else
phase+=2;
break;
case 3:
LED_output;
LED_off;
blink+=BLINK_BANK_TIME_LOW;
phase=0;
break;
}
}
if(check<millis())
{
//Test bind button: for AVR it's shared with the LED so some work is needed to check it...
#ifndef STM32_BOARD
bool led=IS_LED_on;
BIND_SET_INPUT;
BIND_SET_PULLUP;
#endif
bool test_bind=IS_BIND_BUTTON_on;
#ifndef STM32_BOARD
if(led)
LED_on;
else
LED_off;
LED_output;
#endif
if( test_bind )
{ // Increase bank
LED_on;
bank++;
if(bank>=NBR_BANKS)
bank=0;
eeprom_write_byte((EE_ADDR)EEPROM_BANK_OFFSET,bank);
debugln("Using bank %d", bank);
phase=3;
blink+=BLINK_BANK_REPEAT;
check+=2*BLINK_BANK_REPEAT;
}
check+=1;
}
}
return bank;
}
#endif
inline void tx_pause() inline void tx_pause()
{ {
#ifdef TELEMETRY #ifdef TELEMETRY
@ -799,21 +885,21 @@ static void protocol_init()
{ {
#ifdef A7105_INSTALLED #ifdef A7105_INSTALLED
#if defined(FLYSKY_A7105_INO) #if defined(FLYSKY_A7105_INO)
case MODE_FLYSKY: case PROTO_FLYSKY:
PE1_off; //antenna RF1 PE1_off; //antenna RF1
next_callback = initFlySky(); next_callback = initFlySky();
remote_callback = ReadFlySky; remote_callback = ReadFlySky;
break; break;
#endif #endif
#if defined(AFHDS2A_A7105_INO) #if defined(AFHDS2A_A7105_INO)
case MODE_AFHDS2A: case PROTO_AFHDS2A:
PE1_off; //antenna RF1 PE1_off; //antenna RF1
next_callback = initAFHDS2A(); next_callback = initAFHDS2A();
remote_callback = ReadAFHDS2A; remote_callback = ReadAFHDS2A;
break; break;
#endif #endif
#if defined(HUBSAN_A7105_INO) #if defined(HUBSAN_A7105_INO)
case MODE_HUBSAN: case PROTO_HUBSAN:
PE1_off; //antenna RF1 PE1_off; //antenna RF1
if(IS_BIND_BUTTON_FLAG_on) random_id(EEPROM_ID_OFFSET,true); // Generate new ID if bind button is pressed. if(IS_BIND_BUTTON_FLAG_on) random_id(EEPROM_ID_OFFSET,true); // Generate new ID if bind button is pressed.
next_callback = initHubsan(); next_callback = initHubsan();
@ -823,7 +909,7 @@ static void protocol_init()
#endif #endif
#ifdef CC2500_INSTALLED #ifdef CC2500_INSTALLED
#if defined(FRSKYD_CC2500_INO) #if defined(FRSKYD_CC2500_INO)
case MODE_FRSKYD: case PROTO_FRSKYD:
PE1_off; //antenna RF2 PE1_off; //antenna RF2
PE2_on; PE2_on;
next_callback = initFrSky_2way(); next_callback = initFrSky_2way();
@ -831,7 +917,7 @@ static void protocol_init()
break; break;
#endif #endif
#if defined(FRSKYV_CC2500_INO) #if defined(FRSKYV_CC2500_INO)
case MODE_FRSKYV: case PROTO_FRSKYV:
PE1_off; //antenna RF2 PE1_off; //antenna RF2
PE2_on; PE2_on;
next_callback = initFRSKYV(); next_callback = initFRSKYV();
@ -839,7 +925,7 @@ static void protocol_init()
break; break;
#endif #endif
#if defined(FRSKYX_CC2500_INO) #if defined(FRSKYX_CC2500_INO)
case MODE_FRSKYX: case PROTO_FRSKYX:
PE1_off; //antenna RF2 PE1_off; //antenna RF2
PE2_on; PE2_on;
next_callback = initFrSkyX(); next_callback = initFrSkyX();
@ -847,7 +933,7 @@ static void protocol_init()
break; break;
#endif #endif
#if defined(SFHSS_CC2500_INO) #if defined(SFHSS_CC2500_INO)
case MODE_SFHSS: case PROTO_SFHSS:
PE1_off; //antenna RF2 PE1_off; //antenna RF2
PE2_on; PE2_on;
next_callback = initSFHSS(); next_callback = initSFHSS();
@ -855,7 +941,7 @@ static void protocol_init()
break; break;
#endif #endif
#if defined(CORONA_CC2500_INO) #if defined(CORONA_CC2500_INO)
case MODE_CORONA: case PROTO_CORONA:
PE1_off; //antenna RF2 PE1_off; //antenna RF2
PE2_on; PE2_on;
next_callback = initCORONA(); next_callback = initCORONA();
@ -865,25 +951,25 @@ static void protocol_init()
#endif #endif
#ifdef CYRF6936_INSTALLED #ifdef CYRF6936_INSTALLED
#if defined(DSM_CYRF6936_INO) #if defined(DSM_CYRF6936_INO)
case MODE_DSM: case PROTO_DSM:
PE2_on; //antenna RF4 PE2_on; //antenna RF4
next_callback = initDsm(); next_callback = initDsm();
remote_callback = ReadDsm; remote_callback = ReadDsm;
break; break;
#endif #endif
#if defined(DEVO_CYRF6936_INO) #if defined(DEVO_CYRF6936_INO)
case MODE_DEVO: case PROTO_DEVO:
#ifdef ENABLE_PPM #ifdef ENABLE_PPM
if(mode_select) //PPM mode if(mode_select) //PPM mode
{ {
if(IS_BIND_BUTTON_FLAG_on) if(IS_BIND_BUTTON_FLAG_on)
{ {
eeprom_write_byte((EE_ADDR)(MODELMODE_EEPROM_OFFSET+mode_select),0x00); // reset to autobind mode for the current model eeprom_write_byte((EE_ADDR)(MODELMODE_EEPROM_OFFSET+RX_num),0x00); // reset to autobind mode for the current model
option=0; option=0;
} }
else else
{ {
option=eeprom_read_byte((EE_ADDR)(MODELMODE_EEPROM_OFFSET+mode_select)); // load previous mode: autobind or fixed id option=eeprom_read_byte((EE_ADDR)(MODELMODE_EEPROM_OFFSET+RX_num)); // load previous mode: autobind or fixed id
if(option!=1) option=0; // if not fixed id mode then it should be autobind if(option!=1) option=0; // if not fixed id mode then it should be autobind
} }
} }
@ -894,18 +980,18 @@ static void protocol_init()
break; break;
#endif #endif
#if defined(WK2x01_CYRF6936_INO) #if defined(WK2x01_CYRF6936_INO)
case MODE_WK2x01: case PROTO_WK2x01:
#ifdef ENABLE_PPM #ifdef ENABLE_PPM
if(mode_select) //PPM mode if(mode_select) //PPM mode
{ {
if(IS_BIND_BUTTON_FLAG_on) if(IS_BIND_BUTTON_FLAG_on)
{ {
eeprom_write_byte((EE_ADDR)(MODELMODE_EEPROM_OFFSET+mode_select),0x00); // reset to autobind mode for the current model eeprom_write_byte((EE_ADDR)(MODELMODE_EEPROM_OFFSET+RX_num),0x00); // reset to autobind mode for the current model
option=0; option=0;
} }
else else
{ {
option=eeprom_read_byte((EE_ADDR)(MODELMODE_EEPROM_OFFSET+mode_select)); // load previous mode: autobind or fixed id option=eeprom_read_byte((EE_ADDR)(MODELMODE_EEPROM_OFFSET+RX_num)); // load previous mode: autobind or fixed id
if(option!=1) option=0; // if not fixed id mode then it should be autobind if(option!=1) option=0; // if not fixed id mode then it should be autobind
} }
} }
@ -916,7 +1002,7 @@ static void protocol_init()
break; break;
#endif #endif
#if defined(J6PRO_CYRF6936_INO) #if defined(J6PRO_CYRF6936_INO)
case MODE_J6PRO: case PROTO_J6PRO:
PE2_on; //antenna RF4 PE2_on; //antenna RF4
next_callback = initJ6Pro(); next_callback = initJ6Pro();
remote_callback = ReadJ6Pro; remote_callback = ReadJ6Pro;
@ -925,141 +1011,141 @@ static void protocol_init()
#endif #endif
#ifdef NRF24L01_INSTALLED #ifdef NRF24L01_INSTALLED
#if defined(HISKY_NRF24L01_INO) #if defined(HISKY_NRF24L01_INO)
case MODE_HISKY: case PROTO_HISKY:
next_callback=initHiSky(); next_callback=initHiSky();
remote_callback = hisky_cb; remote_callback = hisky_cb;
break; break;
#endif #endif
#if defined(V2X2_NRF24L01_INO) #if defined(V2X2_NRF24L01_INO)
case MODE_V2X2: case PROTO_V2X2:
next_callback = initV2x2(); next_callback = initV2x2();
remote_callback = ReadV2x2; remote_callback = ReadV2x2;
break; break;
#endif #endif
#if defined(YD717_NRF24L01_INO) #if defined(YD717_NRF24L01_INO)
case MODE_YD717: case PROTO_YD717:
next_callback=initYD717(); next_callback=initYD717();
remote_callback = yd717_callback; remote_callback = yd717_callback;
break; break;
#endif #endif
#if defined(KN_NRF24L01_INO) #if defined(KN_NRF24L01_INO)
case MODE_KN: case PROTO_KN:
next_callback = initKN(); next_callback = initKN();
remote_callback = kn_callback; remote_callback = kn_callback;
break; break;
#endif #endif
#if defined(SYMAX_NRF24L01_INO) #if defined(SYMAX_NRF24L01_INO)
case MODE_SYMAX: case PROTO_SYMAX:
next_callback = initSymax(); next_callback = initSymax();
remote_callback = symax_callback; remote_callback = symax_callback;
break; break;
#endif #endif
#if defined(SLT_NRF24L01_INO) #if defined(SLT_NRF24L01_INO)
case MODE_SLT: case PROTO_SLT:
next_callback=initSLT(); next_callback=initSLT();
remote_callback = SLT_callback; remote_callback = SLT_callback;
break; break;
#endif #endif
#if defined(CX10_NRF24L01_INO) #if defined(CX10_NRF24L01_INO)
case MODE_Q2X2: case PROTO_Q2X2:
sub_protocol|=0x08; // Increase the number of sub_protocols for CX-10 sub_protocol|=0x08; // Increase the number of sub_protocols for CX-10
case MODE_CX10: case PROTO_CX10:
next_callback=initCX10(); next_callback=initCX10();
remote_callback = CX10_callback; remote_callback = CX10_callback;
break; break;
#endif #endif
#if defined(CG023_NRF24L01_INO) #if defined(CG023_NRF24L01_INO)
case MODE_CG023: case PROTO_CG023:
next_callback=initCG023(); next_callback=initCG023();
remote_callback = CG023_callback; remote_callback = CG023_callback;
break; break;
#endif #endif
#if defined(BAYANG_NRF24L01_INO) #if defined(BAYANG_NRF24L01_INO)
case MODE_BAYANG: case PROTO_BAYANG:
next_callback=initBAYANG(); next_callback=initBAYANG();
remote_callback = BAYANG_callback; remote_callback = BAYANG_callback;
break; break;
#endif #endif
#if defined(ESKY_NRF24L01_INO) #if defined(ESKY_NRF24L01_INO)
case MODE_ESKY: case PROTO_ESKY:
next_callback=initESKY(); next_callback=initESKY();
remote_callback = ESKY_callback; remote_callback = ESKY_callback;
break; break;
#endif #endif
#if defined(MT99XX_NRF24L01_INO) #if defined(MT99XX_NRF24L01_INO)
case MODE_MT99XX: case PROTO_MT99XX:
next_callback=initMT99XX(); next_callback=initMT99XX();
remote_callback = MT99XX_callback; remote_callback = MT99XX_callback;
break; break;
#endif #endif
#if defined(MJXQ_NRF24L01_INO) #if defined(MJXQ_NRF24L01_INO)
case MODE_MJXQ: case PROTO_MJXQ:
next_callback=initMJXQ(); next_callback=initMJXQ();
remote_callback = MJXQ_callback; remote_callback = MJXQ_callback;
break; break;
#endif #endif
#if defined(SHENQI_NRF24L01_INO) #if defined(SHENQI_NRF24L01_INO)
case MODE_SHENQI: case PROTO_SHENQI:
next_callback=initSHENQI(); next_callback=initSHENQI();
remote_callback = SHENQI_callback; remote_callback = SHENQI_callback;
break; break;
#endif #endif
#if defined(FY326_NRF24L01_INO) #if defined(FY326_NRF24L01_INO)
case MODE_FY326: case PROTO_FY326:
next_callback=initFY326(); next_callback=initFY326();
remote_callback = FY326_callback; remote_callback = FY326_callback;
break; break;
#endif #endif
#if defined(FQ777_NRF24L01_INO) #if defined(FQ777_NRF24L01_INO)
case MODE_FQ777: case PROTO_FQ777:
next_callback=initFQ777(); next_callback=initFQ777();
remote_callback = FQ777_callback; remote_callback = FQ777_callback;
break; break;
#endif #endif
#if defined(ASSAN_NRF24L01_INO) #if defined(ASSAN_NRF24L01_INO)
case MODE_ASSAN: case PROTO_ASSAN:
next_callback=initASSAN(); next_callback=initASSAN();
remote_callback = ASSAN_callback; remote_callback = ASSAN_callback;
break; break;
#endif #endif
#if defined(HONTAI_NRF24L01_INO) #if defined(HONTAI_NRF24L01_INO)
case MODE_HONTAI: case PROTO_HONTAI:
next_callback=initHONTAI(); next_callback=initHONTAI();
remote_callback = HONTAI_callback; remote_callback = HONTAI_callback;
break; break;
#endif #endif
#if defined(Q303_NRF24L01_INO) #if defined(Q303_NRF24L01_INO)
case MODE_Q303: case PROTO_Q303:
next_callback=initQ303(); next_callback=initQ303();
remote_callback = Q303_callback; remote_callback = Q303_callback;
break; break;
#endif #endif
#if defined(GW008_NRF24L01_INO) #if defined(GW008_NRF24L01_INO)
case MODE_GW008: case PROTO_GW008:
next_callback=initGW008(); next_callback=initGW008();
remote_callback = GW008_callback; remote_callback = GW008_callback;
break; break;
#endif #endif
#if defined(DM002_NRF24L01_INO) #if defined(DM002_NRF24L01_INO)
case MODE_DM002: case PROTO_DM002:
next_callback=initDM002(); next_callback=initDM002();
remote_callback = DM002_callback; remote_callback = DM002_callback;
break; break;
#endif #endif
#if defined(CABELL_NRF24L01_INO) #if defined(CABELL_NRF24L01_INO)
case MODE_CABELL: case PROTO_CABELL:
next_callback=initCABELL(); next_callback=initCABELL();
remote_callback = CABELL_callback; remote_callback = CABELL_callback;
break; break;
#endif #endif
#if defined(ESKY150_NRF24L01_INO) #if defined(ESKY150_NRF24L01_INO)
case MODE_ESKY150: case PROTO_ESKY150:
next_callback=initESKY150(); next_callback=initESKY150();
remote_callback = ESKY150_callback; remote_callback = ESKY150_callback;
break; break;
#endif #endif
#if defined(H8_3D_NRF24L01_INO) #if defined(H8_3D_NRF24L01_INO)
case MODE_H8_3D: case PROTO_H8_3D:
next_callback=initH8_3D(); next_callback=initH8_3D();
remote_callback = H8_3D_callback; remote_callback = H8_3D_callback;
break; break;
@ -1114,27 +1200,27 @@ void update_serial_data()
//Forced frequency tuning values for CC2500 protocols //Forced frequency tuning values for CC2500 protocols
#if defined(FORCE_FRSKYD_TUNING) && defined(FRSKYD_CC2500_INO) #if defined(FORCE_FRSKYD_TUNING) && defined(FRSKYD_CC2500_INO)
if(protocol==MODE_FRSKYD) if(protocol==PROTO_FRSKYD)
option=FORCE_FRSKYD_TUNING; // Use config-defined tuning value for FrSkyD option=FORCE_FRSKYD_TUNING; // Use config-defined tuning value for FrSkyD
else else
#endif #endif
#if defined(FORCE_FRSKYV_TUNING) && defined(FRSKYV_CC2500_INO) #if defined(FORCE_FRSKYV_TUNING) && defined(FRSKYV_CC2500_INO)
if(protocol==MODE_FRSKYV) if(protocol==PROTO_FRSKYV)
option=FORCE_FRSKYV_TUNING; // Use config-defined tuning value for FrSkyV option=FORCE_FRSKYV_TUNING; // Use config-defined tuning value for FrSkyV
else else
#endif #endif
#if defined(FORCE_FRSKYX_TUNING) && defined(FRSKYX_CC2500_INO) #if defined(FORCE_FRSKYX_TUNING) && defined(FRSKYX_CC2500_INO)
if(protocol==MODE_FRSKYX) if(protocol==PROTO_FRSKYX)
option=FORCE_FRSKYX_TUNING; // Use config-defined tuning value for FrSkyX option=FORCE_FRSKYX_TUNING; // Use config-defined tuning value for FrSkyX
else else
#endif #endif
#if defined(FORCE_SFHSS_TUNING) && defined(SFHSS_CC2500_INO) #if defined(FORCE_SFHSS_TUNING) && defined(SFHSS_CC2500_INO)
if (protocol==MODE_SFHSS) if (protocol==PROTO_SFHSS)
option=FORCE_SFHSS_TUNING; // Use config-defined tuning value for SFHSS option=FORCE_SFHSS_TUNING; // Use config-defined tuning value for SFHSS
else else
#endif #endif
#if defined(FORCE_CORONA_TUNING) && defined(CORONA_CC2500_INO) #if defined(FORCE_CORONA_TUNING) && defined(CORONA_CC2500_INO)
if (protocol==MODE_CORONA) if (protocol==PROTO_CORONA)
option=FORCE_CORONA_TUNING; // Use config-defined tuning value for CORONA option=FORCE_CORONA_TUNING; // Use config-defined tuning value for CORONA
else else
#endif #endif
@ -1175,7 +1261,7 @@ void update_serial_data()
if( ((rx_ok_buff[1]&0x80)==0) && ((cur_protocol[1]&0x80)!=0) ) // Bind flag has been reset if( ((rx_ok_buff[1]&0x80)==0) && ((cur_protocol[1]&0x80)!=0) ) // Bind flag has been reset
{ // Request protocol to end bind { // Request protocol to end bind
#if defined(FRSKYD_CC2500_INO) || defined(FRSKYX_CC2500_INO) || defined(FRSKYV_CC2500_INO) #if defined(FRSKYD_CC2500_INO) || defined(FRSKYX_CC2500_INO) || defined(FRSKYV_CC2500_INO)
if(protocol==MODE_FRSKYD || protocol==MODE_FRSKYX || protocol==MODE_FRSKYV) if(protocol==PROTO_FRSKYD || protocol==PROTO_FRSKYX || protocol==PROTO_FRSKYV)
BIND_DONE; BIND_DONE;
else else
#endif #endif
@ -1441,11 +1527,11 @@ void pollBoot()
#if defined(TELEMETRY) #if defined(TELEMETRY)
void PPM_Telemetry_serial_init() void PPM_Telemetry_serial_init()
{ {
if( (protocol==MODE_FRSKYD) || (protocol==MODE_HUBSAN) || (protocol==MODE_AFHDS2A) || (protocol==MODE_BAYANG) || (protocol==MODE_CABELL) ) if( (protocol==PROTO_FRSKYD) || (protocol==PROTO_HUBSAN) || (protocol==PROTO_AFHDS2A) || (protocol==PROTO_BAYANG) || (protocol==PROTO_CABELL) )
initTXSerial( SPEED_9600 ) ; initTXSerial( SPEED_9600 ) ;
if(protocol==MODE_FRSKYX) if(protocol==PROTO_FRSKYX)
initTXSerial( SPEED_57600 ) ; initTXSerial( SPEED_57600 ) ;
if(protocol==MODE_DSM) if(protocol==PROTO_DSM)
initTXSerial( SPEED_125K ) ; initTXSerial( SPEED_125K ) ;
} }
#endif #endif

View File

@ -32,18 +32,18 @@
#endif #endif
// Dial // Dial
#define MODE_DIAL1_pin 2 #define PROTO_DIAL1_pin 2
#define MODE_DIAL1_port PORTB #define PROTO_DIAL1_port PORTB
#define MODE_DIAL1_ipr PINB #define PROTO_DIAL1_ipr PINB
#define MODE_DIAL2_pin 3 #define PROTO_DIAL2_pin 3
#define MODE_DIAL2_port PORTB #define PROTO_DIAL2_port PORTB
#define MODE_DIAL2_ipr PINB #define PROTO_DIAL2_ipr PINB
#define MODE_DIAL3_pin 4 #define PROTO_DIAL3_pin 4
#define MODE_DIAL3_port PORTB #define PROTO_DIAL3_port PORTB
#define MODE_DIAL3_ipr PINB #define PROTO_DIAL3_ipr PINB
#define MODE_DIAL4_pin 0 #define PROTO_DIAL4_pin 0
#define MODE_DIAL4_port PORTC #define PROTO_DIAL4_port PORTC
#define MODE_DIAL4_ipr PINC #define PROTO_DIAL4_ipr PINC
// PPM // PPM
#define PPM_pin 3 //D3 = PD3 #define PPM_pin 3 //D3 = PD3
@ -291,6 +291,7 @@
#define LED_output pinMode(LED_pin,OUTPUT) #define LED_output pinMode(LED_pin,OUTPUT)
#define IS_LED_on ( digitalRead(LED_pin)==HIGH) #define IS_LED_on ( digitalRead(LED_pin)==HIGH)
//iRangeX modules have a second LED
#define LED2_on digitalWrite(LED2_pin,HIGH) #define LED2_on digitalWrite(LED2_pin,HIGH)
#define LED2_off digitalWrite(LED2_pin,LOW) #define LED2_off digitalWrite(LED2_pin,LOW)
#define LED2_toggle digitalWrite(LED2_pin ,!digitalRead(LED2_pin)) #define LED2_toggle digitalWrite(LED2_pin ,!digitalRead(LED2_pin))

View File

@ -113,14 +113,14 @@ static void multi_send_status()
//Is failsafe supported? //Is failsafe supported?
switch (protocol) switch (protocol)
{ {
case MODE_HISKY: case PROTO_HISKY:
if(sub_protocol!=HK310) if(sub_protocol!=HK310)
break; break;
case MODE_AFHDS2A: case PROTO_AFHDS2A:
case MODE_DEVO: case PROTO_DEVO:
case MODE_SFHSS: case PROTO_SFHSS:
case MODE_WK2x01: case PROTO_WK2x01:
case MODE_FRSKYX: case PROTO_FRSKYX:
flags |= 0x20; //Yes flags |= 0x20; //Yes
default: default:
break; break;
@ -219,7 +219,7 @@ void frsky_check_telemetry(uint8_t *pkt,uint8_t len)
if(pktt[6]>0 && pktt[6]<=10) if(pktt[6]>0 && pktt[6]<=10)
{ {
if (protocol==MODE_FRSKYD) if (protocol==PROTO_FRSKYD)
{ {
if ( ( pktt[7] & 0x1F ) == (telemetry_counter & 0x1F) ) if ( ( pktt[7] & 0x1F ) == (telemetry_counter & 0x1F) )
{ {
@ -243,7 +243,7 @@ void frsky_check_telemetry(uint8_t *pkt,uint8_t len)
// //
#if defined SPORT_TELEMETRY && defined FRSKYX_CC2500_INO #if defined SPORT_TELEMETRY && defined FRSKYX_CC2500_INO
telemetry_lost=0; telemetry_lost=0;
if (protocol==MODE_FRSKYX) if (protocol==PROTO_FRSKYX)
{ {
uint16_t lcrc = frskyX_crc_x(&pkt[3], len-7 ) ; uint16_t lcrc = frskyX_crc_x(&pkt[3], len-7 ) ;
@ -340,7 +340,7 @@ void init_frskyd_link_telemetry()
void frsky_link_frame() void frsky_link_frame()
{ {
frame[0] = 0xFE; // Link frame frame[0] = 0xFE; // Link frame
if (protocol==MODE_FRSKYD) if (protocol==PROTO_FRSKYD)
{ {
frame[1] = pktt[3]; // A1 frame[1] = pktt[3]; // A1
frame[2] = pktt[4]; // A2 frame[2] = pktt[4]; // A2
@ -349,7 +349,7 @@ void frsky_link_frame()
telemetry_link |= 2 ; // Send hub if available telemetry_link |= 2 ; // Send hub if available
} }
else else
if (protocol==MODE_HUBSAN||protocol==MODE_AFHDS2A||protocol==MODE_BAYANG||protocol==MODE_CABELL) if (protocol==PROTO_HUBSAN||protocol==PROTO_AFHDS2A||protocol==PROTO_BAYANG||protocol==PROTO_CABELL)
{ {
frame[1] = v_lipo1; frame[1] = v_lipo1;
frame[2] = v_lipo2; frame[2] = v_lipo2;
@ -854,7 +854,7 @@ void TelemetryUpdate()
#endif #endif
#if defined SPORT_TELEMETRY #if defined SPORT_TELEMETRY
if (protocol==MODE_FRSKYX) if (protocol==PROTO_FRSKYX)
{ // FrSkyX { // FrSkyX
for(;;) for(;;)
{ {
@ -900,7 +900,7 @@ void TelemetryUpdate()
#endif // SPORT_TELEMETRY #endif // SPORT_TELEMETRY
#if defined DSM_TELEMETRY #if defined DSM_TELEMETRY
if(telemetry_link && protocol == MODE_DSM) if(telemetry_link && protocol == PROTO_DSM)
{ // DSM { // DSM
DSM_frame(); DSM_frame();
telemetry_link=0; telemetry_link=0;
@ -908,7 +908,7 @@ void TelemetryUpdate()
} }
#endif #endif
#if defined AFHDS2A_FW_TELEMETRY #if defined AFHDS2A_FW_TELEMETRY
if(telemetry_link == 2 && protocol == MODE_AFHDS2A) if(telemetry_link == 2 && protocol == PROTO_AFHDS2A)
{ {
AFHDSA_short_frame(); AFHDSA_short_frame();
telemetry_link=0; telemetry_link=0;
@ -916,13 +916,13 @@ void TelemetryUpdate()
} }
#endif #endif
if((telemetry_link & 1 )&& protocol != MODE_FRSKYX) if((telemetry_link & 1 )&& protocol != PROTO_FRSKYX)
{ // FrSkyD + Hubsan + AFHDS2A + Bayang + Cabell { // FrSkyD + Hubsan + AFHDS2A + Bayang + Cabell
frsky_link_frame(); frsky_link_frame();
return; return;
} }
#if defined HUB_TELEMETRY #if defined HUB_TELEMETRY
if((telemetry_link & 2) && protocol == MODE_FRSKYD) if((telemetry_link & 2) && protocol == PROTO_FRSKYD)
{ // FrSkyD { // FrSkyD
frsky_user_frame(); frsky_user_frame();
return; return;

View File

@ -49,6 +49,11 @@
#error "You have enabled CHECK_FOR_BOOTLOADER but not selected the 'Flash from TX' bootloader." #error "You have enabled CHECK_FOR_BOOTLOADER but not selected the 'Flash from TX' bootloader."
#endif #endif
//Check number of banks
#if NBR_BANKS < 1 || NBR_BANKS > 5
#error "You need to select a number of banks between 1 and 5."
#endif
//Check failsafe throttle value //Check failsafe throttle value
#ifdef FAILSAFE_ENABLE #ifdef FAILSAFE_ENABLE
#if ( FAILSAFE_THROTTLE_LOW < -125 ) || ( FAILSAFE_THROTTLE_LOW > 125 ) #if ( FAILSAFE_THROTTLE_LOW < -125 ) || ( FAILSAFE_THROTTLE_LOW > 125 )

View File

@ -294,7 +294,7 @@ static void __attribute__((unused)) WK_build_beacon_pkt_2801()
BIND_SET_PULLUP; // set pullup BIND_SET_PULLUP; // set pullup
if(IS_BIND_BUTTON_on) if(IS_BIND_BUTTON_on)
{ {
eeprom_write_byte((EE_ADDR)(MODELMODE_EEPROM_OFFSET+mode_select),0x01); // Set fixed id mode for the current model eeprom_write_byte((EE_ADDR)(MODELMODE_EEPROM_OFFSET+RX_num),0x01); // Set fixed id mode for the current model
option=1; option=1;
} }
BIND_SET_OUTPUT; BIND_SET_OUTPUT;
@ -303,7 +303,7 @@ static void __attribute__((unused)) WK_build_beacon_pkt_2801()
if(prev_option!=option && IS_BIND_DONE) if(prev_option!=option && IS_BIND_DONE)
{ {
set_rx_tx_addr(MProtocol_id); set_rx_tx_addr(MProtocol_id);
rx_tx_addr[2]=rx_tx_addr[3]<<4; // Make use of RX_Num rx_tx_addr[2]=rx_tx_addr[3]<<4; // Make use of RX_num
bind_counter = WK_BIND_COUNT / 8 + 1; bind_counter = WK_BIND_COUNT / 8 + 1;
} }
if (option) if (option)
@ -490,7 +490,7 @@ uint16_t WK_setup()
} }
else else
{ {
rx_tx_addr[2]=rx_tx_addr[3]<<4; // Make use of RX_Num rx_tx_addr[2]=rx_tx_addr[3]<<4; // Make use of RX_num
bind_counter = 0; bind_counter = 0;
phase = WK_BOUND_1; phase = WK_BOUND_1;
BIND_DONE; BIND_DONE;

View File

@ -22,7 +22,7 @@
/********************/ /********************/
//If you know parameters you want for sure to be enabled or disabled which survives in future, you can use a file named "_MyConfig.h". //If you know parameters you want for sure to be enabled or disabled which survives in future, you can use a file named "_MyConfig.h".
//An example is given within the file named "_MyConfig.h.example" which needs to be renamed if you want to use it. //An example is given within the file named "_MyConfig.h.example" which needs to be renamed if you want to use it.
//To enable this config file remove the // from the line below. It's automatically loaded if the file exists for the AVR platform but not STM32... //To enable this config file remove the // from the line below.
//#define USE_MY_CONFIG //#define USE_MY_CONFIG
@ -305,160 +305,240 @@
/** Dial Protocol Selector Settings **/ /** Dial Protocol Selector Settings **/
//The table below indicates which protocol to run when a specific position on the dial has been selected. //The table below indicates which protocol to run when a specific position on the dial has been selected.
//All fields and values are explained below. Everything is configurable from here like in the Serial mode. //All fields and values are explained below. Everything is configurable from here like in the Serial mode.
//Example: You can associate multiple times the same protocol to different dial positions to take advantage of the model match (RX_Num) //Tip: You can associate multiple times the same protocol to different dial positions to take advantage of the model match based on RX_Num
const PPM_Parameters PPM_prot[15]= {
//A system of banks enable the access to more protocols than positions on the dial. Banks can be selected by placing the dial on position 15, power up the module and
// short press the bind button multiple times until you reach the desired one. The bank number currently selected is indicated by the number of LED flash.
//The parameter below indicates the number of desired banks between 1 and 5. Default is 5.
#define NBR_BANKS 5
const PPM_Parameters PPM_prot[14*NBR_BANKS]= {
#if NBR_BANKS > 0
//****************************** BANK 1 ******************************
// Dial Protocol Sub protocol RX_Num Power Auto Bind Option // Dial Protocol Sub protocol RX_Num Power Auto Bind Option
/* 1 */ {MODE_FLYSKY, Flysky , 0 , P_HIGH , NO_AUTOBIND , 0 }, /* 1 */ {PROTO_FLYSKY, Flysky , 0 , P_HIGH , NO_AUTOBIND , 0 },
/* 2 */ {MODE_HUBSAN, H107 , 0 , P_HIGH , NO_AUTOBIND , 0 }, /* 2 */ {PROTO_AFHDS2A, PWM_IBUS , 0 , P_HIGH , NO_AUTOBIND , 0 }, // RX number 0
/* 3 */ {MODE_FRSKYD, 0 , 0 , P_HIGH , NO_AUTOBIND , 40 }, // option=fine freq tuning /* 3 */ {PROTO_AFHDS2A, PWM_IBUS , 1 , P_HIGH , NO_AUTOBIND , 0 }, // RX number 1
/* 4 */ {MODE_HISKY , Hisky , 0 , P_HIGH , NO_AUTOBIND , 0 }, /* 4 */ {PROTO_AFHDS2A, PWM_IBUS , 2 , P_HIGH , NO_AUTOBIND , 0 }, // RX number 2
/* 5 */ {MODE_V2X2 , 0 , 0 , P_HIGH , NO_AUTOBIND , 0 }, /* 5 */ {PROTO_AFHDS2A, PWM_IBUS , 3 , P_HIGH , NO_AUTOBIND , 0 }, // RX number 3
/* 6 */ {MODE_DSM , DSMX_11 , 0 , P_HIGH , NO_AUTOBIND , 6 }, // option=number of channels /* 6 */ {PROTO_AFHDS2A, PWM_IBUS , 2 , P_HIGH , NO_AUTOBIND , 0 }, // RX number 4
/* 7 */ {MODE_DSM , DSM2_22 , 0 , P_HIGH , NO_AUTOBIND , 6 }, /* 7 */ {PROTO_AFHDS2A, PWM_IBUS , 3 , P_HIGH , NO_AUTOBIND , 0 }, // RX number 5
/* 8 */ {MODE_YD717 , YD717 , 0 , P_HIGH , NO_AUTOBIND , 0 }, /* 8 */ {PROTO_SFHSS, H107 , 0 , P_HIGH , NO_AUTOBIND , 0 },
/* 9 */ {MODE_KN , WLTOYS , 0 , P_HIGH , NO_AUTOBIND , 0 }, /* 9 */ {PROTO_FRSKYV, 0 , 0 , P_HIGH , NO_AUTOBIND , 40 }, // option=fine freq tuning
/* 10 */ {MODE_SYMAX , SYMAX , 0 , P_HIGH , NO_AUTOBIND , 0 }, /* 10 */ {PROTO_FRSKYD, 0 , 0 , P_HIGH , NO_AUTOBIND , 40 }, // option=fine freq tuning
/* 11 */ {MODE_SLT , 0 , 0 , P_HIGH , NO_AUTOBIND , 0 }, /* 11 */ {PROTO_FRSKYX, CH_16 , 0 , P_HIGH , NO_AUTOBIND , 40 }, // option=fine freq tuning
/* 12 */ {MODE_CX10 , CX10_BLUE , 0 , P_HIGH , NO_AUTOBIND , 0 }, /* 12 */ {PROTO_FRSKYX, EU_16 , 0 , P_HIGH , NO_AUTOBIND , 40 }, // option=fine freq tuning
/* 13 */ {MODE_CG023 , CG023 , 0 , P_HIGH , NO_AUTOBIND , 0 }, /* 13 */ {PROTO_DEVO , 0 , 0 , P_HIGH , NO_AUTOBIND , 0 },
/* 14 */ {MODE_BAYANG, BAYANG , 0 , P_HIGH , NO_AUTOBIND , 0 }, /* 14 */ {PROTO_WK2x01, WK2801 , 0 , P_HIGH , NO_AUTOBIND , 0 },
/* 15 */ {MODE_SYMAX , SYMAX5C , 0 , P_HIGH , NO_AUTOBIND , 0 } #endif
#if NBR_BANKS > 1
//****************************** BANK 2 ******************************
// Dial Protocol Sub protocol RX_Num Power Auto Bind Option
/* 1 */ {PROTO_DSM , DSM2_11 , 0 , P_HIGH , NO_AUTOBIND , 6 }, // option=number of channels
/* 2 */ {PROTO_DSM , DSM2_22 , 0 , P_HIGH , NO_AUTOBIND , 6 }, // option=number of channels
/* 3 */ {PROTO_DSM , DSMX_11 , 0 , P_HIGH , NO_AUTOBIND , 6 }, // option=number of channels
/* 4 */ {PROTO_DSM , DSMX_22 , 0 , P_HIGH , NO_AUTOBIND , 6 }, // option=number of channels
/* 5 */ {PROTO_DSM , DSM2_11 , 0 , P_HIGH , NO_AUTOBIND , 8 }, // option=number of channels
/* 6 */ {PROTO_DSM , DSM2_22 , 0 , P_HIGH , NO_AUTOBIND , 8 }, // option=number of channels
/* 7 */ {PROTO_DSM , DSMX_11 , 0 , P_HIGH , NO_AUTOBIND , 8 }, // option=number of channels
/* 8 */ {PROTO_DSM , DSMX_22 , 0 , P_HIGH , NO_AUTOBIND , 8 }, // option=number of channels
/* 9 */ {PROTO_SLT , 0 , 0 , P_HIGH , NO_AUTOBIND , 0 },
/* 10 */ {PROTO_HUBSAN, H107 , 0 , P_HIGH , NO_AUTOBIND , 0 },
/* 11 */ {PROTO_HUBSAN, H301 , 0 , P_HIGH , NO_AUTOBIND , 0 },
/* 12 */ {PROTO_HUBSAN, H501 , 0 , P_HIGH , NO_AUTOBIND , 0 },
/* 13 */ {PROTO_HISKY , Hisky , 0 , P_HIGH , NO_AUTOBIND , 0 },
/* 14 */ {PROTO_V2X2 , 0 , 0 , P_HIGH , NO_AUTOBIND , 0 },
#endif
#if NBR_BANKS > 2
//****************************** BANK 3 ******************************
// Dial Protocol Sub protocol RX_Num Power Auto Bind Option
/* 1 */ {PROTO_ESKY , 0 , 0 , P_HIGH , NO_AUTOBIND , 0 },
/* 2 */ {PROTO_ESKY150, 0 , 0 , P_HIGH , NO_AUTOBIND , 0 },
/* 3 */ {PROTO_ASSAN, 0 , 0 , P_HIGH , NO_AUTOBIND , 0 },
/* 4 */ {PROTO_CORONA, COR_V2 , 0 , P_HIGH , NO_AUTOBIND , 0 },
/* 5 */ {PROTO_SYMAX , SYMAX , 0 , P_HIGH , NO_AUTOBIND , 0 },
/* 6 */ {PROTO_KN , WLTOYS , 0 , P_HIGH , NO_AUTOBIND , 0 },
/* 7 */ {PROTO_BAYANG, BAYANG , 0 , P_HIGH , NO_AUTOBIND , 0 },
/* 8 */ {PROTO_BAYANG, H8S3D , 0 , P_HIGH , NO_AUTOBIND , 0 },
/* 9 */ {PROTO_BAYANG, X16_AH , 0 , P_HIGH , NO_AUTOBIND , 0 },
/* 10 */ {PROTO_BAYANG, IRDRONE , 0 , P_HIGH , NO_AUTOBIND , 0 },
/* 11 */ {PROTO_H8_3D, H8_3D , 0 , P_HIGH , NO_AUTOBIND , 0 },
/* 12 */ {PROTO_H8_3D, H20H , 0 , P_HIGH , NO_AUTOBIND , 0 },
/* 13 */ {PROTO_H8_3D, H20MINI , 0 , P_HIGH , NO_AUTOBIND , 0 },
/* 14 */ {PROTO_H8_3D, H30MINI , 0 , P_HIGH , NO_AUTOBIND , 0 },
#endif
#if NBR_BANKS > 3
//****************************** BANK 4 ******************************
// Dial Protocol Sub protocol RX_Num Power Auto Bind Option
/* 1 */ {PROTO_MJXQ , WLH08 , 0 , P_HIGH , NO_AUTOBIND , 0 },
/* 2 */ {PROTO_MJXQ , X600 , 0 , P_HIGH , NO_AUTOBIND , 0 },
/* 3 */ {PROTO_MJXQ , X800 , 0 , P_HIGH , NO_AUTOBIND , 0 },
/* 4 */ {PROTO_MJXQ , H26D , 0 , P_HIGH , NO_AUTOBIND , 0 },
/* 5 */ {PROTO_MJXQ , E010 , 0 , P_HIGH , NO_AUTOBIND , 0 },
/* 6 */ {PROTO_MJXQ , H26WH , 0 , P_HIGH , NO_AUTOBIND , 0 },
/* 7 */ {PROTO_HONTAI, HONTAI , 0 , P_HIGH , NO_AUTOBIND , 0 },
/* 8 */ {PROTO_HONTAI, JJRCX1 , 0 , P_HIGH , NO_AUTOBIND , 0 },
/* 9 */ {PROTO_HONTAI, X5C1 , 0 , P_HIGH , NO_AUTOBIND , 0 },
/* 10 */ {PROTO_HONTAI, FQ777_951 , 0 , P_HIGH , NO_AUTOBIND , 0 },
/* 11 */ {PROTO_Q303 , Q303 , 0 , P_HIGH , NO_AUTOBIND , 0 },
/* 12 */ {PROTO_Q303 , CX35 , 0 , P_HIGH , NO_AUTOBIND , 0 },
/* 13 */ {PROTO_Q303 , CX10D , 0 , P_HIGH , NO_AUTOBIND , 0 },
/* 14 */ {PROTO_Q303 , CX10WD , 0 , P_HIGH , NO_AUTOBIND , 0 },
#endif
#if NBR_BANKS > 4
//****************************** BANK 5 ******************************
// Dial Protocol Sub protocol RX_Num Power Auto Bind Option
/* 1 */ {PROTO_CX10 , CX10_GREEN , 0 , P_HIGH , NO_AUTOBIND , 0 },
/* 2 */ {PROTO_CX10 , CX10_BLUE , 0 , P_HIGH , NO_AUTOBIND , 0 },
/* 3 */ {PROTO_CX10 , DM007 , 0 , P_HIGH , NO_AUTOBIND , 0 },
/* 4 */ {PROTO_CX10 , JC3015_1 , 0 , P_HIGH , NO_AUTOBIND , 0 },
/* 5 */ {PROTO_CX10 , JC3015_2 , 0 , P_HIGH , NO_AUTOBIND , 0 },
/* 6 */ {PROTO_CX10 , MK33041 , 0 , P_HIGH , NO_AUTOBIND , 0 },
/* 7 */ {PROTO_Q2X2 , Q222 , 0 , P_HIGH , NO_AUTOBIND , 0 },
/* 8 */ {PROTO_Q2X2 , Q242 , 0 , P_HIGH , NO_AUTOBIND , 0 },
/* 9 */ {PROTO_Q2X2 , Q282 , 0 , P_HIGH , NO_AUTOBIND , 0 },
/* 10 */ {PROTO_CG023, CG023 , 0 , P_HIGH , NO_AUTOBIND , 0 },
/* 11 */ {PROTO_CG023, YD829 , 0 , P_HIGH , NO_AUTOBIND , 0 },
/* 12 */ {PROTO_FQ777, 0 , 0 , P_HIGH , NO_AUTOBIND , 0 },
/* 13 */ {PROTO_YD717, YD717 , 0 , P_HIGH , NO_AUTOBIND , 0 },
/* 14 */ {PROTO_MT99XX, MT99 , 0 , P_HIGH , NO_AUTOBIND , 0 },
#endif
}; };
/* Available protocols and associated sub protocols to pick and choose from /* Available protocols and associated sub protocols to pick and choose from
MODE_FLYSKY PROTO_FLYSKY
Flysky Flysky
V9X9 V9X9
V6X6 V6X6
V912 V912
CX20 CX20
MODE_HUBSAN PROTO_HUBSAN
H107 H107
H301 H301
H501 H501
MODE_FRSKYV PROTO_FRSKYV
NONE NONE
MODE_FRSKYD PROTO_FRSKYD
NONE NONE
MODE_FRSKYX PROTO_FRSKYX
CH_16 CH_16
CH_8 CH_8
EU_16 EU_16
EU_8 EU_8
MODE_HISKY PROTO_HISKY
Hisky Hisky
HK310 HK310
MODE_V2X2 PROTO_V2X2
V2X2 V2X2
JXD506 JXD506
MODE_DSM PROTO_DSM
DSM2_22 DSM2_22
DSM2_11 DSM2_11
DSMX_22 DSMX_22
DSMX_11 DSMX_11
MODE_DEVO PROTO_DEVO
NONE NONE
MODE_YD717 PROTO_YD717
YD717 YD717
SKYWLKR SKYWLKR
SYMAX4 SYMAX4
XINXUN XINXUN
NIHUI NIHUI
MODE_KN PROTO_KN
WLTOYS WLTOYS
FEILUN FEILUN
MODE_SYMAX PROTO_SYMAX
SYMAX SYMAX
SYMAX5C SYMAX5C
MODE_SLT PROTO_SLT
NONE NONE
MODE_CX10 PROTO_CX10
CX10_GREEN CX10_GREEN
CX10_BLUE CX10_BLUE
DM007 DM007
JC3015_1 JC3015_1
JC3015_2 JC3015_2
MK33041 MK33041
MODE_Q2X2 PROTO_Q2X2
Q222 Q222
Q242 Q242
Q282 Q282
MODE_SLT PROTO_SLT
SLT SLT
VISTA VISTA
MODE_CG023 PROTO_CG023
CG023 CG023
YD829 YD829
MODE_BAYANG PROTO_BAYANG
BAYANG BAYANG
H8S3D H8S3D
X16_AH X16_AH
IRDRONE IRDRONE
MODE_ESKY PROTO_ESKY
NONE NONE
MODE_MT99XX PROTO_MT99XX
MT99 MT99
H7 H7
YZ YZ
LS LS
FY805 FY805
MODE_MJXQ PROTO_MJXQ
WLH08 WLH08
X600 X600
X800 X800
H26D H26D
E010 E010
H26WH H26WH
MODE_SHENQI PROTO_SHENQI
NONE NONE
MODE_FY326 PROTO_FY326
FY326 FY326
FY319 FY319
MODE_SFHSS PROTO_SFHSS
NONE NONE
MODE_J6PRO PROTO_J6PRO
NONE NONE
MODE_FQ777 PROTO_FQ777
NONE NONE
MODE_ASSAN PROTO_ASSAN
NONE NONE
MODE_HONTAI PROTO_HONTAI
FORMAT_HONTAI HONTAI
FORMAT_JJRCX1 JJRCX1
FORMAT_X5C1 X5C1
FORMAT_FQ777_951 FQ777_951
MODE_AFHDS2A PROTO_AFHDS2A
PWM_IBUS PWM_IBUS
PPM_IBUS PPM_IBUS
PWM_SBUS PWM_SBUS
PPM_SBUS PPM_SBUS
MODE_WK2X01 PROTO_WK2x01
WK2801 WK2801
WK2401 WK2401
W6_5_1 W6_5_1
W6_6_1 W6_6_1
W6_HEL W6_HEL
W6_HEL_I W6_HEL_I
MODE_Q303 PROTO_Q303
Q303 Q303
CX35 CX35
CX10D CX10D
CX10WD CX10WD
MODE_GW008 PROTO_GW008
NONE NONE
MODE_DM002 PROTO_DM002
NONE NONE
MODE_CABELL PROTO_CABELL
CABELL_V3 CABELL_V3
CABELL_V3_TELEMETRY CABELL_V3_TELEMETRY
CABELL_SET_FAIL_SAFE CABELL_SET_FAIL_SAFE
CABELL_UNBIND CABELL_UNBIND
MODE_ESKY150 PROTO_ESKY150
MODE_H8_3D PROTO_H8_3D
H8_3D H8_3D
H20H H20H
H20 Mini H20MINI
H30 Mini H30MINI
MODE_CORONA PROTO_CORONA
COR_V1 COR_V1
COR_V2 COR_V2
*/ */

View File

@ -27,29 +27,20 @@ Here are detailed descriptions of every supported protocols (sorted by RF module
- Using channel 16 for the bind channel seems the most relevant as only one protocol so far is using 16 channels which is FrSkyX. But even on FrSkyX this feature won't have any impact since there is NO valid reason to have Autobind set to Y for such a protocol. - Using channel 16 for the bind channel seems the most relevant as only one protocol so far is using 16 channels which is FrSkyX. But even on FrSkyX this feature won't have any impact since there is NO valid reason to have Autobind set to Y for such a protocol.
## Default Mapping of Protocols in PPM mode<a name="DefaultMapping"></a> ## Protocol selection in PPM mode
Here is the default mapping of protocols to the 16-position protocol selection switch on the module. You can customize these when you compile your own firmware as described in [Compiling and Programming.](docs/Compiling.md) The protocol selection is based on 2 parameters:
* selection switch: this is the rotary switch on the module numbered from 0 to 15
- switch position 0 is to select the Serial mode for er9x/ersky9x/OpenTX radio
- switch position 15 is to select the bank
- switch position 1..14 will select the protocol 1..14 in the bank X
* banks are used to increase the amount of accessible protocols by the switch. There are up to 5 banks giving acces to up to 70 protocol entries (5 * 14). To modify or verify which bank is currenlty active do the following:
- turn on the module with the switch on position 15
- the number of LED flash indicates the bank number (1 to 5 flash)
- to go to the next bank short press the bind button, this action is confirmed by the LED staying on for 1.5 sec
**Note that the protocol must be selected before the unit is turned on.** The default protocol mapping can be seen at the end of the file [_Config.h](/Multiprotocol/_Config.h).
Dial|Protocol|Sub_protocol|RX Num|Power|Auto Bind|Option|RF Module **Note: the protocol selection must be done before the module is turned on**
----|--------|------------|------|-----|---------|------|---------
0|Select serial||||||
1|FLYSKY|Flysky|0|High|No|0|A7105
2|HUBSAN|-|0|High|No|0|A7105
3|FRSKYD|-|0|High|No|40|CC2500
4|HISKY|Hisky|0|High|No|0|NRF24L01
5|V2X2|-|0|High|No|0|NRF24L01
6|DSM|DSM2|0|High|No|6|CYRF6936
7|DEVO|-|0|High|No|0|CYRF6936
8|YD717|YD717|0|High|No|0|NRF24L01
9|KN|WLTOYS|0|High|No|0|NRF24L01
10|SYMAX|SYMAX|0|High|No|0|NRF24L01
11|SLT|-|0|High|No|0|NRF24L01
12|CX10|BLUE|0|High|No|0|NRF24L01
13|CG023|CG023|0|High|No|0|NRF24L01
14|BAYANG|-|0|High|No|0|NRF24L01
15|SYMAX|SYMAX5C|0|High|No|0|NRF24L01
# A7105 RF Module # A7105 RF Module
@ -259,7 +250,7 @@ Bind procedure using serial:
- Turn on RX (RX LED fast blink). - Turn on RX (RX LED fast blink).
- Turn on TX (RX LED solid, TX LED fast blink). - Turn on TX (RX LED solid, TX LED fast blink).
- Wait for bind on the TX to complete (TX LED solid). - Wait for bind on the TX to complete (TX LED solid).
- Make sure to set the RX_Num value for model match. - Make sure to set a uniq RX_Num value for model match.
- Change option to 1 to use the global ID. - Change option to 1 to use the global ID.
- Do not touch option/RX_Num anymore. - Do not touch option/RX_Num anymore.
@ -272,7 +263,7 @@ Bind procedure using PPM:
- Wait for bind on the TX to complete (TX LED solid). - Wait for bind on the TX to complete (TX LED solid).
- Press the bind button for 1 second. TX/RX is now in fixed ID mode. - Press the bind button for 1 second. TX/RX is now in fixed ID mode.
- To verify that the TX is in fixed mode: power cycle the TX, the module LED should be solid ON (no blink). - To verify that the TX is in fixed mode: power cycle the TX, the module LED should be solid ON (no blink).
- Note: Autobind/fixed ID mode is linked to the dial number. Which means that you can have multiple dial numbers set to the same protocol DEVO with different RX_Num and have different bind modes at the same time. It enables PPM users to get model match under DEVO. - Note: Autobind/fixed ID mode is linked to the RX_Num number. Which means that you can have multiple dial numbers set to the same protocol DEVO with different RX_Num and have different bind modes at the same time. It enables PPM users to get model match under DEVO.
## WK2X01 - *30* ## WK2X01 - *30*
Extended limits supported Extended limits supported
@ -295,7 +286,7 @@ Bind procedure using serial:
- Turn on RX (RX LED fast blink). - Turn on RX (RX LED fast blink).
- Turn on TX (RX LED solid, TX LED fast blink). - Turn on TX (RX LED solid, TX LED fast blink).
- Wait for bind on the TX to complete (TX LED solid). - Wait for bind on the TX to complete (TX LED solid).
- Make sure to set the RX_Num value for model match. - Make sure to set a uniq RX_Num value for model match.
- Change option to 1 to use the global ID. - Change option to 1 to use the global ID.
- Do not touch option/RX_Num anymore. - Do not touch option/RX_Num anymore.
@ -308,7 +299,7 @@ Bind procedure using PPM:
- Wait for bind on the TX to complete (TX LED solid). - Wait for bind on the TX to complete (TX LED solid).
- Press the bind button for 1 second. TX/RX is now in fixed ID mode. - Press the bind button for 1 second. TX/RX is now in fixed ID mode.
- To verify that the TX is in fixed mode: power cycle the TX, the module LED should be solid ON (no blink). - To verify that the TX is in fixed mode: power cycle the TX, the module LED should be solid ON (no blink).
- Note: Autobind/fixed ID mode is linked to the dial number. Which means that you can have multiple dial numbers set to the same protocol WK2X01 and sub_protocol WK2801 with different RX_Num and have different bind modes at the same time. It enables PPM users to get model match. - Note: Autobind/fixed ID mode is linked to the RX_Num number. Which means that you can have multiple dial numbers set to the same protocol DEVO with different RX_Num and have different bind modes at the same time. It enables PPM users to get model match under DEVO.
### Sub_protocol WK2401 - *1* ### Sub_protocol WK2401 - *1*
The WK2401 protocol is used to control older Walkera models. The WK2401 protocol is used to control older Walkera models.