From 7309f13b37fdab0a6e4f56ac5edc78041135adfa Mon Sep 17 00:00:00 2001 From: Assaf Inbal Date: Fri, 11 Oct 2024 10:34:44 +0300 Subject: [PATCH] Add support for unicore SoCs (esp32-c3) Fixes #203 --- main/Kconfig.projbuild | 6 ++++++ main/ble2mqtt.c | 2 +- main/ota.c | 3 ++- 3 files changed, 9 insertions(+), 2 deletions(-) create mode 100644 main/Kconfig.projbuild diff --git a/main/Kconfig.projbuild b/main/Kconfig.projbuild new file mode 100644 index 0000000..8376105 --- /dev/null +++ b/main/Kconfig.projbuild @@ -0,0 +1,6 @@ +menu "BLE2MQTT" + config BLE2MQTT_PINNED_TO_CORE + int + default 1 if !FREERTOS_UNICORE + default 0 +endmenu diff --git a/main/ble2mqtt.c b/main/ble2mqtt.c index 4474575..1c53d93 100644 --- a/main/ble2mqtt.c +++ b/main/ble2mqtt.c @@ -705,7 +705,7 @@ static int start_ble2mqtt_task(void) return -1; if (xTaskCreatePinnedToCore(ble2mqtt_task, "ble2mqtt_task", 4096, NULL, 5, - NULL, 1) != pdPASS) + NULL, CONFIG_BLE2MQTT_PINNED_TO_CORE) != pdPASS) { return -1; } diff --git a/main/ota.c b/main/ota.c index a52b5ec..300a86c 100644 --- a/main/ota.c +++ b/main/ota.c @@ -237,7 +237,8 @@ int ota_download(ota_type_t type, const char *url, ota_on_completed_cb_t cb) ctx->url = strdup(url); ctx->on_completed_cb = cb; - xTaskCreatePinnedToCore(ota_task, "ota_task", 8192, ctx, 5, NULL, 1); + xTaskCreatePinnedToCore(ota_task, "ota_task", 8192, ctx, 5, NULL, + CONFIG_BLE2MQTT_PINNED_TO_CORE); return 0; }