diff options
author | David Crocker <dcrocker@eschertech.com> | 2022-10-04 15:50:10 +0300 |
---|---|---|
committer | David Crocker <dcrocker@eschertech.com> | 2022-10-04 15:50:10 +0300 |
commit | 6d2dc6441a22e7eb87de0fe34bd575b7bacb636b (patch) | |
tree | 98dd9fc49c0ad468c003b3719a47db11bc455e97 | |
parent | e56a9779fe8c9ce56f0e63a2de8977e249024b2d (diff) |
Fixed network starup issues on MB6HC
-rw-r--r-- | src/Networking/Network.cpp | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/src/Networking/Network.cpp b/src/Networking/Network.cpp index 428c097f..78cbd2d8 100644 --- a/src/Networking/Network.cpp +++ b/src/Networking/Network.cpp @@ -97,6 +97,9 @@ Network::Network(Platform& p) noexcept : platform(p) # else # error Unknown board # endif +# if defined(DUET3_MB6HC) + interfaces[1] = nullptr; // no WiFi interface yet +# endif #endif // HAS_NETWORKING } @@ -344,7 +347,7 @@ WiFiInterface *Network::FindWiFiInterface() const noexcept #if HAS_WIFI_NETWORKING for (NetworkInterface *iface : interfaces) { - if (iface->IsWiFiInterface()) + if (iface != nullptr && iface->IsWiFiInterface()) { return static_cast<WiFiInterface *>(iface); } @@ -527,7 +530,10 @@ void Network::Spin() noexcept // Keep the network modules running for (NetworkInterface *iface : interfaces) { - iface->Spin(); + if (iface != nullptr) + { + iface->Spin(); + } } #if HAS_RESPONDERS @@ -597,7 +603,10 @@ void Network::Diagnostics(MessageType mtype) noexcept for (NetworkInterface *iface : interfaces) { - iface->Diagnostics(mtype); + if (iface != nullptr) + { + iface->Diagnostics(mtype); + } } #endif @@ -622,7 +631,7 @@ void Network::SetEthernetIPAddress(IPAddress p_ipAddress, IPAddress p_netmask, I #if HAS_NETWORKING for (NetworkInterface *iface : interfaces) { - if (!iface->IsWiFiInterface()) + if (iface != nullptr && !iface->IsWiFiInterface()) { iface->SetIPAddress(p_ipAddress, p_netmask, p_gateway); } @@ -693,9 +702,12 @@ void Network::SetHostname(const char *name) noexcept strcpy(hostname, DEFAULT_HOSTNAME); } - for (unsigned int i = 0; i < GetNumNetworkInterfaces(); ++i) + for (NetworkInterface *iface : interfaces) { - interfaces[i]->UpdateHostname(hostname); + if (iface != nullptr) + { + iface->UpdateHostname(hostname); + } } #endif } |