Skip to content

Commit

Permalink
KN: additional trim and flag
Browse files Browse the repository at this point in the history
  • Loading branch information
pascallanger committed Feb 15, 2024
1 parent 724abbc commit 53d5684
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 19 deletions.
4 changes: 2 additions & 2 deletions Lua_scripts/MultiChan.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
22 changes: 8 additions & 14 deletions Multiprotocol/KN_nrf24l01.ino
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down
6 changes: 3 additions & 3 deletions Protocols_Details.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 53d5684

Please sign in to comment.