From 1847482a7bc975e8a171cd1df9257647ab6b66f5 Mon Sep 17 00:00:00 2001 From: Uros Majstorovic Date: Sat, 20 Jan 2018 06:26:28 +0100 Subject: foxed esp32 semaphore bug --- code/esp32/components/eos/fe310.c | 5 +++-- code/esp32/components/eos/transport.c | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) (limited to 'code/esp32') diff --git a/code/esp32/components/eos/fe310.c b/code/esp32/components/eos/fe310.c index a3552f9..b13d653 100644 --- a/code/esp32/components/eos/fe310.c +++ b/code/esp32/components/eos/fe310.c @@ -161,8 +161,9 @@ void eos_fe310_init(void) { assert(ret==ESP_OK); eos_msgq_init(&send_q, send_q_array, EOS_FE310_SIZE_Q); - mutex = xSemaphoreCreateMutex(); - xTaskCreate(&worker, "fe310_receiver", 4096, NULL, 5, NULL); + mutex = xSemaphoreCreateBinary(); + xSemaphoreGive(mutex); + xTaskCreatePinnedToCore(&worker, "fe310_receiver", 4096, NULL, 5, NULL, 1); } int eos_fe310_send(unsigned char cmd, unsigned char *buffer, uint16_t len) { diff --git a/code/esp32/components/eos/transport.c b/code/esp32/components/eos/transport.c index 9a9309c..597be61 100755 --- a/code/esp32/components/eos/transport.c +++ b/code/esp32/components/eos/transport.c @@ -158,7 +158,7 @@ static esp_err_t esp32_wifi_event_handler(void *ctx, system_event_t *event) { ESP_LOGI(TAG, "* - Our IP address is: " IPSTR, IP2STR(&event->event_info.got_ip.ip_info.ip)); ESP_LOGI(TAG, "********************************************"); t_open(); - xTaskCreate(&receiver, "receiver", 4096, NULL, 5, &receiver_task); + xTaskCreatePinnedToCore(&receiver, "receiver", 4096, NULL, 5, &receiver_task, 1); eos_fe310_send(EOS_FE310_CMD_CONNECT, NULL, 0); break; @@ -175,7 +175,7 @@ void eos_net_init(void) { memset(&wifi_config, 0, sizeof(wifi_config)); tcpip_adapter_init(); - ESP_ERROR_CHECK( nvs_flash_init() ); +// ESP_ERROR_CHECK( nvs_flash_init() ); ESP_ERROR_CHECK( esp_event_loop_init(esp32_wifi_event_handler, NULL) ); ESP_ERROR_CHECK( esp_wifi_init(&cfg) ); ESP_ERROR_CHECK( esp_wifi_set_storage(WIFI_STORAGE_RAM) ); -- cgit v1.2.3