Skip to content

Commit 2ead395

Browse files
committed
Merge branch 'release_candidate' into pcUpdates
2 parents 4550b3f + d235008 commit 2ead395

File tree

15 files changed

+2650
-2576
lines changed

15 files changed

+2650
-2576
lines changed

Firmware/RTK_Everywhere/AP-Config/src/main.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2424,6 +2424,7 @@ function newFirmwareVersion(firmwareVersion) {
24242424
return;
24252425
}
24262426

2427+
showMsg('firmwareCheckNewMsg', "New firmware available!");
24272428
ge("btnGetNewFirmware").innerHTML = "Update to v" + firmwareVersion;
24282429
ge("btnGetNewFirmware").disabled = false;
24292430
ge("firmwareUpdateProgressBar").value = 0;

Firmware/RTK_Everywhere/Developer.ino

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@ const uint8_t * networkGetMacAddress()
4949
}
5050
NetPriority_t networkGetPriority() {return 0;}
5151
bool networkHasInternet() {return false;}
52-
bool networkHasInternet(NetIndex_t index) {return false;}
5352
bool networkInterfaceHasInternet(NetIndex_t index) {return false;}
5453
bool networkIsInterfaceStarted(NetIndex_t index) {return false;}
5554
void networkMarkOffline(NetIndex_t index) {}

Firmware/RTK_Everywhere/HTTP_Client.ino

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -356,6 +356,7 @@ void httpClientUpdate()
356356
// Connect to the HTTP server
357357
case HTTP_CLIENT_CONNECTING_2_SERVER: {
358358
// Allocate the httpSecureClient structure
359+
networkUseDefaultInterface();
359360
httpSecureClient = new NetworkClientSecure();
360361
if (!httpSecureClient)
361362
{

Firmware/RTK_Everywhere/MQTT_Client.ino

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -876,6 +876,7 @@ void mqttClientUpdate()
876876
// Connect to the MQTT broker
877877
case MQTT_CLIENT_CONNECTING_2_BROKER: {
878878
// Allocate the mqttSecureClient structure
879+
networkUseDefaultInterface();
879880
mqttSecureClient = new NetworkClientSecure();
880881
if (!mqttSecureClient)
881882
{

Firmware/RTK_Everywhere/Network.ino

Lines changed: 83 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1269,6 +1269,37 @@ void networkInterfaceInternetConnectionAvailable(NetIndex_t index)
12691269
networkMulticastDNSStart(previousIndex);
12701270
}
12711271

1272+
/*
1273+
Network Loss Handling:
1274+
1275+
Arduino IP lost event
1276+
|
1277+
|
1278+
V
1279+
networkInterfaceEventInternetLost
1280+
|
1281+
| Set internet lost event flag
1282+
V
1283+
networkUpdate
1284+
|
1285+
| Clear internet lost event flag
1286+
V
1287+
+<------- Fake connection loss
1288+
|
1289+
V
1290+
networkInterfaceInternetConnectionLost
1291+
|
1292+
| Notify Interface of connection loss
1293+
V
1294+
.----------------+----------------.
1295+
| |
1296+
| |
1297+
V V
1298+
networkInterfaceRunning Interface stop sequence
1299+
called by xxxUpdate
1300+
or xxxEnabled
1301+
*/
1302+
12721303
//----------------------------------------
12731304
// Mark network interface as having NO access to the internet
12741305
//----------------------------------------
@@ -1298,7 +1329,6 @@ void networkInterfaceInternetConnectionLost(NetIndex_t index)
12981329
return;
12991330
}
13001331

1301-
// Mark this network as offline
13021332
bitMask = 1 << index;
13031333

13041334
// If we are currently running a start sequence, do nothing
@@ -1310,6 +1340,7 @@ void networkInterfaceInternetConnectionLost(NetIndex_t index)
13101340
return;
13111341
}
13121342

1343+
// Mark this network as offline
13131344
networkHasInternet_bm &= ~bitMask;
13141345
if (settings.debugNetworkLayer)
13151346
systemPrintf("%s does NOT have internet access\r\n", networkInterfaceTable[index].name);
@@ -1377,6 +1408,35 @@ void networkInterfaceInternetConnectionLost(NetIndex_t index)
13771408
}
13781409
}
13791410

1411+
//----------------------------------------
1412+
// Get the interface priority
1413+
//----------------------------------------
1414+
NetPriority_t networkInterfacePriority(NetIndex_t index)
1415+
{
1416+
NetPriority_t priority;
1417+
1418+
// Validate the index
1419+
networkValidateIndex(index);
1420+
1421+
// Get the interface priority
1422+
priority = networkIndexTable[index];
1423+
return priority;
1424+
}
1425+
1426+
//----------------------------------------
1427+
// Determine if the interface should be running
1428+
//----------------------------------------
1429+
NetPriority_t networkInterfaceRunning(NetIndex_t index)
1430+
{
1431+
NetPriority_t priority;
1432+
1433+
// Get the interface priority
1434+
priority = networkInterfacePriority(index);
1435+
1436+
// Return the running status
1437+
return (networkPriority >= priority);
1438+
}
1439+
13801440
//----------------------------------------
13811441
// Determine if the specified network interface is higher priority than
13821442
// the current network interface
@@ -2399,14 +2459,11 @@ void networkUpdate()
23992459

