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)
{ // Build standard packet
// Set channel
// Set RF channel
CC2500_WriteReg(CC2500_0A_CHANNR, hopping_frequency[hopping_frequency_no]);
hopping_frequency_no++;
hopping_frequency_no%=CORONA_RF_NUM_CHANNELS;
// Update power
// Update RF power
CC2500_SetPower();
// Build packet
@ -155,6 +153,8 @@ static void __attribute__((unused)) CORONA_build_packet()
packet[17] = 0x03;
break;
}
hopping_frequency_no++;
hopping_frequency_no%=CORONA_RF_NUM_CHANNELS;
}
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...

View File

@ -19,7 +19,7 @@
#define VERSION_MAJOR 1
#define VERSION_MINOR 2
#define VERSION_REVISION 0
#define VERSION_PATCH_LEVEL 12
#define VERSION_PATCH_LEVEL 13
//******************
// Protocols
//******************

View File

@ -789,6 +789,8 @@ static void protocol_init()
PE1_on; //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
{
#ifdef A7105_INSTALLED
@ -1061,7 +1063,6 @@ static void protocol_init()
#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( 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
}
#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) ) )
{ // New model has been selected
CHANGE_PROTOCOL_FLAG_on; //change protocol
WAIT_BIND_off;
if(IS_AUTOBIND_FLAG_on)
BIND_IN_PROGRESS; //launch bind right away if in autobind mode
if((rx_ok_buff[1]&0x80)!=0 || IS_AUTOBIND_FLAG_on)
BIND_IN_PROGRESS; //launch bind right away if in autobind mode or bind is set
else
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]

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.
#if (defined(ARDUINO_MULTI_NO_BOOT) || defined(ARDUINO_MULTI_STM32_NO_BOOT)) && defined(CHECK_FOR_BOOTLOADER)
#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
#error "You have enabled CHECK_FOR_BOOTLOADER but not selected the 'Flash from TX' bootloader."
#endif