From 1091a59ae138caaf60751c4b40a5837f449ad899 Mon Sep 17 00:00:00 2001 From: "john.moore" Date: Sun, 20 Aug 2023 20:20:06 +0100 Subject: [PATCH] Init WIP --- Multiprotocol/DSM_Rx_cyrf6936.ino | 4 ++++ Multiprotocol/DSM_cyrf6936.ino | 10 +++++----- Multiprotocol/Multi.txt | 2 +- Multiprotocol/Multi_Protos.ino | 6 +++++- Multiprotocol/Multiprotocol.h | 12 +++++++++++- Multiprotocol/Multiprotocol.ino | 2 +- Multiprotocol/_Config.h | 13 +++++++------ 7 files changed, 34 insertions(+), 15 deletions(-) diff --git a/Multiprotocol/DSM_Rx_cyrf6936.ino b/Multiprotocol/DSM_Rx_cyrf6936.ino index 66a546e..68a2c51 100644 --- a/Multiprotocol/DSM_Rx_cyrf6936.ino +++ b/Multiprotocol/DSM_Rx_cyrf6936.ino @@ -261,6 +261,10 @@ uint16_t DSM_RX_callback() &0xF0 => false=1024, true=2048 */ DSM_rx_type=packet_in[12]; debugln(", num_ch=%d, type=%02X",num_ch, DSM_rx_type); + if(sub_protocol==DSM_CLONE) + { + debugln("Collecting TX MfgId"); + } eeprom_write_byte((EE_ADDR)temp, DSM_rx_type); CYRF_WriteRegister(CYRF_29_RX_ABORT, 0x20); // Abort RX operation CYRF_SetTxRxMode(TX_EN); // Force end state TX diff --git a/Multiprotocol/DSM_cyrf6936.ino b/Multiprotocol/DSM_cyrf6936.ino index 5f2c562..ed3d304 100644 --- a/Multiprotocol/DSM_cyrf6936.ino +++ b/Multiprotocol/DSM_cyrf6936.ino @@ -529,11 +529,11 @@ void DSM_init() sop_col = (cyrfmfg_id[0] + cyrfmfg_id[1] + cyrfmfg_id[2] + 2) & 0x07; //Fix for OrangeRX using wrong DSM_pncodes by preventing access to "Col 8" - if(sop_col==0 && sub_protocol != DSMR) - { - cyrfmfg_id[rx_tx_addr[0]%3]^=0x01; //Change a bit so sop_col will be different from 0 - sop_col = (cyrfmfg_id[0] + cyrfmfg_id[1] + cyrfmfg_id[2] + 2) & 0x07; - } + //if(sop_col==0 && sub_protocol != DSMR) + //{ + // cyrfmfg_id[rx_tx_addr[0]%3]^=0x01; //Change a bit so sop_col will be different from 0 + // sop_col = (cyrfmfg_id[0] + cyrfmfg_id[1] + cyrfmfg_id[2] + 2) & 0x07; + //} //Calc CRC seed seed = (cyrfmfg_id[0] << 8) + cyrfmfg_id[1]; diff --git a/Multiprotocol/Multi.txt b/Multiprotocol/Multi.txt index 52854f1..3e0a317 100644 --- a/Multiprotocol/Multi.txt +++ b/Multiprotocol/Multi.txt @@ -67,7 +67,7 @@ 67,LR12,LR12,LR12_6ch 68,Skyartec 69,ESKYv2,150V2 -70,DSM_RX,Multi,CPPM +70,DSM_RX,Multi,CloneTX,EraseTX,CPPM 71,JJRC345,JJRC345,SkyTmblr 72,Q90C 73,Kyosho,FHSS,Hype diff --git a/Multiprotocol/Multi_Protos.ino b/Multiprotocol/Multi_Protos.ino index a61e781..0093d58 100644 --- a/Multiprotocol/Multi_Protos.ino +++ b/Multiprotocol/Multi_Protos.ino @@ -179,12 +179,16 @@ const char STR_SUBTYPE_FX[] = "\x04""816\0""620\0""9630"; #ifdef SEND_CPPM const char STR_SUB_FRSKY_RX[] = "\x07""Multi\0 ""CloneTX""EraseTX""CPPM\0 "; + const char STR_SUB_DSM_RX[] = "\x07""Multi\0 ""CloneTX""EraseTX""CPPM\0 "; #define FRCPPM 4 + #define DSMCPPM 4 const char STR_CPPM[] = "\x05""Multi""CPPM\0"; #define NBR_CPPM 2 #else const char STR_SUB_FRSKY_RX[] = "\x07""Multi\0 ""CloneTX""EraseTX"; + const char STR_SUB_DSM_RX[] = "\x07""Multi\0 ""CloneTX""EraseTX"; #define FRCPPM 3 + #define DSMCPPM 3 #define STR_CPPM NO_SUBTYPE #define NBR_CPPM 0 #endif @@ -249,7 +253,7 @@ const mm_protocol_definition multi_protocols[] = { {PROTO_DSM, STR_DSM, STR_SUBTYPE_DSM, 6, OPTION_MAXTHR, 0, 1, SW_CYRF, DSM_init, DSM_callback }, #endif #if defined(DSM_RX_CYRF6936_INO) - {PROTO_DSM_RX, STR_DSM_RX, STR_CPPM, NBR_CPPM, OPTION_NONE, 0, 1, SW_CYRF, DSM_RX_init, DSM_RX_callback }, + {PROTO_DSM_RX, STR_DSM_RX, STR_SUB_DSM_RX, DSMCPPM, OPTION_NONE, 0, 1, SW_CYRF, DSM_RX_init, DSM_RX_callback }, #endif #if defined(E010R5_CYRF6936_INO) {PROTO_E010R5, STR_E010R5, NO_SUBTYPE, 0, OPTION_NONE, 0, 0, SW_CYRF, E010R5_init, E010R5_callback }, diff --git a/Multiprotocol/Multiprotocol.h b/Multiprotocol/Multiprotocol.h index 76e89d9..ce3975c 100644 --- a/Multiprotocol/Multiprotocol.h +++ b/Multiprotocol/Multiprotocol.h @@ -19,7 +19,7 @@ #define VERSION_MAJOR 1 #define VERSION_MINOR 3 #define VERSION_REVISION 3 -#define VERSION_PATCH_LEVEL 28 +#define VERSION_PATCH_LEVEL 29 #define MODE_SERIAL 0 @@ -170,6 +170,12 @@ enum DSM DSM_AUTO = 4, DSMR = 5, }; +enum DSM_RX +{ + DSM_RX = 0, + DSM_CLONE = 1, + DSM_ERASE = 2, +}; enum YD717 { YD717 = 0, @@ -962,6 +968,10 @@ Serial: 100000 Baud 8e2 _ xxxx xxxx p -- DSMX_1F 2 DSMX_2F 3 DSM_AUTO 4 + sub_protocol==DSM_RX + DSM_RX 0 + DSM_CLONE 1 + DSM_ERASE 2 sub_protocol==YD717 YD717 0 SKYWLKR 1 diff --git a/Multiprotocol/Multiprotocol.ino b/Multiprotocol/Multiprotocol.ino index fae9502..76b4be3 100644 --- a/Multiprotocol/Multiprotocol.ino +++ b/Multiprotocol/Multiprotocol.ino @@ -23,7 +23,7 @@ #include //#define DEBUG_PIN // Use pin TX for AVR and SPI_CS for STM32 => DEBUG_PIN_on, DEBUG_PIN_off, DEBUG_PIN_toggle -//#define DEBUG_SERIAL // Only for STM32_BOARD, compiled with Upload method "Serial"->usart1, "STM32duino bootloader"->USB serial +#define DEBUG_SERIAL // Only for STM32_BOARD, compiled with Upload method "Serial"->usart1, "STM32duino bootloader"->USB serial #ifdef __arm__ // Let's automatically select the board if arm is selected #define STM32_BOARD diff --git a/Multiprotocol/_Config.h b/Multiprotocol/_Config.h index 67394c9..4f767b2 100644 --- a/Multiprotocol/_Config.h +++ b/Multiprotocol/_Config.h @@ -41,7 +41,7 @@ //Modify the channel order based on your TX: AETR, TAER, RETA... //Examples: Flysky & DEVO is AETR, JR/Spektrum radio is TAER, Multiplex is AERT... //Default is AETR. -#define AETR +#define TAER //Uncomment to reverse the direction of the specified channel for all protocols //#define REVERSE_AILERON @@ -74,10 +74,10 @@ //4-in-1 modules have the A7105, CYRF6936, CC2500 and NRF24L01 RF chips installed //5-in-1 modules have all RF chips installed //!!!If a RF chip is present it MUST be marked as installed!!! or weird things will happen you have been warned. -#define A7105_INSTALLED +//#define A7105_INSTALLED #define CYRF6936_INSTALLED #define CC2500_INSTALLED -#define NRF24L01_INSTALLED +//#define NRF24L01_INSTALLED //#define SX1276_INSTALLED // only supported on STM32 modules //Uncomment (remove //) if you have an internal 5-in-1 Multi module in a Jumper T18 or T-Lite. @@ -158,7 +158,7 @@ //If you have 2 Multi modules which you want to share the same ID so you can use either to control the same RC model // then you can force the ID to a certain known value using the lines below. //Default is commented, you should uncoment only for test purpose or if you know exactly what you are doing!!! -//#define FORCE_CYRF_ID "\x12\x34\x56\x78\x9A\xBC" +//#define FORCE_CYRF_ID "\x7b\xe8\x8b\x40\x9A\xBC" /****************************/ @@ -317,7 +317,7 @@ //For er9x it depends if you have an inveter mod or not on the telemetry pin. If you don't have an inverter comment this line. #define INVERT_TELEMETRY //For STM32 and OrangeRX modules, comment to prevent the TX from forcing the serial telemetry polarity normal/invert. -#define INVERT_TELEMETRY_TX +#define INVERT_TELEMETRY_TXs //Sends Multi status and allow OpenTX and erskyTX to autodetect the telemetry format. Comment to disable. #define MULTI_TELEMETRY @@ -603,7 +603,8 @@ const PPM_Parameters PPM_prot[14*NBR_BANKS]= { DSMX_2F DSMR PROTO_DSM_RX - NONE + DSM_RX + DSM_CLONE PROTO_E010R5 NONE PROTO_E016H