mirror of
https://github.com/pascallanger/DIY-Multiprotocol-TX-Module.git
synced 2025-07-01 01:57:52 +00:00
New SFC protocol WL91x
This commit is contained in:
parent
fa055e991c
commit
168aa89c57
@ -233,3 +233,4 @@
|
||||
103,0,H36,Std,1,Flip,HLess,RTH
|
||||
104,0,KAMTOM,Std,0,ST_Tr,TH_Tr,TH_DR
|
||||
105,0,Shenqi2,Std,1
|
||||
106,0,WL91x,Std,0
|
||||
|
@ -101,3 +101,4 @@
|
||||
103,H36
|
||||
104,KAMTOM
|
||||
105,Shenqi2
|
||||
106,WL91x
|
@ -117,6 +117,7 @@ const char STR_YUXIANG[] ="YuXiang";
|
||||
const char STR_UDIRC[] ="UDIRC";
|
||||
const char STR_JIABAILE[] ="JIABAILE";
|
||||
const char STR_KAMTOM[] ="KAMTOM";
|
||||
const char STR_WL91X[] ="WL91x";
|
||||
|
||||
const char STR_SUBTYPE_FLYSKY[] = "\x04""Std\0""V9x9""V6x6""V912""CX20";
|
||||
const char STR_SUBTYPE_HUBSAN[] = "\x04""H107""H301""H501";
|
||||
@ -504,9 +505,6 @@ const mm_protocol_definition multi_protocols[] = {
|
||||
#if defined(V911S_CCNRF_INO)
|
||||
{PROTO_V911S, STR_V911S, STR_SUBTYPE_V911S, 2, OPTION_RFTUNE, 0, 0, SW_NRF, V911S_init, V911S_callback },
|
||||
#endif
|
||||
#if defined(WK2x01_CYRF6936_INO)
|
||||
{PROTO_WK2x01, STR_WK2x01, STR_SUBTYPE_WK2x01, 6, OPTION_NONE, 1, 1, SW_CYRF, WK_init, WK_callback },
|
||||
#endif
|
||||
#if defined(WFLY_CYRF6936_INO)
|
||||
{PROTO_WFLY, STR_WFLY, STR_SUBTYPE_WFLY, 1, OPTION_NONE, 1, 0, SW_CYRF, WFLY_init, WFLY_callback },
|
||||
#endif
|
||||
@ -514,6 +512,13 @@ const mm_protocol_definition multi_protocols[] = {
|
||||
{PROTO_WFLY2, STR_WFLY2, STR_SUBTYPE_WFLY2, 1, OPTION_OPTION, 1, 0, SW_A7105, WFLY2_init, WFLY2_callback },
|
||||
// {PROTO_WFLY2, STR_WFLY2, STR_SUBTYPE_WFLY2, 1, OPTION_WBUS, 1, 0, SW_A7105, WFLY2_init, WFLY2_callback },// crash OpenTX...
|
||||
#endif
|
||||
#if defined(WK2x01_CYRF6936_INO)
|
||||
{PROTO_WK2x01, STR_WK2x01, STR_SUBTYPE_WK2x01, 6, OPTION_NONE, 1, 1, SW_CYRF, WK_init, WK_callback },
|
||||
#endif
|
||||
#if defined(WL91X_CCNRF_INO)
|
||||
{PROTO_WL91X, STR_WL91X, NO_SUBTYPE, 0, OPTION_NONE, 0, 0, SW_NRF, WL91X_init, WL91X_callback },
|
||||
#endif
|
||||
|
||||
#if defined(XERALL_NRF24L01_INO)
|
||||
{PROTO_XERALL, STR_XERALL, NO_SUBTYPE, 0, OPTION_NONE, 0, 0, SW_NRF, XERALL_init, XERALL_callback },
|
||||
#endif
|
||||
|
@ -19,7 +19,7 @@
|
||||
#define VERSION_MAJOR 1
|
||||
#define VERSION_MINOR 3
|
||||
#define VERSION_REVISION 4
|
||||
#define VERSION_PATCH_LEVEL 42
|
||||
#define VERSION_PATCH_LEVEL 43
|
||||
|
||||
#define MODE_SERIAL 0
|
||||
|
||||
@ -133,6 +133,7 @@ enum PROTOCOLS
|
||||
PROTO_H36 = 103, // =>NRF24L01
|
||||
PROTO_KAMTOM = 104, // =>NRF24L01
|
||||
PROTO_SHENQI2 = 105, // =>NRF24L01
|
||||
PROTO_WL91X = 106, // =>CC2500 & NRF24L01
|
||||
|
||||
PROTO_NANORF = 126, // =>NRF24L01
|
||||
PROTO_TEST = 127, // =>CC2500
|
||||
|
@ -359,6 +359,7 @@
|
||||
#undef SLT_CCNRF_INO
|
||||
#undef UDIRC_CCNRF_INO
|
||||
#undef V911S_CCNRF_INO
|
||||
#undef WL91X_CCNRF_INO
|
||||
#undef XK_CCNRF_INO
|
||||
#undef XK2_CCNRF_INO
|
||||
#endif
|
||||
@ -397,6 +398,7 @@
|
||||
#undef JIABAILE_NRF24L01_INO
|
||||
#undef UDIRC_CCNRF_INO
|
||||
#undef KAMTOM_NRF24L01_INO
|
||||
#undef WL91X_CCNRF_INO
|
||||
#endif
|
||||
|
||||
#ifdef MULTI_SURFACE
|
||||
|
96
Multiprotocol/WL91X_ccnrf.ino
Normal file
96
Multiprotocol/WL91X_ccnrf.ino
Normal file
@ -0,0 +1,96 @@
|
||||
/*
|
||||
This project is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
Multiprotocol is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Multiprotocol. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#if defined(WL91X_CCNRF_INO)
|
||||
|
||||
#include "iface_xn297.h"
|
||||
|
||||
//#define FORCE_WL91X_ORIGINAL_ID
|
||||
|
||||
#define WL91X_PAYLOAD_SIZE 9
|
||||
#define WL91X_RF_NUM_CHANNELS 3
|
||||
#define WL91X_PACKET_PERIOD 2594
|
||||
|
||||
static void __attribute__((unused)) WL91X_send_packet()
|
||||
{
|
||||
uint8_t val;
|
||||
|
||||
//RF freq
|
||||
XN297_Hopping(hopping_frequency_no++);
|
||||
hopping_frequency_no %= WL91X_RF_NUM_CHANNELS;
|
||||
|
||||
//Sticks
|
||||
val = convert_channel_16b_limit(CH2,0x21,0xE0); //THR forward 00..5F, backward 80..DF
|
||||
if(val < 128) val = 127 - val;
|
||||
packet[0] = val - 0x80;
|
||||
val = convert_channel_s8b(CH1); //ST right 00..7F, left 80..FF
|
||||
packet[1] = val - 0x80;
|
||||
//Trims
|
||||
val = convert_channel_s8b(CH3); //ST_Trim centered=80, increment/decrement=4, right 04..7C, left 84..FC
|
||||
packet[2] = val - 0x80;
|
||||
packet[3] = convert_channel_16b_limit(CH4,0x00,0x70); //TH_Trim increment/decrement=3, 00..39..6F
|
||||
//TX_ID
|
||||
memcpy(&packet[4], rx_tx_addr, 4);
|
||||
//Checksum
|
||||
val = 0;
|
||||
for(uint8_t i=0; i<WL91X_PAYLOAD_SIZE-1; i++)
|
||||
val += packet[i];
|
||||
packet[8] = val;
|
||||
|
||||
//Send
|
||||
XN297_SetPower();
|
||||
XN297_SetFreqOffset();
|
||||
XN297_SetTxRxMode(TX_EN);
|
||||
XN297_WritePayload(packet, WL91X_PAYLOAD_SIZE);
|
||||
#ifdef DEBUG_SERIAL
|
||||
for(uint8_t i=0; i < WL91X_PAYLOAD_SIZE; i++)
|
||||
debug("%02X ", packet[i]);
|
||||
debugln();
|
||||
#endif
|
||||
}
|
||||
|
||||
static void __attribute__((unused)) WL91X_RF_init()
|
||||
{
|
||||
XN297_Configure(XN297_CRCEN, XN297_UNSCRAMBLED, XN297_250K);
|
||||
XN297_HoppingCalib(WL91X_RF_NUM_CHANNELS);
|
||||
XN297_SetTXAddr((uint8_t*)"\x46\x14\x7B\x08", 4);
|
||||
}
|
||||
|
||||
static void __attribute__((unused)) WL91X_initialize_txid()
|
||||
{
|
||||
#ifdef FORCE_WL91X_ORIGINAL_ID
|
||||
memcpy(rx_tx_addr, (uint8_t*)"\x00\x1E\x33\x02",4);
|
||||
#endif
|
||||
memcpy(hopping_frequency, (uint8_t*)"\x1A\x3B\x3B",3); //26,59,59
|
||||
}
|
||||
|
||||
uint16_t WL91X_callback()
|
||||
{
|
||||
#ifdef MULTI_SYNC
|
||||
telemetry_set_input_sync(WL91X_PACKET_PERIOD);
|
||||
#endif
|
||||
WL91X_send_packet();
|
||||
return WL91X_PACKET_PERIOD;
|
||||
}
|
||||
|
||||
void WL91X_init()
|
||||
{
|
||||
BIND_DONE; //No bind for this protocol
|
||||
WL91X_initialize_txid();
|
||||
WL91X_RF_init();
|
||||
hopping_frequency_no = 0;
|
||||
}
|
||||
|
||||
#endif
|
@ -277,6 +277,7 @@
|
||||
#define SLT_CCNRF_INO
|
||||
#define UDIRC_CCNRF_INO
|
||||
#define V911S_CCNRF_INO
|
||||
#define WL91X_CCNRF_INO
|
||||
#define XK_CCNRF_INO
|
||||
#define XK2_CCNRF_INO
|
||||
|
||||
|
@ -1486,6 +1486,14 @@ A|E|T|R|CALIB|RATE|6G_3D|6GSENIOR|LIGHT
|
||||
|
||||
A280 -> 6GSENIOR: -100% - 6G, +100% - Senior mode (turn off gyro), LIGHT: cycle the light through on-flash-off when the CH9 value is changed from -100% to 100%
|
||||
|
||||
## WL91X - *106*
|
||||
|
||||
Models: WLtoys WL911, WL913, WL915 and may be others...
|
||||
|
||||
CH1|CH2|CH3|CH4
|
||||
---|---|---|---
|
||||
ST|TH|ST_TR|TH_TR
|
||||
|
||||
## XK - *62*
|
||||
|
||||
CC2500: only X450 is supported.
|
||||
|
Loading…
x
Reference in New Issue
Block a user