mirror of
https://github.com/pascallanger/DIY-Multiprotocol-TX-Module.git
synced 2025-02-09 22:58:14 +00:00
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:
parent
bf6e66ea47
commit
2d90844239
@ -217,6 +217,14 @@ void A7105_Init(void)
|
|||||||
for (uint8_t i = 0; i < 0x32; i++)
|
for (uint8_t i = 0; i < 0x32; i++)
|
||||||
{
|
{
|
||||||
uint8_t val=pgm_read_byte_near(&A7105_Regs[i]);
|
uint8_t val=pgm_read_byte_near(&A7105_Regs[i]);
|
||||||
|
#ifdef FLYSKY_A7105_INO
|
||||||
|
if(protocol==MODE_FLYSKY && sub_protocol==CX20)
|
||||||
|
{
|
||||||
|
if(i==0x0E) val=0x01
|
||||||
|
if(i==0x1F) val=0x1F
|
||||||
|
if(i==0x20) val=0x1E
|
||||||
|
}
|
||||||
|
#endif
|
||||||
if( val != 0xFF)
|
if( val != 0xFF)
|
||||||
A7105_WriteReg(i, val);
|
A7105_WriteReg(i, val);
|
||||||
}
|
}
|
||||||
|
@ -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 void __attribute__((unused)) flysky_apply_extension_flags()
|
||||||
{
|
{
|
||||||
static uint8_t seq_counter;
|
|
||||||
switch(sub_protocol)
|
switch(sub_protocol)
|
||||||
{
|
{
|
||||||
case V9X9:
|
case V9X9:
|
||||||
@ -100,9 +99,9 @@ static void __attribute__((unused)) flysky_apply_extension_flags()
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case V912:
|
case V912:
|
||||||
seq_counter++;
|
packet_count++;
|
||||||
if( seq_counter > 9)
|
if( packet_count > 9)
|
||||||
seq_counter = 0;
|
packet_count = 0;
|
||||||
packet[12] |= 0x20; // bit 6 is always set ?
|
packet[12] |= 0x20; // bit 6 is always set ?
|
||||||
packet[13] = 0x00; // unknown
|
packet[13] = 0x00; // unknown
|
||||||
packet[14] = 0x00;
|
packet[14] = 0x00;
|
||||||
@ -112,8 +111,8 @@ static void __attribute__((unused)) flysky_apply_extension_flags()
|
|||||||
packet[14] |= FLAG_V912_TOPBTN;
|
packet[14] |= FLAG_V912_TOPBTN;
|
||||||
packet[15] = 0x27; // [15] and [16] apparently hold an analog channel with a value lower than 1000
|
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[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
|
packet[17] = pgm_read_byte( &V912_X17_SEQ[packet_count] ) ; // not sure what [17] & [18] are for
|
||||||
if(seq_counter == 0) // V912 Rx does not even read those bytes... [17-20]
|
if(packet_count == 0) // V912 Rx does not even read those bytes... [17-20]
|
||||||
packet[18] = 0x02;
|
packet[18] = 0x02;
|
||||||
else
|
else
|
||||||
packet[18] = 0x00;
|
packet[18] = 0x00;
|
||||||
@ -121,6 +120,11 @@ static void __attribute__((unused)) flysky_apply_extension_flags()
|
|||||||
packet[20] = 0x00; // unknown
|
packet[20] = 0x00; // unknown
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case CX20:
|
||||||
|
packet_count++;
|
||||||
|
packet[19] = 0x00; // unknown
|
||||||
|
packet[20] = (packet_count<<4)|0x0A;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -164,7 +168,11 @@ uint16_t ReadFlySky()
|
|||||||
hopping_frequency_no = (hopping_frequency_no + 1) & 0x0F;
|
hopping_frequency_no = (hopping_frequency_no + 1) & 0x0F;
|
||||||
A7105_SetPower();
|
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] = {
|
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[((chanrow&1)?15-i:i)]=temp-chanoffset;
|
||||||
}
|
}
|
||||||
hopping_frequency_no=0;
|
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)
|
if(IS_AUTOBIND_FLAG_on)
|
||||||
bind_counter = FLYSKY_BIND_COUNT;
|
bind_counter = FLYSKY_BIND_COUNT;
|
||||||
else
|
else
|
||||||
|
@ -55,7 +55,8 @@ enum Flysky
|
|||||||
Flysky = 0,
|
Flysky = 0,
|
||||||
V9X9 = 1,
|
V9X9 = 1,
|
||||||
V6X6 = 2,
|
V6X6 = 2,
|
||||||
V912 = 3
|
V912 = 3,
|
||||||
|
CX20 = 4
|
||||||
};
|
};
|
||||||
enum AFHDS2A
|
enum AFHDS2A
|
||||||
{
|
{
|
||||||
@ -240,14 +241,14 @@ struct PPM_Parameters
|
|||||||
//*** AUX flags ***
|
//*** AUX flags ***
|
||||||
//*******************
|
//*******************
|
||||||
#define GET_FLAG(ch, mask) ( ch ? mask : 0)
|
#define GET_FLAG(ch, mask) ( ch ? mask : 0)
|
||||||
#define Servo_AUX1 Servo_AUX & _BV(0)
|
#define Servo_AUX1 (Servo_AUX & _BV(0))
|
||||||
#define Servo_AUX2 Servo_AUX & _BV(1)
|
#define Servo_AUX2 (Servo_AUX & _BV(1))
|
||||||
#define Servo_AUX3 Servo_AUX & _BV(2)
|
#define Servo_AUX3 (Servo_AUX & _BV(2))
|
||||||
#define Servo_AUX4 Servo_AUX & _BV(3)
|
#define Servo_AUX4 (Servo_AUX & _BV(3))
|
||||||
#define Servo_AUX5 Servo_AUX & _BV(4)
|
#define Servo_AUX5 (Servo_AUX & _BV(4))
|
||||||
#define Servo_AUX6 Servo_AUX & _BV(5)
|
#define Servo_AUX6 (Servo_AUX & _BV(5))
|
||||||
#define Servo_AUX7 Servo_AUX & _BV(6)
|
#define Servo_AUX7 (Servo_AUX & _BV(6))
|
||||||
#define Servo_AUX8 Servo_AUX & _BV(7)
|
#define Servo_AUX8 (Servo_AUX & _BV(7))
|
||||||
|
|
||||||
//************************
|
//************************
|
||||||
//*** Power settings ***
|
//*** Power settings ***
|
||||||
@ -415,6 +416,7 @@ Serial: 100000 Baud 8e2 _ xxxx xxxx p --
|
|||||||
V9x9 1
|
V9x9 1
|
||||||
V6x6 2
|
V6x6 2
|
||||||
V912 3
|
V912 3
|
||||||
|
CX20 4
|
||||||
sub_protocol==Hisky
|
sub_protocol==Hisky
|
||||||
Hisky 0
|
Hisky 0
|
||||||
HK310 1
|
HK310 1
|
||||||
|
@ -178,6 +178,7 @@ const PPM_Parameters PPM_prot[15]= {
|
|||||||
V9X9
|
V9X9
|
||||||
V6X6
|
V6X6
|
||||||
V912
|
V912
|
||||||
|
CX20
|
||||||
MODE_HUBSAN
|
MODE_HUBSAN
|
||||||
NONE
|
NONE
|
||||||
MODE_FRSKYD
|
MODE_FRSKYD
|
||||||
|
Loading…
x
Reference in New Issue
Block a user