From 6a80aaa7f3ad0f78bd3c9471067065e2732c2e6e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=20St=C3=A4ck?= Date: Sat, 16 Aug 2014 21:58:55 +0200 Subject: [PATCH 1/2] Change MAC address input format Set the base of strtol to 16 when parsing MAC address. This means the address can be specified in the much more human-friendly format M540 PBE:EF:12:34:56:78 The variant with "0x" preceding each byte still works just as earlier, this small change just makes the 0x optional. --- GCodes.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/GCodes.cpp b/GCodes.cpp index 852a087..a7a5f6b 100644 --- a/GCodes.cpp +++ b/GCodes.cpp @@ -1344,7 +1344,7 @@ void GCodes::SetMACAddress(GCodeBuffer *gb) { if(ipString[sp] == ':') { - mac[ipp] = strtol(&ipString[spp], NULL, 0); + mac[ipp] = strtol(&ipString[spp], NULL, 16); ipp++; if(ipp > 5) { From f9d06c8c7621000ef5ee2ad0a64abcdc9614f614 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=20St=C3=A4ck?= Date: Sat, 16 Aug 2014 22:11:34 +0200 Subject: [PATCH 2/2] Remember second strtol as well Same change to the strtol a few lines down, affecting the last byte of the MAC address. --- GCodes.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/GCodes.cpp b/GCodes.cpp index a7a5f6b..b29f19c 100644 --- a/GCodes.cpp +++ b/GCodes.cpp @@ -1358,7 +1358,7 @@ void GCodes::SetMACAddress(GCodeBuffer *gb) }else sp++; } - mac[ipp] = strtol(&ipString[spp], NULL, 0); + mac[ipp] = strtol(&ipString[spp], NULL, 16); if(ipp == 5) { platform->SetMACAddress(mac);