Initial IDF-4.0 port

SmartConfig and ETH need some work to adapt to the new API
This commit is contained in:
me-no-dev
2020-01-25 05:44:14 +02:00
parent be4d3b6cb8
commit 1bf59ac227
48 changed files with 401 additions and 267 deletions

View File

@ -687,7 +687,12 @@ bool WiFiSTAClass::beginSmartConfig() {
esp_wifi_disconnect();
esp_err_t err;
#ifdef ESP_IDF_VERSION_MAJOR
smartconfig_start_config_t conf = SMARTCONFIG_START_CONFIG_DEFAULT();
err = esp_smartconfig_start(&conf);
#else
err = esp_smartconfig_start(reinterpret_cast<sc_callback_t>(&WiFiSTAClass::_smartConfigCallback), 1);
#endif
if (err == ESP_OK) {
_smartConfigStarted = true;
_smartConfigDone = false;
@ -734,6 +739,7 @@ const char * sc_type_strings[] = {
#endif
void WiFiSTAClass::_smartConfigCallback(uint32_t st, void* result) {
#ifndef ESP_IDF_VERSION_MAJOR //todo
smartconfig_status_t status = (smartconfig_status_t) st;
log_d("Status: %s", sc_status_strings[st % 5]);
if (status == SC_STATUS_GETTING_SSID_PSWD) {
@ -757,4 +763,5 @@ void WiFiSTAClass::_smartConfigCallback(uint32_t st, void* result) {
}
WiFi.stopSmartConfig();
}
#endif
}