mirror of
https://github.com/pascallanger/DIY-Multiprotocol-TX-Module.git
synced 2025-02-04 19:48:11 +00:00
Fixed xn297 scramble mode affecting cx-10a and probably other xn297 based protocols...
This commit is contained in:
parent
4486582006
commit
6d752acb28
@ -25,7 +25,6 @@
|
||||
#define Q282_PACKET_SIZE 21
|
||||
#define CX10_PACKET_PERIOD 1316 // Timeout for callback in uSec
|
||||
#define CX10A_PACKET_PERIOD 6000
|
||||
#define CX10A_BIND_COUNT 400 // 2 seconds
|
||||
|
||||
#define CX10_INITIAL_WAIT 500
|
||||
|
||||
@ -198,12 +197,6 @@ uint16_t CX10_callback()
|
||||
}
|
||||
break;
|
||||
case CX10_BIND2:
|
||||
bind_counter--;
|
||||
if(bind_counter==0)
|
||||
{ // Needed for some CX-10A to properly finish the bind
|
||||
CX10_init();
|
||||
bind_counter=CX10A_BIND_COUNT;
|
||||
}
|
||||
if( NRF24L01_ReadReg(NRF24L01_07_STATUS) & BV(NRF24L01_07_RX_DR))
|
||||
{ // RX fifo data ready
|
||||
XN297_ReadPayload(packet, packet_length);
|
||||
@ -211,16 +204,18 @@ uint16_t CX10_callback()
|
||||
NRF24L01_SetTxRxMode(TX_EN);
|
||||
if(packet[9] == 1)
|
||||
{
|
||||
phase = CX10_BIND1;
|
||||
bind_counter=0;
|
||||
BIND_DONE;
|
||||
phase = CX10_DATA;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// switch to TX mode
|
||||
NRF24L01_SetTxRxMode(TXRX_OFF);
|
||||
NRF24L01_FlushTx();
|
||||
NRF24L01_SetTxRxMode(TX_EN);
|
||||
CX10_Write_Packet(1);
|
||||
_delay_us(1000);
|
||||
_delay_us(400);
|
||||
// switch to RX mode
|
||||
NRF24L01_SetTxRxMode(TXRX_OFF);
|
||||
NRF24L01_FlushRx();
|
||||
@ -270,7 +265,6 @@ uint16_t initCX10(void)
|
||||
packet_period = CX10A_PACKET_PERIOD;
|
||||
|
||||
phase = CX10_BIND2;
|
||||
bind_counter=CX10A_BIND_COUNT;
|
||||
|
||||
for(uint8_t i=0; i<4; i++)
|
||||
packet[5+i] = 0xff; // clear aircraft id
|
||||
|
@ -258,7 +258,7 @@ uint8_t NRF24L01_packet_ack()
|
||||
|
||||
///////////////
|
||||
// XN297 emulation layer
|
||||
uint8_t xn297_scramble_enabled;
|
||||
uint8_t xn297_scramble_enabled=1; //enabled by default
|
||||
uint8_t xn297_addr_len;
|
||||
uint8_t xn297_tx_addr[5];
|
||||
uint8_t xn297_rx_addr[5];
|
||||
|
Loading…
x
Reference in New Issue
Block a user