From 0bf43f11b4460804ef96da06f4b407c63e26cb54 Mon Sep 17 00:00:00 2001 From: pennam Date: Tue, 22 Oct 2024 11:44:29 +0200 Subject: [PATCH] Portenta C33 WiFi: get STA MAC address as default --- libraries/WiFi/src/WiFi.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/libraries/WiFi/src/WiFi.cpp b/libraries/WiFi/src/WiFi.cpp index bb1750fc..8417aaec 100644 --- a/libraries/WiFi/src/WiFi.cpp +++ b/libraries/WiFi/src/WiFi.cpp @@ -168,12 +168,13 @@ void CWifi::end(void) { /* -------------------------------------------------------------------------- */ uint8_t* CWifi::macAddress(uint8_t* mac) { /* -------------------------------------------------------------------------- */ - if(ni != nullptr) { - if(ni->getMacAddress(mac) == WL_MAC_ADDR_LENGTH) { - return mac; - } + if(ni == nullptr) { + ni = CLwipIf::getInstance().get(NI_WIFI_STATION); + } + + if(ni->getMacAddress(mac) != WL_MAC_ADDR_LENGTH) { + memset(mac, 0x00, 6); } - memset(mac,0x00,6); return mac; }