Skip to content

Commit

Permalink
XK: new subprotocol Cars
Browse files Browse the repository at this point in the history
Removed:
 - deadband which was needed on the planes
- force bind since the cars remember the bind info
-
  • Loading branch information
pascallanger committed Feb 17, 2024
1 parent 50bd485 commit 72f87ca
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 12 deletions.
1 change: 1 addition & 0 deletions Lua_scripts/MultiChan.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion Multiprotocol/Multi.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions Multiprotocol/Multi_Protos.ino
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -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 },
Expand Down
1 change: 1 addition & 0 deletions Multiprotocol/Multiprotocol.h
Original file line number Diff line number Diff line change
Expand Up @@ -376,6 +376,7 @@ enum XK
{
X450 = 0,
X420 = 1,
XK_CARS = 2,
};
enum XN297DUMP
{
Expand Down
22 changes: 15 additions & 7 deletions Multiprotocol/XK_ccnrf.ino
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
}
Expand All @@ -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;
Expand Down
1 change: 1 addition & 0 deletions Multiprotocol/_Config.h
Original file line number Diff line number Diff line change
Expand Up @@ -846,6 +846,7 @@ const PPM_Parameters PPM_prot[14*NBR_BANKS]= {
PROTO_XK
X450
X420
XK_CARS
PROTO_YD717
YD717
SKYWLKR
Expand Down
7 changes: 5 additions & 2 deletions Protocols_Details.md
Original file line number Diff line number Diff line change
Expand Up @@ -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|
Expand All @@ -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.
Expand Down Expand Up @@ -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

Expand Down

0 comments on commit 72f87ca

Please sign in to comment.