2727#define MT99XX_PACKET_PERIOD_DRAGON 1038 // there is a pause of 2x1038 between two packets, no idea why and how since it is not even stable on a same dump...
2828#define MT99XX_PACKET_PERIOD_DRAGON_TELEM 10265 // long pause to receive the telemetry packets, 3 are sent by the RX one after the other
2929#define MT99XX_PACKET_PERIOD_F949G 3450
30- #define MT99XX_PACKET_PERIOD_PA18 1160
31- #define MT99XX_PA18_CRC 0x89 // Is it a constant???
30+ #define MT99XX_PACKET_PERIOD_PA18 1338
3231#define MT99XX_INITIAL_WAIT 500
3332#define MT99XX_PACKET_SIZE 9
3433
3534// #define FORCE_A180_ID
3635// #define FORCE_DRAGON_ID
3736// #define FORCE_F949G_ID
38- #define FORCE_PA18_ID
37+ #define FORCE_PA18_ID1
38+ // #define FORCE_PA18_ID2
3939
4040enum {
4141 MT99XX_DATA,
@@ -115,10 +115,10 @@ static void __attribute__((unused)) MT99XX_send_packet()
115115
116116 // Set RF freq
117117 if (sub_protocol == LS)
118- XN297_RFChannel (0x2D ); // LS always transmits on the same channel
118+ XN297_RFChannel (0x2D ); // LS always transmits on the same channel
119119 else
120120 if (sub_protocol==FY805)
121- XN297_RFChannel (0x4B ); // FY805 always transmits on the same channel
121+ XN297_RFChannel (0x4B ); // FY805 always transmits on the same channel
122122 else // MT99 & H7 & YZ & A180 & DRAGON & F949G & PA18
123123 XN297_Hopping (hopping_frequency_no);
124124
@@ -154,7 +154,7 @@ static void __attribute__((unused)) MT99XX_send_packet()
154154 packet[6 ] = rx_tx_addr[2 ];
155155 if (sub_protocol == PA18+8 )
156156 {
157- packet[7 ] = MT99XX_PA18_CRC; // checksum offset
157+ packet[7 ] = num_ch; // checksum offset
158158 packet[8 ] = 0x55 ; // fixed
159159 }
160160 else
@@ -255,10 +255,10 @@ static void __attribute__((unused)) MT99XX_send_packet()
255255 break ;
256256 case PA18+8 :
257257 if (Channel_data[CH5] > CHANNEL_MAX_COMMAND) // Expert mode
258- packet[5 ] + = 0xA0 ;
258+ packet[5 ] = 0xA0 ;
259259 else
260260 if (Channel_data[CH5] > CHANNEL_MIN_COMMAND) // Intermediate mode
261- packet[5 ] + = 0x60 ;
261+ packet[5 ] = 0x60 ;
262262 packet[6 ] = GET_FLAG ( CH6_SW, FLAG_PA18_FLIP ) // Flip
263263 | GET_FLAG ( CH7_SW, FLAG_PA18_RTH ); // RTH
264264 if (hopping_frequency_no == 0 )
@@ -269,7 +269,7 @@ static void __attribute__((unused)) MT99XX_send_packet()
269269 for (uint8_t i=0 ; i<8 ; i++)
270270 result += packet[i];
271271 if (sub_protocol == PA18+8 )
272- result += MT99XX_PA18_CRC ;
272+ result += num_ch ;
273273 packet[8 ] = result;
274274 }
275275 else
@@ -337,8 +337,8 @@ static void __attribute__((unused)) MT99XX_RF_init()
337337
338338static void __attribute__ ((unused)) MT99XX_initialize_txid()
339339{
340- rx_tx_addr[ 1 ] = rx_tx_addr[3 ]; // RX_Num
341-
340+ num_ch = rx_tx_addr[1 ]; // PA18
341+ rx_tx_addr[ 1 ] = rx_tx_addr[ 3 ]; // RX_Num
342342 switch (sub_protocol)
343343 {
344344 case YZ:
@@ -381,20 +381,35 @@ static void __attribute__((unused)) MT99XX_initialize_txid()
381381 // channel_offset = 0x03
382382 break ;
383383 #endif
384- #ifdef FORCE_PA18_ID
384+ #ifdef FORCE_PA18_ID1
385385 case PA18+8 :
386386 rx_tx_addr[0 ] = 0xC9 ; // zebble ID
387387 rx_tx_addr[1 ] = 0x02 ;
388388 rx_tx_addr[2 ] = 0x13 ;
389+ num_ch = 0x89 ; // additional crc init. How is this calculated? or could it be random?
389390 // crc8 = 0xDE
390- // additional crc init of 0x89, how is this calculated???
391391 // channel_offset = 0x03
392- // 1Mb C=5 S=Y A= C9 02 13 CC CC P(9)= E1 70 70 70 20 20 00 20 1A
392+ // 1Mb C=5 S=Y A= C9 02 13 CC CC P(9)= E1 70 70 70 20 20 00 20 1A -> 0x91 + 0x89 => 0x1A
393+ // S=Y A= C9 02 13 CC CC P(9)= E1 70 70 70 20 A0 00 20 9A -> 0x11 + 0x89 => 0x9A
393394 // bind S=Y A= CC CC CC CC CC P(9)= 20 14 03 25 C9 02 13 89 55
394395 break ;
395396 #endif
396- default : // MT99 & H7 & A180 & DRAGON & F949G
397+ #ifdef FORCE_PA18_ID2
398+ case PA18+8 :
399+ rx_tx_addr[0 ] = 0x0E ;
400+ rx_tx_addr[1 ] = 0x05 ;
401+ rx_tx_addr[2 ] = 0x13 ;
402+ num_ch = 0xD1 ; // additional crc init. How is this calculated? or could it be random?
403+ // crc8 = 0x28
404+ // channel_offset = 0x00
405+ // 1Mb C=2 S=Y A= 0E 05 13 CC CC P(9)= E1 70 70 70 20 60 00 60 E2 -> 0x11 + 0xD1 => 0xE2
406+ // bind S=Y A= CC CC CC CC CC P(9)= 20 14 03 25 0E 05 13 D1 55
407+ break ;
408+ #endif
409+ default : // MT99 & H7 & A180 & DRAGON & F949G & PA18
397410 rx_tx_addr[2 ] = 0x00 ;
411+ if (sub_protocol == PA18+8 )
412+ rx_tx_addr[2 ] = 0x13 ;
398413 break ;
399414 }
400415
0 commit comments