Flysky: addition of sub_protocol CX20

sub_protocol=4
7 channels
supports bind and extended channels
Only 1 TXID supported for now
This commit is contained in:
pascallanger
2016-11-29 22:30:03 +01:00
parent bf6e66ea47
commit 2d90844239
4 changed files with 41 additions and 17 deletions

View File

@@ -55,7 +55,6 @@ const uint8_t PROGMEM V912_X17_SEQ[10] = { 0x14, 0x31, 0x40, 0x49, 0x49, //
static void __attribute__((unused)) flysky_apply_extension_flags()
{
static uint8_t seq_counter;
switch(sub_protocol)
{
case V9X9:
@@ -100,9 +99,9 @@ static void __attribute__((unused)) flysky_apply_extension_flags()
break;
case V912:
seq_counter++;
if( seq_counter > 9)
seq_counter = 0;
packet_count++;
if( packet_count > 9)
packet_count = 0;
packet[12] |= 0x20; // bit 6 is always set ?
packet[13] = 0x00; // unknown
packet[14] = 0x00;
@@ -112,8 +111,8 @@ static void __attribute__((unused)) flysky_apply_extension_flags()
packet[14] |= FLAG_V912_TOPBTN;
packet[15] = 0x27; // [15] and [16] apparently hold an analog channel with a value lower than 1000
packet[16] = 0x03; // maybe it's there for a pitch channel for a CP copter ?
packet[17] = pgm_read_byte( &V912_X17_SEQ[seq_counter] ) ; // not sure what [17] & [18] are for
if(seq_counter == 0) // V912 Rx does not even read those bytes... [17-20]
packet[17] = pgm_read_byte( &V912_X17_SEQ[packet_count] ) ; // not sure what [17] & [18] are for
if(packet_count == 0) // V912 Rx does not even read those bytes... [17-20]
packet[18] = 0x02;
else
packet[18] = 0x00;
@@ -121,6 +120,11 @@ static void __attribute__((unused)) flysky_apply_extension_flags()
packet[20] = 0x00; // unknown
break;
case CX20:
packet_count++;
packet[19] = 0x00; // unknown
packet[20] = (packet_count<<4)|0x0A;
break;
default:
break;
}
@@ -164,7 +168,11 @@ uint16_t ReadFlySky()
hopping_frequency_no = (hopping_frequency_no + 1) & 0x0F;
A7105_SetPower();
}
return 1510; //1460 on deviation but not working with the latest V911 bricks... Turnigy 9X v2 is 1533, Flysky TX for 9XR/9XR Pro is 1510, V911 TX is 1490.
if(sub_protocol=CX20)
return 3984;
else
return 1510; //1460 on deviation but not working with the latest V911 bricks... Turnigy 9X v2 is 1533, Flysky TX for 9XR/9XR Pro is 1510, V911 TX is 1490.
}
const uint8_t PROGMEM tx_channels[8][4] = {
@@ -205,7 +213,12 @@ uint16_t initFlySky()
hopping_frequency[((chanrow&1)?15-i:i)]=temp-chanoffset;
}
hopping_frequency_no=0;
if(sub_protocol==CX20)
{//Haven't figured yet the relation between TX ID and Frequencies
memcpy(rx_tx_addr,"\x06\x35\x89\x72",4);
memcpy(hopping_frequency,"\x35\x85\x21\x71\x2B\x7B\x3A\x53\x49\x26\x0D\x5D\x3F\x8F\x17\x6",16);
}
packet_count=0;
if(IS_AUTOBIND_FLAG_on)
bind_counter = FLYSKY_BIND_COUNT;
else