Skip to content

Commit 8e7b737

Browse files
committed
Report NTRIP connection attempts total
Connection attempts is reset every time the NTRIP Server/Client is restarted. Add count to be displayed during system menu indicating the total re-connect attempts. This is better for uptime displays.
1 parent 1b0f93d commit 8e7b737

File tree

4 files changed

+12
-13
lines changed

4 files changed

+12
-13
lines changed

Firmware/RTK_Surveyor/NtripClient.ino

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -81,11 +81,6 @@ unsigned long lastGGAPush = 0;
8181
// NTRIP Client Routines - compiled out
8282
//----------------------------------------
8383

84-
void ntripClientAllowMoreConnections()
85-
{
86-
ntripClientConnectionAttempts = 0;
87-
}
88-
8984
bool ntripClientConnect()
9085
{
9186
if (!ntripClient)
@@ -170,6 +165,8 @@ bool ntripClientConnectLimitReached()
170165
bool limitReached = false;
171166
if (ntripClientConnectionAttempts++ >= MAX_NTRIP_CLIENT_CONNECTION_ATTEMPTS) limitReached = true;
172167

168+
ntripClientConnectionAttemptsTotal++;
169+
173170
if (limitReached == false)
174171
{
175172
ntripClientConnectionAttemptTimeout = ntripClientConnectionAttempts * 15 * 1000L; //Wait 15, 30, 45, etc seconds between attempts
@@ -270,9 +267,7 @@ void ntripClientStart()
270267
ntripClientSetState(NTRIP_CLIENT_ON);
271268
}
272269

273-
//Only fallback to Bluetooth once, then try WiFi again. This enables changes
274-
//to the WiFi SSID and password to properly restart the WiFi.
275-
ntripClientAllowMoreConnections();
270+
ntripClientConnectionAttempts = 0;
276271
#endif //COMPILE_WIFI
277272
}
278273

@@ -475,7 +470,7 @@ void ntripClientUpdate()
475470
//We don't use a task because we use I2C hardware (and don't have a semphore).
476471
online.ntripClient = true;
477472
ntripClientStartTime = millis();
478-
ntripClientAllowMoreConnections();
473+
ntripClientConnectionAttempts = 0;
479474
ntripClientSetState(NTRIP_CLIENT_CONNECTED);
480475
}
481476
}

Firmware/RTK_Surveyor/NtripServer.ino

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,8 @@ bool ntripServerConnectLimitReached()
133133
bool limitReached = false;
134134
if (ntripServerConnectionAttempts++ >= MAX_NTRIP_SERVER_CONNECTION_ATTEMPTS) limitReached = true;
135135

136+
ntripServerConnectionAttemptsTotal++;
137+
136138
if (limitReached == false)
137139
{
138140
ntripServerConnectionAttemptTimeout = ntripServerConnectionAttempts * 5 * 60 * 1000L; //Wait 5, 10, 15, etc minutes between attempts

Firmware/RTK_Surveyor/RTK_Surveyor.ino

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -168,15 +168,17 @@ volatile uint8_t wifiNmeaConnected;
168168
// * Receive NTRIP data timeout
169169
static uint32_t ntripClientTimer;
170170
static uint32_t ntripClientStartTime; //For calculating uptime
171-
static int ntripClientConnectionAttempts; //Count the number of connection attempts
171+
static int ntripClientConnectionAttempts; //Count the number of connection attempts between restarts
172+
static int ntripClientConnectionAttemptsTotal; //Count the number of connection attempts absolutely
172173

173174
//NTRIP server timer usage:
174175
// * Measure the connection response time
175176
// * Receive RTCM correction data timeout
176177
// * Monitor last RTCM byte received for frame counting
177178
static uint32_t ntripServerTimer;
178179
static uint32_t ntripServerStartTime;
179-
static int ntripServerConnectionAttempts; //Count the number of connection attempts
180+
static int ntripServerConnectionAttempts; //Count the number of connection attempts between restarts
181+
static int ntripServerConnectionAttemptsTotal; //Count the number of connection attempts absolutely
180182

181183
//=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
182184

Firmware/RTK_Surveyor/menuSystem.ino

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ void menuSystem()
151151
uptimeMinutes,
152152
uptimeSeconds,
153153
uptimeMilliseconds,
154-
ntripClientConnectionAttempts);
154+
ntripClientConnectionAttemptsTotal);
155155
}
156156

157157
//Display NTRIP Server status and uptime
@@ -201,7 +201,7 @@ void menuSystem()
201201
uptimeMinutes,
202202
uptimeSeconds,
203203
uptimeMilliseconds,
204-
ntripServerConnectionAttempts);
204+
ntripServerConnectionAttemptsTotal);
205205
}
206206

207207
if (settings.enableSD == true)

0 commit comments

Comments
 (0)