Skip to content

Commit

Permalink
Merge pull request #184 from JAndrassy/wific3_mac_bytes_ordering
Browse files Browse the repository at this point in the history
WiFiC3 - macAddress() return normal bytes ordering
  • Loading branch information
aentinger authored Dec 14, 2023
2 parents d474ea4 + ae4e5c8 commit 6174969
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 20 deletions.
8 changes: 4 additions & 4 deletions libraries/WiFi/examples/ConnectWithWPA/ConnectWithWPA.ino
Original file line number Diff line number Diff line change
Expand Up @@ -97,14 +97,14 @@ void printCurrentNet() {
}

void printMacAddress(byte mac[]) {
for (int i = 5; i >= 0; i--) {
for (int i = 0; i < 6; i++) {
if (i > 0) {
Serial.print(":");
}
if (mac[i] < 16) {
Serial.print("0");
}
Serial.print(mac[i], HEX);
if (i > 0) {
Serial.print(":");
}
}
Serial.println();
}
10 changes: 5 additions & 5 deletions libraries/WiFi/examples/ScanNetworks/ScanNetworks.ino
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
connect to any network, so no encryption scheme is specified.
Circuit:
* Board with NINA module (Arduino MKR WiFi 1010, MKR VIDOR 4000 and Uno WiFi Rev.2)
* Portenta C33
created 13 July 2010
by dlf (Metodo2 srl)
Expand Down Expand Up @@ -108,14 +108,14 @@ void printEncryptionType(int thisType) {
}

void printMacAddress(byte mac[]) {
for (int i = 5; i >= 0; i--) {
for (int i = 0; i < 6; i++) {
if (i > 0) {
Serial.print(":");
}
if (mac[i] < 16) {
Serial.print("0");
}
Serial.print(mac[i], HEX);
if (i > 0) {
Serial.print(":");
}
}
Serial.println();
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
BSSID and WiFi channel are printed
Circuit:
* Board with NINA module (Arduino MKR WiFi 1010, MKR VIDOR 4000 and Uno WiFi Rev.2)
* Portenta C33
This example is based on ScanNetworks
Expand Down Expand Up @@ -130,14 +130,14 @@ void print2Digits(byte thisByte) {
}

void printMacAddress(byte mac[]) {
for (int i = 5; i >= 0; i--) {
for (int i = 0; i < 6; i++) {
if (i > 0) {
Serial.print(":");
}
if (mac[i] < 16) {
Serial.print("0");
}
Serial.print(mac[i], HEX);
if (i > 0) {
Serial.print(":");
}
}
Serial.println();
}
6 changes: 0 additions & 6 deletions libraries/WiFi/src/WiFi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -173,12 +173,6 @@ uint8_t* CWifi::macAddress(uint8_t* mac) {
/* -------------------------------------------------------------------------- */
if(ni != nullptr) {
if(ni->getMacAddress(mac) == WL_MAC_ADDR_LENGTH) {
// internal mac address representation is inverted
for (int i = 0; i<3; i++) {
auto tmp = mac[i];
mac[i] = mac[5-i];
mac[5-i] = tmp;
}
return mac;
}
}
Expand Down

0 comments on commit 6174969

Please sign in to comment.