1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-20 14:55:21 +03:00

Added CE domain with reduced telemetry power

This commit is contained in:
phobos- 2022-08-14 16:50:51 +02:00
parent 545caf2908
commit 185a94384c
5 changed files with 21 additions and 5 deletions

View file

@ -511,7 +511,7 @@ static const char* const lookupTableFreqDomain[] = {
"AU433", "AU915", "EU433", "EU868", "IN866", "FCC915", "AU433", "AU915", "EU433", "EU868", "IN866", "FCC915",
#endif #endif
#ifdef USE_RX_SX1280 #ifdef USE_RX_SX1280
"ISM2400", "ISM2400", "CE2400"
#endif #endif
#if !defined(USE_RX_SX127X) && !defined(USE_RX_SX1280) #if !defined(USE_RX_SX127X) && !defined(USE_RX_SX1280)
"NONE", "NONE",

View file

@ -300,11 +300,18 @@ static uint8_t minLqForChaos(void)
return interval * ((interval * numfhss + 99) / (interval * numfhss)); return interval * ((interval * numfhss + 99) / (interval * numfhss));
} }
static bool domainIsTeam24()
{
const elrsFreqDomain_e domain = rxExpressLrsSpiConfig()->domain;
return (domain == ISM2400) || (domain == CE2400);
}
static void setRfLinkRate(const uint8_t index) static void setRfLinkRate(const uint8_t index)
{ {
#if defined(USE_RX_SX1280) && defined(USE_RX_SX127X) #if defined(USE_RX_SX1280) && defined(USE_RX_SX127X)
receiver.modParams = (rxExpressLrsSpiConfig()->domain == ISM2400) ? &airRateConfig[1][index] : &airRateConfig[0][index]; const uint8_t domainIdx = domainIsTeam24() ? 1 : 0;
receiver.rfPerfParams = (rxExpressLrsSpiConfig()->domain == ISM2400) ? &rfPerfConfig[1][index] : &rfPerfConfig[0][index]; receiver.modParams = &airRateConfig[domainIdx][index];
receiver.rfPerfParams = &rfPerfConfig[domainIdx][index];
#else #else
receiver.modParams = &airRateConfig[0][index]; receiver.modParams = &airRateConfig[0][index];
receiver.rfPerfParams = &rfPerfConfig[0][index]; receiver.rfPerfParams = &rfPerfConfig[0][index];
@ -314,6 +321,10 @@ static void setRfLinkRate(const uint8_t index)
receiver.cycleIntervalMs = ((uint32_t)11U * fhssGetNumEntries() * receiver.modParams->fhssHopInterval * receiver.modParams->interval) / (10U * 1000U); receiver.cycleIntervalMs = ((uint32_t)11U * fhssGetNumEntries() * receiver.modParams->fhssHopInterval * receiver.modParams->interval) / (10U * 1000U);
receiver.config(receiver.modParams->bw, receiver.modParams->sf, receiver.modParams->cr, receiver.currentFreq, receiver.modParams->preambleLen, receiver.UID[5] & 0x01); receiver.config(receiver.modParams->bw, receiver.modParams->sf, receiver.modParams->cr, receiver.currentFreq, receiver.modParams->preambleLen, receiver.UID[5] & 0x01);
#if defined(USE_RX_SX1280)
if (rxExpressLrsSpiConfig()->domain == CE2400)
sx1280SetOutputPower(10);
#endif
expressLrsUpdateTimerInterval(receiver.modParams->interval); expressLrsUpdateTimerInterval(receiver.modParams->interval);
@ -651,7 +662,7 @@ static bool processRFSyncPacket(volatile elrsOtaPacket_t const * const otaPktPtr
receiver.lastSyncPacketMs = timeStampMs; receiver.lastSyncPacketMs = timeStampMs;
// Will change the packet air rate in loop() if this changes // Will change the packet air rate in loop() if this changes
receiver.nextRateIndex = (rxExpressLrsSpiConfig()->domain == ISM2400) ? airRateIndexToIndex24(otaPktPtr->sync.rateIndex, receiver.rateIndex) : airRateIndexToIndex900(otaPktPtr->sync.rateIndex, receiver.rateIndex); receiver.nextRateIndex = domainIsTeam24() ? airRateIndexToIndex24(otaPktPtr->sync.rateIndex, receiver.rateIndex) : airRateIndexToIndex900(otaPktPtr->sync.rateIndex, receiver.rateIndex);
uint8_t switchEncMode = otaPktPtr->sync.switchEncMode; uint8_t switchEncMode = otaPktPtr->sync.switchEncMode;
// Update switch mode encoding immediately // Update switch mode encoding immediately
@ -877,6 +888,8 @@ bool expressLrsSpiInit(const struct rxSpiConfig_s *rxConfig, struct rxRuntimeSta
#endif #endif
#ifdef USE_RX_SX1280 #ifdef USE_RX_SX1280
case ISM2400: case ISM2400:
FALLTHROUGH;
case CE2400:
configureReceiverForSX1280(); configureReceiverForSX1280();
bindingRateIndex = ELRS_BINDING_RATE_24; bindingRateIndex = ELRS_BINDING_RATE_24;
break; break;
@ -1062,7 +1075,7 @@ void expressLrsDoTelem(void)
expressLrsHandleTelemetryUpdate(); expressLrsHandleTelemetryUpdate();
expressLrsSendTelemResp(); expressLrsSendTelemResp();
if (rxExpressLrsSpiConfig()->domain != ISM2400 && !receiver.didFhss && !expressLrsTelemRespReq() && lqPeriodIsSet()) { if (!domainIsTeam24() && !receiver.didFhss && !expressLrsTelemRespReq() && lqPeriodIsSet()) {
// TODO No need to handle this on SX1280, but will on SX127x // TODO No need to handle this on SX1280, but will on SX127x
// TODO this needs to be DMA aswell, SX127x unlikely to work right now // TODO this needs to be DMA aswell, SX127x unlikely to work right now
receiver.handleFreqCorrection(receiver.freqOffset, receiver.currentFreq); //corrects for RX freq offset receiver.handleFreqCorrection(receiver.freqOffset, receiver.currentFreq); //corrects for RX freq offset

View file

@ -105,6 +105,7 @@ const elrsFhssConfig_t fhssConfigs[] = {
#endif #endif
#ifdef USE_RX_SX1280 #ifdef USE_RX_SX1280
{ISM2400, FREQ_HZ_TO_REG_VAL_24(2400400000), FREQ_HZ_TO_REG_VAL_24(2479400000), 80}, {ISM2400, FREQ_HZ_TO_REG_VAL_24(2400400000), FREQ_HZ_TO_REG_VAL_24(2479400000), 80},
{CE2400, FREQ_HZ_TO_REG_VAL_24(2400400000), FREQ_HZ_TO_REG_VAL_24(2479400000), 80},
#endif #endif
#if !defined(USE_RX_SX127X) && !defined(USE_RX_SX1280) #if !defined(USE_RX_SX127X) && !defined(USE_RX_SX1280)
{0}, {0},

View file

@ -79,6 +79,7 @@ typedef enum {
#endif #endif
#ifdef USE_RX_SX1280 #ifdef USE_RX_SX1280
ISM2400, ISM2400,
CE2400,
#endif #endif
#if !defined(USE_RX_SX127X) && !defined(USE_RX_SX1280) #if !defined(USE_RX_SX127X) && !defined(USE_RX_SX1280)
NONE, NONE,

View file

@ -425,6 +425,7 @@ extern "C" {
} }
void sx1280AdjustFrequency(int32_t , const uint32_t ) {} void sx1280AdjustFrequency(int32_t , const uint32_t ) {}
bool sx1280Init(IO_t , IO_t ) { return true; } bool sx1280Init(IO_t , IO_t ) { return true; }
void sx1280SetOutputPower(const int8_t ) {}
void sx127xConfig(const sx127xBandwidth_e , const sx127xSpreadingFactor_e , const sx127xCodingRate_e , const uint32_t , const uint8_t , const bool ) {} void sx127xConfig(const sx127xBandwidth_e , const sx127xSpreadingFactor_e , const sx127xCodingRate_e , const uint32_t , const uint8_t , const bool ) {}
void sx127xStartReceiving(void) {} void sx127xStartReceiving(void) {}