mirror of
https://github.com/espressif/ESP8266_RTOS_SDK.git
synced 2025-05-22 09:37:00 +08:00
feat(startup): add fast boot and fast restart function
This commit is contained in:
@ -313,6 +313,34 @@ esp_err_t esp_read_mac(uint8_t* mac, esp_mac_type_t type)
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
esp_err_t esp_mac_init(void)
|
||||
{
|
||||
esp_err_t ret;
|
||||
uint8_t efuse_mac[6];
|
||||
|
||||
if ((ret = nvs_flash_init()) != ESP_OK) {
|
||||
ESP_LOGE(TAG, "Init NVS error=%d", ret);
|
||||
return ESP_ERR_INVALID_MAC;
|
||||
}
|
||||
|
||||
if (load_backup_mac_data(efuse_mac) == ESP_OK) {
|
||||
ESP_LOGD(TAG, "Load MAC from NVS error=%d", ret);
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
if ((ret = esp_efuse_mac_get_default(efuse_mac)) != ESP_OK) {
|
||||
ESP_LOGE(TAG, "Get mac address error=%d", ret);
|
||||
return ESP_ERR_INVALID_MAC;
|
||||
}
|
||||
|
||||
if ((ret = store_backup_mac_data()) != ESP_OK) {
|
||||
ESP_LOGE(TAG, "Store mac address error=%d", ret);
|
||||
return ESP_ERR_INVALID_MAC;
|
||||
}
|
||||
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get IDF version
|
||||
*/
|
||||
|
Reference in New Issue
Block a user