Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/Duet3D/RepRapFirmware.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Crocker <dcrocker@eschertech.com>2020-01-26 23:56:03 +0300
committerDavid Crocker <dcrocker@eschertech.com>2020-01-26 23:56:03 +0300
commit79df4b88ed68875cd58ef4e1ec5ea22f9ab9d55e (patch)
tree701938eab5583381e5896116dec79e21cc278a82 /src/Networking/LwipEthernet/LwipEthernetInterface.cpp
parent6e8f8223fd862eae27545ead596b52c5a6a46ca2 (diff)
Refactored MAC address code
M540 on Duet WiFi now returns correct MAC address MAC address added to object model WiFi firmware version now returned correctly in object model
Diffstat (limited to 'src/Networking/LwipEthernet/LwipEthernetInterface.cpp')
-rw-r--r--src/Networking/LwipEthernet/LwipEthernetInterface.cpp11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/Networking/LwipEthernet/LwipEthernetInterface.cpp b/src/Networking/LwipEthernet/LwipEthernetInterface.cpp
index 4fa2dd36..ba6f0f85 100644
--- a/src/Networking/LwipEthernet/LwipEthernetInterface.cpp
+++ b/src/Networking/LwipEthernet/LwipEthernetInterface.cpp
@@ -112,8 +112,8 @@ constexpr ObjectModelTableEntry LwipEthernetInterface::objectModelTable[] =
{
// These entries must be in alphabetical order
{ "actualIP", OBJECT_MODEL_FUNC(self->ipAddress), ObjectModelEntryFlags::none },
- { "firmwareVersion", OBJECT_MODEL_FUNC_NOSELF(nullptr), ObjectModelEntryFlags::none },
{ "gateway", OBJECT_MODEL_FUNC(self->gateway), ObjectModelEntryFlags::none },
+ { "mac", OBJECT_MODEL_FUNC(self->macAddress), ObjectModelEntryFlags::none },
{ "subnet", OBJECT_MODEL_FUNC(self->netmask), ObjectModelEntryFlags::none },
{ "type", OBJECT_MODEL_FUNC_NOSELF("ethernet"), ObjectModelEntryFlags::none },
};
@@ -137,7 +137,7 @@ void LwipEthernetInterface::Init() noexcept
listeningPcbs[i] = nullptr;
}
- memcpy(macAddress, platform.GetDefaultMacAddress(), sizeof(macAddress));
+ macAddress = platform.GetDefaultMacAddress();
}
GCodeResult LwipEthernetInterface::EnableProtocol(NetworkProtocol protocol, int port, int secure, const StringRef& reply) noexcept
@@ -338,7 +338,7 @@ void LwipEthernetInterface::Start() noexcept
const char *hostname = reprap.GetNetwork().GetHostname();
// Allow the MAC address to be set only before LwIP is started...
- ethernet_configure_interface(platform.GetDefaultMacAddress(), hostname);
+ ethernet_configure_interface(platform.GetDefaultMacAddress().bytes, hostname);
init_ethernet(DefaultIpAddress, DefaultNetMask, DefaultGateway);
// Initialise mDNS subsystem
@@ -589,9 +589,10 @@ void LwipEthernetInterface::UpdateHostname(const char *hostname) noexcept
}
}
-void LwipEthernetInterface::SetMacAddress(const uint8_t mac[]) noexcept
+GCodeResult LwipEthernetInterface::SetMacAddress(const MacAddress& mac, const StringRef& reply) noexcept
{
- memcpy(macAddress, mac, sizeof(macAddress));
+ macAddress = mac;
+ return GCodeResult::ok;
}
void LwipEthernetInterface::OpenDataPort(Port port) noexcept