-
Notifications
You must be signed in to change notification settings - Fork 109
Description
A user emailed Adafruit IO support suggesting an improvement to the IO library to fetch the Ethernet mac address before starting the module:
Hello! I'm Gavin, I made an adafruit.io related application, and adafruit's blog also reported on this application: https://blog.adafruit.com/2024/05/24/a-raspberry-pi-pico-board-with-dvi-video-and-ethernet/
I am using "Adafruit IO Arduino 4.3", the MAC address for Ethernet initialization is defined and initialized in: Adafruit_IO_Arduino/src
/AdafruitIO_Ethernet.h
But there are some unreasonable things about doing this:
If the user uses several devices: they need to change the MAC address of each device in the library, otherwise multiple devices will not work at the same time (because the devices have the same MAC address);
Can my suggestion be changed to this?
STEUP() in Sketch:
Ethernet.begin(mac);
// connect to io.adafruit.com
adafruit_io.connect();</p>
Change AdafruitIO_Ethernet.h to this, first read the MAC address from the WIZnet chip, and then re-initialize:
void _connect() {
byte macAddress_[6];
Ethernet.MACAddress(macAddress_); //read mac address from Wiznet Chip
if (Ethernet.begin(macAddress_) == 0) {
_status = AIO_NET_DISCONNECTED;
if (Ethernet.hardwareStatus() == EthernetNoHardware) {
AIO_DEBUG_PRINTLN("Ethernet FeatherWing not found! Please recheck "
"wiring connections.");
while(true)
delay(1); // do nothing, no point running without Ethernet hardware
}
} else {
// Ethernet.MACAddress(macAddress_);
// for (int i = 0; i < 6; i++) {
// Serial.print(macAddress_[i], HEX);
// if (i < 5) Serial.print(':');
// }
_status = AIO_NET_CONNECTED;
}
}
This eliminates the need to change the MAC address every time you enter the library file.