From 72f87cade972b8fd5f70bd4a649b0aa32f26defc Mon Sep 17 00:00:00 2001 From: pascallanger Date: Sat, 17 Feb 2024 11:02:52 +0100 Subject: [PATCH] XK: new subprotocol Cars Removed: - deadband which was needed on the planes - force bind since the cars remember the bind info - --- Lua_scripts/MultiChan.txt | 1 + Multiprotocol/Multi.txt | 2 +- Multiprotocol/Multi_Protos.ino | 4 ++-- Multiprotocol/Multiprotocol.h | 1 + Multiprotocol/XK_ccnrf.ino | 22 +++++++++++++++------- Multiprotocol/_Config.h | 1 + Protocols_Details.md | 7 +++++-- 7 files changed, 26 insertions(+), 12 deletions(-) diff --git a/Lua_scripts/MultiChan.txt b/Lua_scripts/MultiChan.txt index 883727b..ed15054 100644 --- a/Lua_scripts/MultiChan.txt +++ b/Lua_scripts/MultiChan.txt @@ -188,6 +188,7 @@ 30,5,WK2x01,W6HEL_I,0,Gear,Col,Gyro 62,0,XK,X450,1,FMode,TakeOf,Emerg,3D_6G,Pict,Video 62,1,XK,X420,1,FMode,TakeOf,Emerg,3D_6G,Pict,Video +62,2,XK,Cars,0,FMode,TakeOf,Emerg,3D_6G,Pict,Video 8,0,YD717,Std,1,Flip,Light,Pict,Video,HLess 8,1,YD717,SkyWlkr,1,Flip,Light,Pict,Video,HLess 8,2,YD717,Simax4,1,Flip,Light,Pict,Video,HLess diff --git a/Multiprotocol/Multi.txt b/Multiprotocol/Multi.txt index 7d87c33..ba78de7 100644 --- a/Multiprotocol/Multi.txt +++ b/Multiprotocol/Multi.txt @@ -59,7 +59,7 @@ 59,Bayang_RX,Multi,CPPM 60,Pelikan,Pro,Lite,SCX24 61,Tiger -62,XK,X450,X420 +62,XK,X450,X420,Cars 63,XN_DUMP,250K,1M,2M,AUTO 64,FrskyX2,CH_16,CH_8,EU_16,EU_8,Cloned 65,FrSkyR9,915MHz,868MHz,915_8ch,868_8ch,FCC,--,FCC_8ch,--_8ch diff --git a/Multiprotocol/Multi_Protos.ino b/Multiprotocol/Multi_Protos.ino index 3f62ef0..a8a13df 100644 --- a/Multiprotocol/Multi_Protos.ino +++ b/Multiprotocol/Multi_Protos.ino @@ -158,7 +158,7 @@ const char STR_SUBTYPE_XN297DUMP[] = "\x07""250Kbps""1Mbps\0 ""2Mbps\0 ""Auto\0 const char STR_SUBTYPE_ESKY150[] = "\x03""4ch""7ch"; const char STR_SUBTYPE_ESKY150V2[] = "\x05""150V2"; const char STR_SUBTYPE_V911S[] = "\x05""V911S""E119\0"; -const char STR_SUBTYPE_XK[] = "\x04""X450""X420"; +const char STR_SUBTYPE_XK[] = "\x04""X450""X420""Cars"; const char STR_SUBTYPE_FRSKYR9[] = "\x07""915MHz\0""868MHz\0""915 8ch""868 8ch""FCC\0 ""--\0 ""FCC 8ch""-- 8ch\0"; const char STR_SUBTYPE_ESKY[] = "\x03""Std""ET4"; const char STR_SUBTYPE_PROPEL[] = "\x04""74-Z"; @@ -489,7 +489,7 @@ const mm_protocol_definition multi_protocols[] = { {PROTO_XERALL, STR_XERALL, NO_SUBTYPE, 0, OPTION_NONE, 0, 0, SW_NRF, XERALL_init, XERALL_callback }, #endif #if defined(XK_CCNRF_INO) - {PROTO_XK, STR_XK, STR_SUBTYPE_XK, 2, OPTION_RFTUNE, 0, 0, SW_NRF, XK_init, XK_callback }, + {PROTO_XK, STR_XK, STR_SUBTYPE_XK, 3, OPTION_RFTUNE, 0, 0, SW_NRF, XK_init, XK_callback }, #endif #if defined(XN297DUMP_NRF24L01_INO) {PROTO_XN297DUMP, STR_XN297DUMP, STR_SUBTYPE_XN297DUMP, 6, OPTION_RFCHAN, 0, 0, SW_NRF, XN297Dump_init, XN297Dump_callback }, diff --git a/Multiprotocol/Multiprotocol.h b/Multiprotocol/Multiprotocol.h index a584030..711d04e 100644 --- a/Multiprotocol/Multiprotocol.h +++ b/Multiprotocol/Multiprotocol.h @@ -376,6 +376,7 @@ enum XK { X450 = 0, X420 = 1, + XK_CARS = 2, }; enum XN297DUMP { diff --git a/Multiprotocol/XK_ccnrf.ino b/Multiprotocol/XK_ccnrf.ino index 879ca33..e369d99 100644 --- a/Multiprotocol/XK_ccnrf.ino +++ b/Multiprotocol/XK_ccnrf.ino @@ -29,11 +29,18 @@ Multiprotocol is distributed in the hope that it will be useful, static uint16_t __attribute__((unused)) XK_convert_channel(uint8_t num) { - // Introduce deadband on all channels to prevent twitching - //debug("val:%d",val); - uint16_t val=convert_channel_8b_limit_deadband(num,0x00,0x80, 0xFF, 40)<<2; - //debugln(",%d",val); - + uint16_t val; + + if(sub_protocol != XK_CARS) + { + // Introduce deadband on all channels to prevent twitching + //debug("val:%d",val); + val=convert_channel_8b_limit_deadband(num,0x00,0x80, 0xFF, 40)<<2; + //debugln(",%d",val); + } + else + val=convert_channel_16b_limit(num,0x00,0x3FF); + // 1FF..01=left, 00=center, 200..3FF=right if(val==0x200) val=0; // 0 @@ -187,7 +194,7 @@ static void __attribute__((unused)) XK_initialize_txid() static void __attribute__((unused)) XK_RF_init() { - XN297_Configure(XN297_CRCEN, XN297_SCRAMBLED, sub_protocol==X420 ? XN297_1M : XN297_250K); + XN297_Configure(XN297_CRCEN, XN297_SCRAMBLED, sub_protocol==X450 ? XN297_250K : XN297_1M ); XN297_SetTXAddr((uint8_t*)"\x68\x94\xA6\xD5\xC3", 5); // Bind address XN297_HoppingCalib(XK_RF_BIND_NUM_CHANNELS+XK_RF_NUM_CHANNELS); // Calibrate all channels } @@ -209,7 +216,8 @@ uint16_t XK_callback() void XK_init() { - BIND_IN_PROGRESS; // Autobind protocol + if(sub_protocol != XK_CARS) + BIND_IN_PROGRESS; // Autobind protocol XK_initialize_txid(); XK_RF_init(); hopping_frequency_no = 0; diff --git a/Multiprotocol/_Config.h b/Multiprotocol/_Config.h index 0495cd9..b36876e 100644 --- a/Multiprotocol/_Config.h +++ b/Multiprotocol/_Config.h @@ -846,6 +846,7 @@ const PPM_Parameters PPM_prot[14*NBR_BANKS]= { PROTO_XK X450 X420 + XK_CARS PROTO_YD717 YD717 SKYWLKR diff --git a/Protocols_Details.md b/Protocols_Details.md index 6a4f8b2..55addf4 100644 --- a/Protocols_Details.md +++ b/Protocols_Details.md @@ -131,7 +131,7 @@ CFlie|38|CFlie||||||||NRF24L01| [Q2X2](Protocols_Details.md#Q2X2---29)|29|Q222|Q242|Q282||||||NRF24L01| [Q303](Protocols_Details.md#Q303---31)|31|Q303|CX35|CX10D|CX10WD|||||NRF24L01|XN297 [Q90C](Protocols_Details.md#Q90C---72)|72|Q90C*||||||||NRF24L01|XN297 -[RadioLink](Protocols_Details.md#RadioLink---74)|74|Surface|Air|DumboRC||||||CC2500| +[RadioLink](Protocols_Details.md#RadioLink---74)|74|Surface|Air|DumboRC|RC4G|||||CC2500| [Realacc](Protocols_Details.md#Realacc---76)|76|R11||||||||NRF24L01| [Redpine](Protocols_Details.md#Redpine---50)|50|FAST|SLOW|||||||NRF24L01|XN297 [Scanner](Protocols_Details.md#Scanner---54)|54|||||||||CC2500| @@ -150,7 +150,7 @@ CFlie|38|CFlie||||||||NRF24L01| [WFLY2](Protocols_Details.md#WFLY2---79)|79|RF20x||||||||A7105| [WK2x01](Protocols_Details.md#WK2X01---30)|30|WK2801|WK2401|W6_5_1|W6_6_1|W6_HEL|W6_HEL_I|||CYRF6936| [XERALL](Protocols_Details.md#XERALL---91)|91|Tank||||||||NRF24L01|XN297 -[XK](Protocols_Details.md#XK---62)|62|X450|X420|||||||NRF24L01|XN297 +[XK](Protocols_Details.md#XK---62)|62|X450|X420|Cars||||||NRF24L01|XN297 [YD717](Protocols_Details.md#YD717---8)|8|YD717|SKYWLKR|SYMAX4|XINXUN|NIHUI||||NRF24L01| [ZSX](Protocols_Details.md#ZSX---52)|52|280||||||||NRF24L01|XN297 * "*" Sub Protocols designated by * suffix are using a XN297L@250kbps which will be emulated by default with the NRF24L01. If option (freq tune) is diffrent from 0, the CC2500 module (if installed) will be used instead. Each specific sub protocol has a more detailed explanation. @@ -1430,6 +1430,9 @@ If only a NRF24L01 is installed then this sub protocol might be problematic beca ### Sub_protocol X420 - *1* Models: XK X420/X520 (TX=X4), WLtoys 284131/284161/284010 +### Sub_protocol Cars - *2* +Models: WLtoys cars 284131/284161/284010/... + *** # NRF24L01 RF Module