use base mac for getMACaddr() if interface is not up

This commit is contained in:
hathach 2025-06-10 11:00:40 +07:00
parent 40b28eae7e
commit 81c521d286
No known key found for this signature in database
GPG key ID: 26FAB84F615C3C52
2 changed files with 9 additions and 1 deletions

View file

@ -6,6 +6,6 @@
#define AIRLIFT_MISO 6
#define AIRLIFT_SCK 22
#define AIRLIFT_CS 7
#define AIRLIFT_BUSY CONFIG_BT_LE_HCI_UART_RTS_PIN // ready
#define AIRLIFT_BUSY CONFIG_BT_LE_HCI_UART_RTS_PIN // 18, aka ready
#endif

View file

@ -35,6 +35,7 @@
// ADAFRUIT-CHANGE: Adafruit-style enterprise wifi support
#include "esp_eap_client.h"
#include "esp_wifi.h"
#include "esp_mac.h"
#include "esp_log.h"
#include "esp_sntp.h"
@ -517,6 +518,13 @@ int getMACaddr(const uint8_t command[], uint8_t response[])
WiFi.macAddress(mac);
if (mac[0] == 0x00 && mac[1] == 0x00 && mac[2] == 0x00 &&
mac[3] == 0x00 && mac[4] == 0x00 && mac[5] == 0x00) {
// If the MAC address is all zeros, STA/AP interface is not enabled/ready.
// use base mac address
esp_base_mac_addr_get(mac);
}
response[2] = 1; // number of parameters
response[3] = sizeof(mac); // parameter 1 length