From 957d623b4b3c0e94aa48731d1f56097fdc316994 Mon Sep 17 00:00:00 2001 From: Pascal Langer Date: Sat, 2 May 2020 18:20:47 +0200 Subject: [PATCH] FrSky D16 LBT v1.x & 2.1: adjust thresholds to match ETSI requirements --- Multiprotocol/CC2500_SPI.ino | 5 +++++ Multiprotocol/FrSkyX_cc2500.ino | 4 ++-- Multiprotocol/Multiprotocol.h | 8 +++++++- 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/Multiprotocol/CC2500_SPI.ino b/Multiprotocol/CC2500_SPI.ino index af726ca..c59e2f9 100644 --- a/Multiprotocol/CC2500_SPI.ino +++ b/Multiprotocol/CC2500_SPI.ino @@ -150,6 +150,11 @@ void CC2500_SetPower() #else power=CC2500_HIGH_POWER; #endif + if(IS_LBT_POWER_on) + { + power=CC2500_LBT_POWER; + LBT_POWER_off; // Only accept once + } if(IS_RANGE_FLAG_on) power=CC2500_RANGE_POWER; if(prev_power != power) diff --git a/Multiprotocol/FrSkyX_cc2500.ino b/Multiprotocol/FrSkyX_cc2500.ino index 89f06ff..d3aad29 100644 --- a/Multiprotocol/FrSkyX_cc2500.ino +++ b/Multiprotocol/FrSkyX_cc2500.ino @@ -302,10 +302,10 @@ uint16_t ReadFrSkyX() uint8_t rssi_level=convert_channel_8b(CH16)>>1; //CH16 0..127 if ( rssi > rssi_level && rssi < 128) //test rssi level dynamically #else - if ( rssi > 72 && rssi < 128) //LBT and RSSI between -36 and -8.5 dBm + if ( rssi > 14 && rssi < 128) // if RSSI above -65dBm (12=-70) => ETSI requirement #endif { - POWER_FLAG_off; // Reduce to low power before transmitting + LBT_POWER_on; // Reduce to low power before transmitting debugln("Busy %d %d",hopping_frequency_no,rssi); } } diff --git a/Multiprotocol/Multiprotocol.h b/Multiprotocol/Multiprotocol.h index 262c973..50f2c74 100644 --- a/Multiprotocol/Multiprotocol.h +++ b/Multiprotocol/Multiprotocol.h @@ -19,7 +19,7 @@ #define VERSION_MAJOR 1 #define VERSION_MINOR 3 #define VERSION_REVISION 0 -#define VERSION_PATCH_LEVEL 93 +#define VERSION_PATCH_LEVEL 94 //****************** // Protocols @@ -487,6 +487,11 @@ enum MultiPacketTypes #define DISABLE_TELEM_on protocol_flags3 |= _BV(3) #define IS_DISABLE_TELEM_on ( ( protocol_flags3 & _BV(3) ) !=0 ) #define IS_DISABLE_TELEM_off ( ( protocol_flags3 & _BV(3) ) ==0 ) +//LBT power +#define LBT_POWER_off protocol_flags3 &= ~_BV(7) +#define LBT_POWER_on protocol_flags3 |= _BV(7) +#define IS_LBT_POWER_on ( ( protocol_flags3 & _BV(7) ) !=0 ) +#define IS_LBT_POWER_off ( ( protocol_flags3 & _BV(7) ) ==0 ) // Failsafe @@ -611,6 +616,7 @@ enum CC2500_POWER CC2500_POWER_17 = 0xFF // +1dbm }; #define CC2500_HIGH_POWER CC2500_POWER_17 +#define CC2500_LBT_POWER CC2500_POWER_14 #define CC2500_LOW_POWER CC2500_POWER_13 #define CC2500_RANGE_POWER CC2500_POWER_1 #define CC2500_BIND_POWER CC2500_POWER_1