@@ -95,6 +95,7 @@ static NetworkServer *tcpServer = nullptr;
95
95
static uint16_t tcpServerPort;
96
96
static uint8_t tcpServerState;
97
97
static uint32_t tcpServerTimer;
98
+ static bool tcpServerWiFiSoftAp;
98
99
static const char * tcpServerName;
99
100
100
101
// TCP server clients
@@ -175,6 +176,7 @@ bool tcpServerEnabled(const char ** line)
175
176
bool enabled;
176
177
const char * name;
177
178
uint16_t port;
179
+ bool softAP;
178
180
179
181
do
180
182
{
@@ -195,6 +197,7 @@ bool tcpServerEnabled(const char ** line)
195
197
name = " TCP Server" ;
196
198
casterMode = false ;
197
199
port = settings.tcpServerPort ;
200
+ softAP = false ;
198
201
}
199
202
200
203
// Determine if the base caster should be running
@@ -207,13 +210,17 @@ bool tcpServerEnabled(const char ** line)
207
210
// Select the base caster WiFi mode and port number
208
211
if (settings.baseCasterOverride )
209
212
{
213
+ // Using soft AP
210
214
name = " Base Caster" ;
211
215
port = 2101 ;
216
+ softAP = true ;
212
217
}
213
218
else
214
219
{
215
220
name = " NTRIP Caster" ;
221
+ // Using WiFi station
216
222
port = settings.tcpServerPort ;
223
+ softAP = false ;
217
224
}
218
225
}
219
226
@@ -231,12 +238,14 @@ bool tcpServerEnabled(const char ** line)
231
238
tcpServerName = name;
232
239
tcpServerInCasterMode = casterMode;
233
240
tcpServerPort = port;
241
+ tcpServerWiFiSoftAp = softAP;
234
242
}
235
243
236
244
// Shutdown and restart the TCP server when configuration changes
237
245
else if ((name != tcpServerName)
238
246
|| (casterMode != tcpServerInCasterMode)
239
- || (port != tcpServerPort))
247
+ || (port != tcpServerPort)
248
+ || (softAP != tcpServerWiFiSoftAp))
240
249
{
241
250
*line = " , Wrong state to switch configuration!" ;
242
251
break ;
@@ -468,7 +477,8 @@ void tcpServerUpdate()
468
477
469
478
// Shutdown the TCP server when the mode or setting changes
470
479
DMW_st (tcpServerSetState, tcpServerState);
471
- connected = networkConsumerIsConnected (NETCONSUMER_TCP_SERVER);
480
+ connected = networkConsumerIsConnected (NETCONSUMER_TCP_SERVER)
481
+ || (tcpServerWiFiSoftAp && wifiSoftApOnline);
472
482
enabled = tcpServerEnabled (&line);
473
483
if ((tcpServerState > TCP_SERVER_STATE_OFF) && !enabled)
474
484
tcpServerStop ();
@@ -517,7 +527,7 @@ void tcpServerUpdate()
517
527
// Wait until the network is connected
518
528
case TCP_SERVER_STATE_WAIT_FOR_NETWORK:
519
529
// Wait until the network is connected to the media
520
- if (connected || wifiSoftApOnline )
530
+ if (connected)
521
531
{
522
532
// Delay before starting the TCP server
523
533
if ((millis () - tcpServerTimer) >= (1 * 1000 ))
@@ -538,7 +548,7 @@ void tcpServerUpdate()
538
548
// Handle client connections and link failures
539
549
case TCP_SERVER_STATE_RUNNING:
540
550
// Determine if the network has failed
541
- if (( connected == false && wifiSoftApOnline == false ) || (!settings. enableTcpServer && !settings. baseCasterOverride ) )
551
+ if (connected == false )
542
552
{
543
553
if ((settings.debugTcpServer || PERIODIC_DISPLAY (PD_TCP_SERVER_DATA)) && (!inMainMenu))
544
554
{
0 commit comments