Thu, 24 Jun 2021 14:07:49 +0200
Changed to esp-idf 4.2.1 stable API.
CMakeLists.txt | file | annotate | diff | comparison | revisions | |
kicad/co2meter.pro | file | annotate | diff | comparison | revisions | |
main/config.h | file | annotate | diff | comparison | revisions | |
main/task_wifi.c | file | annotate | diff | comparison | revisions |
--- a/CMakeLists.txt Mon May 31 16:52:10 2021 +0200 +++ b/CMakeLists.txt Thu Jun 24 14:07:49 2021 +0200 @@ -2,7 +2,7 @@ # in this exact order for cmake to work correctly cmake_minimum_required(VERSION 3.5) -set(PROJECT_VER "0.2.6") +set(PROJECT_VER "0.2.7") set(PROJECT_NAME "co2meter") include($ENV{IDF_PATH}/tools/cmake/project.cmake)
--- a/kicad/co2meter.pro Mon May 31 16:52:10 2021 +0200 +++ b/kicad/co2meter.pro Thu Jun 24 14:07:49 2021 +0200 @@ -1,4 +1,4 @@ -update=22/05/2015 07:44:53 +update=ma 31 mei 2021 16:56:35 CEST version=1 last_client=kicad [general] @@ -31,3 +31,13 @@ version=1 LibDir= [eeschema/libraries] +[schematic_editor] +version=1 +PageLayoutDescrFile= +PlotDirectoryName= +SubpartIdSeparator=0 +SubpartFirstId=65 +NetFmtName= +SpiceAjustPassiveValues=0 +LabSize=50 +ERC_TestSimilarLabels=1
--- a/main/config.h Mon May 31 16:52:10 2021 +0200 +++ b/main/config.h Thu Jun 24 14:07:49 2021 +0200 @@ -44,7 +44,6 @@ #include "lwip/sockets.h" #include "lwip/dns.h" #include "lwip/netdb.h" -#include "tcpip_adapter.h" #include "mqtt_client.h" #include "rotary_encoder.h"
--- a/main/task_wifi.c Mon May 31 16:52:10 2021 +0200 +++ b/main/task_wifi.c Thu Jun 24 14:07:49 2021 +0200 @@ -16,6 +16,8 @@ wifi_ap_record_t *accessp_records; ///< [MAX_AP_NUM] records array with scan results. wifi_config_t *task_wifi_ConfigSTA = NULL; ///< Current STA configuration. WIFI_State *wifi_state = NULL; ///< Public state for other tasks. +esp_netif_t *sta_netif = NULL; ///< Station interface + wifi_scan_config_t scan_config = { .ssid = 0, @@ -88,7 +90,7 @@ case WIFI_EVENT_STA_START: ESP_LOGI(TAG, "Event wifi START"); // Set the configured hostname for the dhcp client. - ESP_ERROR_CHECK(tcpip_adapter_set_hostname(TCPIP_ADAPTER_IF_STA, config.hostname)); + ESP_ERROR_CHECK(esp_netif_set_hostname(sta_netif, config.hostname)); esp_wifi_connect(); break; @@ -149,9 +151,9 @@ ip_event_got_ip_t* event = (ip_event_got_ip_t*) event_data; if (xSemaphoreTake(xSemaphoreWiFi, 25) == pdTRUE) { wifi_state->STA_online = true; - snprintf(wifi_state->STA_ip, 16, "%s", ip4addr_ntoa(&event->ip_info.ip)); - snprintf(wifi_state->STA_nm, 16, "%s", ip4addr_ntoa(&event->ip_info.netmask)); - snprintf(wifi_state->STA_gw, 16, "%s", ip4addr_ntoa(&event->ip_info.gw)); + snprintf(wifi_state->STA_ip, 16, IPSTR, IP2STR(&event->ip_info.ip)); + snprintf(wifi_state->STA_nm, 16, IPSTR, IP2STR(&event->ip_info.netmask)); + snprintf(wifi_state->STA_gw, 16, IPSTR, IP2STR(&event->ip_info.gw)); xSemaphoreGive(xSemaphoreWiFi); } else { ESP_LOGE(TAG, "got_ip_event_handler() lock error IP_EVENT_STA_GOT_IP"); @@ -193,8 +195,10 @@ /* event handler and event group for the wifi driver */ xEventGroupWifi = xEventGroupCreate(); /* initialize the tcp stack */ - tcpip_adapter_init(); + ESP_ERROR_CHECK(esp_netif_init()); ESP_ERROR_CHECK(esp_event_loop_create_default()); + sta_netif = esp_netif_create_default_wifi_sta(); + assert(sta_netif); /* * memory allocation of objects used by the task @@ -207,18 +211,16 @@ wifi_state = malloc(sizeof(WIFI_State)); memset(wifi_state, 0x00, sizeof(WIFI_State)); - /* stop dhcp server and start dhcp client */ - ESP_ERROR_CHECK(tcpip_adapter_dhcps_stop(TCPIP_ADAPTER_IF_AP)); - ESP_ERROR_CHECK(tcpip_adapter_dhcpc_start(TCPIP_ADAPTER_IF_STA)); - /* * init wifi as station */ wifi_init_config_t wifi_init_config = WIFI_INIT_CONFIG_DEFAULT(); ESP_ERROR_CHECK(esp_wifi_init(&wifi_init_config)); - ESP_ERROR_CHECK( esp_event_handler_register(WIFI_EVENT, ESP_EVENT_ANY_ID, &wifi_event_handler, NULL) ); - ESP_ERROR_CHECK( esp_event_handler_register(IP_EVENT, ESP_EVENT_ANY_ID, &got_ip_event_handler, NULL) ); + esp_event_handler_instance_t instance_any_id; + esp_event_handler_instance_t instance_got_ip; + ESP_ERROR_CHECK( esp_event_handler_instance_register(WIFI_EVENT, ESP_EVENT_ANY_ID, &wifi_event_handler, NULL, &instance_any_id) ); + ESP_ERROR_CHECK( esp_event_handler_instance_register(IP_EVENT, ESP_EVENT_ANY_ID, &got_ip_event_handler, NULL, &instance_got_ip) ); ESP_ERROR_CHECK(esp_wifi_set_storage(WIFI_STORAGE_RAM)); ESP_ERROR_CHECK(esp_wifi_set_mode(WIFI_MODE_STA));