New protocol CX-10/Q242

This commit is contained in:
pascallanger 2016-01-25 18:14:56 +01:00
parent a41bfabede
commit 9140c426c4
4 changed files with 43 additions and 18 deletions

View File

@ -90,24 +90,36 @@ static void CX10_Write_Packet(uint8_t bind)
if(Servo_AUX4) flags |= 0x08; // Channel 8 - video
break;
case Q282:
case Q242:
memcpy(&packet[15], "\x10\x10\xaa\xaa\x00\x00", 6);
//FLIP|LED|PICTURE|VIDEO|HEADLESS|RTH|XCAL|YCAL
if(Servo_AUX1) flags2 =0x80; // Channel 5 - FLIP
if(Servo_AUX2) flags2|=0x40; // Channel 6 - LED
if(Servo_AUX3) flags2|=0x10; // Channel 7 - picture
if(Servo_AUX4) // Channel 8 - video
{
if (!(video_state & 0x20)) video_state ^= 0x21;
}
else
if (video_state & 0x20) video_state &= 0x01;
flags2 |= video_state;
if(Servo_AUX5) flags2|=0x08; // Channel 9 - HEADLESS
flags=3;
if(sub_protocol==Q282)
{
if(Servo_AUX3) flags2|=0x10; // Channel 7 - picture
if(Servo_AUX4) // Channel 8 - video
{
if (!(video_state & 0x20)) video_state ^= 0x21;
}
else
if (video_state & 0x20) video_state &= 0x01;
flags2 |= video_state;
flags=3;
}
else
{
if(Servo_AUX3) flags2|=0x01; // Channel 7 - picture
if(Servo_AUX4) flags2|=0x10; // Channel 8 - video
flags=2;
packet[17]=0x00;
packet[18]=0x00;
}
if(Servo_AUX6) flags |=0x80; // Channel 10 - RTH
if(Servo_AUX7) flags2|=0x04; // Channel 11 - XCAL
if(Servo_AUX8) flags2|=0x02; // Channel 12 - YCAL
memcpy(&packet[15], "\x10\x10\xaa\xaa\x00\x00", 6);
break;
case DM007:
//FLIP|MODE|PICTURE|VIDEO|HEADLESS
@ -225,12 +237,20 @@ static void initialize_txid()
hopping_frequency[3] = 0x4c;
}
else
{
hopping_frequency[0] = 0x03 + (rx_tx_addr[0] & 0x0F);
hopping_frequency[1] = 0x16 + (rx_tx_addr[0] >> 4);
hopping_frequency[2] = 0x2D + (rx_tx_addr[1] & 0x0F);
hopping_frequency[3] = 0x40 + (rx_tx_addr[1] >> 4);
}
if(sub_protocol==Q242)
{
hopping_frequency[0] = 0x48;
hopping_frequency[1] = 0x4a;
hopping_frequency[2] = 0x4c;
hopping_frequency[3] = 0x4e;
}
else
{
hopping_frequency[0] = 0x03 + (rx_tx_addr[0] & 0x0F);
hopping_frequency[1] = 0x16 + (rx_tx_addr[0] >> 4);
hopping_frequency[2] = 0x2D + (rx_tx_addr[1] & 0x0F);
hopping_frequency[3] = 0x40 + (rx_tx_addr[1] >> 4);
}
}
uint16_t initCX10(void)
@ -247,7 +267,7 @@ uint16_t initCX10(void)
}
else
{
if(sub_protocol==Q282)
if(sub_protocol==Q282||sub_protocol==Q242)
packet_length = Q282_PACKET_SIZE;
else
packet_length = CX10_PACKET_SIZE;

View File

@ -104,6 +104,7 @@ static const PPM_Parameters PPM_prot[15]=
JC3015_1
JC3015_2
MK33041
Q242
MODE_CG023
CG023
YD829

View File

@ -78,7 +78,8 @@ enum CX10
Q282=3,
JC3015_1=4,
JC3015_2=5,
MK33041=6
MK33041=6,
Q242=7
};
enum CG023
{
@ -428,6 +429,7 @@ Serial: 100000 Baud 8e2 _ xxxx xxxx p --
JC3015_1 4
JC3015_2 5
MK33041 6
Q242 7
sub_protocol==CG023
CG023 0
YD829 1

View File

@ -163,6 +163,7 @@ CX10||NRF24L01
|JC3015_1
|JC3015_2
|MK33041
|Q242
CG023||NRF24L01
|CG023
|YD829
@ -251,6 +252,7 @@ CH5|CH6|CH7|CH8|CH9
FLIP|MODE|PICTURE|VIDEO|HEADLESS
#####Sub_protocol CX10_Q282
#####Sub_protocol CX10_Q242
CH5|CH6|CH7|CH8|CH9|CH10|CH11|CH12
---|---|---|---|---|---|---|---