From e8a8111b2a02beefc0934925c20e409ac3e99264 Mon Sep 17 00:00:00 2001 From: iranl Date: Thu, 26 Dec 2024 19:11:41 +0100 Subject: [PATCH] Fix single core devices --- src/Config.h | 2 +- src/PreferencesKeys.h | 7 ++++--- src/main.cpp | 10 ++++++++-- 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/src/Config.h b/src/Config.h index 914b0d0..35c01b4 100644 --- a/src/Config.h +++ b/src/Config.h @@ -5,7 +5,7 @@ #define NUKI_HUB_VERSION "9.06" #define NUKI_HUB_VERSION_INT (uint32_t)906 #define NUKI_HUB_BUILD "unknownbuildnr" -#define NUKI_HUB_DATE "2024-12-22" +#define NUKI_HUB_DATE "2024-12-26" #define GITHUB_LATEST_RELEASE_URL (char*)"https://github.com/technyon/nuki_hub/releases/latest" #define GITHUB_OTA_MANIFEST_URL (char*)"https://raw.githubusercontent.com/technyon/nuki_hub/binary/ota/manifest.json" diff --git a/src/PreferencesKeys.h b/src/PreferencesKeys.h index f2e295d..beedf5a 100644 --- a/src/PreferencesKeys.h +++ b/src/PreferencesKeys.h @@ -210,14 +210,14 @@ inline void initPreferences(Preferences* preferences) preferences->putInt(preference_query_interval_configuration, 3600); preferences->putInt(preference_query_interval_battery, 1800); preferences->putInt(preference_query_interval_keypad, 1800); - + preferences->putBool(preference_debug_connect, false); preferences->putBool(preference_debug_communication, false); preferences->putBool(preference_debug_readable_data, false); preferences->putBool(preference_debug_hex_data, false); preferences->putBool(preference_debug_command, false); preferences->putBool(preference_connect_mode, true); - + preferences->putBool(preference_retain_gpio, false); #ifndef CONFIG_IDF_TARGET_ESP32H2 @@ -232,6 +232,7 @@ inline void initPreferences(Preferences* preferences) Log->print("Last config version: "); Log->println(lastConfigVer); Log->print("Current config version: "); + Log->println(NUKI_HUB_VERSION_INT); if(lastConfigVer >= NUKI_HUB_VERSION_INT && lastConfigVer < 20000) return; @@ -380,7 +381,7 @@ private: preference_auth_control_enabled, preference_auth_topic_per_entry, preference_auth_info_enabled, preference_auth_max_entries, preference_wifi_ssid, preference_wifi_pass, preference_keypad_check_code_enabled, preference_disable_network_not_connected, preference_mqtt_hass_enabled, preference_hass_device_discovery, preference_retain_gpio, preference_debug_connect, preference_debug_communication, preference_debug_readable_data, preference_debug_hex_data, preference_debug_command, preference_connect_mode - + }; std::vector _redact = { diff --git a/src/main.cpp b/src/main.cpp index 930cfc9..ea9b61f 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -9,6 +9,7 @@ #include "Config.h" #include "esp32-hal-log.h" #include "hal/wdt_hal.h" +#include "esp_chip_info.h" #ifndef NUKI_HUB_UPDATER #include "NukiWrapper.h" @@ -22,6 +23,7 @@ #include "PreferencesKeys.h" #include "RestartReason.h" #include "EspMillis.h" +#include "NimBLEDevice.h" /* #ifdef DEBUG_NUKIHUB @@ -444,16 +446,20 @@ void setupTasks(bool ota) }; esp_task_wdt_reconfigure(&twdt_config); + esp_chip_info_t info; + esp_chip_info(&info); + uint8_t espCores = info.cores; + if(ota) { - xTaskCreatePinnedToCore(otaTask, "ota", 8192, NULL, 2, &otaTaskHandle, 1); + xTaskCreatePinnedToCore(otaTask, "ota", 8192, NULL, 2, &otaTaskHandle, (espCores > 1) ? 1 : 0); esp_task_wdt_add(otaTaskHandle); } else { if(!disableNetwork) { - xTaskCreatePinnedToCore(networkTask, "ntw", preferences->getInt(preference_task_size_network, NETWORK_TASK_SIZE), NULL, 3, &networkTaskHandle, 1); + xTaskCreatePinnedToCore(networkTask, "ntw", preferences->getInt(preference_task_size_network, NETWORK_TASK_SIZE), NULL, 3, &networkTaskHandle, (espCores > 1) ? 1 : 0); esp_task_wdt_add(networkTaskHandle); } #ifndef NUKI_HUB_UPDATER