Fixes for wolfssl_client example

This commit is contained in:
Andras Fekete
2022-12-16 10:23:09 -05:00
parent b823da9bb9
commit b9e69f1795

View File

@ -29,19 +29,17 @@
#include "nvs_flash.h" #include "nvs_flash.h"
#if ESP_IDF_VERSION_MAJOR >= 4 #if ESP_IDF_VERSION_MAJOR >= 4
#include "protocol_examples_common.h" #include "protocol_examples_common.h"
#endif #else
const static int CONNECTED_BIT = BIT0; const static int CONNECTED_BIT = BIT0;
static EventGroupHandle_t wifi_event_group; static EventGroupHandle_t wifi_event_group;
#endif
/* proto-type */ /* proto-type */
extern void tls_smp_client_task(); extern void tls_smp_client_task();
static void tls_smp_client_init(); static void tls_smp_client_init();
const static char *TAG = "tls_client"; const static char *TAG = "tls_client";
static EventGroupHandle_t wifi_event_group;
extern void tls_smp_client_task();
static void set_time() static void set_time()
{ {
/* set dummy wallclock time. */ /* set dummy wallclock time. */
@ -80,7 +78,7 @@ static void set_time()
static void tls_smp_client_init(void) static void tls_smp_client_init(void)
{ {
int ret; int ret;
xTaskHandle _handle; TaskHandle_t _handle;
/* http://esp32.info/docs/esp_idf/html/dd/d3c/group__xTaskCreate.html */ /* http://esp32.info/docs/esp_idf/html/dd/d3c/group__xTaskCreate.html */
ret = xTaskCreate(tls_smp_client_task, ret = xTaskCreate(tls_smp_client_task,
TLS_SMP_CLIENT_TASK_NAME, TLS_SMP_CLIENT_TASK_NAME,
@ -93,6 +91,7 @@ static void tls_smp_client_init(void)
ESP_LOGI(TAG, "create thread %s failed", TLS_SMP_CLIENT_TASK_NAME); ESP_LOGI(TAG, "create thread %s failed", TLS_SMP_CLIENT_TASK_NAME);
} }
} }
#if ESP_IDF_VERSION_MAJOR < 4
/* event handler for wifi events */ /* event handler for wifi events */
static esp_err_t wifi_event_handler(void *ctx, system_event_t *event) static esp_err_t wifi_event_handler(void *ctx, system_event_t *event)
{ {
@ -121,6 +120,7 @@ static esp_err_t wifi_event_handler(void *ctx, system_event_t *event)
} }
return ESP_OK; return ESP_OK;
} }
#endif
/* entry point */ /* entry point */
void app_main(void) void app_main(void)
{ {
@ -137,7 +137,6 @@ void app_main(void)
/* */ /* */
#if ESP_IDF_VERSION_MAJOR >= 4 #if ESP_IDF_VERSION_MAJOR >= 4
(void) wifi_event_handler;
ESP_ERROR_CHECK(esp_event_loop_create_default()); ESP_ERROR_CHECK(esp_event_loop_create_default());
/* This helper function configures Wi-Fi or Ethernet, as selected in menuconfig. /* This helper function configures Wi-Fi or Ethernet, as selected in menuconfig.
* Read "Establishing Wi-Fi or Ethernet Connection" section in * Read "Establishing Wi-Fi or Ethernet Connection" section in