if(key_flag ==1)
{
key_flag = 0;
printf("6666666666666666666666666666666666\r\n");
xTaskCreatePinnedToCore(&smartconfig_init_start, "smartconfig_init_start", 9216, NULL, 2, smartconfig_task, 1);
}
EventBits_t uxBits; /* 定义一个事件位变量来接收事件标志组等待函数的返回值 */
void smartconfig_init_start(void * parm)
{
ESP_ERROR_CHECK( esp_smartconfig_set_type(SC_TYPE_ESPTOUCH_AIRKISS) );
/* 通过SMARTCONFIG_START_CONFIG_DEFAULT宏 来获取一个默认的smartconfig配置参数结构体变量*/
smartconfig_start_config_t cfg = SMARTCONFIG_START_CONFIG_DEFAULT();
if(ssid != NULL)
{
nvs_flash_erase();
}
/* 开始智能配网 */
ESP_ERROR_CHECK( esp_smartconfig_start(&cfg) );
printf("smartconfig start ....... \n");
while (1)
{
led_mode = Config_led;
/* 设置智能配网类型为 AirKiss */
/* 使用事件标志组等待连接建立(WIFI_CONNECTED_BIT)或连接失败(WIFI_FAIL_BIT)事件 */
/* 等待事件标志组,退出前清除设置的事件标志,任意置1就会返回*/
uxBits = xEventGroupWaitBits(s_wifi_event_group, CONNECTED_BIT | SMART_CONFIG_BIT,
true, false, portMAX_DELAY);
if(uxBits & CONNECTED_BIT)
{
printf("WiFi Connected to ap ok. \n");
}
if(uxBits & SMART_CONFIG_BIT)
{
printf("smartconfig over \n");
esp_smartconfig_stop(); /* 关闭智能配网 */
vTaskDelete(smartconfig_task);
}
}
}
这是串口打印的信息,在得到WiFi之后出现ESP_ERROR_CHECK failed: esp_err_t 0x1101 (ESP_ERR_NVS_NOT_INITIALIZED) 错误????
smartconfig got SSID and password
SSID:esp32c3
PASSWORD:123456789
ESP_ERROR_CHECK failed: esp_err_t 0x1101 (ESP_ERR_NVS_NOT_INITIALIZED) at 0x403847dd
file: "../main/main.c" line 323
func: event_handler
expression: nvs_open("WiFi_cfg", NVS_READWRITE, &wificfg_nvs_handler)
abort() was called at PC 0x403847e1 on core 0
用按键来配网得到ssid和password,复位导致ssid和password没有了???
Moderator: ESP_Bob
-
- Posts: 171
- Joined: Thu Sep 23, 2021 10:03 am
Who is online
Users browsing this forum: No registered users and 60 guests