mirror of
https://github.com/pascallanger/DIY-Multiprotocol-TX-Module.git
synced 2025-02-04 16:28:10 +00:00
New protocol Realacc
This commit is contained in:
parent
1408431649
commit
ea24ab6032
@ -135,10 +135,11 @@
|
||||
31,2,Q303,CX10D,1,Arm,Flip
|
||||
31,3,Q303,CX10WD,1,Arm,Flip
|
||||
72,0,Q90C,Std,0,FMode,VTX+
|
||||
50,0,Redpine,Fast,0,sCH5,sCH6,sCH7,sCH8,sCH9,sCH10,sCH11,sCH12,sCH13,sCH14,sCH15,sCH16
|
||||
50,1,Redpine,Slow,0,sCH5,sCH6,sCH7,sCH8,sCH9,sCH10,sCH11,sCH12,sCH13,sCH14,sCH15,sCH16
|
||||
74,0,RadioLink,Surface,0,CH5,CH6,CH7,CH8,FS_CH1,FS_CH2,FS_CH3,FS_CH4,FS_CH5,FS_CH6,FS_CH7,FS_CH8
|
||||
74,1,RadioLink,Air,0,CH5,CH6,CH7,CH8,FS_CH1,FS_CH2,FS_CH3,FS_CH4,FS_CH5,FS_CH6,FS_CH7,FS_CH8
|
||||
76,0,Realacc,R11,1,Flip,Light,Calib,HLess,RTH,UNK
|
||||
50,0,Redpine,Fast,0,sCH5,sCH6,sCH7,sCH8,sCH9,sCH10,sCH11,sCH12,sCH13,sCH14,sCH15,sCH16
|
||||
50,1,Redpine,Slow,0,sCH5,sCH6,sCH7,sCH8,sCH9,sCH10,sCH11,sCH12,sCH13,sCH14,sCH15,sCH16
|
||||
21,0,SFHSS,Std,0,CH5,CH6,CH7,CH8
|
||||
19,0,Shenqi,Cycle,1
|
||||
68,0,Skyartec,Std,0,CH5,CH6,CH7
|
||||
|
@ -71,4 +71,5 @@
|
||||
71,JJRC345
|
||||
72,Q90C
|
||||
73,Kyosho
|
||||
74,RadioLink,Surface
|
||||
74,RadioLink,Surface
|
||||
76,Realacc,R11
|
@ -88,6 +88,7 @@ const char STR_PROPEL[] ="Propel";
|
||||
const char STR_SKYARTEC[] ="Skyartc";
|
||||
const char STR_KYOSHO[] ="Kyosho";
|
||||
const char STR_RLINK[] ="RadLink";
|
||||
const char STR_REALACC[] ="Realacc";
|
||||
const char STR_TEST[] ="Test";
|
||||
const char STR_FAKE[] ="Fake";
|
||||
|
||||
@ -142,6 +143,7 @@ const char STR_SUBTYPE_HOTT[] = "\x07""Sync\0 ""No_Sync";
|
||||
const char STR_SUBTYPE_PELIKAN[] = "\x04""Pro\0""Lite";
|
||||
const char STR_SUBTYPE_V761[] = "\x03""3ch""4ch";
|
||||
const char STR_SUBTYPE_RLINK[] = "\x07""Surface""Air\0 ";
|
||||
const char STR_SUBTYPE_REALACC[] = "\x03""R11";
|
||||
|
||||
enum
|
||||
{
|
||||
@ -323,12 +325,15 @@ const mm_protocol_definition multi_protocols[] = {
|
||||
#if defined(Q90C_NRF24L01_INO)
|
||||
{PROTO_Q90C, STR_Q90C, 0, NO_SUBTYPE, OPTION_RFTUNE },
|
||||
#endif
|
||||
#if defined(REDPINE_CC2500_INO)
|
||||
{PROTO_REDPINE, STR_REDPINE, 2, STR_SUBTYPE_REDPINE, OPTION_RFTUNE },
|
||||
#endif
|
||||
#if defined(RLINK_CC2500_INO)
|
||||
{PROTO_RLINK, STR_RLINK, 2, STR_SUBTYPE_RLINK, OPTION_RFTUNE },
|
||||
#endif
|
||||
#if defined(REALACC_NRF24L01_INO)
|
||||
{PROTO_REALACC, STR_REALACC, 1, STR_SUBTYPE_REALACC, OPTION_NONE },
|
||||
#endif
|
||||
#if defined(REDPINE_CC2500_INO)
|
||||
{PROTO_REDPINE, STR_REDPINE, 2, STR_SUBTYPE_REDPINE, OPTION_RFTUNE },
|
||||
#endif
|
||||
#if defined(SCANNER_CC2500_INO)
|
||||
// {PROTO_SCANNER, STR_SCANNER, 0, NO_SUBTYPE, OPTION_NONE },
|
||||
#endif
|
||||
|
@ -19,7 +19,7 @@
|
||||
#define VERSION_MAJOR 1
|
||||
#define VERSION_MINOR 3
|
||||
#define VERSION_REVISION 1
|
||||
#define VERSION_PATCH_LEVEL 52
|
||||
#define VERSION_PATCH_LEVEL 53
|
||||
|
||||
//******************
|
||||
// Protocols
|
||||
@ -101,6 +101,7 @@ enum PROTOCOLS
|
||||
PROTO_Q90C = 72, // =>NRF24L01 or CC2500
|
||||
PROTO_KYOSHO = 73, // =>A7105
|
||||
PROTO_RLINK = 74, // =>CC2500
|
||||
PROTO_REALACC = 76, // =>NRF24L01
|
||||
|
||||
PROTO_FAKE = 126, // =>CC2500+NRF24L01
|
||||
PROTO_TEST = 127, // =>CC2500
|
||||
@ -809,6 +810,7 @@ Serial: 100000 Baud 8e2 _ xxxx xxxx p --
|
||||
Q90C 72
|
||||
KYOSHO 73
|
||||
RLINK 74
|
||||
REALACC 76
|
||||
BindBit=> 0x80 1=Bind/0=No
|
||||
AutoBindBit=> 0x40 1=Yes /0=No
|
||||
RangeCheck=> 0x20 1=Yes /0=No
|
||||
|
@ -1598,6 +1598,12 @@ static void protocol_init()
|
||||
remote_callback = Q90C_callback;
|
||||
break;
|
||||
#endif
|
||||
#if defined(REALACC_NRF24L01_INO)
|
||||
case PROTO_REALACC:
|
||||
next_callback=initREALACC();
|
||||
remote_callback = REALACC_callback;
|
||||
break;
|
||||
#endif
|
||||
#if defined(TEST_CC2500_INO)
|
||||
case PROTO_TEST:
|
||||
next_callback=initTEST();
|
||||
|
157
Multiprotocol/REALACC_nrf24l01.ino
Normal file
157
Multiprotocol/REALACC_nrf24l01.ino
Normal file
@ -0,0 +1,157 @@
|
||||
/*
|
||||
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/>.
|
||||
*/
|
||||
// Compatible with Realacc R11
|
||||
|
||||
#if defined(REALACC_NRF24L01_INO)
|
||||
|
||||
#include "iface_nrf24l01.h"
|
||||
|
||||
#define FORCE_REALACC_ORIGINAL_ID
|
||||
|
||||
#define REALACC_INITIAL_WAIT 500
|
||||
#define REALACC_PACKET_PERIOD 2268
|
||||
#define REALACC_BIND_RF_CHANNEL 80
|
||||
#define REALACC_BIND_PAYLOAD_SIZE 10
|
||||
#define REALACC_PAYLOAD_SIZE 13
|
||||
#define REALACC_BIND_COUNT 50
|
||||
#define REALACC_RF_NUM_CHANNELS 5
|
||||
|
||||
static void __attribute__((unused)) REALACC_send_packet()
|
||||
{
|
||||
packet[ 0]= 0xDC;
|
||||
packet[ 1]= convert_channel_8b(AILERON); // 00..80..FF
|
||||
packet[ 2]= convert_channel_8b(ELEVATOR); // 00..80..FF
|
||||
packet[ 3]= convert_channel_8b(THROTTLE); // 00..FF
|
||||
packet[ 4]= convert_channel_8b(RUDDER); // 00..80..FF
|
||||
packet[ 5]= 0x20; // Trim
|
||||
packet[ 6]= 0x20; // Trim
|
||||
packet[ 7]= 0x20; // Trim
|
||||
packet[ 8]= 0x20; // Trim
|
||||
packet[ 9]= num_ch; // Change at each power up
|
||||
packet[10]= 0x04 // Flag1
|
||||
| 0x02 // Rate1=0, Rate2=1, Rate3=2
|
||||
| GET_FLAG(CH8_SW, 0x20); // Headless
|
||||
packet[11]= 0x00 // Flag2
|
||||
| GET_FLAG(CH7_SW, 0x01) // Calib
|
||||
| GET_FLAG(CH9_SW, 0x20) // Return
|
||||
| GET_FLAG(CH10_SW,0x80); // Unknown
|
||||
packet[12]= 0x00 // Flag3
|
||||
| GET_FLAG(CH5_SW, 0x01) // Flip
|
||||
| GET_FLAG(CH6_SW, 0x80); // Light
|
||||
|
||||
NRF24L01_WriteReg(NRF24L01_05_RF_CH, hopping_frequency_no);
|
||||
hopping_frequency_no++;
|
||||
hopping_frequency_no %= REALACC_RF_NUM_CHANNELS;
|
||||
XN297_WritePayload(packet, REALACC_PAYLOAD_SIZE);
|
||||
}
|
||||
|
||||
static void __attribute__((unused)) REALACC_send_bind_packet()
|
||||
{
|
||||
packet[0] = 0xB1;
|
||||
memcpy(&packet[1],rx_tx_addr,4);
|
||||
memcpy(&packet[5],hopping_frequency,5);
|
||||
|
||||
XN297_WritePayload(packet, REALACC_BIND_PAYLOAD_SIZE);
|
||||
}
|
||||
|
||||
static void __attribute__((unused)) REALACC_initialize_txid()
|
||||
{
|
||||
calc_fh_channels(REALACC_RF_NUM_CHANNELS);
|
||||
num_ch=random(0xfefefefe); // 00..FF
|
||||
|
||||
#ifdef FORCE_REALACC_ORIGINAL_ID
|
||||
//Dump
|
||||
rx_tx_addr[0]=0x99;
|
||||
rx_tx_addr[1]=0x06;
|
||||
rx_tx_addr[2]=0x00;
|
||||
rx_tx_addr[3]=0x00;
|
||||
hopping_frequency[0]=0x55;
|
||||
hopping_frequency[1]=0x59;
|
||||
hopping_frequency[2]=0x5A;
|
||||
hopping_frequency[3]=0x5A;
|
||||
hopping_frequency[4]=0x62;
|
||||
num_ch=0xC5; // Value in dumps: C5 A2 77 F0 84 58
|
||||
#endif
|
||||
}
|
||||
|
||||
static void __attribute__((unused)) REALACC_init()
|
||||
{
|
||||
NRF24L01_Initialize();
|
||||
NRF24L01_SetTxRxMode(TX_EN);
|
||||
NRF24L01_FlushTx();
|
||||
NRF24L01_FlushRx();
|
||||
NRF24L01_WriteReg(NRF24L01_07_STATUS, 0x70); // Clear data ready, data sent, and retransmit
|
||||
NRF24L01_WriteReg(NRF24L01_01_EN_AA, 0x00); // No Auto Acknowldgement on all data pipes
|
||||
NRF24L01_WriteReg(NRF24L01_02_EN_RXADDR, 0x01); // Enable data pipe 0 only
|
||||
NRF24L01_SetBitrate(NRF24L01_BR_1M); // 1Mbps
|
||||
NRF24L01_SetPower();
|
||||
XN297_SetTXAddr((uint8_t*)"MAIN", 4);
|
||||
NRF24L01_WriteReg(NRF24L01_05_RF_CH, REALACC_BIND_RF_CHANNEL); // Set bind channel
|
||||
}
|
||||
|
||||
uint16_t REALACC_callback()
|
||||
{
|
||||
#ifdef MULTI_SYNC
|
||||
telemetry_set_input_sync(REALACC_PACKET_PERIOD);
|
||||
#endif
|
||||
XN297_Configure(_BV(NRF24L01_00_EN_CRC) | _BV(NRF24L01_00_CRCO) | _BV(NRF24L01_00_PWR_UP));
|
||||
NRF24L01_WriteReg(NRF24L01_07_STATUS, 0x70);
|
||||
NRF24L01_FlushTx();
|
||||
NRF24L01_SetPower();
|
||||
if(IS_BIND_IN_PROGRESS)
|
||||
{
|
||||
REALACC_send_bind_packet();
|
||||
if(--bind_counter==0)
|
||||
{
|
||||
BIND_DONE;
|
||||
XN297_SetTXAddr(rx_tx_addr, 4);
|
||||
}
|
||||
}
|
||||
else
|
||||
REALACC_send_packet();
|
||||
return REALACC_PACKET_PERIOD;
|
||||
}
|
||||
|
||||
uint16_t initREALACC()
|
||||
{
|
||||
BIND_IN_PROGRESS; // autobind protocol
|
||||
REALACC_initialize_txid();
|
||||
REALACC_init();
|
||||
bind_counter=REALACC_BIND_COUNT;
|
||||
hopping_frequency_no=0;
|
||||
return REALACC_INITIAL_WAIT;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
// XN297 speed 1Mb, scrambled, enhanced
|
||||
// Bind
|
||||
// Address = 4D 41 49 4E = 'MAIN'
|
||||
// Channel = 80 (most likely from dump)
|
||||
// P(10) = B1 99 06 00 00 55 59 5A 5A 62
|
||||
// B1 indicates bind packet
|
||||
// 99 06 00 00 = ID = address of normal packets
|
||||
// 55 59 5A 5A 62 = 85, 89, 90, 90, 98 = RF channels to be used (kind of match previous dumps)// Normal
|
||||
// Normal
|
||||
// Address = 99 06 00 00
|
||||
// Channels = 84, 89, 90, 90, 98 (guess from bind)
|
||||
// P(13)= DC 80 80 32 80 20 20 20 20 58 04 00 00
|
||||
// DC = normal packet
|
||||
// 80 80 32 80 : AETR 00..80..FF
|
||||
// 20 20 20 20 : Trims
|
||||
// 58 : changing every time the TX restart
|
||||
// 04 : |0x20=headless, |0x01=rate2, |0x02=rate3
|
||||
// 00 : |0x01=calib, |0x20=return, |0x80=unknown
|
||||
// 00 : |0x80=light, |0x01=flip
|
@ -285,6 +285,7 @@
|
||||
#undef PROPEL_NRF24L01_INO
|
||||
#undef Q303_NRF24L01_INO
|
||||
#undef Q90C_NRF24L01_INO
|
||||
#undef REALACC_NRF24L01_INO
|
||||
#undef SHENQI_NRF24L01_INO
|
||||
#undef SLT_NRF24L01_INO
|
||||
#undef SYMAX_NRF24L01_INO
|
||||
|
@ -231,6 +231,7 @@
|
||||
#define PROPEL_NRF24L01_INO
|
||||
#define Q303_NRF24L01_INO
|
||||
#define Q90C_NRF24L01_INO
|
||||
#define REALACC_NRF24L01_INO
|
||||
#define SHENQI_NRF24L01_INO
|
||||
#define SLT_NRF24L01_INO
|
||||
#define SYMAX_NRF24L01_INO
|
||||
@ -700,6 +701,8 @@ const PPM_Parameters PPM_prot[14*NBR_BANKS]= {
|
||||
CX10WD
|
||||
PROTO_Q90C
|
||||
NONE
|
||||
PROTO_REALACC
|
||||
NONE
|
||||
PROTO_REDPINE
|
||||
RED_FAST
|
||||
RED_SLOW
|
||||
|
Loading…
x
Reference in New Issue
Block a user