diff --git a/Lua_scripts/MultiChan.txt b/Lua_scripts/MultiChan.txt
index e09ff6f..eddf86b 100644
--- a/Lua_scripts/MultiChan.txt
+++ b/Lua_scripts/MultiChan.txt
@@ -221,3 +221,4 @@
97,1,SGF22,F22S,1,Mode,Flip,LED,Pict,Video,TrRes
61,0,EazyRC
98,0,Kyosho3,ASF,0
+100,0,YuXiang,Std,0,Lock,Rate,Land,AltHol,Manual,Flip,Mode,Pitch
diff --git a/Multiprotocol/Multi.txt b/Multiprotocol/Multi.txt
index 4db1a40..d818124 100644
--- a/Multiprotocol/Multi.txt
+++ b/Multiprotocol/Multi.txt
@@ -96,3 +96,4 @@
97,SGF22,F22,F22S,J20
98,Kyosho3
99,XK2
+100,YuXiang
diff --git a/Multiprotocol/Multi_Protos.ino b/Multiprotocol/Multi_Protos.ino
index a8cc6a2..de023ba 100644
--- a/Multiprotocol/Multi_Protos.ino
+++ b/Multiprotocol/Multi_Protos.ino
@@ -111,6 +111,7 @@ const char STR_BUMBLEB[] ="BumbleB";
const char STR_SGF22[] ="SGF22";
const char STR_EAZYRC[] ="EazyRC";
const char STR_KYOSHO3[] ="Kyosho3";
+const char STR_YUXIANG[] ="YuXiang";
const char STR_SUBTYPE_FLYSKY[] = "\x04""Std\0""V9x9""V6x6""V912""CX20";
const char STR_SUBTYPE_HUBSAN[] = "\x04""H107""H301""H501";
@@ -156,7 +157,7 @@ const char STR_SUBTYPE_REDPINE[] = "\x04""Fast""Slow";
const char STR_SUBTYPE_POTENSIC[] = "\x03""A20";
const char STR_SUBTYPE_ZSX[] = "\x07""280JJRC";
const char STR_SUBTYPE_HEIGHT[] = "\x03""5ch""8ch";
-const char STR_SUBTYPE_XN297DUMP[] = "\x07""250Kbps""1Mbps\0 ""2Mbps\0 ""Auto\0 ""NRF\0 ""CC2500\0";
+const char STR_SUBTYPE_XN297DUMP[] = "\x07""250Kbps""1Mbps\0 ""2Mbps\0 ""Auto\0 ""NRF\0 ""CC2500\0""XN297\0 ";
const char STR_SUBTYPE_ESKY150[] = "\x03""4ch""7ch";
const char STR_SUBTYPE_ESKY150V2[] = "\x05""150V2";
const char STR_SUBTYPE_V911S[] = "\x05""V911S""E119\0";
@@ -501,11 +502,14 @@ const mm_protocol_definition multi_protocols[] = {
{PROTO_XK2, STR_XK2, NO_SUBTYPE, 0, OPTION_RFTUNE, 0, 0, SW_NRF, XK2_init, XK2_callback },
#endif
#if defined(XN297DUMP_NRF24L01_INO)
- {PROTO_XN297DUMP, STR_XN297DUMP, STR_SUBTYPE_XN297DUMP, 6, OPTION_RFCHAN, 0, 0, SW_NRF, XN297Dump_init, XN297Dump_callback },
+ {PROTO_XN297DUMP, STR_XN297DUMP, STR_SUBTYPE_XN297DUMP, 7, OPTION_RFCHAN, 0, 0, SW_NRF, XN297Dump_init, XN297Dump_callback },
#endif
#if defined(YD717_NRF24L01_INO)
{PROTO_YD717, STR_YD717, STR_SUBTYPE_YD717, 5, OPTION_NONE, 0, 0, SW_NRF, YD717_init, YD717_callback },
#endif
+ #if defined(YUXIANG_NRF24L01_INO)
+ {PROTO_YUXIANG, STR_YUXIANG, NO_SUBTYPE, 0, OPTION_NONE, 0, 0, SW_NRF, YUXIANG_init, YUXIANG_callback },
+ #endif
#if defined(ZSX_NRF24L01_INO)
{PROTO_ZSX, STR_ZSX, STR_SUBTYPE_ZSX, 1, OPTION_NONE, 0, 0, SW_NRF, ZSX_init, ZSX_callback },
#endif
diff --git a/Multiprotocol/Multiprotocol.h b/Multiprotocol/Multiprotocol.h
index 03d72a4..4f08733 100644
--- a/Multiprotocol/Multiprotocol.h
+++ b/Multiprotocol/Multiprotocol.h
@@ -19,7 +19,7 @@
#define VERSION_MAJOR 1
#define VERSION_MINOR 3
#define VERSION_REVISION 4
-#define VERSION_PATCH_LEVEL 13
+#define VERSION_PATCH_LEVEL 14
#define MODE_SERIAL 0
@@ -127,6 +127,7 @@ enum PROTOCOLS
PROTO_SGF22 = 97, // =>NRF24L01
PROTO_KYOSHO3 = 98, // =>CYRF6936
PROTO_XK2 = 99, // =>CC2500 & NRF24L01
+ PROTO_YUXIANG = 100, // =>NRF24L01
PROTO_NANORF = 126, // =>NRF24L01
PROTO_TEST = 127, // =>CC2500
@@ -390,6 +391,7 @@ enum XN297DUMP
XN297DUMP_AUTO = 3,
XN297DUMP_NRF = 4,
XN297DUMP_CC2500 = 5,
+ XN297DUMP_XN297 = 6,
};
enum FRSKY_R9
{
diff --git a/Multiprotocol/Validate.h b/Multiprotocol/Validate.h
index e4ace60..9cb2fa4 100644
--- a/Multiprotocol/Validate.h
+++ b/Multiprotocol/Validate.h
@@ -339,6 +339,7 @@
#undef V761_NRF24L01_INO
#undef XERALL_NRF24L01_INO
#undef YD717_NRF24L01_INO
+ #undef YUXIANG_NRF24L01_INO
#undef ZSX_NRF24L01_INO
#endif
#if ( not defined(CC2500_INSTALLED) && not defined(NRF24L01_INSTALLED) ) || defined MULTI_EU
@@ -442,6 +443,7 @@
#undef Q90C_CCNRF_INO
#undef V911S_CCNRF_INO
#undef SGF22_NRF24L01_INO
+ #undef YUXIANG_NRF24L01_INO
#endif
//OpenTX 2.3.x issue
@@ -480,6 +482,7 @@
#undef PROPEL_HUB_TELEMETRY
#undef OMP_HUB_TELEMETRY
#undef V761_HUB_TELEMETRY
+ #undef YUXIANG_HUB_TELEMETRY
#undef RLINK_HUB_TELEMETRY
#undef DSM_RX_CYRF6936_INO
#undef DSM_FWD_PGM
@@ -518,6 +521,9 @@
#if not defined(V761_NRF24L01_INO)
#undef V761_HUB_TELEMETRY
#endif
+ #if not defined(YUXIANG_NRF24L01_INO)
+ #undef YUXIANG_HUB_TELEMETRY
+ #endif
#if not defined(PROPEL_NRF24L01_INO)
#undef PROPEL_HUB_TELEMETRY
#endif
@@ -575,7 +581,7 @@
//protocols using FRSKYD user frames
#undef HUB_TELEMETRY
#endif
- #if not defined(HOTT_FW_TELEMETRY) && not defined(DSM_TELEMETRY) && not defined(SPORT_TELEMETRY) && not defined(HUB_TELEMETRY) && not defined(HUBSAN_HUB_TELEMETRY) && not defined(BUGS_HUB_TELEMETRY) && not defined(NCC1701_HUB_TELEMETRY) && not defined(BAYANG_HUB_TELEMETRY) && not defined(CABELL_HUB_TELEMETRY) && not defined(RLINK_HUB_TELEMETRY) && not defined(AFHDS2A_HUB_TELEMETRY) && not defined(AFHDS2A_FW_TELEMETRY) && not defined(MULTI_TELEMETRY) && not defined(MULTI_STATUS) && not defined(HITEC_HUB_TELEMETRY) && not defined(HITEC_FW_TELEMETRY) && not defined(SCANNER_TELEMETRY) && not defined(FRSKY_RX_TELEMETRY) && not defined(AFHDS2A_RX_TELEMETRY) && not defined(BAYANG_RX_TELEMETRY) && not defined(DEVO_HUB_TELEMETRY) && not defined(PROPEL_HUB_TELEMETRY) && not defined(OMP_HUB_TELEMETRY) && not defined(V761_HUB_TELEMETRY) && not defined(WFLY2_HUB_TELEMETRY) && not defined(LOLI_HUB_TELEMETRY) && not defined(MLINK_HUB_TELEMETRY) && not defined(MLINK_FW_TELEMETRY) && not defined(MT99XX_HUB_TELEMETRY) && not defined(MULTI_CONFIG_INO)
+ #if not defined(HOTT_FW_TELEMETRY) && not defined(DSM_TELEMETRY) && not defined(SPORT_TELEMETRY) && not defined(HUB_TELEMETRY) && not defined(HUBSAN_HUB_TELEMETRY) && not defined(BUGS_HUB_TELEMETRY) && not defined(NCC1701_HUB_TELEMETRY) && not defined(BAYANG_HUB_TELEMETRY) && not defined(CABELL_HUB_TELEMETRY) && not defined(RLINK_HUB_TELEMETRY) && not defined(AFHDS2A_HUB_TELEMETRY) && not defined(AFHDS2A_FW_TELEMETRY) && not defined(MULTI_TELEMETRY) && not defined(MULTI_STATUS) && not defined(HITEC_HUB_TELEMETRY) && not defined(HITEC_FW_TELEMETRY) && not defined(SCANNER_TELEMETRY) && not defined(FRSKY_RX_TELEMETRY) && not defined(AFHDS2A_RX_TELEMETRY) && not defined(BAYANG_RX_TELEMETRY) && not defined(DEVO_HUB_TELEMETRY) && not defined(PROPEL_HUB_TELEMETRY) && not defined(OMP_HUB_TELEMETRY) && not defined(V761_HUB_TELEMETRY) && not defined(YUXIANG_HUB_TELEMETRY) && not defined(WFLY2_HUB_TELEMETRY) && not defined(LOLI_HUB_TELEMETRY) && not defined(MLINK_HUB_TELEMETRY) && not defined(MLINK_FW_TELEMETRY) && not defined(MT99XX_HUB_TELEMETRY) && not defined(MULTI_CONFIG_INO)
#undef TELEMETRY
#undef INVERT_TELEMETRY
#undef MULTI_TELEMETRY
diff --git a/Multiprotocol/Yuxiang_nrf24l01.ino b/Multiprotocol/Yuxiang_nrf24l01.ino
new file mode 100644
index 0000000..555ce13
--- /dev/null
+++ b/Multiprotocol/Yuxiang_nrf24l01.ino
@@ -0,0 +1,226 @@
+/*
+ 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 .
+
+ Thanks to Goebish ,Ported from his deviation firmware
+ */
+
+#if defined(YUXIANG_NRF24L01_INO)
+
+#include "iface_xn297.h"
+
+#define YUXIANG_FORCE_ID
+
+#define YUXIANG_PACKET_PERIOD 12430
+#define YUXIANG_PACKET_SIZE 9
+#define YUXIANG_BIND_COUNT 20000
+#define YUXIANG_BIND_FREQ 0x30
+#define YUXIANG_RF_NUM_CHANNELS 4
+
+#define YUXIANG_WRITE_TIME 1000
+#define YUXIANG_TELEM_DEBUG
+
+enum
+{
+ YUXIANG_DATA = 0,
+ YUXIANG_RX
+};
+
+static void __attribute__((unused)) YUXIANG_send_packet()
+{
+ static bool bind_state = false;
+
+ if(bind_counter && (hopping_frequency_no & 0x0E) == 0)
+ {
+ bind_counter--;
+ if(!bind_counter)
+ BIND_DONE;
+ XN297_Hopping(YUXIANG_BIND_FREQ);
+ XN297_SetTXAddr((uint8_t*)"\x00\x00\x00\x00\x00", 5);
+ XN297_SetRXAddr((uint8_t*)"\x00\x00\x00\x00\x00", YUXIANG_PACKET_SIZE);
+ bind_state = true;
+ }
+ else
+ {
+ XN297_Hopping(hopping_frequency_no & 0x03);
+ if(bind_state)
+ {
+ XN297_SetTXAddr(rx_tx_addr, 5);
+ XN297_SetRXAddr(rx_tx_addr, YUXIANG_PACKET_SIZE);
+ bind_state = false;
+ }
+ }
+ hopping_frequency_no++;
+
+ packet[0] = GET_FLAG(!bind_state, 0x80) // Bind packet
+ | GET_FLAG(telemetry_lost, 0x20) // No telem
+ | GET_FLAG(!CH5_SW, 0x10) // Lock
+ | GET_FLAG(CH6_SW, 0x08) // High
+ | GET_FLAG(CH12_SW, 0x01); // Screw pitch -> temporary
+
+ packet[1] = GET_FLAG(CH7_SW, 0x08) // Land only when unlock
+ | GET_FLAG(CH11_SW, 0x20); // Mode
+
+ packet[2] = GET_FLAG(CH8_SW, 0x02) // Altitude hold
+ | GET_FLAG(CH9_SW, 0x03) // Manual
+ | GET_FLAG(CH10_SW, 0x40); // Flip
+
+ uint16_t value = convert_channel_16b_limit(AILERON,0,1000);
+ packet[3] = value;
+ packet[7] = value >> 8;
+ value = convert_channel_16b_limit(ELEVATOR,0,1000);
+ packet[4] = value;
+ packet[7] |= (value >> 6) & 0x0C;
+ value = convert_channel_16b_limit(THROTTLE,0,1000);
+ packet[5] = value;
+ packet[7] |= (value >> 4) & 0x30;
+ value = convert_channel_16b_limit(RUDDER,0,1000);
+ packet[6] = value;
+ packet[7] |= (value >> 2) & 0xC0;
+
+ if(bind_state && (hopping_frequency_no&1))
+ memcpy(&packet[3], rx_tx_addr, 4);
+ else
+ packet[0] |= 0x80;
+
+ uint8_t checksum = 0;
+ for(uint8_t i=0; i 240) // Around 3sec with no telemetry
+ telemetry_lost = 1;
+ else
+ packet_count++;
+ #endif
+ #ifdef MULTI_SYNC
+ telemetry_set_input_sync(packet_period);
+ #endif
+ YUXIANG_send_packet();
+ if(rx)
+ { // Check if a packet has been received
+ #ifdef YUXIANG_TELEM_DEBUG
+ debug("RX ");
+ #endif
+ if(XN297_ReadPayload(packet_in, YUXIANG_PACKET_SIZE))
+ { // packet with good CRC and length
+ #ifdef YUXIANG_TELEM_DEBUG
+ debug("OK:");
+ for(uint8_t i=0;i