Skip to content

Commit

Permalink
Automatically save the RX initial rate on disconnect
Browse files Browse the repository at this point in the history
  • Loading branch information
CapnBry committed Sep 30, 2023
1 parent ec63eb8 commit 19c26e8
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions src/src/rx_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -759,6 +759,10 @@ void LostConnection(bool resumeRx)
{
DBGLN("lost conn fc=%d fo=%d", FreqCorrection, hwTimer::getFreqOffset());

// Use this rate as the initial rate next time if we connected on it
if (connectionState == connected)
config.SetRateInitialIdx(ExpressLRS_nextAirRateIndex);

RFmodeCycleMultiplier = 1;
connectionState = disconnected; //set lost connection
RXtimerState = tim_disconnected;
Expand Down Expand Up @@ -1207,7 +1211,7 @@ static void setupSerial()
{
hottTlmSerial = true;
serialBaud = 19200;
}
}
#endif
bool invert = config.GetSerialProtocol() == PROTOCOL_SBUS || config.GetSerialProtocol() == PROTOCOL_INVERTED_CRSF || config.GetSerialProtocol() == PROTOCOL_DJI_RS_PRO;

Expand Down Expand Up @@ -1264,11 +1268,11 @@ static void setupSerial()

#if defined(PLATFORM_ESP8266)
SerialConfig config = SERIAL_8N1;

if(sbusSerialOutput)
{
config = SERIAL_8E2;
}
}
else if(hottTlmSerial)
{
config = SERIAL_8N2;
Expand All @@ -1280,14 +1284,14 @@ static void setupSerial()
uint32_t config = SERIAL_8N1;

if(sbusSerialOutput)
{
{
config = SERIAL_8E2;
}
else if(hottTlmSerial)
{
config = SERIAL_8N2;
}

Serial.begin(serialBaud, config, GPIO_PIN_RCSIGNAL_RX, GPIO_PIN_RCSIGNAL_TX, invert);
#endif

Expand Down

0 comments on commit 19c26e8

Please sign in to comment.