mirror of
https://github.com/pascallanger/DIY-Multiprotocol-TX-Module.git
synced 2025-02-04 18:48:11 +00:00
Tweakes
This commit is contained in:
parent
243bdf2240
commit
d29461607b
@ -232,7 +232,7 @@ static void __attribute__((unused)) FrSkyX_build_packet()
|
|||||||
if(nbr_bytes)
|
if(nbr_bytes)
|
||||||
{//Check the buffer status
|
{//Check the buffer status
|
||||||
uint8_t used = SportTail;
|
uint8_t used = SportTail;
|
||||||
if ( SportHead >= SportTail )
|
if ( SportHead > SportTail )
|
||||||
used += MAX_SPORT_BUFFER - SportHead ;
|
used += MAX_SPORT_BUFFER - SportHead ;
|
||||||
else
|
else
|
||||||
used -= SportHead ;
|
used -= SportHead ;
|
||||||
@ -353,7 +353,7 @@ uint16_t ReadFrSkyX()
|
|||||||
case FRSKY_DATA3:
|
case FRSKY_DATA3:
|
||||||
uint8_t rssi;
|
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
|
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;
|
transmit=false;
|
||||||
debugln("Busy %d %d",hopping_frequency_no,rssi);
|
debugln("Busy %d %d",hopping_frequency_no,rssi);
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
#define VERSION_MAJOR 1
|
#define VERSION_MAJOR 1
|
||||||
#define VERSION_MINOR 3
|
#define VERSION_MINOR 3
|
||||||
#define VERSION_REVISION 0
|
#define VERSION_REVISION 0
|
||||||
#define VERSION_PATCH_LEVEL 25
|
#define VERSION_PATCH_LEVEL 26
|
||||||
|
|
||||||
//******************
|
//******************
|
||||||
// Protocols
|
// Protocols
|
||||||
@ -299,11 +299,11 @@ enum TRAXXAS
|
|||||||
|
|
||||||
struct PPM_Parameters
|
struct PPM_Parameters
|
||||||
{
|
{
|
||||||
uint8_t protocol : 6;
|
uint8_t protocol;
|
||||||
uint8_t sub_proto : 3;
|
uint8_t sub_proto : 3;
|
||||||
uint8_t rx_num : 4;
|
uint8_t rx_num : 6;
|
||||||
uint8_t power : 1;
|
uint8_t power : 1;
|
||||||
uint8_t autobind : 1;
|
uint8_t autobind : 1;
|
||||||
int8_t option;
|
int8_t option;
|
||||||
uint32_t chan_order;
|
uint32_t chan_order;
|
||||||
};
|
};
|
||||||
|
@ -1712,9 +1712,12 @@ void update_serial_data()
|
|||||||
#endif
|
#endif
|
||||||
if(IS_RX_MISSED_BUFF_on) // If the buffer is still valid
|
if(IS_RX_MISSED_BUFF_on) // If the buffer is still valid
|
||||||
{
|
{
|
||||||
rx_len=rx_idx;
|
if(rx_idx>=26 && rx_idx<RXBUFFER_SIZE)
|
||||||
memcpy((void*)rx_ok_buff,(const void*)rx_buff,rx_len);// Duplicate the buffer
|
{
|
||||||
RX_FLAG_on; // data to be processed next time...
|
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;
|
RX_MISSED_BUFF_off;
|
||||||
}
|
}
|
||||||
#ifdef ORANGE_TX
|
#ifdef ORANGE_TX
|
||||||
@ -2085,14 +2088,14 @@ static uint32_t random_id(uint16_t address, uint8_t create_new)
|
|||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
#if defined STM32_BOARD
|
#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->SR = 0x1E5F & ~TIMER_SR_CC2IF; // Clear Timer2/Comp2 interrupt flag
|
||||||
TIMER2_BASE->DIER |= TIMER_DIER_CC2IE; // Enable Timer2/Comp2 interrupt
|
TIMER2_BASE->DIER |= TIMER_DIER_CC2IE; // Enable Timer2/Comp2 interrupt
|
||||||
#else
|
#else
|
||||||
TX_RX_PAUSE_on;
|
TX_RX_PAUSE_on;
|
||||||
tx_pause();
|
tx_pause();
|
||||||
cli(); // Disable global int due to RW of 16 bits registers
|
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
|
sei(); // Enable global int
|
||||||
TIFR1 = OCF1B_bm ; // clear OCR1B match flag
|
TIFR1 = OCF1B_bm ; // clear OCR1B match flag
|
||||||
SET_TIMSK1_OCIE1B ; // enable interrupt on compare B match
|
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
|
rx_buff[rx_idx++]=UDR0; // Store received byte
|
||||||
#if defined STM32_BOARD
|
#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
|
#else
|
||||||
cli(); // Disable global int due to RW of 16 bits registers
|
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
|
sei(); // Enable global int
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@ -2149,11 +2152,12 @@ static uint32_t random_id(uint16_t address, uint8_t create_new)
|
|||||||
#elif defined STM32_BOARD
|
#elif defined STM32_BOARD
|
||||||
void ISR_COMPB()
|
void ISR_COMPB()
|
||||||
#else
|
#else
|
||||||
ISR(TIMER1_COMPB_vect, ISR_NOBLOCK )
|
ISR(TIMER1_COMPB_vect)
|
||||||
#endif
|
#endif
|
||||||
{ // Timer1 compare B interrupt
|
{ // Timer1 compare B interrupt
|
||||||
if(rx_idx>=26)
|
if(rx_idx>=26 && rx_idx<RXBUFFER_SIZE)
|
||||||
{
|
{
|
||||||
|
debugln("%d",rx_idx);
|
||||||
#ifdef MULTI_SYNC
|
#ifdef MULTI_SYNC
|
||||||
last_serial_input=TCNT1;
|
last_serial_input=TCNT1;
|
||||||
#endif
|
#endif
|
||||||
|
@ -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)
|
rssi_rel = rssi - 128; // relative power levels 0-127 (equals -137 to -72 dBm)
|
||||||
}
|
}
|
||||||
else {
|
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;
|
return rssi_rel;
|
||||||
}
|
}
|
||||||
|
@ -1287,4 +1287,9 @@ ISR(TIMER0_OVF_vect)
|
|||||||
|
|
||||||
#endif // BASH_SERIAL
|
#endif // BASH_SERIAL
|
||||||
|
|
||||||
|
#else
|
||||||
|
void telemetry_set_input_sync(uint16_t refreshRate)
|
||||||
|
{
|
||||||
|
(void)refreshRate;
|
||||||
|
}
|
||||||
#endif // TELEMETRY
|
#endif // TELEMETRY
|
||||||
|
Loading…
x
Reference in New Issue
Block a user