Skip to content

Commit b032180

Browse files
committed
Correct WiFi TCP logic. Change NTRIP Client to 15s throttling.
1 parent 197e1c2 commit b032180

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

Firmware/RTK_Surveyor/NtripClient.ino

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ static const int CREDENTIALS_BUFFER_SIZE = 512;
4242

4343
//Give up connecting after this number of attempts
4444
//Connection attempts are throttled to increase the time between attempts
45-
//30 attempts with 5 minute increases will take over 38 hours
45+
//30 attempts with 15 second increases will take almost two hours
4646
static const int MAX_NTRIP_CLIENT_CONNECTION_ATTEMPTS = 30;
4747

4848
//NTRIP caster response timeout
@@ -172,7 +172,7 @@ bool ntripClientConnectLimitReached()
172172

173173
if (limitReached == false)
174174
{
175-
ntripClientConnectionAttemptTimeout = ntripClientConnectionAttempts * 5 * 60 * 1000L; //Wait 5, 10, 15, etc minutes between attempts
175+
ntripClientConnectionAttemptTimeout = ntripClientConnectionAttempts * 15 * 1000L; //Wait 15, 30, 45, etc seconds between attempts
176176

177177
log_d("ntripClientConnectionAttemptTimeout increased to %d minutes", ntripClientConnectionAttemptTimeout / (60 * 1000L));
178178

Firmware/RTK_Surveyor/WiFi.ino

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -153,13 +153,13 @@ void wifiStartAP()
153153
#define WIFI_SSID "TRex"
154154
#define WIFI_PASSWORD "parachutes"
155155

156+
WiFi.mode(WIFI_STA);
157+
156158
#ifdef COMPILE_ESPNOW
157159
// Return protocol to default settings (no WIFI_PROTOCOL_LR for ESP NOW)
158160
esp_wifi_set_protocol(WIFI_IF_STA, WIFI_PROTOCOL_11B | WIFI_PROTOCOL_11G | WIFI_PROTOCOL_11N); //Stops WiFi Station
159161
#endif
160162

161-
WiFi.mode(WIFI_STA);
162-
163163
WiFi.begin(WIFI_SSID, WIFI_PASSWORD);
164164
Serial.print("WiFi connecting to");
165165
while (wifiGetStatus() != WL_CONNECTED)
@@ -382,11 +382,6 @@ void wifiStop()
382382
#ifdef COMPILE_WIFI
383383
stopWebServer();
384384

385-
if (wifiState == WIFI_OFF)
386-
{
387-
//Do nothing
388-
}
389-
390385
//Shutdown the NMEA client
391386
if (online.nmeaClient)
392387
{
@@ -407,6 +402,11 @@ void wifiStop()
407402
delay(5);
408403
Serial.println("NMEA Server offline");
409404
}
405+
406+
if (wifiState == WIFI_OFF)
407+
{
408+
//Do nothing
409+
}
410410

411411
#ifdef COMPILE_ESPNOW
412412
//If WiFi is on but ESP NOW is off, then turn off radio entirely

0 commit comments

Comments
 (0)