mirror of
https://github.com/pascallanger/DIY-Multiprotocol-TX-Module.git
synced 2026-01-01 19:33:14 +00:00
XK: new subprotocol Cars
Removed: - deadband which was needed on the planes - force bind since the cars remember the bind info -
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user