mirror of
https://github.com/pascallanger/DIY-Multiprotocol-TX-Module.git
synced 2025-03-14 12:19:11 +00:00
Bayang RX: Sync
This commit is contained in:
parent
396c005b0a
commit
0008633d6e
@ -65,7 +65,7 @@ static void __attribute__((unused)) Bayang_Rx_build_telemetry_packet()
|
|||||||
uint8_t idx = 0;
|
uint8_t idx = 0;
|
||||||
|
|
||||||
packet_in[idx++] = RX_LQI;
|
packet_in[idx++] = RX_LQI;
|
||||||
packet_in[idx++] = RX_LQI; // no RSSI
|
packet_in[idx++] = RX_LQI>>1; // no RSSI: 125..0
|
||||||
packet_in[idx++] = 0; // start channel
|
packet_in[idx++] = 0; // start channel
|
||||||
packet_in[idx++] = 10; // number of channels in packet
|
packet_in[idx++] = 10; // number of channels in packet
|
||||||
|
|
||||||
@ -104,6 +104,7 @@ uint16_t initBayang_Rx()
|
|||||||
Bayang_Rx_init_nrf24l01();
|
Bayang_Rx_init_nrf24l01();
|
||||||
hopping_frequency_no = 0;
|
hopping_frequency_no = 0;
|
||||||
rx_data_started = false;
|
rx_data_started = false;
|
||||||
|
rx_data_received = false;
|
||||||
|
|
||||||
if (IS_BIND_IN_PROGRESS) {
|
if (IS_BIND_IN_PROGRESS) {
|
||||||
phase = BAYANG_RX_BIND;
|
phase = BAYANG_RX_BIND;
|
||||||
@ -160,7 +161,8 @@ uint16_t Bayang_Rx_callback()
|
|||||||
telemetry_link = 1;
|
telemetry_link = 1;
|
||||||
}
|
}
|
||||||
rx_data_started = true;
|
rx_data_started = true;
|
||||||
read_retry = 4;
|
rx_data_received = true;
|
||||||
|
read_retry = 8;
|
||||||
pps_counter++;
|
pps_counter++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -168,12 +170,11 @@ uint16_t Bayang_Rx_callback()
|
|||||||
if (millis() - pps_timer >= 1000) {
|
if (millis() - pps_timer >= 1000) {
|
||||||
pps_timer = millis();
|
pps_timer = millis();
|
||||||
debugln("%d pps", pps_counter);
|
debugln("%d pps", pps_counter);
|
||||||
RX_LQI = pps_counter / 2;
|
RX_LQI = pps_counter >> 1;
|
||||||
pps_counter = 0;
|
pps_counter = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// frequency hopping
|
// frequency hopping
|
||||||
if (read_retry++ >= 4) {
|
if (read_retry++ >= 8) {
|
||||||
hopping_frequency_no++;
|
hopping_frequency_no++;
|
||||||
if (hopping_frequency_no >= BAYANG_RX_RF_NUM_CHANNELS)
|
if (hopping_frequency_no >= BAYANG_RX_RF_NUM_CHANNELS)
|
||||||
hopping_frequency_no = 0;
|
hopping_frequency_no = 0;
|
||||||
@ -181,7 +182,20 @@ uint16_t Bayang_Rx_callback()
|
|||||||
NRF24L01_FlushRx();
|
NRF24L01_FlushRx();
|
||||||
NRF24L01_WriteReg(NRF24L01_07_STATUS, 0x70);
|
NRF24L01_WriteReg(NRF24L01_07_STATUS, 0x70);
|
||||||
if (rx_data_started)
|
if (rx_data_started)
|
||||||
|
{
|
||||||
|
if(rx_data_received)
|
||||||
|
{ // In sync
|
||||||
|
rx_data_received = false;
|
||||||
|
read_retry = 5;
|
||||||
|
return 1500;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{ // packet lost
|
||||||
read_retry = 0;
|
read_retry = 0;
|
||||||
|
if(RX_LQI==0) // communication lost
|
||||||
|
rx_data_started=false;
|
||||||
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
read_retry = -16; // retry longer until first packet is caught
|
read_retry = -16; // retry longer until first packet is caught
|
||||||
}
|
}
|
||||||
|
@ -229,6 +229,7 @@ uint8_t packet_in[TELEMETRY_BUFFER_SIZE];//telemetry receiving packets
|
|||||||
//RX protocols
|
//RX protocols
|
||||||
#if defined(AFHDS2A_RX_A7105_INO) || defined(FRSKY_RX_CC2500_INO) || defined(BAYANG_RX_NRF24L01_INO)
|
#if defined(AFHDS2A_RX_A7105_INO) || defined(FRSKY_RX_CC2500_INO) || defined(BAYANG_RX_NRF24L01_INO)
|
||||||
bool rx_data_started;
|
bool rx_data_started;
|
||||||
|
bool rx_data_received;
|
||||||
bool rx_disable_lna;
|
bool rx_disable_lna;
|
||||||
uint16_t rx_rc_chan[16];
|
uint16_t rx_rc_chan[16];
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user