@@ -201,7 +201,10 @@ void menuTcpUdp()
201
201
systemPrintf (" 7) UDP Server Port: %ld\r\n " , settings.udpServerPort );
202
202
203
203
if (settings.enableTcpServer )
204
+ {
204
205
systemPrintf (" 8) Enable NTRIP Caster: %s\r\n " , settings.enableNtripCaster ? " Enabled" : " Disabled" );
206
+ systemPrintf (" 9) Enable base Caster override: %s\r\n " , settings.baseCasterOverride ? " Enabled" : " Disabled" );
207
+ }
205
208
206
209
// ------------------------------
207
210
// Display the mDNS server menu items
@@ -286,6 +289,9 @@ void menuTcpUdp()
286
289
else if (incoming == 8 && settings.enableTcpServer )
287
290
settings.enableNtripCaster ^= 1 ;
288
291
292
+ else if (incoming == 9 && settings.enableTcpServer )
293
+ settings.baseCasterOverride ^= 1 ;
294
+
289
295
// ------------------------------
290
296
// Get the mDNS server parameters
291
297
// ------------------------------
@@ -485,10 +491,18 @@ NETCONSUMER_MASK_t networkConsumerBits(NetIndex_t index)
485
491
return networkConsumersAny | netIfConsumers[index];
486
492
}
487
493
494
+ // ----------------------------------------
495
+ // Count the number of network consumers
496
+ // ----------------------------------------
497
+ int networkConsumerCount (NetIndex_t index)
498
+ {
499
+ return networkConsumerCountBits (networkConsumerBits (index));
500
+ }
501
+
488
502
// ----------------------------------------
489
503
// Count the network consumer bits
490
504
// ----------------------------------------
491
- int networkConsumerCount (NETCONSUMER_MASK_t bits)
505
+ int networkConsumerCountBits (NETCONSUMER_MASK_t bits)
492
506
{
493
507
int bitCount;
494
508
NETCONSUMER_MASK_t bitMask;
@@ -527,7 +541,7 @@ void networkConsumerDisplay()
527
541
bits |= netIfConsumers[index];
528
542
users = netIfUsers[index];
529
543
}
530
- systemPrintf (" Network Consumers: %d" , networkConsumerCount (bits));
544
+ systemPrintf (" Network Consumers: %d" , networkConsumerCountBits (bits));
531
545
networkConsumerPrint (bits, users, " , " );
532
546
systemPrintln ();
533
547
@@ -672,7 +686,10 @@ void networkConsumerRemove(NETCONSUMER_t consumer, NetIndex_t network, const cha
672
686
{
673
687
// Display the consumer
674
688
if (settings.debugNetworkLayer )
689
+ {
690
+ networkDisplayStatus ();
675
691
systemPrintf (" Network: Stopping the networks\r\n " );
692
+ }
676
693
677
694
// Walk the networks in increasing priority
678
695
// Turn off the lower priority networks first to eliminate failover
@@ -758,6 +775,10 @@ void networkDisplayInterface(NetIndex_t index)
758
775
networkValidateIndex (index);
759
776
entry = &networkInterfaceTable[index];
760
777
networkDisplayNetworkData (entry->name , entry->netif );
778
+
779
+ // Display additional WiFi data
780
+ if (index == NETWORK_WIFI_STATION)
781
+ wifiStationDisplayData ();
761
782
}
762
783
763
784
// ----------------------------------------
@@ -1363,7 +1384,7 @@ void networkInterfaceInternetConnectionLost(NetIndex_t index)
1363
1384
bool networkIsHighestPriority (NetIndex_t index)
1364
1385
{
1365
1386
NetPriority_t priority;
1366
- bool higherPriority ;
1387
+ bool highestPriority ;
1367
1388
1368
1389
// Validate the index
1369
1390
networkValidateIndex (index);
@@ -1372,10 +1393,10 @@ bool networkIsHighestPriority(NetIndex_t index)
1372
1393
priority = networkPriority;
1373
1394
1374
1395
// Determine if the specified interface has higher priority
1375
- higherPriority = (priority == NETWORK_OFFLINE);
1376
- if (!higherPriority )
1377
- higherPriority = (priority > networkPriorityTable[index]);
1378
- return higherPriority ;
1396
+ highestPriority = (priority == NETWORK_OFFLINE);
1397
+ if (highestPriority == false )
1398
+ highestPriority = (priority >= networkPriorityTable[index]);
1399
+ return highestPriority ;
1379
1400
}
1380
1401
1381
1402
// ----------------------------------------
@@ -1536,7 +1557,7 @@ void networkPrintStatus(uint8_t priority)
1536
1557
{
1537
1558
NetMask_t bitMask;
1538
1559
NETCONSUMER_MASK_t consumerMask;
1539
- NETCONSUMER_t consumers;
1560
+ NETCONSUMER_MASK_t consumers;
1540
1561
bool highestPriority;
1541
1562
int index;
1542
1563
const char *name;
@@ -2020,7 +2041,7 @@ NETCONSUMER_MASK_t networkSoftApConsumerBits()
2020
2041
// ----------------------------------------
2021
2042
void networkSoftApConsumerDisplay ()
2022
2043
{
2023
- systemPrintf (" WiFi Soft AP Consumers: %d" , networkConsumerCount (networkSoftApConsumer));
2044
+ systemPrintf (" WiFi Soft AP Consumers: %d" , networkConsumerCountBits (networkSoftApConsumer));
2024
2045
networkConsumerPrint (networkSoftApConsumer, 0 , " , " );
2025
2046
systemPrintln ();
2026
2047
}
@@ -2279,10 +2300,7 @@ void networkStartDelayed(NetIndex_t index, uintptr_t parameter, bool debug)
2279
2300
// ----------------------------------------
2280
2301
void networkUpdate ()
2281
2302
{
2282
- bool displayIpAddress;
2283
2303
NetIndex_t index;
2284
- IPAddress ipAddress;
2285
- bool ipAddressDisplayed;
2286
2304
uint8_t networkType;
2287
2305
NETWORK_POLL_ROUTINE pollRoutine;
2288
2306
uint8_t priority;
@@ -2295,18 +2313,8 @@ void networkUpdate()
2295
2313
2296
2314
// Handle the network lost internet event
2297
2315
if (networkEventInternetLost[index])
2298
- {
2299
2316
networkInterfaceInternetConnectionLost (index);
2300
2317
2301
- // Attempt to restart WiFi
2302
- if ((index == NETWORK_WIFI_STATION) && (networkIsHighestPriority (index)))
2303
- {
2304
- if (networkIsStarted (index))
2305
- networkStop (index, settings.debugWifiState , __FILE__, __LINE__);
2306
- networkStart (index, settings.debugWifiState , __FILE__, __LINE__);
2307
- }
2308
- }
2309
-
2310
2318
// Handle the network stop event
2311
2319
if (networkEventStop[index])
2312
2320
networkStop (index, settings.debugNetworkLayer , __FILE__, __LINE__);
@@ -2341,6 +2349,9 @@ void networkUpdate()
2341
2349
}
2342
2350
}
2343
2351
2352
+ // Update the WiFi state
2353
+ wifiStationUpdate ();
2354
+
2344
2355
// Update the network services
2345
2356
// Start or stop mDNS
2346
2357
if (networkMdnsRequests != networkMdnsRunning)
@@ -2367,44 +2378,62 @@ void networkUpdate()
2367
2378
webServerUpdate (); // Start webServer for web config as needed
2368
2379
2369
2380
// Periodically display the network interface state
2370
- displayIpAddress = PERIODIC_DISPLAY (PD_IP_ADDRESS);
2371
- for (int index = 0 ; index < NETWORK_OFFLINE; index++)
2381
+ if (PERIODIC_DISPLAY (PD_NETWORK_STATE))
2372
2382
{
2373
- // Display the current state
2374
- ipAddressDisplayed = displayIpAddress && (index == networkPriority);
2375
- if (PERIODIC_DISPLAY (networkInterfaceTable[index].pdState ) || PERIODIC_DISPLAY (PD_NETWORK_STATE) ||
2376
- ipAddressDisplayed)
2377
- {
2383
+ PERIODIC_CLEAR (PD_NETWORK_STATE);
2384
+ PERIODIC_CLEAR (PD_IP_ADDRESS);
2385
+ for (int index = 0 ; index < NETWORK_OFFLINE; index++)
2378
2386
PERIODIC_CLEAR (networkInterfaceTable[index].pdState );
2379
- if (networkInterfaceTable[index].netif ->hasIP ())
2380
- {
2381
- ipAddress = networkInterfaceTable[index].netif ->localIP ();
2382
- systemPrintf (" %s: %s%s\r\n " , networkInterfaceTable[index].name , ipAddress.toString ().c_str (),
2383
- networkInterfaceTable[index].netif ->isDefault () ? " (default)" : " " );
2384
- }
2385
- else if (networkInterfaceTable[index].netif ->linkUp ())
2386
- systemPrintf (" %s: Link Up\r\n " , networkInterfaceTable[index].name );
2387
- else if (networkInterfaceTable[index].netif ->started ())
2388
- systemPrintf (" %s: Started\r\n " , networkInterfaceTable[index].name );
2389
2387
2390
- else if (index == NETWORK_WIFI_STATION && (WiFi.getMode () == WIFI_AP || WiFi.getMode () == WIFI_AP_STA))
2391
- {
2392
- // NETIF doesn't capture the IP address of a soft AP
2393
- ipAddress = WiFi.softAPIP ();
2394
- systemPrintf (" %s: %s%s\r\n " , networkInterfaceTable[index].name , ipAddress.toString ().c_str (),
2395
- networkInterfaceTable[index].netif ->isDefault () ? " (default)" : " " );
2396
- }
2397
- else
2398
- systemPrintf (" %s: Stopped\r\n " , networkInterfaceTable[index].name );
2399
- }
2388
+ // Display the network state
2389
+ networkDisplayStatus ();
2400
2390
}
2401
- if ( PERIODIC_DISPLAY (PD_NETWORK_STATE))
2402
- PERIODIC_CLEAR (PD_NETWORK_STATE);
2403
- if (displayIpAddress )
2391
+
2392
+ // Periodically display the IP address
2393
+ else if (PERIODIC_DISPLAY (PD_IP_ADDRESS) )
2404
2394
{
2405
- if (!ipAddressDisplayed)
2406
- systemPrintln (" Network: Offline" );
2395
+ int index;
2396
+ IPAddress ipAddress;
2397
+
2407
2398
PERIODIC_CLEAR (PD_IP_ADDRESS);
2399
+
2400
+ // Display the IP address of the highest priority network
2401
+ index = networkPriorityTable[networkPriority];
2402
+ if ((index < NETWORK_OFFLINE)
2403
+ && networkInterfaceHasInternet (index)
2404
+ && networkInterfaceTable[index].netif ->hasIP ())
2405
+ {
2406
+ ipAddress = networkInterfaceTable[index].netif ->localIP ();
2407
+ systemPrintf (" %s: %s%s\r\n " ,
2408
+ networkInterfaceTable[index].name ,
2409
+ ipAddress.toString ().c_str (),
2410
+ networkInterfaceTable[index].netif ->isDefault () ? " (default)" : " " );
2411
+ }
2412
+ else
2413
+ systemPrintf (" Network: Offline\r\n " );
2414
+
2415
+ // Display the soft AP IP address
2416
+ if (wifiSoftApOnline)
2417
+ {
2418
+ ipAddress = wifiSoftApGetIpAddress ();
2419
+ systemPrintf (" WiFi Soft AP: %s\r\n " , ipAddress.toString ().c_str ());
2420
+ }
2421
+ else
2422
+ systemPrintf (" WiFi Soft AP: Offline\r\n " );
2423
+ }
2424
+
2425
+ // Periodically display an interface state
2426
+ else
2427
+ {
2428
+ for (int index = 0 ; index < NETWORK_OFFLINE; index++)
2429
+ if (PERIODIC_DISPLAY (networkInterfaceTable[index].pdState ))
2430
+ {
2431
+ PERIODIC_CLEAR (networkInterfaceTable[index].pdState );
2432
+
2433
+ // Display the state for an interface
2434
+ networkPrintStatus (index);
2435
+ networkDisplayInterface (index);
2436
+ }
2408
2437
}
2409
2438
}
2410
2439
@@ -2437,6 +2466,26 @@ void networkUserAdd(NETCONSUMER_t consumer, const char *fileName, uint32_t lineN
2437
2466
networkConsumerIndexLast[consumer] = index;
2438
2467
}
2439
2468
2469
+ // ----------------------------------------
2470
+ // Get the network user bit mask
2471
+ // ----------------------------------------
2472
+ NETCONSUMER_MASK_t networkUserBits (NetIndex_t index)
2473
+ {
2474
+ // Validate the index
2475
+ networkValidateIndex (index);
2476
+
2477
+ // Return the consumer bits
2478
+ return netIfUsers[index];
2479
+ }
2480
+
2481
+ // ----------------------------------------
2482
+ // Count the number of network users
2483
+ // ----------------------------------------
2484
+ int networkUserCount (NetIndex_t index)
2485
+ {
2486
+ return networkConsumerCountBits (networkUserBits (index));
2487
+ }
2488
+
2440
2489
// ----------------------------------------
2441
2490
// Display the network interface users
2442
2491
// ----------------------------------------
@@ -2449,7 +2498,7 @@ void networkUserDisplay(NetIndex_t index)
2449
2498
2450
2499
// Determine if there are any users
2451
2500
bits = netIfUsers[index];
2452
- systemPrintf (" %s Users: %d" , networkInterfaceTable[index].name , networkConsumerCount (bits));
2501
+ systemPrintf (" %s Users: %d" , networkInterfaceTable[index].name , networkConsumerCountBits (bits));
2453
2502
networkConsumerPrint (bits, 0 , " , " );
2454
2503
systemPrintln ();
2455
2504
}
0 commit comments