Skip to content

Commit 66f8906

Browse files
committed
WPL new protocol
Only 1 ID
1 parent dcbc557 commit 66f8906

File tree

6 files changed

+170
-4
lines changed

6 files changed

+170
-4
lines changed

Multiprotocol/Multi_Protos.ino

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@ const char STR_UDIRC[] ="UDIRC";
118118
const char STR_JIABAILE[] ="JIABAILE";
119119
const char STR_KAMTOM[] ="KAMTOM";
120120
const char STR_WL91X[] ="WL91x";
121+
const char STR_WPL[] ="WPL";
121122

122123
const char STR_SUBTYPE_FLYSKY[] = "\x04""Std\0""V9x9""V6x6""V912""CX20";
123124
const char STR_SUBTYPE_HUBSAN[] = "\x04""H107""H301""H501";
@@ -518,7 +519,9 @@ const mm_protocol_definition multi_protocols[] = {
518519
#if defined(WL91X_CCNRF_INO)
519520
{PROTO_WL91X, STR_WL91X, NO_SUBTYPE, 0, OPTION_NONE, 0, 0, SW_NRF, WL91X_init, WL91X_callback },
520521
#endif
521-
522+
#if defined(WPL_NRF24L01_INO)
523+
{PROTO_WPL, STR_WPL, NO_SUBTYPE, 0, OPTION_NONE, 0, 0, SW_NRF, WPL_init, WPL_callback },
524+
#endif
522525
#if defined(XERALL_NRF24L01_INO)
523526
{PROTO_XERALL, STR_XERALL, NO_SUBTYPE, 0, OPTION_NONE, 0, 0, SW_NRF, XERALL_init, XERALL_callback },
524527
#endif

Multiprotocol/Multiprotocol.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
#define VERSION_MAJOR 1
2020
#define VERSION_MINOR 3
2121
#define VERSION_REVISION 4
22-
#define VERSION_PATCH_LEVEL 50
22+
#define VERSION_PATCH_LEVEL 51
2323

2424
#define MODE_SERIAL 0
2525

@@ -134,6 +134,7 @@ enum PROTOCOLS
134134
PROTO_KAMTOM = 104, // =>NRF24L01
135135
PROTO_SHENQI2 = 105, // =>NRF24L01
136136
PROTO_WL91X = 106, // =>CC2500 & NRF24L01
137+
PROTO_WPL = 107, // =>NRF24L01
137138

138139
PROTO_NANORF = 126, // =>NRF24L01
139140
PROTO_TEST = 127, // =>CC2500

Multiprotocol/Validate.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -341,6 +341,7 @@
341341
#undef SYMAX_NRF24L01_INO
342342
#undef V2X2_NRF24L01_INO
343343
#undef V761_NRF24L01_INO
344+
#undef WPL_NRF24L01_INO
344345
#undef XERALL_NRF24L01_INO
345346
#undef YD717_NRF24L01_INO
346347
#undef YUXIANG_NRF24L01_INO
@@ -399,6 +400,7 @@
399400
#undef UDIRC_CCNRF_INO
400401
#undef KAMTOM_NRF24L01_INO
401402
#undef WL91X_CCNRF_INO
403+
#undef WPL_NRF24L01_INO
402404
//Save flash space...
403405
#undef CABELL_NRF24L01_INO
404406
#undef REDPINE_CC2500_INO

Multiprotocol/WPL_nrf24l01.ino

Lines changed: 143 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,143 @@
1+
/*
2+
This project is free software: you can redistribute it and/or modify
3+
it under the terms of the GNU General Public License as published by
4+
the Free Software Foundation, either version 3 of the License, or
5+
(at your option) any later version.
6+
7+
Multiprotocol is distributed in the hope that it will be useful,
8+
but WITHOUT ANY WARRANTY; without even the implied warranty of
9+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10+
GNU General Public License for more details.
11+
12+
You should have received a copy of the GNU General Public License
13+
along with Multiprotocol. If not, see <http://www.gnu.org/licenses/>.
14+
*/
15+
// Compatible with WPL "Basic" TX models D12, D12KM, D22, D32, D42, D14
16+
17+
#if defined(WPL_NRF24L01_INO)
18+
19+
#include "iface_xn297.h"
20+
21+
#define FORCE_WPL_ORIGINAL_ID
22+
23+
#define WPL_PACKET_PERIOD 9875
24+
#define WPL_RF_NUM_CHANNELS 4
25+
#define WPL_PAYLOAD_SIZE 16
26+
#define WPL_BIND_COUNT 303 //3sec
27+
28+
static void __attribute__((unused)) WPL_send_packet()
29+
{
30+
XN297_Hopping(hopping_frequency_no + (IS_BIND_IN_PROGRESS?0:4) );
31+
hopping_frequency_no++;
32+
hopping_frequency_no &= WPL_RF_NUM_CHANNELS-1; // 4 RF channels
33+
34+
memset(&packet[8],0,7);
35+
packet[0] = 0x94; //??
36+
packet[1] = 0x16; //??
37+
packet[2] = 0xCC; //??
38+
39+
if(IS_BIND_IN_PROGRESS)
40+
{
41+
memcpy(&packet[3],rx_tx_addr,5);
42+
packet[9] = 0x08; // ?? Not bound + Headlights on
43+
}
44+
else
45+
{
46+
packet[3 ] = convert_channel_s8b(CH1); // Throttle
47+
packet[4 ] = convert_channel_s8b(CH2); // Steering
48+
packet[5 ] = convert_channel_16b_limit(CH3,0x22,0x5E); // Steering trim
49+
packet[6 ] = rx_tx_addr[3]; // 0x32??
50+
packet[7 ] = convert_channel_s8b(CH4); // Aux
51+
packet[9 ] = 0x80 // ?? Bound
52+
| GET_FLAG(CH5_SW, 0x08) // Headlights 100%=on
53+
| GET_FLAG(CH6_SW, 0x04) // Throttle rate 100%=high
54+
| GET_FLAG(CH7_SW, 0x02); // Steering rate 100%=high
55+
}
56+
57+
// Send
58+
XN297_SetPower();
59+
XN297_SetTxRxMode(TX_EN);
60+
XN297_WritePayload(packet, WPL_PAYLOAD_SIZE);
61+
}
62+
63+
static void __attribute__((unused)) WPL_RF_init()
64+
{
65+
XN297_Configure(XN297_CRCEN, XN297_SCRAMBLED, XN297_1M);
66+
XN297_SetTXAddr((uint8_t*)"\x69\xA5\x37\x4D\x8B", 5);
67+
XN297_HoppingCalib(WPL_RF_NUM_CHANNELS*2); // Calibrate bind and normal channels
68+
}
69+
70+
static void __attribute__((unused)) WPL_initialize_txid()
71+
{
72+
//Bind frequencies
73+
memcpy(hopping_frequency ,"\x17\x25\x46\x36", WPL_RF_NUM_CHANNELS); //23=17, 37=25, 70=46, 54=36
74+
//Normal frequencies
75+
memcpy(hopping_frequency+4,"\x0C\x2A\x3D\x1D", WPL_RF_NUM_CHANNELS); //12=0C, 42=2A, 61=3D, 29=1D
76+
#ifdef FORCE_WPL_ORIGINAL_ID
77+
memcpy(rx_tx_addr,"\x96\x2A\xA9\x32\xB4",5);
78+
#endif
79+
}
80+
81+
uint16_t WPL_callback()
82+
{
83+
#ifdef MULTI_SYNC
84+
telemetry_set_input_sync(WPL_PACKET_PERIOD);
85+
#endif
86+
if(bind_counter)
87+
if(--bind_counter==0)
88+
BIND_DONE;
89+
WPL_send_packet();
90+
return WPL_PACKET_PERIOD;
91+
}
92+
93+
void WPL_init()
94+
{
95+
BIND_IN_PROGRESS; // autobind protocol
96+
WPL_initialize_txid();
97+
WPL_RF_init();
98+
hopping_frequency_no = 0;
99+
bind_counter=WPL_BIND_COUNT;
100+
}
101+
102+
#endif
103+
/* https://github.com/pascallanger/DIY-Multiprotocol-TX-Module/issues/1120
104+
Bind packet
105+
-----------
106+
XN297 1Mb Scrambled
107+
Bind address: 69 A5 37 4D 8B
108+
RF channels: 23, 37, 70, 54
109+
Timing: 9875µs
110+
Payload 16 bytes: 94 16 CC 96 2A A9 32 B4 00 08 00 00 00 00 00 33
111+
112+
P[0] = 94 ??
113+
P[1] = 16 ??
114+
P[2] = CC ??
115+
P[3..7] = Normal address
116+
P[8] = 00 ??
117+
P[9] = 08 ?? not bound?, Throttle and Steering rate low, Headlights on
118+
P[10..14] = 00 ??
119+
P[15] = sum(P[0..14])+66 why 66...
120+
121+
Normal packet
122+
-----------
123+
XN297 1Mb Scrambled
124+
Normal address: 96 2A A9 32 B4
125+
RF channels: 12=0C, 42=2A, 61=3D, 29=1D -> no idea where they come from...
126+
Timing: 9875µs
127+
Payload 16 bytes: 94 16 CC 80 80 38 32 80 00 88 00 00 00 00 00 4E
128+
P[0] = 94 ??
129+
P[1] = 16 ??
130+
P[2] = CC ??
131+
P[3] = Throttle, not enough data on dumps... Same coding as Steering?
132+
P[4] = Steering, not enough data on dumps, looks like one side goes from 7F to 00 and the other 80 to FF which would be s8b
133+
P[5] = Steering trim 22..5E, mid gives 40 not 38... Was the trim centered on the other dumps with value 38?
134+
P[6] = 32 ?? Left over from the bind packet TX_ADDR[3]?
135+
P[7] = 80 ?? Additional channel? It moves at the same time as the trim but my guess is that it is an unconnected channel.
136+
P[8] = 00 ??
137+
P[9] = 80 ?? bound?, Throttle and Steering rate low, Headlights off
138+
|02 -> Steering rate high
139+
|04 -> Throttle rate high
140+
|08 -> Headlights on
141+
P[10..14] = 00 ??
142+
P[15] = sum(P[0..14])+66 why 66...
143+
*/

Multiprotocol/_Config.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -261,6 +261,7 @@
261261
#define SYMAX_NRF24L01_INO
262262
#define V2X2_NRF24L01_INO
263263
#define V761_NRF24L01_INO
264+
#define WPL_NRF24L01_INO
264265
#define XERALL_NRF24L01_INO
265266
#define YD717_NRF24L01_INO
266267
#define YUXIANG_NRF24L01_INO
@@ -876,6 +877,8 @@ const PPM_Parameters PPM_prot[14*NBR_BANKS]= {
876877
W6_6_1
877878
W6_HEL
878879
W6_HEL_I
880+
PROTO_WPL
881+
NONE
879882
PROTO_XERALL
880883
NONE
881884
PROTO_XK

Protocols_Details.md

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -155,9 +155,10 @@ CFlie|AIR|38|CFlie||||||||NRF24L01|
155155
[WFLY](Protocols_Details.md#WFLY---40)||40|WFR0x||||||||CYRF6936|
156156
[WFLY2](Protocols_Details.md#WFLY2---79)||79|RF20x||||||||A7105|
157157
[WK2x01](Protocols_Details.md#WK2X01---30)||30|WK2801|WK2401|W6_5_1|W6_6_1|W6_HEL|W6_HEL_I|||CYRF6936|
158-
[WL91X](Protocols_Details.md#WL91X---106)||106|||||||||NRF24L011&CC2500|XN297
158+
[WL91X](Protocols_Details.md#WL91X---106)||106|||||||||NRF24L01&CC2500|XN297
159+
[WPL](Protocols_Details.md#WPL---107)||107|||||||||NRF24L01|XN297
159160
[XERALL](Protocols_Details.md#XERALL---91)||91|Tank||||||||NRF24L01|XN297
160-
[XK](Protocols_Details.md#XK---62)||62|X450|X420|Cars||||||NRF24L011&CC2500|XN297
161+
[XK](Protocols_Details.md#XK---62)||62|X450|X420|Cars||||||NRF24L01&CC2500|XN297
161162
[XK2](Protocols_Details.md#XK2---99)||99|X4|P10|||||||NRF24L01&CC2500|XN297
162163
[YD717](Protocols_Details.md#YD717---8)||8|YD717|SKYWLKR|SYMAX4|XINXUN|NIHUI||||NRF24L01|
163164
[YuXiang](Protocols_Details.md#YuXiang---100)||100|||||||||NRF24L01|XN297
@@ -2363,6 +2364,19 @@ CH1|CH2|CH3|CH4|CH5|CH6|CH7|CH8|CH9
23632364
---|---|---|---|---|---|---|---|---
23642365
A|E|T|R|GYRO|CALIB|FLIP|RTN_ACT|RTN
23652366

2367+
## WPL - *107*
2368+
TX: "Basic", Models: D12 / D12KM / D22 / D32 / D42 / D14
2369+
2370+
**Only 1 ID** available. If you have a TX contact me on GitHub or RCGroups.
2371+
2372+
Autobind protocol
2373+
2374+
CH1|CH2|CH3|CH4|CH5|CH6|CH7
2375+
---|---|---|---|---|---|---
2376+
TH|ST|ST_Trim|Aux|Light|TH_Rate|ST_Rate
2377+
2378+
Light: -100%=Off, +100%=On, Rate: -100%=Low, +100%=High
2379+
23662380
## XERALL - *91*
23672381
Model: Xerall TankCopter
23682382

0 commit comments

Comments
 (0)