E129/C185 new debug flag

This commit is contained in:
pascallanger
2024-07-11 16:20:32 +02:00
parent 600ffe87d7
commit 6edd2a14a7
5 changed files with 115 additions and 14 deletions

View File

@@ -41,7 +41,8 @@ static void __attribute__((unused)) E129_build_data_packet()
}
else
{
packet[ 1] = 0xA6;
packet[ 1] = 0xA6; // Set to A5 every few packets??
//Flags
if(sub_protocol == E129_E129)
packet[ 2] = 0xF7; // High rate 0xF7, low 0xF4
@@ -53,11 +54,18 @@ static void __attribute__((unused)) E129_build_data_packet()
packet[15] = bit_reverse(rx_tx_addr[0]);
packet[16] = bit_reverse(rx_tx_addr[1]);
}
packet[ 3] = GET_FLAG(CH10_SW, 0x40) // C159 loop flight 0x40, flag 0x04 is also set on this heli
| GET_FLAG(CH11_SW, 0x08); // C129V2 flip
// Other flags in packet[3] => E129 Mode: short press=0x20->0x00->0x20->..., long press=0x10->0x30->0x10->... => C186 throttle trim is doing the same:up=short press and down=long press
packet[ 3] = GET_FLAG(CH10_SW, 0x40) // C159: loop flight 0x40
| GET_FLAG(CH11_SW, 0x08); // C129V2: flip
//Other flags seen in packet[3]
// Flag 0x04 is set on some helis (C159/C190)
// E129 Mode: short press=0x20->0x00->0x20->..., long press=0x10->0x30->0x10->... => C186 throttle trim is doing the same:up=short press and down=long press
packet[ 4] = GET_FLAG(CH5_SW, 0x20) // Take off/Land 0x20
| GET_FLAG(CH6_SW, 0x04); // Emergency stop 0x04
| GET_FLAG(CH6_SW, 0x04) // Emergency stop 0x04
| GET_FLAG(CH12_SW, 0x80); // C190: debug mode->remote THR trim down sets 0x80
//Other flags seen in packet[4]
// C190 remote LANDING sets 0x10
// C190 remote THR trim down sets 0x80
//Channels and trims
uint16_t val = convert_channel_10b(AILERON,false);
uint8_t trim = convert_channel_8b(CH7) & 0xFC;

View File

@@ -436,6 +436,7 @@
#undef Q303_CCNRF_INO
#undef Q90C_CCNRF_INO
#undef V911S_CCNRF_INO
#undef SGF22_NRF24L01_INO
#endif
//OpenTX 2.3.x issue

View File

@@ -138,11 +138,11 @@ uint16_t XK2_callback()
debug(" %02X",packet[i]);
debugln("");
#endif
//phase = XK2_BIND1;
//return 500;
crc8 = 0xBF;
for(uint8_t i=0; i<XK2_PAYLOAD_SIZE-1; i++)
crc8 += packet[i];
//phase = XK2_BIND1;
//return 500;
if(crc8 != packet[8])
{
phase = XK2_BIND1;
@@ -199,3 +199,93 @@ void XK2_init()
#endif
/*
XK A160 Piper CUB
Bind
----
Plane sends these packets:
RX: 0us C=71 S=Y A= CC CC CC CC CC P(9)= 9C BB CC DD 38 12 10 00 19
P[0] = 9C bind phase 1
P[1] = Dummy TX_ID
P[2] = Dummy TX_ID
P[3] = Dummy TX_ID
P[4] = RX_ID[0]
P[5] = RX_ID[1]
P[6] = RX_ID[2]
P[7] = 00
P[8] = sum P[0..7] + BF
TX responds to plane:
RX 9D 66 4F 47 38 12 10 00 B3
P[0] = 9D bind phase 2
P[1] = TX_ID[0]
P[2] = TX_ID[1]
P[3] = TX_ID[2]
P[4] = RX_ID[0]
P[5] = RX_ID[1]
P[6] = RX_ID[2]
P[7] = 00
P[8] = sum P[0..7] + C0
Planes ack:
RX: 4299us C=71 S=Y A= CC CC CC CC CC P(9)= 9B 66 4F 47 38 12 10 00 B0
RX: 26222us C=71 S=Y A= CC CC CC CC CC P(9)= 9B 66 4F 47 38 12 10 00 B0
RX: 8743us C=71 S=Y A= CC CC CC CC CC P(9)= 9B 66 4F 47 38 12 10 00 B0
P[0] = 9B bind phase 3
P[1] = TX_ID[0]
P[2] = TX_ID[1]
P[3] = TX_ID[2]
P[4] = RX_ID[0]
P[5] = RX_ID[1]
P[6] = RX_ID[2]
P[7] = 00
P[8] = sum P[0..7] + BF
Normal
------
TX sends
C=65,69,73,77 -> only one channel when telemetry is working
250K C=69 S=Y A= 66 4F 47 CC CC P(9)= 32 32 00 32 E0 00 01 5A 50
P[0] = A 00..32..64
P[1] = E 00..32..64
P[2] = T 00..64
P[3] = R 00..32..64
P[4] = alternates 20,60,A0,E0
trims
A 01..20..3F
E 41..60..7F
R 81..A0..BF
telemetry
E0 present when the telemetry works
6g/3d
C1 few times if P[6] flag 00->08
C0 few times if P[6] = flag 08->00
P[5] = flags
01=high rate
20=hover=long_press_left
08=6g/3d=short_press_right sequece also switches for a few packets to C1 if 8 C0 if 0
P[6] = 00 telemetry nok
01 telemetry ok but sometimes switch to 1 also when telemetry is nok...
P[7] = 5A
P[8] = sum P[0..7] + 7F
Telemetry
RX on channel: 69, Time: 3408us P: 66 4F 47 00 00 00 00 00 C8
P[0] = TX_ID[0]
P[1] = TX_ID[1]
P[2] = TX_ID[2]
P[8] = sum P[0..7] + CC
Timing when plane is not detected:
RF
2469 110713 0
2473 114560 3847
2477 120291 5731
2465 135684 15393
2469 142138 6454
2473 145984 3846
2477 151753 5769
2465 155330 3577
*/