FIX OpenTX DSM autodetect

This commit is contained in:
Pascal Langer 2018-01-22 13:23:11 +01:00
parent ce489887db
commit 4facdf0932
4 changed files with 14 additions and 9 deletions

View File

@ -115,11 +115,9 @@ static void __attribute__((unused)) CORONA_build_packet()
if(state==0 || sub_protocol==COR_V1) if(state==0 || sub_protocol==COR_V1)
{ // Build standard packet { // Build standard packet
// Set channel // Set RF channel
CC2500_WriteReg(CC2500_0A_CHANNR, hopping_frequency[hopping_frequency_no]); CC2500_WriteReg(CC2500_0A_CHANNR, hopping_frequency[hopping_frequency_no]);
hopping_frequency_no++; // Update RF power
hopping_frequency_no%=CORONA_RF_NUM_CHANNELS;
// Update power
CC2500_SetPower(); CC2500_SetPower();
// Build packet // Build packet
@ -155,6 +153,8 @@ static void __attribute__((unused)) CORONA_build_packet()
packet[17] = 0x03; packet[17] = 0x03;
break; break;
} }
hopping_frequency_no++;
hopping_frequency_no%=CORONA_RF_NUM_CHANNELS;
} }
else else
{ // Send identifier packet for 2.65sec. This is how the RX learns the hopping table after a bind. Why it's not part of the bind like V1 is a mistery... { // Send identifier packet for 2.65sec. This is how the RX learns the hopping table after a bind. Why it's not part of the bind like V1 is a mistery...

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 0 #define VERSION_REVISION 0
#define VERSION_PATCH_LEVEL 12 #define VERSION_PATCH_LEVEL 13
//****************** //******************
// Protocols // Protocols
//****************** //******************

View File

@ -789,6 +789,8 @@ static void protocol_init()
PE1_on; //NRF24L01 antenna RF3 by default PE1_on; //NRF24L01 antenna RF3 by default
PE2_off; //NRF24L01 antenna RF3 by default PE2_off; //NRF24L01 antenna RF3 by default
debugln("Protocol selected: %d, sub proto %d, rxnum %d, option %d", protocol, sub_protocol, RX_num, option);
switch(protocol) // Init the requested protocol switch(protocol) // Init the requested protocol
{ {
#ifdef A7105_INSTALLED #ifdef A7105_INSTALLED
@ -1061,7 +1063,6 @@ static void protocol_init()
#endif #endif
} }
} }
debugln("Protocol selected: %d, sub proto %d, rxnum %d, option %d", protocol, sub_protocol, RX_num, option);
#if defined(WAIT_FOR_BIND) && defined(ENABLE_BIND_CH) #if defined(WAIT_FOR_BIND) && defined(ENABLE_BIND_CH)
if( IS_AUTOBIND_FLAG_on && IS_BIND_CH_PREV_off && (cur_protocol[1]&0x80)==0 && mode_select == MODE_SERIAL) if( IS_AUTOBIND_FLAG_on && IS_BIND_CH_PREV_off && (cur_protocol[1]&0x80)==0 && mode_select == MODE_SERIAL)
@ -1144,12 +1145,16 @@ void update_serial_data()
FAILSAFE_VALUES_on; //failsafe data has been received FAILSAFE_VALUES_on; //failsafe data has been received
} }
#endif #endif
#ifdef BONI
if(CH14_SW)
rx_ok_buff[2]=(rx_ok_buff[2]&0xF0)|((rx_ok_buff[2]+1)&0x0F); // Extremely dangerous, do not enable this!!! This is really for a special case...
#endif
if( (rx_ok_buff[0] != cur_protocol[0]) || ((rx_ok_buff[1]&0x5F) != (cur_protocol[1]&0x5F)) || ( (rx_ok_buff[2]&0x7F) != (cur_protocol[2]&0x7F) ) ) if( (rx_ok_buff[0] != cur_protocol[0]) || ((rx_ok_buff[1]&0x5F) != (cur_protocol[1]&0x5F)) || ( (rx_ok_buff[2]&0x7F) != (cur_protocol[2]&0x7F) ) )
{ // New model has been selected { // New model has been selected
CHANGE_PROTOCOL_FLAG_on; //change protocol CHANGE_PROTOCOL_FLAG_on; //change protocol
WAIT_BIND_off; WAIT_BIND_off;
if(IS_AUTOBIND_FLAG_on) if((rx_ok_buff[1]&0x80)!=0 || IS_AUTOBIND_FLAG_on)
BIND_IN_PROGRESS; //launch bind right away if in autobind mode BIND_IN_PROGRESS; //launch bind right away if in autobind mode or bind is set
else else
BIND_DONE; BIND_DONE;
protocol=(rx_ok_buff[0]==0x55?0:32) + (rx_ok_buff[1]&0x1F); //protocol no (0-63) bits 4-6 of buff[1] and bit 0 of buf[0] protocol=(rx_ok_buff[0]==0x55?0:32) + (rx_ok_buff[1]&0x1F); //protocol no (0-63) bits 4-6 of buff[1] and bit 0 of buf[0]

View File

@ -47,7 +47,7 @@
// Error if CHECK_FOR_BOOTLOADER is enabled but the 'Flash from TX' bootloader or upload method isn't selected. // Error if CHECK_FOR_BOOTLOADER is enabled but the 'Flash from TX' bootloader or upload method isn't selected.
#if (defined(ARDUINO_MULTI_NO_BOOT) || defined(ARDUINO_MULTI_STM32_NO_BOOT)) && defined(CHECK_FOR_BOOTLOADER) #if (defined(ARDUINO_MULTI_NO_BOOT) || defined(ARDUINO_MULTI_STM32_NO_BOOT)) && defined(CHECK_FOR_BOOTLOADER)
#if defined(STM32_BOARD) #if defined(STM32_BOARD)
#error "You have enabled CHECK_FOR_BOOTLOADER but not selected the 'Flash from TX' upload method." #warning "You have enabled CHECK_FOR_BOOTLOADER but not selected the 'Flash from TX' upload method."
#else #else
#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