mirror of
https://github.com/pascallanger/DIY-Multiprotocol-TX-Module.git
synced 2025-02-04 16:48:10 +00:00
Compare commits
11 Commits
f6a5f4cf7d
...
83f56cc68a
Author | SHA1 | Date | |
---|---|---|---|
|
83f56cc68a | ||
|
75445ee4a7 | ||
|
e724d6970e | ||
|
190ebaefd4 | ||
|
3fdf417ac9 | ||
|
e05bc7c447 | ||
|
715f2e7389 | ||
|
7f5d1ecd8d | ||
|
0d4afa68b8 | ||
|
66886c472a | ||
|
b7e89e3bd4 |
@ -176,8 +176,8 @@
|
||||
43,0,Traxxas,TQ,0
|
||||
5,0,V2x2,Std,1,Flip,Light,Pict,Video,HLess,CalX,CalY
|
||||
5,1,V2x2,JXD506,1,Flip,Light,Pict,Video,HLess,StaSto,Emerg,Cam_UD
|
||||
48,0,V761,3CH,0,Gyro,Calib,Flip,RtnAct,Rtn
|
||||
48,1,V761,4CH,0,Gyro,Calib,Flip,RtnAct,Rtn
|
||||
48,0,V761,3CH,0,Gyro,Calib,Flip,RtnAct,Rtn,Beep
|
||||
48,1,V761,4CH,0,Gyro,Calib,Flip,RtnAct,Rtn,Beep
|
||||
48,2,V761,TOPRC,0,Gyro,Calib,Flip,RtnAct,Rtn
|
||||
46,0,V911s,V911s,1,Calib,Rate
|
||||
46,1,V911s,E119,1,Calib,Rate,6G_3D
|
||||
@ -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
|
||||
|
@ -12,7 +12,7 @@
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Multiprotocol. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
// compatible with MT99xx, Eachine H7, Yi Zhan i6S and LS114/124
|
||||
// compatible with MT99xx, Eachine H7, Yi Zhan i6S, LS114/124, QF009 Su35
|
||||
// Last sync with Goebish mt99xx_nrf24l01.c dated 2016-01-29
|
||||
|
||||
#if defined(MT99XX_CCNRF_INO)
|
||||
@ -96,6 +96,16 @@ enum{
|
||||
FLAG_PA18_FLIP = 0x80,
|
||||
};
|
||||
|
||||
enum{
|
||||
// flags going to packet[6] (QF009 Su35)
|
||||
FLAG_SU35_6G = 0x00,
|
||||
FLAG_SU35_3D = 0x40,
|
||||
FLAG_SU35_HIRATE = 0x01,
|
||||
FLAG_SU35_LED = 0x02,
|
||||
FLAG_SU35_FLASH = 0x04,
|
||||
FLAG_SU35_INVERT = 0x08,
|
||||
};
|
||||
|
||||
const uint8_t h7_mys_byte[] = {
|
||||
0x01, 0x11, 0x02, 0x12, 0x03, 0x13, 0x04, 0x14,
|
||||
0x05, 0x15, 0x06, 0x16, 0x07, 0x17, 0x00, 0x10
|
||||
@ -271,6 +281,14 @@ static void __attribute__((unused)) MT99XX_send_packet()
|
||||
if(hopping_frequency_no == 0)
|
||||
packet[7] ^= 0x40;
|
||||
break;
|
||||
case SU35+8:
|
||||
packet[6] = FLAG_SU35_6G
|
||||
| GET_FLAG( CH5_SW, FLAG_SU35_3D )
|
||||
| GET_FLAG( !CH6_SW, FLAG_SU35_LED )
|
||||
| GET_FLAG( CH7_SW, FLAG_SU35_FLASH )
|
||||
| GET_FLAG( CH8_SW, FLAG_SU35_INVERT )
|
||||
| GET_FLAG( CH9_SW, FLAG_SU35_HIRATE );
|
||||
break;
|
||||
}
|
||||
uint8_t result=crc8;
|
||||
for(uint8_t i=0; i<8; i++)
|
||||
|
@ -88,7 +88,7 @@
|
||||
89,Losi
|
||||
90,MouldKg,Analog,Digit
|
||||
91,Xerall
|
||||
92,MT99xx,PA18
|
||||
92,MT99xx,PA18,SU35
|
||||
93,Kyosho2,KT-17
|
||||
94,Scorpio
|
||||
95,BlueFly
|
||||
@ -96,3 +96,4 @@
|
||||
97,SGF22,F22,F22S,J20
|
||||
98,Kyosho3
|
||||
99,XK2
|
||||
100,YuXiang
|
||||
|
@ -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";
|
||||
@ -136,7 +137,7 @@ const char STR_SUBTYPE_CX10[] = "\x07""Green\0 ""Blue\0 ""DM007\0 ""-\0
|
||||
const char STR_SUBTYPE_CG023[] = "\x05""Std\0 ""YD829";
|
||||
const char STR_SUBTYPE_BAYANG[] = "\x07""Std\0 ""H8S3D\0 ""X16 AH\0""IRDrone""DHD D4\0""QX100\0 ";
|
||||
const char STR_SUBTYPE_MT99[] = "\x06""MT99\0 ""H7\0 ""YZ\0 ""LS\0 ""FY805\0""A180\0 ""Dragon""F949G\0";
|
||||
const char STR_SUBTYPE_MT992[] = "\x04""PA18";
|
||||
const char STR_SUBTYPE_MT992[] = "\x04""PA18""SU35";
|
||||
const char STR_SUBTYPE_MJXQ[] = "\x07""WLH08\0 ""X600\0 ""X800\0 ""H26D\0 ""E010\0 ""H26WH\0 ""Phoenix";
|
||||
const char STR_SUBTYPE_FY326[] = "\x05""Std\0 ""FY319";
|
||||
const char STR_SUBTYPE_HONTAI[] = "\x07""Std\0 ""JJRC X1""X5C1\0 ""FQ_951";
|
||||
@ -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";
|
||||
@ -413,7 +414,7 @@ const mm_protocol_definition multi_protocols[] = {
|
||||
{PROTO_MT99XX, STR_MT99XX, STR_SUBTYPE_MT99, 8, OPTION_NONE, 0, 0, SW_NRF, MT99XX_init, MT99XX_callback },
|
||||
#endif
|
||||
#if defined(MT99XX_CCNRF_INO)
|
||||
{PROTO_MT99XX2, STR_MT99XX2, STR_SUBTYPE_MT992, 1, OPTION_NONE, 0, 0, SW_NRF, MT99XX_init, MT99XX_callback },
|
||||
{PROTO_MT99XX2, STR_MT99XX2, STR_SUBTYPE_MT992, 2, OPTION_NONE, 0, 0, SW_NRF, MT99XX_init, MT99XX_callback },
|
||||
#endif
|
||||
#if defined(NCC1701_NRF24L01_INO)
|
||||
{PROTO_NCC1701, STR_NCC1701, NO_SUBTYPE, 0, OPTION_NONE, 0, 0, SW_NRF, NCC_init, NCC_callback },
|
||||
@ -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
|
||||
|
@ -19,7 +19,7 @@
|
||||
#define VERSION_MAJOR 1
|
||||
#define VERSION_MINOR 3
|
||||
#define VERSION_REVISION 4
|
||||
#define VERSION_PATCH_LEVEL 12
|
||||
#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
|
||||
@ -255,6 +256,7 @@ enum MT99XX
|
||||
enum MT99XX2
|
||||
{
|
||||
PA18 = 0,
|
||||
SU35 = 1,
|
||||
};
|
||||
enum MJXQ
|
||||
{
|
||||
@ -390,6 +392,7 @@ enum XN297DUMP
|
||||
XN297DUMP_AUTO = 3,
|
||||
XN297DUMP_NRF = 4,
|
||||
XN297DUMP_CC2500 = 5,
|
||||
XN297DUMP_XN297 = 6,
|
||||
};
|
||||
enum FRSKY_R9
|
||||
{
|
||||
|
@ -120,7 +120,8 @@ static void __attribute__((unused)) V761_send_packet()
|
||||
|
||||
packet[6] = GET_FLAG(CH7_SW, 0x20) // Flip
|
||||
|GET_FLAG(CH8_SW, 0x08) // RTH activation
|
||||
|GET_FLAG(CH9_SW, 0x10); // RTH on/off
|
||||
|GET_FLAG(CH9_SW, 0x10) // RTH on/off
|
||||
|GET_FLAG(CH10_SW, 0x40); // Beeper on/off
|
||||
if(sub_protocol == V761_3CH)
|
||||
packet[6] |= 0x80; // Unknown, set on original V761-1 dump but not on eachine dumps, keeping for compatibility
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -23,7 +23,7 @@
|
||||
|
||||
// Parameters which can be modified
|
||||
#define XN297DUMP_PERIOD_SCAN 50000 // 25000
|
||||
#define XN297DUMP_MAX_RF_CHANNEL 127 // Default 84
|
||||
#define XN297DUMP_MAX_RF_CHANNEL 84 // Default 84
|
||||
|
||||
// Do not touch from there
|
||||
#define XN297DUMP_INITIAL_WAIT 500
|
||||
@ -186,6 +186,7 @@ static void __attribute__((unused)) XN297Dump_overflow()
|
||||
static uint16_t XN297Dump_callback()
|
||||
{
|
||||
static uint32_t time=0,*time_rf;
|
||||
static uint8_t *nbr_rf,compare_channel;
|
||||
|
||||
//!!!Blocking mode protocol!!!
|
||||
TX_MAIN_PAUSE_off;
|
||||
@ -370,8 +371,15 @@ static uint16_t XN297Dump_callback()
|
||||
hopping_frequency_no=0;
|
||||
rf_ch_num=0;
|
||||
packet_count=0;
|
||||
nbr_rf=(uint8_t*)malloc(XN297DUMP_MAX_RF_CHANNEL*sizeof(uint8_t));
|
||||
if(nbr_rf==NULL)
|
||||
{
|
||||
debugln("\r\nCan't allocate memory for next phase!!!");
|
||||
phase=0;
|
||||
break;
|
||||
}
|
||||
debug("Trying RF channel: 0");
|
||||
|
||||
rx_tx_addr[0]=0;rx_tx_addr[1]=0;rx_tx_addr[2]=0;rx_tx_addr[3]=0;rx_tx_addr[4]=0;
|
||||
XN297_SetTXAddr(rx_tx_addr,address_length);
|
||||
XN297_SetRXAddr(rx_tx_addr,packet_length);
|
||||
XN297_RFChannel(0);
|
||||
@ -391,9 +399,34 @@ static uint16_t XN297Dump_callback()
|
||||
packet_count=0;
|
||||
if(hopping_frequency_no>XN297DUMP_MAX_RF_CHANNEL)
|
||||
{
|
||||
uint8_t nbr_max=0,j=0;
|
||||
debug("\r\n\r\n%d RF channels identified:",rf_ch_num);
|
||||
compare_channel=0;
|
||||
for(uint8_t i=0;i<rf_ch_num;i++)
|
||||
debug(" %d",hopping_frequency[i]);
|
||||
{
|
||||
debug(" %d[%d]",hopping_frequency[i],nbr_rf[i]);
|
||||
if(nbr_rf[i]>nbr_max)
|
||||
{
|
||||
nbr_max=nbr_rf[i];
|
||||
compare_channel=i;
|
||||
}
|
||||
}
|
||||
nbr_max = (nbr_max*2)/3;
|
||||
debug("\r\nKeeping only RF channels with more than %d packets:", nbr_max);
|
||||
for(uint8_t i=0;i<rf_ch_num;i++)
|
||||
if(nbr_rf[i]>=nbr_max)
|
||||
{
|
||||
hopping_frequency[j]=hopping_frequency[i];
|
||||
debug(" %d",hopping_frequency[j]);
|
||||
if(compare_channel==i)
|
||||
{
|
||||
compare_channel=j;
|
||||
debug("*");
|
||||
}
|
||||
j++;
|
||||
}
|
||||
rf_ch_num = j;
|
||||
free(nbr_rf);
|
||||
time_rf=(uint32_t*)malloc(rf_ch_num*sizeof(time));
|
||||
if(time_rf==NULL)
|
||||
{
|
||||
@ -403,13 +436,13 @@ static uint16_t XN297Dump_callback()
|
||||
}
|
||||
debugln("\r\n--------------------------------");
|
||||
debugln("Identifying RF channels order.");
|
||||
hopping_frequency_no=1;
|
||||
hopping_frequency_no=0;
|
||||
phase=3;
|
||||
packet_count=0;
|
||||
bind_counter=0;
|
||||
debugln("Time between CH:%d and CH:%d",hopping_frequency[0],hopping_frequency[hopping_frequency_no]);
|
||||
debugln("Time between CH:%d and CH:%d",hopping_frequency[compare_channel],hopping_frequency[hopping_frequency_no]);
|
||||
time_rf[hopping_frequency_no]=0xFFFFFFFF;
|
||||
XN297_RFChannel(hopping_frequency[0]);
|
||||
XN297_RFChannel(hopping_frequency[compare_channel]);
|
||||
uint16_t timeL=TCNT1;
|
||||
if(TIMER2_BASE->SR & TIMER_SR_UIF)
|
||||
{//timer just rolled over...
|
||||
@ -430,7 +463,7 @@ static uint16_t XN297Dump_callback()
|
||||
}
|
||||
if( XN297_IsRX() )
|
||||
{ // RX fifo data ready
|
||||
// if(NRF24L01_ReadReg(NRF24L01_09_CD))
|
||||
if(NRF24L01_ReadReg(NRF24L01_09_CD))
|
||||
{
|
||||
uint8_t res;
|
||||
if(enhanced)
|
||||
@ -462,6 +495,7 @@ static uint16_t XN297Dump_callback()
|
||||
for(uint8_t i=0;i<packet_length;i++)
|
||||
debug(" %02X",packet[i]);
|
||||
packet_count++;
|
||||
nbr_rf[rf_ch_num-1]=packet_count;
|
||||
if(packet_count>20)
|
||||
{//change channel
|
||||
bind_counter=XN297DUMP_PERIOD_SCAN+1;
|
||||
@ -484,15 +518,15 @@ static uint16_t XN297Dump_callback()
|
||||
{
|
||||
uint8_t next=0;
|
||||
debugln("\r\n\r\nChannel order:");
|
||||
debugln("%d: 0us",hopping_frequency[0]);
|
||||
uint8_t i=1;
|
||||
debugln("%d: 0us",hopping_frequency[compare_channel]);
|
||||
uint8_t i=0;
|
||||
do
|
||||
{
|
||||
time=time_rf[i];
|
||||
if(time!=0xFFFFFFFF)
|
||||
{
|
||||
next=i;
|
||||
for(uint8_t j=2;j<rf_ch_num;j++)
|
||||
for(uint8_t j=1;j<rf_ch_num;j++)
|
||||
if(time>time_rf[j])
|
||||
{
|
||||
next=j;
|
||||
@ -512,9 +546,9 @@ static uint16_t XN297Dump_callback()
|
||||
hopping_frequency_no=0;
|
||||
break;
|
||||
}
|
||||
debugln("Time between CH:%d and CH:%d",hopping_frequency[0],hopping_frequency[hopping_frequency_no]);
|
||||
debugln("Time between CH:%d and CH:%d",hopping_frequency[compare_channel],hopping_frequency[hopping_frequency_no]);
|
||||
time_rf[hopping_frequency_no]=-1;
|
||||
XN297_RFChannel(hopping_frequency[0]);
|
||||
XN297_RFChannel(hopping_frequency[compare_channel]);
|
||||
uint16_t timeL=TCNT1;
|
||||
if(TIMER2_BASE->SR & TIMER_SR_UIF)
|
||||
{//timer just rolled over...
|
||||
@ -528,7 +562,7 @@ static uint16_t XN297Dump_callback()
|
||||
}
|
||||
if( XN297_IsRX() )
|
||||
{ // RX fifo data ready
|
||||
//if(NRF24L01_ReadReg(NRF24L01_09_CD))
|
||||
if(NRF24L01_ReadReg(NRF24L01_09_CD))
|
||||
{
|
||||
uint8_t res;
|
||||
if(enhanced)
|
||||
@ -553,7 +587,7 @@ static uint16_t XN297Dump_callback()
|
||||
if(time_rf[hopping_frequency_no] > (time>>1))
|
||||
time_rf[hopping_frequency_no]=time>>1;
|
||||
debugln("Time: %5luus", time>>1);
|
||||
XN297_RFChannel(hopping_frequency[0]);
|
||||
XN297_RFChannel(hopping_frequency[compare_channel]);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -610,11 +644,11 @@ static uint16_t XN297Dump_callback()
|
||||
{
|
||||
if(phase==0)
|
||||
{
|
||||
address_length=4;
|
||||
memcpy(rx_tx_addr, (uint8_t *)"\xF4\x71\x8D\x01", address_length); // bind \x7E\xB8\x63\xA9
|
||||
address_length=5;
|
||||
memcpy(rx_tx_addr, (uint8_t *)"\xCC\xCC\xCC\xCC\xCC", address_length); // bind \x7E\xB8\x63\xA9
|
||||
bitrate=XN297DUMP_250K;
|
||||
packet_length=7;
|
||||
hopping_frequency_no=0x50; //bind 0x50, normal ??
|
||||
packet_length=9;
|
||||
hopping_frequency_no=71; //bind 71, normal ??
|
||||
|
||||
NRF24L01_Initialize();
|
||||
NRF24L01_SetTxRxMode(TXRX_OFF);
|
||||
@ -851,6 +885,63 @@ static uint16_t XN297Dump_callback()
|
||||
}
|
||||
#endif
|
||||
}
|
||||
else if(sub_protocol == XN297DUMP_XN297)
|
||||
{
|
||||
if(phase==0)
|
||||
{
|
||||
address_length=5;
|
||||
memcpy(rx_tx_addr, (uint8_t *)"\x00\x00\x00\x00\x00", address_length); // bind \x7E\xB8\x63\xA9
|
||||
packet_length=9;
|
||||
hopping_frequency_no=0x30;
|
||||
|
||||
XN297_Configure(XN297_CRCEN, XN297_SCRAMBLED, XN297_1M);
|
||||
XN297_SetTxRxMode(TXRX_OFF);
|
||||
XN297_SetTXAddr(rx_tx_addr, address_length);
|
||||
XN297_SetRXAddr(rx_tx_addr, packet_length);
|
||||
XN297_Hopping(option);
|
||||
old_option = option;
|
||||
XN297_SetTxRxMode(RX_EN);
|
||||
|
||||
debugln("XN297 dump, len=%d, rf=%d, address length=%d",packet_length,option,address_length); //hopping_frequency_no,address_length);
|
||||
phase = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
bool rx = XN297_IsRX(); // Needed for the NRF24L01 since otherwise the bit gets cleared
|
||||
if(rx)
|
||||
{ // RX fifo data ready
|
||||
XN297_SetTxRxMode(TXRX_OFF);
|
||||
XN297_SetTxRxMode(RX_EN);
|
||||
XN297Dump_overflow();
|
||||
uint16_t timeL=TCNT1;
|
||||
if(TIMER2_BASE->SR & TIMER_SR_UIF)
|
||||
{//timer just rolled over...
|
||||
XN297Dump_overflow();
|
||||
timeL=0;
|
||||
}
|
||||
time=(timeH<<16)+timeL-time;
|
||||
debug("RX: %5luus ", time>>1);
|
||||
time=(timeH<<16)+timeL;
|
||||
if(XN297_ReadPayload(packet_in, packet_length))
|
||||
{
|
||||
debug("OK:");
|
||||
for(uint8_t i=0;i<packet_length;i++)
|
||||
debug(" %02X",packet_in[i]);
|
||||
}
|
||||
else // Bad packet
|
||||
debug(" NOK");
|
||||
debugln("");
|
||||
// restart RX mode
|
||||
}
|
||||
XN297Dump_overflow();
|
||||
if(old_option != option)
|
||||
{
|
||||
debugln("C=%d(%02X)",option,option);
|
||||
XN297_Hopping(option);
|
||||
old_option = option;
|
||||
}
|
||||
}
|
||||
}
|
||||
bind_counter++;
|
||||
if(IS_RX_FLAG_on) // Let the radio update the protocol
|
||||
{
|
||||
|
224
Multiprotocol/Yuxiang_nrf24l01.ino
Normal file
224
Multiprotocol/Yuxiang_nrf24l01.ino
Normal file
@ -0,0 +1,224 @@
|
||||
/*
|
||||
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/>.
|
||||
|
||||
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<YUXIANG_PACKET_SIZE-1; i++)
|
||||
checksum += packet[i];
|
||||
packet[8] = checksum;
|
||||
|
||||
#if 1
|
||||
debug("P:");
|
||||
for(uint8_t i=0;i<YUXIANG_PACKET_SIZE;i++)
|
||||
debug(" %02X",packet[i]);
|
||||
debugln("");
|
||||
#endif
|
||||
// Send
|
||||
XN297_SetPower();
|
||||
XN297_SetTxRxMode(TX_EN);
|
||||
XN297_WritePayload(packet, YUXIANG_PACKET_SIZE);
|
||||
}
|
||||
|
||||
static void __attribute__((unused)) YUXIANG_RF_init()
|
||||
{
|
||||
XN297_Configure(XN297_CRCEN, XN297_SCRAMBLED, XN297_1M);
|
||||
XN297_SetTXAddr(rx_tx_addr, 5);
|
||||
XN297_SetRXAddr(rx_tx_addr, YUXIANG_PACKET_SIZE);
|
||||
}
|
||||
|
||||
static void __attribute__((unused)) YUXIANG_initialize_txid()
|
||||
{
|
||||
#ifdef YUXIANG_FORCE_ID
|
||||
//TX1
|
||||
memcpy(rx_tx_addr,(uint8_t *)"\xB3\x13\x36\xDD",4); //rx_tx_addr[4]=0xD9
|
||||
memcpy(hopping_frequency,(uint8_t *)"\x32\x35\x42\x49",4);
|
||||
#endif
|
||||
uint8_t sum=0;
|
||||
for(uint8_t i=0; i<4; i++)
|
||||
sum += rx_tx_addr[i];
|
||||
rx_tx_addr[4] = sum;
|
||||
debugln("ID: %02X %02X %02X %02X %02X , HOP: %02X %02X %02X %02X",rx_tx_addr[0],rx_tx_addr[1],rx_tx_addr[2],rx_tx_addr[3],rx_tx_addr[4],hopping_frequency[0],hopping_frequency[1],hopping_frequency[2],hopping_frequency[3]);
|
||||
}
|
||||
|
||||
uint16_t YUXIANG_callback()
|
||||
{
|
||||
static bool rx = false;
|
||||
|
||||
switch(phase)
|
||||
{
|
||||
case YUXIANG_DATA:
|
||||
rx = XN297_IsRX(); // Needed for the NRF24L01 since otherwise the bit gets cleared
|
||||
XN297_SetTxRxMode(TXRX_OFF);
|
||||
#ifdef YUXIANG_HUB_TELEMETRY
|
||||
if(packet_count > 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<YUXIANG_PACKET_SIZE;i++)
|
||||
debug(" %02X",packet_in[i]);
|
||||
#endif
|
||||
uint8_t checksum = 0;
|
||||
for(uint8_t i=0; i<YUXIANG_PACKET_SIZE-1; i++)
|
||||
checksum += packet_in[i];
|
||||
if(packet_in[8] == checksum)
|
||||
{
|
||||
#ifdef YUXIANG_HUB_TELEMETRY
|
||||
v_lipo1 = packet_in[4];
|
||||
telemetry_link = 1;
|
||||
#endif
|
||||
telemetry_lost = 0;
|
||||
packet_count = 0;
|
||||
bind_counter = 0; // Stop bind
|
||||
BIND_DONE;
|
||||
}
|
||||
#ifdef YUXIANG_TELEM_DEBUG
|
||||
else // Bad packet
|
||||
debug(" NOK");
|
||||
#endif
|
||||
}
|
||||
#ifdef YUXIANG_TELEM_DEBUG
|
||||
else // Bad packet
|
||||
debug("NOK");
|
||||
debugln("");
|
||||
#endif
|
||||
rx = false;
|
||||
}
|
||||
phase++;
|
||||
return YUXIANG_WRITE_TIME;
|
||||
case YUXIANG_RX:
|
||||
{ // Wait for packet to be sent before switching to receive mode
|
||||
uint16_t start=(uint16_t)micros();
|
||||
while ((uint16_t)((uint16_t)micros()-(uint16_t)start) < 500)
|
||||
if(XN297_IsPacketSent())
|
||||
break;
|
||||
}
|
||||
XN297_SetTxRxMode(RX_EN);
|
||||
phase = YUXIANG_DATA;
|
||||
return YUXIANG_PACKET_PERIOD - YUXIANG_WRITE_TIME;
|
||||
}
|
||||
return YUXIANG_PACKET_PERIOD;
|
||||
}
|
||||
|
||||
void YUXIANG_init(void)
|
||||
{
|
||||
YUXIANG_initialize_txid();
|
||||
YUXIANG_RF_init();
|
||||
|
||||
if(IS_BIND_IN_PROGRESS)
|
||||
bind_counter = YUXIANG_BIND_COUNT;
|
||||
else
|
||||
bind_counter = 0;
|
||||
|
||||
phase = YUXIANG_DATA;
|
||||
hopping_frequency_no = 0;
|
||||
#ifdef YUXIANG_HUB_TELEMETRY
|
||||
packet_count = 0;
|
||||
telemetry_lost = 1;
|
||||
RX_RSSI = 100; // Dummy value
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif
|
@ -259,6 +259,7 @@
|
||||
#define V761_NRF24L01_INO
|
||||
#define XERALL_NRF24L01_INO
|
||||
#define YD717_NRF24L01_INO
|
||||
#define YUXIANG_NRF24L01_INO
|
||||
#define ZSX_NRF24L01_INO
|
||||
|
||||
//The protocols below need either a CC2500 or NRF24L01 to be installed
|
||||
@ -346,6 +347,7 @@
|
||||
#define NCC1701_HUB_TELEMETRY // Use FrSkyD Hub format to send telemetry to TX
|
||||
#define OMP_HUB_TELEMETRY // Use FrSkyD Hub format to send telemetry to TX
|
||||
#define V761_HUB_TELEMETRY // Use FrSkyD Hub format to send telemetry to TX
|
||||
#define YUXIANG_HUB_TELEMETRY
|
||||
#define PROPEL_HUB_TELEMETRY // Use FrSkyD Hub format to send telemetry to TX
|
||||
#define CABELL_HUB_TELEMETRY // Use FrSkyD Hub format to send telemetry to TX
|
||||
#define RLINK_HUB_TELEMETRY // Use FrSkyD Hub format to send telemetry to TX
|
||||
@ -777,6 +779,7 @@ const PPM_Parameters PPM_prot[14*NBR_BANKS]= {
|
||||
F949G
|
||||
PROTO_MT99XX2
|
||||
PA18
|
||||
SU35
|
||||
PROTO_NCC1701
|
||||
NONE
|
||||
PROTO_OMP
|
||||
@ -868,6 +871,8 @@ const PPM_Parameters PPM_prot[14*NBR_BANKS]= {
|
||||
SYMAX4
|
||||
XINXUN
|
||||
NIHUI
|
||||
PROTO_YUXIANG
|
||||
NONE
|
||||
PROTO_ZSX
|
||||
NONE
|
||||
*/
|
||||
|
@ -143,7 +143,7 @@ CFlie|38|CFlie||||||||NRF24L01|
|
||||
[Skyartec](Protocols_Details.md#Skyartec---68)|68|||||||||CC2500|CC2500
|
||||
[SLT](Protocols_Details.md#SLT---11)|11|SLT_V1|SLT_V2|Q100|Q200|MR100|V1_4CH|||NRF24L01|CC2500
|
||||
[SymaX](Protocols_Details.md#Symax---10)|10|SYMAX|SYMAX5C|||||||NRF24L01|
|
||||
[Traxxas](Protocols_Details.md#Traxxas---43)|43|TQ||||||||CYRF6936|
|
||||
[Traxxas](Protocols_Details.md#Traxxas---43)|43|TQ1|TQ2|||||||CYRF6936|
|
||||
[V2x2](Protocols_Details.md#V2X2---5)|5|V2x2|JXD506|MR101||||||NRF24L01|
|
||||
[V761](Protocols_Details.md#V761---48)|48|3CH|4CH|TOPRC||||||NRF24L01|XN297
|
||||
[V911S](Protocols_Details.md#V911S---46)|46|V911S*|E119*|||||||NRF24L01|XN297
|
||||
@ -154,6 +154,7 @@ CFlie|38|CFlie||||||||NRF24L01|
|
||||
[XK](Protocols_Details.md#XK---62)|62|X450|X420|Cars||||||NRF24L011&CC2500|XN297
|
||||
[XK2](Protocols_Details.md#XK2---99)|99|X4||||||||NRF24L01&CC2500|XN297
|
||||
[YD717](Protocols_Details.md#YD717---8)|8|YD717|SKYWLKR|SYMAX4|XINXUN|NIHUI||||NRF24L01|
|
||||
[YuXiang](Protocols_Details.md#YuXiang---100)|100|||||||||NRF24L01|XN297
|
||||
[ZSX](Protocols_Details.md#ZSX---52)|52|280||||||||NRF24L01|XN297
|
||||
* "*" Sub Protocols designated by * suffix are using a XN297L@250kbps which will be emulated by default with the NRF24L01. If option (freq tune) is diffrent from 0, the CC2500 module (if installed) will be used instead. Each specific sub protocol has a more detailed explanation.
|
||||
|
||||
@ -696,6 +697,13 @@ CH1|CH2|CH3|CH4
|
||||
A|E|T|R
|
||||
|
||||
## Traxxas - *43*
|
||||
|
||||
### Sub_protocol TQ1 - *0*
|
||||
Transmitter 2228 TX and a 2217 RX
|
||||
|
||||
Under dev
|
||||
|
||||
### Sub_protocol TQ2 - *1*
|
||||
Transmitter TQ, Receivers: 6519, 2218(X), ECM-2.5
|
||||
|
||||
Extended limits supported
|
||||
@ -2123,18 +2131,18 @@ RTN_ACT and RTN: -100% disable, +100% enable
|
||||
### Sub_protocol 3CH - *0*
|
||||
Models: Volantex V761-1, V761-3 and may be others
|
||||
|
||||
CH1|CH2|CH3|CH4|CH5|CH6|CH7|CH8|CH9
|
||||
---|---|---|---|---|---|---|---|---
|
||||
-|E|T|R|GYRO|CALIB|FLIP|RTN_ACT|RTN
|
||||
CH1|CH2|CH3|CH4|CH5|CH6|CH7|CH8|CH9|CH10
|
||||
---|---|---|---|---|---|---|---|---|---
|
||||
-|E|T|R|GYRO|CALIB|FLIP|RTN_ACT|RTN|BEEP
|
||||
|
||||
### Sub_protocol 4CH - *1*
|
||||
Models: Volantex V761-4+ and Eachine P51-D, F4U, F22 and may be others
|
||||
|
||||
If the model (761-11 and above) sends telemetry then the battery status ok/empty is in A1 (4.4V -> 2.2V) and RSSI gets a dummy value of 100.
|
||||
|
||||
CH1|CH2|CH3|CH4|CH5|CH6|CH7|CH8|CH9
|
||||
---|---|---|---|---|---|---|---|---
|
||||
A|E|T|R|GYRO|CALIB|FLIP|RTN_ACT|RTN
|
||||
CH1|CH2|CH3|CH4|CH5|CH6|CH7|CH8|CH9|CH10
|
||||
---|---|---|---|---|---|---|---|---|---
|
||||
A|E|T|R|GYRO|CALIB|FLIP|RTN_ACT|RTN|BEEP
|
||||
|
||||
### Sub_protocol TOPRC - *2*
|
||||
Models: Top RC Hobby Spitfire, P51D, BF-109
|
||||
@ -2180,6 +2188,14 @@ A|E|T|R|FLIP|LIGHT|PICTURE|VIDEO|HEADLESS
|
||||
### Sub_protocol NIHUI - *4*
|
||||
Same channels assignement as above.
|
||||
|
||||
## YuXiang - *100*
|
||||
|
||||
**Only 1 TX ID**. Bind might not work... Telemetry is received but content unknown yet.
|
||||
|
||||
CH1|CH2|CH3|CH4|CH5|CH6|CH7|CH8|CH9|CH10|CH11|CH12
|
||||
---|---|---|---|---|---|---|---|---|---|---|---
|
||||
A|E|T|R|LOCK|RATE|LAND|ALTHOL|MANUAL|FLIP|MODE|PITCH
|
||||
|
||||
## ZSX - *52*
|
||||
Model: JJRC ZSX-280
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user