mirror of
https://github.com/pascallanger/DIY-Multiprotocol-TX-Module.git
synced 2025-07-01 01:57:52 +00:00
FrSkyX LBT RSSI timing improvement
This commit is contained in:
parent
9f1bdc901c
commit
400fdb3cc6
@ -297,51 +297,8 @@ uint16_t ReadFrSkyX()
|
||||
FrSkyX_initialize_data(0);
|
||||
hopping_frequency_no=0;
|
||||
BIND_DONE;
|
||||
state++;
|
||||
state++; //FRSKY_DATA1
|
||||
break;
|
||||
case FRSKY_DATA1:
|
||||
if ( prev_option != option )
|
||||
{
|
||||
CC2500_WriteReg(CC2500_0C_FSCTRL0,option); //Frequency offset hack
|
||||
prev_option = option ;
|
||||
}
|
||||
FrSkyX_set_start(hopping_frequency_no);
|
||||
transmit=true;
|
||||
#ifdef FRSKYX_LBT
|
||||
CC2500_Strobe(CC2500_SIDLE);
|
||||
state++;
|
||||
return 210; //Wait for the freq to stabilize
|
||||
case FRSKY_DATA2:
|
||||
CC2500_Strobe(CC2500_SRX); //Acquire RSSI
|
||||
state++;
|
||||
return 20;
|
||||
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
|
||||
{
|
||||
transmit=false;
|
||||
debugln("Busy %d %d",hopping_frequency_no,rssi);
|
||||
}
|
||||
#endif
|
||||
CC2500_SetTxRxMode(TX_EN);
|
||||
CC2500_SetPower();
|
||||
CC2500_Strobe(CC2500_SFRX);
|
||||
hopping_frequency_no = (hopping_frequency_no+FrSkyX_chanskip)%47;
|
||||
CC2500_Strobe(CC2500_SIDLE);
|
||||
if(transmit)
|
||||
CC2500_WriteData(packet, packet[0]+1);
|
||||
state=FRSKY_DATA4;
|
||||
return 5200;
|
||||
case FRSKY_DATA4:
|
||||
CC2500_SetTxRxMode(RX_EN);
|
||||
CC2500_Strobe(CC2500_SIDLE);
|
||||
state++;
|
||||
return 200;
|
||||
case FRSKY_DATA5:
|
||||
CC2500_Strobe(CC2500_SRX);
|
||||
state++;
|
||||
return 3100;
|
||||
case FRSKY_DATA6:
|
||||
telemetry_set_input_sync(9000);
|
||||
len = CC2500_ReadReg(CC2500_3B_RXBYTES | CC2500_READ_BURST) & 0x7F;
|
||||
@ -374,11 +331,52 @@ uint16_t ReadFrSkyX()
|
||||
}
|
||||
FrSkyX_build_packet();
|
||||
state = FRSKY_DATA1;
|
||||
#ifdef FRSKYX_LBT
|
||||
return 270;
|
||||
#else
|
||||
#if not defined(FRSKYX_LBT)
|
||||
return 500;
|
||||
#endif // for LBT just continue to DATA1 right away
|
||||
case FRSKY_DATA1:
|
||||
if ( prev_option != option )
|
||||
{
|
||||
CC2500_WriteReg(CC2500_0C_FSCTRL0,option); //Frequency offset hack
|
||||
prev_option = option ;
|
||||
}
|
||||
FrSkyX_set_start(hopping_frequency_no);
|
||||
transmit=true;
|
||||
#ifdef FRSKYX_LBT
|
||||
CC2500_Strobe(CC2500_SIDLE);
|
||||
state++;
|
||||
return 100; //Wait for the freq to stabilize
|
||||
case FRSKY_DATA2:
|
||||
CC2500_Strobe(CC2500_SRX); //Acquire RSSI
|
||||
state++;
|
||||
return 400;
|
||||
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
|
||||
{
|
||||
transmit=false;
|
||||
debugln("Busy %d %d",hopping_frequency_no,rssi);
|
||||
}
|
||||
#endif
|
||||
CC2500_SetTxRxMode(TX_EN);
|
||||
CC2500_SetPower();
|
||||
CC2500_Strobe(CC2500_SFRX);
|
||||
hopping_frequency_no = (hopping_frequency_no+FrSkyX_chanskip)%47;
|
||||
CC2500_Strobe(CC2500_SIDLE);
|
||||
if(transmit)
|
||||
CC2500_WriteData(packet, packet[0]+1);
|
||||
state=FRSKY_DATA4;
|
||||
return 5200;
|
||||
case FRSKY_DATA4:
|
||||
CC2500_SetTxRxMode(RX_EN);
|
||||
CC2500_Strobe(CC2500_SIDLE);
|
||||
state++;
|
||||
return 200;
|
||||
case FRSKY_DATA5:
|
||||
CC2500_Strobe(CC2500_SRX);
|
||||
state++;
|
||||
return 3100;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
@ -224,8 +224,7 @@
|
||||
|
||||
//FrSkyX specific setting
|
||||
//-----------------------
|
||||
//EU LBT setting
|
||||
//If commented the TX will not check if a channel is busy before transmitting
|
||||
//EU LBT setting: if commented the TX will not check if a channel is busy before transmitting.
|
||||
//#define FRSKYX_LBT
|
||||
|
||||
//DSM specific settings
|
||||
@ -270,6 +269,8 @@
|
||||
//For er9x it depends if you have an inveter mod or not on the telemetry pin. If you don't have an inverter comment this line.
|
||||
//=>OpenTX 2.3.2 with a STM32 or OrangeRX module this setting can be ignored.
|
||||
#define INVERT_TELEMETRY
|
||||
//For STM32 and OrangeRX modules, comment to prevent the TX from forcing the serial telemetry polarity normal/invert.
|
||||
#define INVERT_TELEMETRY_TX
|
||||
|
||||
//Uncomment if you don't want to send Multi status telemetry frames (Protocol available, Bind in progress, version...)
|
||||
//Use with er9x/erskyTX, for OpenTX MULTI_TELEMETRY below is preferred instead
|
||||
|
Loading…
x
Reference in New Issue
Block a user