mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-06 15:59:52 +03:00
pull MAC from efuse
This commit is contained in:
@@ -45,6 +45,7 @@
|
||||
#else // ESP32 Before IDF 4.0
|
||||
#include "../rom/rtc.h"
|
||||
#endif
|
||||
#include <esp_mac.h>
|
||||
#endif
|
||||
|
||||
namespace emsesp {
|
||||
@@ -291,7 +292,7 @@ void System::system_restart(const char * partitionname) {
|
||||
}
|
||||
esp_ota_set_boot_partition(partition);
|
||||
}
|
||||
LOG_INFO("Restarting EMS-ESP from partition '%s'", partitionname);
|
||||
LOG_INFO("Restarting EMS-ESP from %s partition", partitionname);
|
||||
} else {
|
||||
LOG_INFO("Restarting EMS-ESP...");
|
||||
}
|
||||
@@ -967,6 +968,12 @@ void System::show_system(uuid::console::Shell & shell) {
|
||||
shell.printfln(" Board profile: %s", board_profile().c_str());
|
||||
shell.printfln(" Uptime: %s", uuid::log::format_timestamp_ms(uuid::get_uptime_ms(), 3).c_str());
|
||||
#ifndef EMSESP_STANDALONE
|
||||
// https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-reference/system/misc_system_api.html
|
||||
unsigned char mac_base[6] = {0};
|
||||
esp_efuse_mac_get_default(mac_base);
|
||||
esp_read_mac(mac_base, ESP_MAC_WIFI_STA);
|
||||
shell.printfln(" Base MAC Address: %02X:%02X:%02X:%02X:%02X:%02X", mac_base[0], mac_base[1], mac_base[2], mac_base[3], mac_base[4], mac_base[5]);
|
||||
|
||||
shell.printfln(" SDK version: %s", ESP.getSdkVersion());
|
||||
shell.printfln(" CPU frequency: %lu MHz", ESP.getCpuFreqMHz());
|
||||
shell.printfln(" Free heap/Max alloc: %lu KB / %lu KB", getHeapMem(), getMaxAllocMem());
|
||||
@@ -1651,12 +1658,4 @@ bool System::ntp_connected() {
|
||||
return ntp_connected_;
|
||||
}
|
||||
|
||||
std::string System::getMacAddress() const {
|
||||
#ifndef EMSESP_STANDALONE
|
||||
return WiFi.macAddress().c_str();
|
||||
#else
|
||||
return "10:10:10:10:10:10";
|
||||
#endif
|
||||
}
|
||||
|
||||
} // namespace emsesp
|
||||
|
||||
Reference in New Issue
Block a user