mirror of
https://github.com/pascallanger/DIY-Multiprotocol-TX-Module.git
synced 2025-02-04 21:48:12 +00:00
New protocol V761
Protocol number: 48 Sub_protocol: none Channel 5: +100% expert, 0% mid=gyro on no rate limits, -100% beginer=gyro on and axis rate limited. ONLY 1 ID IS AVAILABLE SO BE CAREFUL WHILE FLYING.
This commit is contained in:
parent
aa540514b8
commit
443e1cec75
@ -312,8 +312,8 @@ uint16_t BUGSMINI_callback()
|
|||||||
case BUGSMINI_DATA2:
|
case BUGSMINI_DATA2:
|
||||||
// switch to RX mode
|
// switch to RX mode
|
||||||
NRF24L01_SetTxRxMode(TXRX_OFF);
|
NRF24L01_SetTxRxMode(TXRX_OFF);
|
||||||
NRF24L01_SetTxRxMode(RX_EN);
|
|
||||||
NRF24L01_FlushRx();
|
NRF24L01_FlushRx();
|
||||||
|
NRF24L01_SetTxRxMode(RX_EN);
|
||||||
XN297_Configure(_BV(NRF24L01_00_EN_CRC) | _BV(NRF24L01_00_CRCO)
|
XN297_Configure(_BV(NRF24L01_00_EN_CRC) | _BV(NRF24L01_00_CRCO)
|
||||||
| _BV(NRF24L01_00_PWR_UP) | _BV(NRF24L01_00_PRIM_RX));
|
| _BV(NRF24L01_00_PWR_UP) | _BV(NRF24L01_00_PRIM_RX));
|
||||||
phase = BUGSMINI_DATA1;
|
phase = BUGSMINI_DATA1;
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
#define VERSION_MAJOR 1
|
#define VERSION_MAJOR 1
|
||||||
#define VERSION_MINOR 2
|
#define VERSION_MINOR 2
|
||||||
#define VERSION_REVISION 1
|
#define VERSION_REVISION 1
|
||||||
#define VERSION_PATCH_LEVEL 46
|
#define VERSION_PATCH_LEVEL 47
|
||||||
|
|
||||||
//******************
|
//******************
|
||||||
// Protocols
|
// Protocols
|
||||||
@ -74,6 +74,7 @@ enum PROTOCOLS
|
|||||||
PROTO_E01X = 45, // =>NRF24L01
|
PROTO_E01X = 45, // =>NRF24L01
|
||||||
PROTO_V911S = 46, // =>NRF24L01
|
PROTO_V911S = 46, // =>NRF24L01
|
||||||
PROTO_GD00X = 47, // =>NRF24L01
|
PROTO_GD00X = 47, // =>NRF24L01
|
||||||
|
PROTO_V761 = 48, // =>NRF24L01
|
||||||
PROTO_XN297DUMP = 63, // =>NRF24L01
|
PROTO_XN297DUMP = 63, // =>NRF24L01
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -609,6 +610,7 @@ Serial: 100000 Baud 8e2 _ xxxx xxxx p --
|
|||||||
E01X 45
|
E01X 45
|
||||||
V911S 46
|
V911S 46
|
||||||
GD00X 47
|
GD00X 47
|
||||||
|
V761 48
|
||||||
BindBit=> 0x80 1=Bind/0=No
|
BindBit=> 0x80 1=Bind/0=No
|
||||||
AutoBindBit=> 0x40 1=Yes /0=No
|
AutoBindBit=> 0x40 1=Yes /0=No
|
||||||
RangeCheck=> 0x20 1=Yes /0=No
|
RangeCheck=> 0x20 1=Yes /0=No
|
||||||
|
@ -1222,6 +1222,12 @@ static void protocol_init()
|
|||||||
remote_callback = GD00X_callback;
|
remote_callback = GD00X_callback;
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
|
#if defined(V761_NRF24L01_INO)
|
||||||
|
case PROTO_V761:
|
||||||
|
next_callback=initV761();
|
||||||
|
remote_callback = V761_callback;
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
#if defined(XN297DUMP_NRF24L01_INO)
|
#if defined(XN297DUMP_NRF24L01_INO)
|
||||||
case PROTO_XN297DUMP:
|
case PROTO_XN297DUMP:
|
||||||
next_callback=initXN297Dump();
|
next_callback=initXN297Dump();
|
||||||
|
@ -194,8 +194,6 @@ void NRF24L01_SetTxRxMode(enum TXRX_State mode)
|
|||||||
if (mode == RX_EN)
|
if (mode == RX_EN)
|
||||||
{
|
{
|
||||||
NRF_CE_off;
|
NRF_CE_off;
|
||||||
NRF24L01_WriteReg(NRF24L01_07_STATUS, 0x70); // reset the flag(s)
|
|
||||||
NRF24L01_WriteReg(NRF24L01_00_CONFIG, 0x0F); // switch to RX mode
|
|
||||||
NRF24L01_WriteReg(NRF24L01_07_STATUS, (1 << NRF24L01_07_RX_DR) //reset the flag(s)
|
NRF24L01_WriteReg(NRF24L01_07_STATUS, (1 << NRF24L01_07_RX_DR) //reset the flag(s)
|
||||||
| (1 << NRF24L01_07_TX_DS)
|
| (1 << NRF24L01_07_TX_DS)
|
||||||
| (1 << NRF24L01_07_MAX_RT));
|
| (1 << NRF24L01_07_MAX_RT));
|
||||||
|
191
Multiprotocol/V761_nrf24l01.ino
Normal file
191
Multiprotocol/V761_nrf24l01.ino
Normal file
@ -0,0 +1,191 @@
|
|||||||
|
/*
|
||||||
|
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(V761_NRF24L01_INO)
|
||||||
|
|
||||||
|
#include "iface_nrf24l01.h"
|
||||||
|
|
||||||
|
#define V761_PACKET_PERIOD 7060 // Timeout for callback in uSec
|
||||||
|
#define V761_INITIAL_WAIT 500
|
||||||
|
#define V761_PACKET_SIZE 8
|
||||||
|
#define V761_BIND_COUNT 200
|
||||||
|
|
||||||
|
//Fx chan management
|
||||||
|
#define V761_BIND_FREQ 0x28
|
||||||
|
#define V761_RF_NUM_CHANNELS 3
|
||||||
|
|
||||||
|
enum
|
||||||
|
{
|
||||||
|
V761_BIND1 = 0,
|
||||||
|
V761_BIND2,
|
||||||
|
V761_DATA
|
||||||
|
};
|
||||||
|
|
||||||
|
static void __attribute__((unused)) V761_set_checksum()
|
||||||
|
{
|
||||||
|
uint8_t checksum = packet[0];
|
||||||
|
for(uint8_t i=1; i<V761_PACKET_SIZE-2; i++)
|
||||||
|
checksum += packet[i];
|
||||||
|
if(phase == V761_BIND1)
|
||||||
|
{
|
||||||
|
packet[6] = checksum ^ 0xff;
|
||||||
|
packet[7] = packet[6];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
checksum += packet[6];
|
||||||
|
packet[7] = checksum ^ 0xff;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void __attribute__((unused)) V761_send_packet()
|
||||||
|
{
|
||||||
|
if(phase != V761_DATA)
|
||||||
|
{
|
||||||
|
packet[0] = rx_tx_addr[0];
|
||||||
|
packet[1] = rx_tx_addr[1];
|
||||||
|
packet[2] = rx_tx_addr[2];
|
||||||
|
packet[3] = rx_tx_addr[3];
|
||||||
|
packet[4] = hopping_frequency[1];
|
||||||
|
packet[5] = hopping_frequency[2];
|
||||||
|
if(phase == V761_BIND2)
|
||||||
|
packet[6] = 0xf0; // ?
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
packet[0] = convert_channel_8b(THROTTLE); // throttle
|
||||||
|
packet[1] = convert_channel_8b(RUDDER)>>1; // rudder
|
||||||
|
packet[2] = convert_channel_8b(RUDDER)>>1; // elevator
|
||||||
|
packet[3] = 0x3f; // no functional implementation in this model, possibly optional aileron channel for 4ch version?
|
||||||
|
packet[5] = (packet_count++ / 3)<<6;
|
||||||
|
packet[4] = (packet[5] == 0x40) ? 0x1a : 0x20;
|
||||||
|
|
||||||
|
// Channel 5 - Gyro mode is packet 5
|
||||||
|
if(CH5_SW) // Mode Expert Gyro off
|
||||||
|
flags = 0x0c;
|
||||||
|
else
|
||||||
|
if(Channel_data[CH5] < CHANNEL_MIN_COMMAND)
|
||||||
|
flags = 0x08; // Beginer mode (Gyro on, yaw and pitch rate limited)
|
||||||
|
else
|
||||||
|
flags = 0x0a; // Midd Mode ( Gyro on no rate limits)
|
||||||
|
packet[5] |= flags;
|
||||||
|
packet[6] = 0x80; // unknown
|
||||||
|
|
||||||
|
//packet counter
|
||||||
|
if(packet_count >= 12)
|
||||||
|
packet_count = 0;
|
||||||
|
NRF24L01_WriteReg(NRF24L01_05_RF_CH, hopping_frequency[hopping_frequency_no++]);
|
||||||
|
if(hopping_frequency_no >= V761_RF_NUM_CHANNELS)
|
||||||
|
hopping_frequency_no = 0;
|
||||||
|
}
|
||||||
|
V761_set_checksum();
|
||||||
|
// Power on, TX mode, 2byte CRC
|
||||||
|
XN297_Configure(_BV(NRF24L01_00_EN_CRC) | _BV(NRF24L01_00_CRCO) | _BV(NRF24L01_00_PWR_UP));
|
||||||
|
NRF24L01_WriteReg(NRF24L01_07_STATUS, 0x70);
|
||||||
|
NRF24L01_FlushTx();
|
||||||
|
XN297_WritePayload(packet, V761_PACKET_SIZE);
|
||||||
|
NRF24L01_SetPower();
|
||||||
|
}
|
||||||
|
|
||||||
|
static void __attribute__((unused)) V761_init()
|
||||||
|
{
|
||||||
|
NRF24L01_Initialize();
|
||||||
|
NRF24L01_SetTxRxMode(TX_EN);
|
||||||
|
NRF24L01_FlushTx();
|
||||||
|
NRF24L01_FlushRx();
|
||||||
|
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_WriteReg(NRF24L01_03_SETUP_AW, 0x02); // set address length (4 bytes)
|
||||||
|
NRF24L01_WriteReg(NRF24L01_04_SETUP_RETR, 0x00); // no retransmits
|
||||||
|
NRF24L01_SetBitrate(NRF24L01_BR_1M); // 1Mbps
|
||||||
|
NRF24L01_SetPower();
|
||||||
|
NRF24L01_Activate(0x73); // Activate feature register
|
||||||
|
NRF24L01_WriteReg(NRF24L01_1C_DYNPD, 0x00); // Disable dynamic payload length on all pipes
|
||||||
|
NRF24L01_WriteReg(NRF24L01_1D_FEATURE, 0x01);
|
||||||
|
NRF24L01_Activate(0x73);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void __attribute__((unused)) V761_initialize_txid()
|
||||||
|
{
|
||||||
|
// TODO: try arbitrary rx_tx_addr & frequencies (except hopping_frequency[0])
|
||||||
|
// testing for random Rx_tx_address
|
||||||
|
memcpy(rx_tx_addr,(uint8_t *)"\x47\x93\x45\xD5",4); // random 4 bytes x47\x93\x45\xD5
|
||||||
|
//Actual rx_tx_addr from SPI grab)
|
||||||
|
//memcpy(rx_tx_addr,(uint8_t *)"\x6f\x2c\xb1\x93",4);
|
||||||
|
memcpy(hopping_frequency,(uint8_t *)"\x14\x32\x46",3); // random 2 bytes for hopping_frequency[1] = 0x32 hopping_frequency[2] = 0x46;
|
||||||
|
//Actual hopping_frequency from SPI grab)
|
||||||
|
//memcpy(hopping_frequency,(uint8_t *)"\x14\x1e\x4b",3);
|
||||||
|
//hopping_frequency[0] = 0x14; // not sure if this one is const or calculated ... // combined into one memcopy
|
||||||
|
//hopping_frequency[1] = 0x1e; //combined into one memcopy
|
||||||
|
//hopping_frequency[2] = 0x4b; //combined into one memcopy
|
||||||
|
}
|
||||||
|
|
||||||
|
uint16_t V761_callback()
|
||||||
|
{
|
||||||
|
switch(phase)
|
||||||
|
{
|
||||||
|
case V761_BIND1:
|
||||||
|
if(bind_counter)
|
||||||
|
bind_counter--;
|
||||||
|
packet_count ++;
|
||||||
|
NRF24L01_WriteReg(NRF24L01_05_RF_CH, V761_BIND_FREQ);
|
||||||
|
XN297_SetTXAddr((uint8_t*)"\x34\x43\x10\x10", 4);
|
||||||
|
V761_send_packet();
|
||||||
|
if(packet_count >= 20)
|
||||||
|
{
|
||||||
|
packet_count = 0;
|
||||||
|
phase = V761_BIND2;
|
||||||
|
}
|
||||||
|
return 15730;
|
||||||
|
case V761_BIND2:
|
||||||
|
if(bind_counter)
|
||||||
|
bind_counter--;
|
||||||
|
packet_count ++;
|
||||||
|
NRF24L01_WriteReg(NRF24L01_05_RF_CH, hopping_frequency[0]);
|
||||||
|
XN297_SetTXAddr(rx_tx_addr, 4);
|
||||||
|
V761_send_packet();
|
||||||
|
if(bind_counter == 0)
|
||||||
|
{
|
||||||
|
phase = V761_DATA;
|
||||||
|
BIND_DONE;
|
||||||
|
return 15730;
|
||||||
|
}
|
||||||
|
if(packet_count >= 20)
|
||||||
|
{
|
||||||
|
packet_count = 0;
|
||||||
|
phase = V761_BIND1;
|
||||||
|
}
|
||||||
|
return 15730;
|
||||||
|
case V761_DATA:
|
||||||
|
V761_send_packet();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return V761_PACKET_PERIOD;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint16_t initV761(void)
|
||||||
|
{
|
||||||
|
BIND_IN_PROGRESS;
|
||||||
|
bind_counter = V761_BIND_COUNT;
|
||||||
|
V761_initialize_txid();
|
||||||
|
phase = V761_BIND1;
|
||||||
|
V761_init();
|
||||||
|
hopping_frequency_no = 0;
|
||||||
|
packet_count = 0;
|
||||||
|
return V761_INITIAL_WAIT;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
@ -185,6 +185,7 @@
|
|||||||
#undef BUGSMINI_NRF24L01_INO
|
#undef BUGSMINI_NRF24L01_INO
|
||||||
#undef NCC1701_NRF24L01_INO
|
#undef NCC1701_NRF24L01_INO
|
||||||
#undef E01X_NRF24L01_INO
|
#undef E01X_NRF24L01_INO
|
||||||
|
#undef V761_NRF24L01_INO
|
||||||
#undef V911S_NRF24L01_INO
|
#undef V911S_NRF24L01_INO
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -193,6 +193,7 @@
|
|||||||
#define SLT_NRF24L01_INO
|
#define SLT_NRF24L01_INO
|
||||||
#define SYMAX_NRF24L01_INO
|
#define SYMAX_NRF24L01_INO
|
||||||
#define V2X2_NRF24L01_INO
|
#define V2X2_NRF24L01_INO
|
||||||
|
#define V761_NRF24L01_INO
|
||||||
#define V911S_NRF24L01_INO
|
#define V911S_NRF24L01_INO
|
||||||
#define YD717_NRF24L01_INO
|
#define YD717_NRF24L01_INO
|
||||||
|
|
||||||
@ -603,6 +604,8 @@ const PPM_Parameters PPM_prot[14*NBR_BANKS]= {
|
|||||||
PROTO_V2X2
|
PROTO_V2X2
|
||||||
V2X2
|
V2X2
|
||||||
JXD506
|
JXD506
|
||||||
|
PROTO_V761
|
||||||
|
NONE
|
||||||
PROTO_V911S
|
PROTO_V911S
|
||||||
NONE
|
NONE
|
||||||
PROTO_WFLY
|
PROTO_WFLY
|
||||||
|
Loading…
x
Reference in New Issue
Block a user