This commit is contained in:
pascallanger 2019-10-29 00:36:57 +01:00
parent 243bdf2240
commit d29461607b
5 changed files with 27 additions and 18 deletions

View File

@ -232,7 +232,7 @@ static void __attribute__((unused)) FrSkyX_build_packet()
if(nbr_bytes)
{//Check the buffer status
uint8_t used = SportTail;
if ( SportHead >= SportTail )
if ( SportHead > SportTail )
used += MAX_SPORT_BUFFER - SportHead ;
else
used -= SportHead ;
@ -353,7 +353,7 @@ uint16_t ReadFrSkyX()
case FRSKY_DATA3:
uint8_t rssi;
rssi = CC2500_ReadReg(CC2500_34_RSSI | CC2500_READ_BURST); // 0.5 db/count, RSSI value read from the RSSI status register is a 2's complement number
if ((sub_protocol & 2) && rssi > 72 && rssi < 128) //LBT and RSSI between -36 to -8.5 dBm
if ((sub_protocol & 2) && rssi < 128) //LBT and RSSI between -73 to -8.5 dBm (-36dBm=72)
{
transmit=false;
debugln("Busy %d %d",hopping_frequency_no,rssi);

View File

@ -19,7 +19,7 @@
#define VERSION_MAJOR 1
#define VERSION_MINOR 3
#define VERSION_REVISION 0
#define VERSION_PATCH_LEVEL 25
#define VERSION_PATCH_LEVEL 26
//******************
// Protocols
@ -299,11 +299,11 @@ enum TRAXXAS
struct PPM_Parameters
{
uint8_t protocol : 6;
uint8_t sub_proto : 3;
uint8_t rx_num : 4;
uint8_t power : 1;
uint8_t autobind : 1;
uint8_t protocol;
uint8_t sub_proto : 3;
uint8_t rx_num : 6;
uint8_t power : 1;
uint8_t autobind : 1;
int8_t option;
uint32_t chan_order;
};

View File

@ -1712,9 +1712,12 @@ void update_serial_data()
#endif
if(IS_RX_MISSED_BUFF_on) // If the buffer is still valid
{
rx_len=rx_idx;
memcpy((void*)rx_ok_buff,(const void*)rx_buff,rx_len);// Duplicate the buffer
RX_FLAG_on; // data to be processed next time...
if(rx_idx>=26 && rx_idx<RXBUFFER_SIZE)
{
rx_len=rx_idx;
memcpy((void*)rx_ok_buff,(const void*)rx_buff,rx_len);// Duplicate the buffer
RX_FLAG_on; // data to be processed next time...
}
RX_MISSED_BUFF_off;
}
#ifdef ORANGE_TX
@ -2085,14 +2088,14 @@ static uint32_t random_id(uint16_t address, uint8_t create_new)
#endif
{
#if defined STM32_BOARD
TIMER2_BASE->CCR2=TIMER2_BASE->CNT + 360; // Next byte should show up within 18??s=1.5 byte
TIMER2_BASE->CCR2=TIMER2_BASE->CNT + 500; // Next byte should show up within 250us (1 byte = 120us)
TIMER2_BASE->SR = 0x1E5F & ~TIMER_SR_CC2IF; // Clear Timer2/Comp2 interrupt flag
TIMER2_BASE->DIER |= TIMER_DIER_CC2IE; // Enable Timer2/Comp2 interrupt
#else
TX_RX_PAUSE_on;
tx_pause();
cli(); // Disable global int due to RW of 16 bits registers
OCR1B = TCNT1 + 360; // Next byte should show up within 18??s=1.5 byte
OCR1B = TCNT1 + 500; // Next byte should show up within 250us (1 byte = 120us)
sei(); // Enable global int
TIFR1 = OCF1B_bm ; // clear OCR1B match flag
SET_TIMSK1_OCIE1B ; // enable interrupt on compare B match
@ -2111,10 +2114,10 @@ static uint32_t random_id(uint16_t address, uint8_t create_new)
{
rx_buff[rx_idx++]=UDR0; // Store received byte
#if defined STM32_BOARD
TIMER2_BASE->CCR2=TIMER2_BASE->CNT + 360; // Next byte should show up within 18??s=1.5 byte
TIMER2_BASE->CCR2=TIMER2_BASE->CNT + 500; // Next byte should show up within 250us (1 byte = 120us)
#else
cli(); // Disable global int due to RW of 16 bits registers
OCR1B = TCNT1 + 360; // Next byte should show up within 18??s=1.5 byte
OCR1B = TCNT1 + 500; // Next byte should show up within 250us (1 byte = 120us)
sei(); // Enable global int
#endif
}
@ -2149,11 +2152,12 @@ static uint32_t random_id(uint16_t address, uint8_t create_new)
#elif defined STM32_BOARD
void ISR_COMPB()
#else
ISR(TIMER1_COMPB_vect, ISR_NOBLOCK )
ISR(TIMER1_COMPB_vect)
#endif
{ // Timer1 compare B interrupt
if(rx_idx>=26)
if(rx_idx>=26 && rx_idx<RXBUFFER_SIZE)
{
debugln("%d",rx_idx);
#ifdef MULTI_SYNC
last_serial_input=TCNT1;
#endif

View File

@ -90,7 +90,7 @@ static int __attribute__((unused)) Scanner_scan_rssi()
rssi_rel = rssi - 128; // relative power levels 0-127 (equals -137 to -72 dBm)
}
else {
rssi_rel = rssi + 128; // relativ power levels 128-255 (equals -73 to -10 dBm)
rssi_rel = rssi + 128; // relative power levels 128-255 (equals -73 to -10 dBm)
}
return rssi_rel;
}

View File

@ -1287,4 +1287,9 @@ ISR(TIMER0_OVF_vect)
#endif // BASH_SERIAL
#else
void telemetry_set_input_sync(uint16_t refreshRate)
{
(void)refreshRate;
}
#endif // TELEMETRY