From 53d5684dfd8be99b8ed9a35e64bbde5b501323a4 Mon Sep 17 00:00:00 2001 From: pascallanger Date: Thu, 15 Feb 2024 20:52:01 +0100 Subject: [PATCH] KN: additional trim and flag --- Lua_scripts/MultiChan.txt | 4 ++-- Multiprotocol/KN_nrf24l01.ino | 22 ++++++++-------------- Protocols_Details.md | 6 +++--- 3 files changed, 13 insertions(+), 19 deletions(-) diff --git a/Lua_scripts/MultiChan.txt b/Lua_scripts/MultiChan.txt index da7565beb..3303ca52d 100644 --- a/Lua_scripts/MultiChan.txt +++ b/Lua_scripts/MultiChan.txt @@ -119,8 +119,8 @@ 49,0,KF606,KF606,1,Trim 49,1,KF606,MIG320,1,Trim,LED 49,2,KF606,ZCZ50,1,Trim,UNK -9,0,KN,WLToys,0,DRate,THold,IdleUp,Gyro,Ttrim,Atrim,Etrim -9,1,KN,Feilun,0,DRate,THold,IdleUp,Gyro,Ttrim,Atrim,Etrim +9,0,KN,WLToys,0,DRate,THold,IdleUp,Gyro,Ttrim,Atrim,Etrim,Rtrim,Hover +9,1,KN,Feilun,0,DRate,THold,IdleUp,Gyro,Ttrim,Atrim,Etrim,Rtrim,Hover 73,0,Kyosho,FHSS,0,CH5,CH6,CH7,CH8,CH9,CH10,CH11,CH12,CH13,CH14 73,1,Kyosho,Hype,0,CH5,CH6 18,0,MJXQ,WHL08,1,Flip,LED,Pict,Video,HLess,RTH,AuFlip,Pan,Tilt,Rate diff --git a/Multiprotocol/KN_nrf24l01.ino b/Multiprotocol/KN_nrf24l01.ino index ddd59ec36..4434b5bdd 100644 --- a/Multiprotocol/KN_nrf24l01.ino +++ b/Multiprotocol/KN_nrf24l01.ino @@ -63,7 +63,7 @@ enum { KN_FLAG_DR = 0x01, // Dual Rate: 1 - full range KN_FLAG_TH = 0x02, // Throttle Hold: 1 - hold KN_FLAG_IDLEUP = 0x04, // Idle up: 1 - 3D - KN_FLAG_RES1 = 0x08, + KN_FLAG_RES1 = 0x08, // HoverDebugging KN_FLAG_RES2 = 0x10, KN_FLAG_RES3 = 0x20, KN_FLAG_GYRO3 = 0x40, // 0 - 6G mode, 1 - 3G mode @@ -141,19 +141,13 @@ static void __attribute__((unused)) kn_update_packet_control_data() packet[8] = convert_channel_16b_limit(CH9,0,200); // 0x64; // T packet[9] = convert_channel_16b_limit(CH10,0,200); // 0x64; // A packet[10] = convert_channel_16b_limit(CH11,0,200); // 0x64; // E - packet[11] = 0x64; // R - - flags=0; - if (CH5_SW) - flags = KN_FLAG_DR; - if (CH6_SW) - flags |= KN_FLAG_TH; - if (CH7_SW) - flags |= KN_FLAG_IDLEUP; - if (CH8_SW) - flags |= KN_FLAG_GYRO3; - - packet[12] = flags; + packet[11] = convert_channel_16b_limit(CH12,0,200); // 0x64; // R + + packet[12] = GET_FLAG(CH5_SW, KN_FLAG_DR) + |GET_FLAG(CH6_SW, KN_FLAG_TH) + |GET_FLAG(CH7_SW, KN_FLAG_IDLEUP) + |GET_FLAG(CH8_SW, KN_FLAG_GYRO3) + |GET_FLAG(CH13_SW, KN_FLAG_RES1); //Hover debugging packet[13] = 0x00; if(sub_protocol==WLTOYS) diff --git a/Protocols_Details.md b/Protocols_Details.md index 0ecedb37f..ce7dc8c37 100644 --- a/Protocols_Details.md +++ b/Protocols_Details.md @@ -1756,9 +1756,9 @@ CH1|CH2|CH3|CH4|CH5 | | |T|R|AUX ## KN - *9* -CH1|CH2|CH3|CH4|CH5|CH6|CH7|CH8|CH9|CH10|CH11 ----|---|---|---|---|---|---|---|---|----|---- -A|E|T|R|DR|THOLD|IDLEUP|GYRO|Ttrim|Atrim|Etrim +CH1|CH2|CH3|CH4|CH5|CH6|CH7|CH8|CH9|CH10|CH11|CH12|CH13 +---|---|---|---|---|---|---|---|---|----|----|----|---- +A|E|T|R|DR|THOLD|IDLEUP|GYRO|Ttrim|Atrim|Etrim|Rtrim|HoverDebugging Dual Rate: +100%=full range, Throttle Hold: +100%=hold, Idle Up: +100%=3D, GYRO: -100%=6G, +100%=3G