From 63dfa316e8e152b3b75421152c93aa0179e9d9dc Mon Sep 17 00:00:00 2001 From: pascallanger Date: Fri, 26 Apr 2024 19:25:23 +0200 Subject: [PATCH] Traxxas TQ 1st gen: try 1 --- Multiprotocol/Multi_Protos.ino | 4 +- Multiprotocol/Multiprotocol.h | 3 +- Multiprotocol/TRAXXAS_cyrf6936.ino | 157 +++++++++++++++++++++++++---- 3 files changed, 139 insertions(+), 25 deletions(-) diff --git a/Multiprotocol/Multi_Protos.ino b/Multiprotocol/Multi_Protos.ino index 50a34dcea..daf501ff1 100644 --- a/Multiprotocol/Multi_Protos.ino +++ b/Multiprotocol/Multi_Protos.ino @@ -148,7 +148,7 @@ const char STR_SUBTYPE_H83D[] = "\x07""Std\0 ""H20H\0 ""H20Mini""H30Min const char STR_SUBTYPE_CORONA[] = "\x05""V1\0 ""V2\0 ""FD V3"; const char STR_SUBTYPE_HITEC[] = "\x07""Optima\0""Opt Hub""Minima\0"; const char STR_SUBTYPE_BUGS_MINI[] = "\x06""Std\0 ""Bugs3H"; -const char STR_SUBTYPE_TRAXXAS[] = "\x02""TQ"; +const char STR_SUBTYPE_TRAXXAS[] = "\x03""TQ2""TQ1"; const char STR_SUBTYPE_E01X[] = "\x05""E012\0""E015\0"; const char STR_SUBTYPE_GD00X[] = "\x05""GD_V1""GD_V2"; const char STR_SUBTYPE_REDPINE[] = "\x04""Fast""Slow"; @@ -468,7 +468,7 @@ const mm_protocol_definition multi_protocols[] = { {PROTO_SYMAX, STR_SYMAX, STR_SUBTYPE_SYMAX, 2, OPTION_NONE, 0, 0, SW_NRF, SYMAX_init, SYMAX_callback }, #endif #if defined(TRAXXAS_CYRF6936_INO) - {PROTO_TRAXXAS, STR_TRAXXAS, STR_SUBTYPE_TRAXXAS, 1, OPTION_NONE, 0, 0, SW_CYRF, TRAXXAS_init, TRAXXAS_callback }, + {PROTO_TRAXXAS, STR_TRAXXAS, STR_SUBTYPE_TRAXXAS, 2, OPTION_NONE, 0, 0, SW_CYRF, TRAXXAS_init, TRAXXAS_callback }, #endif #if defined(V2X2_NRF24L01_INO) {PROTO_V2X2, STR_V2X2, STR_SUBTYPE_V2X2, 3, OPTION_NONE, 0, 0, SW_NRF, V2X2_init, V2X2_callback }, diff --git a/Multiprotocol/Multiprotocol.h b/Multiprotocol/Multiprotocol.h index d29353171..c53ded8ba 100644 --- a/Multiprotocol/Multiprotocol.h +++ b/Multiprotocol/Multiprotocol.h @@ -363,7 +363,8 @@ enum REDPINE }; enum TRAXXAS { - TRAXXAS_TQ = 0, + TRAXXAS_TQ2 = 0, + TRAXXAS_TQ1 = 1, }; enum ESKY150 { diff --git a/Multiprotocol/TRAXXAS_cyrf6936.ino b/Multiprotocol/TRAXXAS_cyrf6936.ino index 04eade7ae..462ba45cc 100644 --- a/Multiprotocol/TRAXXAS_cyrf6936.ino +++ b/Multiprotocol/TRAXXAS_cyrf6936.ino @@ -19,12 +19,16 @@ #include "iface_cyrf6936.h" -//#define TRAXXAS_FORCE_ID +#define TRAXXAS_TQ1_FORCE_ID +//#define TRAXXAS_TQ2_FORCE_ID //#define TRAXXAS_DEBUG -#define TRAXXAS_BIND_CHANNEL 0x2B -#define TRAXXAS_CHECK_CHANNEL 0x22 -#define TRAXXAS_PACKET_SIZE 16 +#define TRAXXAS_BIND_CHANNEL 0x2B +#define TRAXXAS_CHECK_CHANNEL 0x22 +#define TRAXXAS_PACKET_SIZE 16 + +#define TRAXXAS_TQ1_BIND_CHANNEL 0x04 +#define TRAXXAS_TQ1_CHECK_CHANNEL 0x34 enum { TRAXXAS_BIND_PREP_RX=0, @@ -34,6 +38,9 @@ enum { TRAXXAS_RX, TRAXXAS_PREP_DATA, TRAXXAS_DATA, + TRAXXAS_TQ1_BIND, + TRAXXAS_TQ1_DATA1, + TRAXXAS_TQ1_DATA2, }; const uint8_t PROGMEM TRAXXAS_init_vals[][2] = { @@ -98,7 +105,46 @@ static void __attribute__((unused)) TRAXXAS_send_data_packet() } CYRF_SetPower(0x08); - CYRF_WriteDataPacketLen(packet, TRAXXAS_PACKET_SIZE); + CYRF_WriteDataPacket(packet); +} + +static void __attribute__((unused)) TRAXXAS_TQ1_send_data_packet() +{ + memcpy(&packet[1], cyrfmfg_id, 4); + if(IS_BIND_IN_PROGRESS) + { + packet_length = 8; + packet[0] = 0x2A; // Bind packet + packet[5] = 0xA0; // Bind phase 0 + packet[6] = TRAXXAS_BIND_CHANNEL-1; // Not sure... + } + else + { + packet[0] = 0x02; // Normal packet + packet[5] = 0xA2; // Bind phase 2 = completed? + //4 channels + uint16_t ch; + for(uint8_t i=0; i<4; i++) + { + ch = convert_channel_ppm(i); + packet[6+i*2]=ch; + packet[7+i*2]=ch>>8; + } + packet[14] = hopping_frequency[0]-1; // Not sure... + } + uint8_t xor_value=0; + for(uint8_t i=0; i CRC: 65-4B=1A E2-A3=3F RX ID: \x00\x00\x2D\x1A\x49\xFE CRC 0x65 0xE2 => CRC: 65-00=65 E2-00=E2 RX ID: \x00\xFF\x2D\x1A\x49\xFE CRC 0x65 0xE3 => CRC: 65-00=65 E2-FF=E3 RX ID: \xFF\x00\x2D\x1A\x49\xFE CRC 0x66 0xE2 => CRC: 65-FF=66 E2-00=E2 -*/ -/* + +SOP Codes: RX1: 02 4A A3 2D 1A 49 FE 06 00 00 02 01 06 06 00 00 SOP: A1 78 DC 3C 9E 82 DC 3C RX2: 02 49 AC 4F 55 4D FE 05 00 00 02 01 06 06 00 00 @@ -340,4 +448,9 @@ Dump of SOP Codes: 20: 00 00 00 33 DE AD BA BE ??over?? */ +/* +Traxxas TQ 1st generation +------------------------- +https://github.com/pascallanger/DIY-Multiprotocol-TX-Module/issues/967#issuecomment-2079038576 +*/ #endif