From b9c828c878f7beeffddfd4fcac1410a06bf57c8f Mon Sep 17 00:00:00 2001 From: pascallanger Date: Thu, 13 Mar 2025 18:29:56 +0100 Subject: [PATCH] MouldKg multi 6 ports brick support --- Lua_scripts/MultiChan.txt | 5 ++-- Multiprotocol/MouldKg_nrf24l01.ino | 13 +++++++-- Multiprotocol/Multi.txt | 2 +- Multiprotocol/Multi_Protos.ino | 4 +-- Multiprotocol/Multiprotocol.h | 7 +++-- Multiprotocol/_Config.h | 5 ++-- Protocols_Details.md | 44 ++++++++++++++++++++++++++++-- 7 files changed, 64 insertions(+), 16 deletions(-) diff --git a/Lua_scripts/MultiChan.txt b/Lua_scripts/MultiChan.txt index 6f4e0b4..3881c37 100644 --- a/Lua_scripts/MultiChan.txt +++ b/Lua_scripts/MultiChan.txt @@ -216,8 +216,9 @@ 85,0,E016H,Std,1,Stop,Flip,n-a,HLess,RTH 87,0,IKEA 89,0,LOSI -90,0,MouldKg,Analog,0 -90,1,MouldKg,Digit,0 +90,0,MouldKg,Analog4,0 +90,1,MouldKg,Digit4,0 +90,2,MouldKg,Analog6,0 91,0,Xerall,Tank,0,FlTa,TakLan,Rate,HLess,Photo,Video,TrimR,TrimE,TrimA 93,0,Kyosho2,KT-17,0 94,0,Scorpio diff --git a/Multiprotocol/MouldKg_nrf24l01.ino b/Multiprotocol/MouldKg_nrf24l01.ino index 177a756..c7cd9de 100644 --- a/Multiprotocol/MouldKg_nrf24l01.ino +++ b/Multiprotocol/MouldKg_nrf24l01.ino @@ -50,12 +50,19 @@ static void __attribute__((unused)) MOULDKG_send_packet() else { uint8_t n = num_ch<<2; - if(sub_protocol == MOULDKG_ANALOG) + if(sub_protocol == MOULDKG_ANALOG4 || sub_protocol == MOULDKG_ANALOG6 ) { packet[0] = 0x36; - uint8_t ch[]={ 1,0,2,3,4,5 }; + const uint8_t ch[]={ 1,0,2,3,4,5 }; + if(sub_protocol == MOULDKG_ANALOG6) + n += num_ch<<1; for(uint8_t i=0;i<6;i++) - packet[i+4] = convert_channel_8b(ch[i]+n); + { + if(i > 3 && (sub_protocol == MOULDKG_ANALOG4 || i + n > 15)) + packet[i+4] = 0x80; //Centered channel + else + packet[i+4] = convert_channel_8b(ch[i]+n); + } len = MOULDKG_PAYLOAD_SIZE_ANALOG; } else diff --git a/Multiprotocol/Multi.txt b/Multiprotocol/Multi.txt index 4bf8ddb..57ba625 100644 --- a/Multiprotocol/Multi.txt +++ b/Multiprotocol/Multi.txt @@ -86,7 +86,7 @@ 87,IKEA 88,WILLIFM 89,Losi -90,MouldKg,Analog,Digit +90,MouldKg,Analog4,Digit4,Analog6 91,Xerall 92,MT99xx,PA18,SU35 93,Kyosho2,KT-17 diff --git a/Multiprotocol/Multi_Protos.ino b/Multiprotocol/Multi_Protos.ino index 593a5f4..4195cb8 100644 --- a/Multiprotocol/Multi_Protos.ino +++ b/Multiprotocol/Multi_Protos.ino @@ -184,7 +184,7 @@ const char STR_SUBTYPE_KYOSHO2[] = "\x05""KT-17"; const char STR_SUBTYPE_KYOSHO3[] = "\x03""ASF"; const char STR_SUBTYPE_FUTABA[] = "\x05""SFHSS"; const char STR_SUBTYPE_JJRC345[] = "\x08""JJRC345\0""SkyTmblr"; -const char STR_SUBTYPE_MOULDKG[] = "\x06""Analog""Digit\0"; +const char STR_SUBTYPE_MOULDKG[] = "\x07""Analog4""Digit4\0""Analog6"; const char STR_SUBTYPE_KF606[] = "\x06""KF606\0""MIG320""ZCZ50\0"; const char STR_SUBTYPE_E129[] = "\x04""E129""C186"; const char STR_SUBTYPE_FX[] = "\x05""816\0 ""620\0 ""9630\0""Q560\0""QF012"; @@ -425,7 +425,7 @@ const mm_protocol_definition multi_protocols[] = { {PROTO_MLINK, STR_MLINK, NO_SUBTYPE, 0, OPTION_NONE, 1, 0, SW_CYRF, MLINK_init, MLINK_callback }, #endif #if defined(MOULDKG_NRF24L01_INO) - {PROTO_MOULDKG, STR_MOULDKG, STR_SUBTYPE_MOULDKG, 2, OPTION_OPTION, 0, 0, SW_NRF, MOULDKG_init, MOULDKG_callback }, + {PROTO_MOULDKG, STR_MOULDKG, STR_SUBTYPE_MOULDKG, 3, OPTION_OPTION, 0, 0, SW_NRF, MOULDKG_init, MOULDKG_callback }, #endif #if defined(MT99XX_CCNRF_INO) {PROTO_MT99XX, STR_MT99XX, STR_SUBTYPE_MT99, 8, OPTION_NONE, 0, 0, SW_NRF, MT99XX_init, MT99XX_callback }, diff --git a/Multiprotocol/Multiprotocol.h b/Multiprotocol/Multiprotocol.h index c86d072..3402b5e 100644 --- a/Multiprotocol/Multiprotocol.h +++ b/Multiprotocol/Multiprotocol.h @@ -19,7 +19,7 @@ #define VERSION_MAJOR 1 #define VERSION_MINOR 3 #define VERSION_REVISION 4 -#define VERSION_PATCH_LEVEL 44 +#define VERSION_PATCH_LEVEL 45 #define MODE_SERIAL 0 @@ -471,8 +471,9 @@ enum RLINK }; enum MOULDKG { - MOULDKG_ANALOG = 0, - MOULDKG_DIGIT = 1, + MOULDKG_ANALOG4 = 0, + MOULDKG_DIGIT4 = 1, + MOULDKG_ANALOG6 = 2, }; enum KF606 { diff --git a/Multiprotocol/_Config.h b/Multiprotocol/_Config.h index 1debd21..512cf80 100644 --- a/Multiprotocol/_Config.h +++ b/Multiprotocol/_Config.h @@ -781,8 +781,9 @@ const PPM_Parameters PPM_prot[14*NBR_BANKS]= { PROTO_MLINK NONE PROTO_MOULDKG - MOULDKG_ANALOG - MOULDKG_DIGIT + MOULDKG_ANALOG4 + MOULDKG_DIGIT4 + MOULDKG_ANALOG6 PROTO_MT99XX MT99 H7 diff --git a/Protocols_Details.md b/Protocols_Details.md index 9c58760..8d55092 100644 --- a/Protocols_Details.md +++ b/Protocols_Details.md @@ -2071,6 +2071,9 @@ CH16| CH8 | -100% | 0% | - | - | - ## MouldKg - *90* Mould King 2.4GHz TX: Technic Brick models +### Sub_protocol Analog4 - *0* +Model: 4 analog ports brick + Up to 4 bricks can be controlled at the same time. Option field | Value @@ -2086,17 +2089,52 @@ To associate a brick to a RX number (RX_num above), set this RX number under the Example: I want to control 2 bricks. I select RX number 1, set option to 1 and launch a bind on the first brick. I select RX number 2, set option to 1 and launch a bind on the second brick. Now to control both bricks I set RX number to 1 and option to 2. Therefore brick1 will react to channels CH1 to CH4 and brick2 to channel CH5 to CH8. On another model I can control 4 other bricks, bind each brick to RX number 3 to 6 and then finaly set RX number to 3 and option to 4 to contol the 4 bricks with CH1 to CH16. -### Sub_protocol Analog - *0* +CH1|CH2|CH3|CH4|CH5|CH6|CH7|CH8|CH9|CH10|CH11|CH12|CH13|CH14|CH15|CH16 +---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|--- +Brick1_A|Brick1_B|Brick1_C|Brick1_D|Brick2_A|Brick2_B|Brick2_C|Brick2_D|Brick3_A|Brick3_B|Brick3_C|Brick3_D|Brick4_A|Brick4_B|Brick4_C|Brick4_D + +### Sub_protocol Digit4 - *1* +Model: 4 digital ports brick + +Up to 4 bricks can be controlled at the same time. + +Option field | Value +-------------|------ +0|The module will act like the original radio which will bind every time and attach to the first brick in bind mode +1|The module will control the brick number RX_num +2|The module will control the brick number RX_num and RX_num+1 +3|The module will control the brick number RX_num, RX_num+1 and RX_num+2 +4|The module will control the brick number RX_num, RX_num+1, RX_num+2 and RX_num+3 + +To associate a brick to a RX number (RX_num above), set this RX number under the protocol, set option to 1, launch a bind and power on the brick you want to control. Repeat this for every brick using a different RX number each time and then indicate the number of bricks to be controlled using the Option field. + +Example: I want to control 2 bricks. I select RX number 1, set option to 1 and launch a bind on the first brick. I select RX number 2, set option to 1 and launch a bind on the second brick. Now to control both bricks I set RX number to 1 and option to 2. Therefore brick1 will react to channels CH1 to CH4 and brick2 to channel CH5 to CH8. +On another model I can control 4 other bricks, bind each brick to RX number 3 to 6 and then finaly set RX number to 3 and option to 4 to contol the 4 bricks with CH1 to CH16. CH1|CH2|CH3|CH4|CH5|CH6|CH7|CH8|CH9|CH10|CH11|CH12|CH13|CH14|CH15|CH16 ---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|--- Brick1_A|Brick1_B|Brick1_C|Brick1_D|Brick2_A|Brick2_B|Brick2_C|Brick2_D|Brick3_A|Brick3_B|Brick3_C|Brick3_D|Brick4_A|Brick4_B|Brick4_C|Brick4_D -### Sub_protocol Digit - *1* +### Sub_protocol Analog6 - *2* +Model: 4/6 analog ports brick + +Up to 3 bricks can be controlled at the same time. The bricks can be either 4 or 6 ports but only the 2 first bricks will be sent 6 channels, the last brick will only be sent 4 channels. + +Option field | Value +-------------|------ +0|The module will act like the original radio which will bind every time and attach to the first brick in bind mode +1|The module will control the brick number RX_num +2|The module will control the brick number RX_num and RX_num+1 +3|The module will control the brick number RX_num, RX_num+1 and RX_num+2 + +To associate a brick to a RX number (RX_num above), set this RX number under the protocol, set option to 1, launch a bind and power on the brick you want to control. Repeat this for every brick using a different RX number each time and then indicate the number of bricks to be controlled using the Option field. + +Example: I want to control 2 bricks. I select RX number 1, set option to 1 and launch a bind on the first brick. I select RX number 2, set option to 1 and launch a bind on the second brick. Now to control both bricks I set RX number to 1 and option to 2. Therefore brick1 will react to channels CH1 to CH4 and brick2 to channel CH5 to CH8. +On another model I can control 3 other bricks, bind each brick to RX number 3 to 5 and then finaly set RX number to 3 and option to 3 to contol the 4 bricks with CH1 to CH16. CH1|CH2|CH3|CH4|CH5|CH6|CH7|CH8|CH9|CH10|CH11|CH12|CH13|CH14|CH15|CH16 ---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|--- -Brick1_A|Brick1_B|Brick1_C|Brick1_D|Brick2_A|Brick2_B|Brick2_C|Brick2_D|Brick3_A|Brick3_B|Brick3_C|Brick3_D|Brick4_A|Brick4_B|Brick4_C|Brick4_D +Brick1_A|Brick1_B|Brick1_C|Brick1_D|Brick1_E|Brick1_F|Brick2_A|Brick2_B|Brick2_C|Brick2_D|Brick2_E|Brick2_F|Brick3_A|Brick3_B|Brick3_C|Brick3_D ## NCC1701 - *44* Model: Air Hogs Star Trek USS Enterprise NCC-1701-A