Loading files
442335385This file is pinned to the selected release. Download the original to open it in your design tool.
Files from this revision, including CAD and LFS contents. Git history is not included.
Or in GitHub Desktop, choose File → Clone repository → URL and paste this address.
Public repositories can be cloned without signing in. For pushing, use your ThingAtlas username and a Git access token as the password.
git lfs install git clone https://thingatlas.com/git/-unclaimed/openharness-1322671404.git
Includes Git history, branches, and Git LFS files. Clones the repository’s default branch, regardless of the version shown here.
#include "device_mac.h"
#include <stdio.h>
#include <string.h>
#include "esp_mac.h"
#include "esp_log.h"
static const char *TAG = "mac";
bool device_mac_str(char *out, size_t cap)
{
if (!out || cap < DEVICE_MAC_STR_LEN) return false;
out[0] = '\0';
uint8_t mac[6] = { 0 };
// ESP_MAC_WIFI_STA, not the AP or the base MAC: it is the address the device uses on the network the
// user actually sees, so it matches what any other tooling would report for this unit.
esp_err_t err = esp_read_mac(mac, ESP_MAC_WIFI_STA);
if (err != ESP_OK) {
ESP_LOGE(TAG, "esp_read_mac failed: %d", (int)err);
return false;
}
snprintf(out, cap, "%02X:%02X:%02X:%02X:%02X:%02X", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
return true;
}
442335385This file is pinned to the selected release. Download the original to open it in your design tool.