24002460
// Display the IP address of the highest priority network
24012461
index = networkPriorityTable[networkPriority];
2402-
if ((index < NETWORK_OFFLINE)
2403-
&& networkInterfaceHasInternet(index)
2404-
&& networkInterfaceTable[index].netif->hasIP())
2462+
if ((index < NETWORK_OFFLINE) && networkInterfaceHasInternet(index) &&
2463+
networkInterfaceTable[index].netif->hasIP())
24052464
{
24062465
ipAddress = networkInterfaceTable[index].netif->localIP();
2407-
systemPrintf("%s: %s%s\r\n",
2408-
networkInterfaceTable[index].name,
2409-
ipAddress.toString().c_str(),
2466+
systemPrintf("%s: %s%s\r\n", networkInterfaceTable[index].name, ipAddress.toString().c_str(),
24102467
networkInterfaceTable[index].netif->isDefault() ? " (default)" : "");
24112468
}
24122469
else
@@ -2437,6 +2494,25 @@ void networkUpdate()
24372494
}
24382495
}
24392496

2497+
//----------------------------------------
2498+
// Set the default network interface
2499+
//----------------------------------------
2500+
void networkUseDefaultInterface()
2501+
{
2502+
NetIndex_t index;
2503+
bool isDefault;
2504+
2505+
// Get the network index
2506+
index = networkGetCurrentInterfaceIndex();
2507+
if (index < NETWORK_OFFLINE)
2508+
{
2509+
// Get the default network interface
2510+
isDefault = networkInterfaceTable[index].netif->isDefault();
2511+
if (!isDefault)
2512+
networkInterfaceTable[index].netif->setDefault();
2513+
}
2514+
}
2515+
24402516
//----------------------------------------
24412517
// Add a network user
24422518
//----------------------------------------

Firmware/RTK_Everywhere/NtripClient.ino

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -656,6 +656,7 @@ void ntripClientUpdate()
656656
if (connected)
657657
{
658658
// Allocate the ntripClient structure
659+
networkUseDefaultInterface();
659660
ntripClient = new NetworkClient();
660661
if (!ntripClient)
661662
{

Firmware/RTK_Everywhere/States.ino

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -445,6 +445,8 @@ void stateUpdate()
445445
// Allow for 750ms before we parse buffer for all data to arrive
446446
if (millis() - timeSinceLastIncomingSetting > 750)
447447
{
448+
bool changed;
449+
448450
currentlyParsingData =
449451
true; // Disallow new data to flow from websocket while we are parsing the current data
450452

@@ -453,7 +455,12 @@ void stateUpdate()
453455
systemWrite(incomingSettings[x]);
454456
systemPrintln();
455457

458+
//Create temporary copy of Settings, so that we can check if they change while parsing
459+
//Useful for detecting when we need to change WiFi station settings
460+
wifiSettingsClone();
461+
456462
parseIncomingSettings();
463+
457464
settings.gnssConfiguredOnce = false; // On the next boot, reapply all settings
458465
settings.gnssConfiguredBase = false;
459466
settings.gnssConfiguredRover = false;

Firmware/RTK_Everywhere/TcpClient.ino

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -306,6 +306,7 @@ bool tcpClientStart()
306306
NetworkClient *client;
307307

308308
// Allocate the TCP client
309+
networkUseDefaultInterface();
309310
client = new NetworkClient();
310311
if (client)
311312
{

Firmware/RTK_Everywhere/WebServer.ino

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1143,9 +1143,9 @@ void webServerStart()
11431143
systemPrintln("Web Server: Starting");
11441144

11451145
// Start the network
1146-
if (settings.wifiConfigOverAP == false)
1146+
if ((settings.wifiConfigOverAP == false) || networkInterfaceHasInternet(NETWORK_WIFI_STATION))
11471147
networkConsumerAdd(NETCONSUMER_WEB_CONFIG, NETWORK_ANY, __FILE__, __LINE__);
1148-
else
1148+
if (settings.wifiConfigOverAP)
11491149
networkSoftApConsumerAdd(NETCONSUMER_WEB_CONFIG, __FILE__, __LINE__);
11501150
webServerSetState(WEBSERVER_STATE_WAIT_FOR_NETWORK);
11511151
}

0 commit comments

Comments
 (0)