mirror of
https://github.com/pascallanger/DIY-Multiprotocol-TX-Module.git
synced 2025-02-04 22:28:12 +00:00
WK2x01: subprotocols addition
WK2801 number 0, 8 channels, fixed id is not supported WK2401 number 1, 4 channels W6_5_1 number 2, 6 channels W6_6_1 number 3, 7 channels W6_HEL number 4, 6 channels, option is used to limit COL W6_HEL_I number 5, 6 channels, COL inverted, option is used to limit COL
This commit is contained in:
parent
fbb919d767
commit
8677e73d75
@ -27,4 +27,4 @@
|
|||||||
27,OpnLrs
|
27,OpnLrs
|
||||||
28,AFHD2SA,PWM_IBUS,PPM_IBUS,PWM_SBUS,PPM_SBUS
|
28,AFHD2SA,PWM_IBUS,PPM_IBUS,PWM_SBUS,PPM_SBUS
|
||||||
29,Q2X2,Q222,Q242,Q282
|
29,Q2X2,Q222,Q242,Q282
|
||||||
30,WK2X01,WK2801,WK2601,WK2401
|
30,WK2x01,WK2801,WK2401,W6_5_1,W6_6_1,W6_HEL,W6_HEL_I
|
||||||
|
@ -178,8 +178,11 @@ enum FY326
|
|||||||
enum WK2x01
|
enum WK2x01
|
||||||
{
|
{
|
||||||
WK2801 = 0,
|
WK2801 = 0,
|
||||||
WK2601 = 1,
|
WK2401 = 1,
|
||||||
WK2401 = 2,
|
W6_5_1 = 2,
|
||||||
|
W6_6_1 = 3,
|
||||||
|
W6_HEL = 4,
|
||||||
|
W6_HEL_I= 5,
|
||||||
};
|
};
|
||||||
|
|
||||||
#define NONE 0
|
#define NONE 0
|
||||||
@ -545,8 +548,11 @@ Serial: 100000 Baud 8e2 _ xxxx xxxx p --
|
|||||||
FY319 1
|
FY319 1
|
||||||
sub_protocol==WK2x01
|
sub_protocol==WK2x01
|
||||||
WK2801 0
|
WK2801 0
|
||||||
WK2601 1
|
WK2401 1
|
||||||
WK2401 2
|
W6_5_1 2
|
||||||
|
W6_6_1 3
|
||||||
|
W6_HEL 4
|
||||||
|
W6_HEL_I 5
|
||||||
|
|
||||||
Power value => 0x80 0=High/1=Low
|
Power value => 0x80 0=High/1=Low
|
||||||
Stream[3] = option_protocol;
|
Stream[3] = option_protocol;
|
||||||
|
@ -201,7 +201,7 @@ static void __attribute__((unused)) WK_channels_heli_2601(uint8_t frame, int16_t
|
|||||||
//pitch is controlled by rx
|
//pitch is controlled by rx
|
||||||
//we can only control fmode, pit-reverse and pit/thr rate
|
//we can only control fmode, pit-reverse and pit/thr rate
|
||||||
uint8_t pit_rev = 0;
|
uint8_t pit_rev = 0;
|
||||||
if ((option/10)%10)
|
if (sub_protocol==W6_HEL_I)
|
||||||
pit_rev = 1;
|
pit_rev = 1;
|
||||||
int16_t pit_rate = WK_get_channel(5, 0x400, 0, 0x400);
|
int16_t pit_rate = WK_get_channel(5, 0x400, 0, 0x400);
|
||||||
uint8_t fmode = 1;
|
uint8_t fmode = 1;
|
||||||
@ -214,7 +214,7 @@ static void __attribute__((unused)) WK_channels_heli_2601(uint8_t frame, int16_t
|
|||||||
{
|
{
|
||||||
//Pitch curve and range
|
//Pitch curve and range
|
||||||
*v1 = pit_rate;
|
*v1 = pit_rate;
|
||||||
*v2 = ((option/100) ? -100 : 100) * 0x400 / 100 + 0x400;
|
*v2 = (int16_t)(option) * 0x400 / 100 + 0x400;
|
||||||
}
|
}
|
||||||
packet[7] = (pit_rev << 2); //reverse bits
|
packet[7] = (pit_rev << 2); //reverse bits
|
||||||
packet[8] = fmode ? 0x02 : 0x00;
|
packet[8] = fmode ? 0x02 : 0x00;
|
||||||
@ -239,12 +239,12 @@ static void __attribute__((unused)) WK_build_data_pkt_2601()
|
|||||||
v1 = WK_get_channel(6, 0x200, 0x200, 0x200);
|
v1 = WK_get_channel(6, 0x200, 0x200, 0x200);
|
||||||
v2 = 0;
|
v2 = 0;
|
||||||
}
|
}
|
||||||
if (option%10 == 1)
|
if (sub_protocol == W6_5_1)
|
||||||
WK_channels_heli_2601(frame, &v1, &v2);
|
WK_channels_5plus1_2601(frame, &v1, &v2);
|
||||||
else if (option%10 == 2)
|
else if (sub_protocol == W6_6_1)
|
||||||
WK_channels_6plus1_2601(frame, &v1, &v2);
|
WK_channels_6plus1_2601(frame, &v1, &v2);
|
||||||
else
|
else
|
||||||
WK_channels_5plus1_2601(frame, &v1, &v2);
|
WK_channels_heli_2601(frame, &v1, &v2);
|
||||||
if (v1 > 1023)
|
if (v1 > 1023)
|
||||||
v1 = 1023;
|
v1 = 1023;
|
||||||
if (v2 > 1023)
|
if (v2 > 1023)
|
||||||
@ -404,10 +404,10 @@ uint16_t WK_cb()
|
|||||||
packet_sent = 1;
|
packet_sent = 1;
|
||||||
if(sub_protocol == WK2801)
|
if(sub_protocol == WK2801)
|
||||||
WK_BuildPacket_2801();
|
WK_BuildPacket_2801();
|
||||||
else if(sub_protocol == WK2601)
|
else if(sub_protocol == WK2401)
|
||||||
WK_BuildPacket_2601();
|
|
||||||
else
|
|
||||||
WK_BuildPacket_2401();
|
WK_BuildPacket_2401();
|
||||||
|
else
|
||||||
|
WK_BuildPacket_2601();
|
||||||
packet_count = (packet_count + 1) % 12;
|
packet_count = (packet_count + 1) % 12;
|
||||||
CYRF_WriteDataPacket(packet);
|
CYRF_WriteDataPacket(packet);
|
||||||
return 1600;
|
return 1600;
|
||||||
|
@ -300,9 +300,11 @@ const PPM_Parameters PPM_prot[15]= {
|
|||||||
PPM_SBUS
|
PPM_SBUS
|
||||||
MODE_WK2X01
|
MODE_WK2X01
|
||||||
WK2801
|
WK2801
|
||||||
WK2601
|
|
||||||
WK2401
|
WK2401
|
||||||
|
W6_5_1
|
||||||
|
W6_6_1
|
||||||
|
W6_HEL
|
||||||
|
W6_HEL_I
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// RX_Num is used for model match. Using RX_Num values different for each receiver will prevent starting a model with the false config loaded...
|
// RX_Num is used for model match. Using RX_Num values different for each receiver will prevent starting a model with the false config loaded...
|
||||||
|
Loading…
x
Reference in New Issue
Block a user