Skip to content
This repository was archived by the owner on Jan 29, 2023. It is now read-only.

Commit f782f71

Browse files
authored
Update Ethernet3 Library Patch
1 parent 69bba88 commit f782f71

File tree

2 files changed

+10
-22
lines changed

2 files changed

+10
-22
lines changed

LibraryPatches/Ethernet3/src/Ethernet3.cpp

Lines changed: 9 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,7 @@ void EthernetClass::phyMode(phyMode_t mode) {
297297
w5500.setPHYCFGR(val);
298298
}
299299

300-
void EthernetClass::setHostname(char* hostname) {
300+
void EthernetClass::setHostname(const char* hostname) {
301301
memset(_customHostname, 0, 32);
302302
memcpy((void*)_customHostname, (void*)hostname, strlen(hostname) >= 31 ? 31 : strlen(hostname));
303303
}
@@ -327,12 +327,9 @@ uint8_t EthernetClass::speed()
327327

328328
if (bitRead(w5500.getPHYCFGR(), 1) == 0)
329329
return 10;
330-
331-
// KH add to fix compile error in some boards
332-
return 0;
333330
}
334-
else
335-
return 0;
331+
332+
return 0;
336333
}
337334

338335
const char* EthernetClass::speedReport()
@@ -344,12 +341,9 @@ const char* EthernetClass::speedReport()
344341

345342
if (bitRead(w5500.getPHYCFGR(), 1) == 0)
346343
return "10 MB";
347-
348-
// KH add to fix compile error in some boards
349-
return "NO LINK";
350344
}
351-
else
352-
return "NO LINK";
345+
346+
return "NO LINK";
353347
}
354348

355349
uint8_t EthernetClass::duplex()
@@ -361,12 +355,9 @@ uint8_t EthernetClass::duplex()
361355

362356
if (bitRead(w5500.getPHYCFGR(), 2) == 0)
363357
return 1;
364-
365-
// KH add to fix compile error in some boards
366-
return 0;
367358
}
368-
else
369-
return 0;
359+
360+
return 0;
370361
}
371362

372363
const char* EthernetClass::duplexReport()
@@ -378,12 +369,9 @@ const char* EthernetClass::duplexReport()
378369

379370
if (bitRead(w5500.getPHYCFGR(), 2) == 0)
380371
return "HALF DUPLEX";
381-
382-
// KH add to fix compile error in some boards
383-
return "NO LINK";
384372
}
385-
else
386-
return "NO LINK";
373+
374+
return "NO LINK";
387375
}
388376

389377
void EthernetClass::setRtTimeOut(uint16_t timeout) {

LibraryPatches/Ethernet3/src/Ethernet3.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ class EthernetClass {
103103
void macAddress(uint8_t mac[]); // get the MAC Address
104104
const char* macAddressReport(); // returns the the MAC Address as a string
105105

106-
void setHostname(char* hostname);
106+
void setHostname(const char* hostname);
107107

108108
// KH add to have similar function to Ethernet lib
109109
// Certainly we can use void macAddress(uint8_t mac[]) to read from W5x00.

0 commit comments

Comments
 (0)