mirror of
https://github.com/pascallanger/DIY-Multiprotocol-TX-Module.git
synced 2025-07-13 18:27:55 +00:00
Expanded Bayang protocol to have Option 2, which adds two analog auxiliary channels driven by channels 14 and 15. The expert byte is taken over, as is the extra txid byte, which is not used by Silverware.
This commit is contained in:
parent
db093cf25b
commit
4b6185548e
@ -47,7 +47,7 @@ static void __attribute__((unused)) BAYANG_send_packet(uint8_t bind)
|
|||||||
if (bind)
|
if (bind)
|
||||||
{
|
{
|
||||||
#ifdef BAYANG_HUB_TELEMETRY
|
#ifdef BAYANG_HUB_TELEMETRY
|
||||||
if(option)
|
if(option > 0)
|
||||||
packet[0]= 0xA3; // telemetry is enabled
|
packet[0]= 0xA3; // telemetry is enabled
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
@ -86,7 +86,13 @@ static void __attribute__((unused)) BAYANG_send_packet(uint8_t bind)
|
|||||||
packet[0] = 0xA5;
|
packet[0] = 0xA5;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
packet[1] = 0xFA; // normal mode is 0xf7, expert 0xfa
|
if (option == 2)
|
||||||
|
{
|
||||||
|
// Analog aux channel 1 (channel 14)
|
||||||
|
packet[1] = convert_channel_8b(CH14);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
packet[1] = 0xFA; // normal mode is 0xf7, expert 0xfa
|
||||||
|
|
||||||
//Flags packet[2]
|
//Flags packet[2]
|
||||||
packet[2] = 0x00;
|
packet[2] = 0x00;
|
||||||
@ -110,7 +116,7 @@ static void __attribute__((unused)) BAYANG_send_packet(uint8_t bind)
|
|||||||
if(CH11_SW)
|
if(CH11_SW)
|
||||||
dyntrim = 0;
|
dyntrim = 0;
|
||||||
if(CH12_SW)
|
if(CH12_SW)
|
||||||
packet[3] |= BAYANG_FLAG_TAKE_OFF;
|
packet[3] |= BAYANG_FLAG_TAKE_OFF;
|
||||||
if(CH13_SW)
|
if(CH13_SW)
|
||||||
packet[3] |= BAYANG_FLAG_EMG_STOP;
|
packet[3] |= BAYANG_FLAG_EMG_STOP;
|
||||||
//Aileron
|
//Aileron
|
||||||
@ -146,7 +152,13 @@ static void __attribute__((unused)) BAYANG_send_packet(uint8_t bind)
|
|||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
packet[12] = rx_tx_addr[2]; // txid[2]
|
packet[12] = rx_tx_addr[2]; // txid[2]
|
||||||
packet[13] = 0x0A;
|
if (option == 2)
|
||||||
|
{
|
||||||
|
// Analog aux channel 2 (channel 15)
|
||||||
|
packet[13] = convert_channel_8b(CH15);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
packet[13] = 0x0A;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
packet[14] = 0;
|
packet[14] = 0;
|
||||||
@ -170,7 +182,7 @@ static void __attribute__((unused)) BAYANG_send_packet(uint8_t bind)
|
|||||||
XN297_Configure(_BV(NRF24L01_00_EN_CRC) | _BV(NRF24L01_00_CRCO) | _BV(NRF24L01_00_PWR_UP));
|
XN297_Configure(_BV(NRF24L01_00_EN_CRC) | _BV(NRF24L01_00_CRCO) | _BV(NRF24L01_00_PWR_UP));
|
||||||
|
|
||||||
#ifdef BAYANG_HUB_TELEMETRY
|
#ifdef BAYANG_HUB_TELEMETRY
|
||||||
if (option)
|
if (option > 0)
|
||||||
{ // switch radio to rx as soon as packet is sent
|
{ // switch radio to rx as soon as packet is sent
|
||||||
while (!(NRF24L01_ReadReg(NRF24L01_07_STATUS) & _BV(NRF24L01_07_TX_DS)));
|
while (!(NRF24L01_ReadReg(NRF24L01_07_STATUS) & _BV(NRF24L01_07_TX_DS)));
|
||||||
NRF24L01_WriteReg(NRF24L01_00_CONFIG, 0x03);
|
NRF24L01_WriteReg(NRF24L01_00_CONFIG, 0x03);
|
||||||
@ -253,7 +265,7 @@ uint16_t BAYANG_callback()
|
|||||||
BAYANG_send_packet(0);
|
BAYANG_send_packet(0);
|
||||||
packet_count++;
|
packet_count++;
|
||||||
#ifdef BAYANG_HUB_TELEMETRY
|
#ifdef BAYANG_HUB_TELEMETRY
|
||||||
if (option)
|
if (option > 0)
|
||||||
{ // telemetry is enabled
|
{ // telemetry is enabled
|
||||||
state++;
|
state++;
|
||||||
if (state > 1000)
|
if (state > 1000)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user