espressif / esp-idf

Espressif IoT Development Framework. Official development framework for Espressif SoCs.
Apache License 2.0
13.63k stars 7.28k forks source link

esp_smartconfig problem #221

Closed seopyoon closed 7 years ago

seopyoon commented 7 years ago

Hello,

I am trying out the ESP_TOUCH protocol. There is little information about how to go about using it. Please help.

I started from the http_get example.
Leaving the void app_main() as is, I have made modifications to the task.

Here is the current code:

    tcpip_adapter_init();
    wifi_init_config_t config = WIFI_INIT_CONFIG_DEFAULT();
    ESP_ERROR_CHECK( esp_wifi_init(&config) );
    ESP_ERROR_CHECK( esp_wifi_set_storage(WIFI_STORAGE_RAM) );
    ESP_ERROR_CHECK( esp_wifi_set_mode(WIFI_MODE_STA) );

    ESP_ERROR_CHECK( esp_esptouch_set_timeout(255) );
    ESP_ERROR_CHECK( esp_smartconfig_set_type(SC_TYPE_ESPTOUCH) );
    ESP_ERROR_CHECK( esp_smartconfig_start(smartconfig_done) );
    vTaskDelete(NULL);  //This part, I based on [this](https://github.com/espressif/ESP8266_RTOS_SDK/blob/master/examples/smart_config/user/user_main.c)

This yields in an error saying E (2108) wifi: esp_wifi_scan_stop 907 wifi not start But I do not think I should be calling esp_wifi_start(). If I should, where should I call the function?

Thanks in advance.