mirror of
https://github.com/pascallanger/DIY-Multiprotocol-TX-Module.git
synced 2025-07-12 17:57:53 +00:00
Merge b0e07c569d46a4c39db9501b0504f7e744df6917 into dd3f8b4717c03dc2f86701191dc8b265d4706751
This commit is contained in:
commit
bc59d80bc9
@ -25,6 +25,7 @@ Multiprotocol is distributed in the hope that it will be useful,
|
||||
#define BAYANG_PACKET_SIZE 15
|
||||
#define BAYANG_RF_NUM_CHANNELS 4
|
||||
#define BAYANG_RF_BIND_CHANNEL 0
|
||||
#define BAYANG_RF_BIND_CHANNEL_X16_AH 10
|
||||
#define BAYANG_ADDRESS_LENGTH 5
|
||||
|
||||
enum BAYANG_FLAGS {
|
||||
@ -35,9 +36,12 @@ enum BAYANG_FLAGS {
|
||||
BAYANG_FLAG_VIDEO = 0x10,
|
||||
BAYANG_FLAG_PICTURE = 0x20,
|
||||
// flags going to packet[3]
|
||||
BAYANG_FLAG_INVERTED = 0x80 // inverted flight on Floureon H101
|
||||
BAYANG_FLAG_INVERTED = 0x80, // inverted flight on Floureon H101
|
||||
BAYANG_FLAG_TAKE_OFF = 0x20, // take off / landing on X16 AH
|
||||
};
|
||||
|
||||
uint8_t bayang_bind_chan;
|
||||
|
||||
static void __attribute__((unused)) BAYANG_send_packet(uint8_t bind)
|
||||
{
|
||||
uint8_t i;
|
||||
@ -53,15 +57,29 @@ static void __attribute__((unused)) BAYANG_send_packet(uint8_t bind)
|
||||
packet[i+1]=rx_tx_addr[i];
|
||||
for(i=0;i<4;i++)
|
||||
packet[i+6]=hopping_frequency[i];
|
||||
switch (sub_protocol) {
|
||||
case X16_AH:
|
||||
packet[10] = 0x00;
|
||||
packet[11] = 0x00;
|
||||
break;
|
||||
default:
|
||||
packet[10] = rx_tx_addr[0]; // txid[0]
|
||||
packet[11] = rx_tx_addr[1]; // txid[1]
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
uint16_t val;
|
||||
switch (sub_protocol) {
|
||||
case X16_AH:
|
||||
packet[0] = 0xA6;
|
||||
break;
|
||||
default:
|
||||
packet[0] = 0xA5;
|
||||
break;
|
||||
}
|
||||
packet[1] = 0xFA; // normal mode is 0xf7, expert 0xfa
|
||||
|
||||
//Flags packet[2]
|
||||
packet[2] = 0x00;
|
||||
if(Servo_AUX1)
|
||||
@ -78,7 +96,8 @@ static void __attribute__((unused)) BAYANG_send_packet(uint8_t bind)
|
||||
packet[3] = 0x00;
|
||||
if(Servo_AUX6)
|
||||
packet[3] = BAYANG_FLAG_INVERTED;
|
||||
|
||||
if(Servo_AUX7)
|
||||
packet[3] |= BAYANG_FLAG_TAKE_OFF;
|
||||
//Aileron
|
||||
val = convert_channel_10b(AILERON);
|
||||
packet[4] = (val>>8) + ((val>>2) & 0xFC);
|
||||
@ -96,13 +115,26 @@ static void __attribute__((unused)) BAYANG_send_packet(uint8_t bind)
|
||||
packet[10] = (val>>8) + (val>>2 & 0xFC);
|
||||
packet[11] = val & 0xFF;
|
||||
}
|
||||
switch (sub_protocol) {
|
||||
case H8S3D:
|
||||
packet[12] = rx_tx_addr[2]; // txid[2]
|
||||
packet[13] = sub_protocol==H8S3D?0x34:0x0A;
|
||||
packet[13] = 0x34;
|
||||
break;
|
||||
case X16_AH:
|
||||
packet[12] = 0;
|
||||
packet[13] = 0;
|
||||
break;
|
||||
default:
|
||||
packet[12] = rx_tx_addr[2]; // txid[2]
|
||||
packet[13] = 0x0A;
|
||||
break;
|
||||
}
|
||||
|
||||
packet[14] = 0;
|
||||
for (uint8_t i=0; i < BAYANG_PACKET_SIZE-1; i++)
|
||||
packet[14] += packet[i];
|
||||
|
||||
NRF24L01_WriteReg(NRF24L01_05_RF_CH, bind ? BAYANG_RF_BIND_CHANNEL:hopping_frequency[hopping_frequency_no++]);
|
||||
NRF24L01_WriteReg(NRF24L01_05_RF_CH, bind ? bayang_bind_chan:hopping_frequency[hopping_frequency_no++]);
|
||||
hopping_frequency_no%=BAYANG_RF_NUM_CHANNELS;
|
||||
|
||||
// clear packet status bits and TX FIFO
|
||||
@ -250,6 +282,14 @@ uint16_t initBAYANG(void)
|
||||
BAYANG_initialize_txid();
|
||||
BAYANG_init();
|
||||
packet_count=0;
|
||||
switch (sub_protocol) {
|
||||
case X16_AH:
|
||||
bayang_bind_chan = BAYANG_RF_BIND_CHANNEL_X16_AH;
|
||||
break;
|
||||
default:
|
||||
bayang_bind_chan = BAYANG_RF_BIND_CHANNEL;
|
||||
break;
|
||||
}
|
||||
#ifdef BAYANG_HUB_TELEMETRY
|
||||
init_frskyd_link_telemetry();
|
||||
telemetry_lost=1; // do not send telemetry to TX right away until we have a TX_RSSI value to prevent warning message...
|
||||
|
@ -136,7 +136,8 @@ enum CG023
|
||||
enum BAYANG
|
||||
{
|
||||
BAYANG = 0,
|
||||
H8S3D = 1
|
||||
H8S3D = 1,
|
||||
X16_AH = 2,
|
||||
};
|
||||
enum MT99XX
|
||||
{
|
||||
@ -537,6 +538,7 @@ Serial: 100000 Baud 8e2 _ xxxx xxxx p --
|
||||
sub_protocol==BAYANG
|
||||
BAYANG 0
|
||||
H8S3D 1
|
||||
X16_AH 2
|
||||
sub_protocol==MT99XX
|
||||
MT99 0
|
||||
H7 1
|
||||
|
@ -305,6 +305,7 @@ const PPM_Parameters PPM_prot[15]= {
|
||||
MODE_BAYANG
|
||||
BAYANG
|
||||
H8S3D
|
||||
X16_AH
|
||||
MODE_ESKY
|
||||
NONE
|
||||
MODE_MT99XX
|
||||
|
Loading…
x
Reference in New Issue
Block a user