diff options
author | David Crocker <dcrocker@eschertech.com> | 2022-09-19 17:45:12 +0300 |
---|---|---|
committer | David Crocker <dcrocker@eschertech.com> | 2022-09-23 15:45:06 +0300 |
commit | 052380267cdcb7b3a3c66c7f755159dba5d24baa (patch) | |
tree | 3965ec8ebaeacd37fc53d2eb13c2e4a86b432446 | |
parent | 13376e04d1da83d2010a7728315e7d5b98bf1b52 (diff) |
Fixed MB6HC network initialisation issues
-rw-r--r-- | src/Networking/Network.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/Networking/Network.cpp b/src/Networking/Network.cpp index 91193ca5..e7140eb3 100644 --- a/src/Networking/Network.cpp +++ b/src/Networking/Network.cpp @@ -186,10 +186,8 @@ void Network::Init() noexcept SafeStrncpy(hostname, DEFAULT_HOSTNAME, ARRAY_SIZE(hostname)); - for (NetworkInterface *iface : interfaces) - { - iface->Init(); - } + // Only the MB6HC has more than one interface, and at this point we haven't created the second one yet. So initialise just the first. + interfaces[0]->Init(); #endif fastLoop = UINT32_MAX; @@ -205,6 +203,8 @@ void Network::CreateAdditionalInterface() noexcept { interfaces[1] = new WiFiInterface(platform); numActualNetworkInterfaces = 2; + interfaces[1]->Init(); + interfaces[1]->UpdateHostname(hostname); } } @@ -695,9 +695,9 @@ void Network::SetHostname(const char *name) noexcept strcpy(hostname, DEFAULT_HOSTNAME); } - for (NetworkInterface *iface : interfaces) + for (unsigned int i = 0; i < GetNumNetworkInterfaces(); ++i) { - iface->UpdateHostname(hostname); + interfaces[i]->UpdateHostname(hostname); } #endif } |