Skip to content

Commit

Permalink
Only reset on packet cycling, normal disconnects call SetRFLinkRate
Browse files Browse the repository at this point in the history
  • Loading branch information
CapnBry committed Apr 26, 2024
1 parent 76fc27f commit 172c65f
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
5 changes: 5 additions & 0 deletions src/lib/LQCALC/LQCALC.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ template <uint8_t N>
class LQCALC
{
public:
LQCALC(void)
{
reset100();
}

/* Set the bit for the current period to true and update the running LQ */
void add()
{
Expand Down
7 changes: 2 additions & 5 deletions src/src/rx_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -353,9 +353,6 @@ void SetRFLinkRate(uint8_t index, bool bindMode) // Set speed of RF link
OtaUpdateSerializers(smWideOr8ch, ModParams->PayloadLength);
MspReceiver.setMaxPackageIndex(ELRS_MSP_MAX_PACKAGES);
TelemetrySender.setMaxPackageIndex(OtaIsFullRes ? ELRS8_TELEMETRY_MAX_PACKAGES : ELRS4_TELEMETRY_MAX_PACKAGES);
// Always start a new packet rate at 100% LQ
LQCalc.reset100();
LQCalcDVDA.reset100();

// Wait for (11/10) 110% of time it takes to cycle through all freqs in FHSS table (in ms)
cycleInterval = ((uint32_t)11U * FHSSgetChannelCount() * ModParams->FHSShopInterval * interval) / (10U * 1000U);
Expand Down Expand Up @@ -1507,8 +1504,8 @@ static void cycleRfMode(unsigned long now)
LastSyncPacket = now; // reset this variable
SendLinkStatstoFCForcedSends = 2;
SetRFLinkRate(scanIndex % RATE_MAX, false); // switch between rates
LQCalc.reset();
LQCalcDVDA.reset();
LQCalc.reset100();
LQCalcDVDA.reset100();
// Display the current air rate to the user as an indicator something is happening
scanIndex++;
Radio.RXnb();
Expand Down
2 changes: 0 additions & 2 deletions src/src/tx_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -394,8 +394,6 @@ void SetRFLinkRate(uint8_t index) // Set speed of RF link
OtaUpdateSerializers(newSwitchMode, ModParams->PayloadLength);
MspSender.setMaxPackageIndex(ELRS_MSP_MAX_PACKAGES);
TelemetryReceiver.setMaxPackageIndex(OtaIsFullRes ? ELRS8_TELEMETRY_MAX_PACKAGES : ELRS4_TELEMETRY_MAX_PACKAGES);
// Always start a new packet rate at 100% LQ
LQCalc.reset100();

ExpressLRS_currAirRate_Modparams = ModParams;
ExpressLRS_currAirRate_RFperfParams = RFperf;
Expand Down

0 comments on commit 172c65f

Please sign in to comment.