From ae609e5c7865f87bab8f97c7b0aac3784f67b5f8 Mon Sep 17 00:00:00 2001 From: Kiryanov D V Date: Wed, 26 Mar 2025 14:31:51 +0300 Subject: [PATCH 1/5] Add a LOCK_TCPIP_CORE lock for correct DNS operation in Arduino. --- aether/dns/esp32_dns_resolve.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/aether/dns/esp32_dns_resolve.cpp b/aether/dns/esp32_dns_resolve.cpp index bd80078d..6de5d20d 100644 --- a/aether/dns/esp32_dns_resolve.cpp +++ b/aether/dns/esp32_dns_resolve.cpp @@ -32,6 +32,7 @@ # include "lwip/err.h" # include "lwip/sys.h" # include "lwip/dns.h" +# include "lwip/tcpip.h" # include "aether/aether.h" # include "aether/actions/action_context.h" @@ -71,6 +72,7 @@ class GethostByNameDnsResolver { // make query ip_addr_t cached_addr; + LOCK_TCPIP_CORE(); auto res = dns_gethostbyname( name_address.name.c_str(), &cached_addr, [](const char* /* name */, const ip_addr_t* ipaddr, @@ -79,6 +81,7 @@ class GethostByNameDnsResolver { context->self->QueryResult(*context, ipaddr); }, &query_context); + UNLOCK_TCPIP_CORE(); if (res == ERR_OK) { QueryResult(query_context, &cached_addr); From d0672349d4830d9354ee3c74d60d1b26826eaa6d Mon Sep 17 00:00:00 2001 From: Kiryanov D V Date: Wed, 26 Mar 2025 14:39:33 +0300 Subject: [PATCH 2/5] Make registered the main example. --- .../platformio/aether-client-cpp/CMakeLists.txt | 4 ++-- .../platformio/aether-client-cpp/platformio.ini | 6 ++++-- .../espressif_riscv/vscode/aether-client-cpp/CMakeLists.txt | 2 +- .../xtensa_lx6/platformio/aether-client-cpp/CMakeLists.txt | 4 ++-- .../xtensa_lx6/platformio/aether-client-cpp/platformio.ini | 6 ++++-- projects/xtensa_lx6/vscode/aether-client-cpp/CMakeLists.txt | 3 ++- 6 files changed, 15 insertions(+), 10 deletions(-) diff --git a/projects/espressif_riscv/platformio/aether-client-cpp/CMakeLists.txt b/projects/espressif_riscv/platformio/aether-client-cpp/CMakeLists.txt index 92cd27cf..7154b12a 100644 --- a/projects/espressif_riscv/platformio/aether-client-cpp/CMakeLists.txt +++ b/projects/espressif_riscv/platformio/aether-client-cpp/CMakeLists.txt @@ -42,8 +42,8 @@ set(AE_DISTILLATION OFF CACHE BOOL "" FORCE) list(APPEND EXTRA_COMPONENT_DIRS "../../../../aether" # "../../../../examples/cloud" - "../../../../examples/key_led" -# "../../../../examples/registered" +# "../../../../examples/key_led" + "../../../../examples/registered" # "../../../../examples/benches/send_message_delays" ) diff --git a/projects/espressif_riscv/platformio/aether-client-cpp/platformio.ini b/projects/espressif_riscv/platformio/aether-client-cpp/platformio.ini index 26486244..29d284a5 100644 --- a/projects/espressif_riscv/platformio/aether-client-cpp/platformio.ini +++ b/projects/espressif_riscv/platformio/aether-client-cpp/platformio.ini @@ -23,9 +23,11 @@ ; https://docs.platformio.org/page/projectconf.html [platformio] -src_dir = ../../../../examples/button -; src_dir = ../../../../examples/benches/send_message_delays ;src_dir = ../../../../examples/cloud +;src_dir = ../../../../examples/key_led +src_dir = ../../../../examples/registered +;src_dir = ../../../../examples/benches/send_message_delays + [env:esp32-c6-devkitm-1] platform = platformio/espressif32 framework = espidf diff --git a/projects/espressif_riscv/vscode/aether-client-cpp/CMakeLists.txt b/projects/espressif_riscv/vscode/aether-client-cpp/CMakeLists.txt index d25d5eb3..483860aa 100644 --- a/projects/espressif_riscv/vscode/aether-client-cpp/CMakeLists.txt +++ b/projects/espressif_riscv/vscode/aether-client-cpp/CMakeLists.txt @@ -26,7 +26,7 @@ idf_build_set_property(CM_PLATFORM "ESP32") add_compile_definitions(CM_ESP32) if(NOT COMPILE_EXAMPLE ) - set(COMPILE_EXAMPLE "key_led") + set(COMPILE_EXAMPLE "registered") endif() if (NOT USER_CONFIG) diff --git a/projects/xtensa_lx6/platformio/aether-client-cpp/CMakeLists.txt b/projects/xtensa_lx6/platformio/aether-client-cpp/CMakeLists.txt index 92cd27cf..7154b12a 100644 --- a/projects/xtensa_lx6/platformio/aether-client-cpp/CMakeLists.txt +++ b/projects/xtensa_lx6/platformio/aether-client-cpp/CMakeLists.txt @@ -42,8 +42,8 @@ set(AE_DISTILLATION OFF CACHE BOOL "" FORCE) list(APPEND EXTRA_COMPONENT_DIRS "../../../../aether" # "../../../../examples/cloud" - "../../../../examples/key_led" -# "../../../../examples/registered" +# "../../../../examples/key_led" + "../../../../examples/registered" # "../../../../examples/benches/send_message_delays" ) diff --git a/projects/xtensa_lx6/platformio/aether-client-cpp/platformio.ini b/projects/xtensa_lx6/platformio/aether-client-cpp/platformio.ini index a0338724..5b277a2b 100644 --- a/projects/xtensa_lx6/platformio/aether-client-cpp/platformio.ini +++ b/projects/xtensa_lx6/platformio/aether-client-cpp/platformio.ini @@ -23,9 +23,11 @@ ; https://docs.platformio.org/page/projectconf.html [platformio] -src_dir = ../../../../examples/button -; src_dir = ../../../../examples/benches/send_message_delays ;src_dir = ../../../../examples/cloud +;src_dir = ../../../../examples/key_led +src_dir = ../../../../examples/registered +;src_dir = ../../../../examples/benches/send_message_delays + [env:esp-wrover-kit] platform = platformio/espressif32 framework = espidf diff --git a/projects/xtensa_lx6/vscode/aether-client-cpp/CMakeLists.txt b/projects/xtensa_lx6/vscode/aether-client-cpp/CMakeLists.txt index 42acdbd8..483860aa 100644 --- a/projects/xtensa_lx6/vscode/aether-client-cpp/CMakeLists.txt +++ b/projects/xtensa_lx6/vscode/aether-client-cpp/CMakeLists.txt @@ -26,7 +26,7 @@ idf_build_set_property(CM_PLATFORM "ESP32") add_compile_definitions(CM_ESP32) if(NOT COMPILE_EXAMPLE ) - set(COMPILE_EXAMPLE "key_led") + set(COMPILE_EXAMPLE "registered") endif() if (NOT USER_CONFIG) @@ -40,6 +40,7 @@ endif() # enable doubles in unity tests add_compile_definitions("CONFIG_UNITY_ENABLE_DOUBLE") +set(AE_DISTILLATION OFF CACHE BOOL "" FORCE) list(APPEND EXTRA_COMPONENT_DIRS "../../../../aether" "../../../../examples/cloud" From 0dc56f94c199df22ca2e23509ec47688690573f3 Mon Sep 17 00:00:00 2001 From: Kiryanov D V Date: Wed, 26 Mar 2025 15:30:54 +0300 Subject: [PATCH 3/5] Set the WiFi login and password in Test1234 in all the examples. --- examples/cloud/cloud_test.cpp | 4 ++-- examples/key_led/key_led_test.cpp | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/examples/cloud/cloud_test.cpp b/examples/cloud/cloud_test.cpp index 303174eb..96529d91 100644 --- a/examples/cloud/cloud_test.cpp +++ b/examples/cloud/cloud_test.cpp @@ -39,8 +39,8 @@ #include "aether/tele/tele.h" -static constexpr std::string_view kWifiSsid = "Test"; -static constexpr std::string_view kWifiPass = "Test"; +static constexpr std::string_view kWifiSsid = "Test1234"; +static constexpr std::string_view kWifiPass = "Test1234"; namespace ae::cloud_test { constexpr ae::SafeStreamConfig kSafeStreamConfig{ diff --git a/examples/key_led/key_led_test.cpp b/examples/key_led/key_led_test.cpp index d06c1a2a..0bde91b0 100644 --- a/examples/key_led/key_led_test.cpp +++ b/examples/key_led/key_led_test.cpp @@ -45,8 +45,8 @@ using std::vector; -static constexpr std::string_view kWifiSsid = "Test123"; -static constexpr std::string_view kWifiPass = "Test123"; +static constexpr std::string_view kWifiSsid = "Test1234"; +static constexpr std::string_view kWifiPass = "Test1234"; static constexpr bool kUseAether = true; namespace ae::key_led_test { From 285fee537d20ac608dc8b93f735f7623d49360b3 Mon Sep 17 00:00:00 2001 From: Kiryanov D V Date: Wed, 26 Mar 2025 17:27:57 +0300 Subject: [PATCH 4/5] Modify the script update_arduino_lib.py to work under Windows. --- scripts/update_arduino_lib.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/scripts/update_arduino_lib.py b/scripts/update_arduino_lib.py index 8b7d2bda..11704761 100755 --- a/scripts/update_arduino_lib.py +++ b/scripts/update_arduino_lib.py @@ -21,11 +21,14 @@ # and call this script with -out # +import io import re import os import shutil import argparse +from pathlib import PureWindowsPath + # copy only files what matches FILTER_SOURCES = re.compile(r'^[\d\w\-_]+($|(\.((h)|(hpp)|(hh)|(c)|(cpp)|(cc)|(md))$))') # list names should not copied to arduino library @@ -112,13 +115,14 @@ def fix_include_paths(dir: str): if not re_sources.match(f): continue file_path = os.path.join(root, f) - lines = open(file_path, 'r').readlines() - with open(file_path, 'w') as open_file: + lines = io.open(file_path, 'r', encoding='utf-8').readlines() + with io.open(file_path, 'w', encoding='utf-8') as open_file: for l in lines: match = re_include.match(l) if match: should_include = get_file_path_relative_to(match[1], root, base_dir) l = '#include \"{}\"\n'.format(should_include) + l = PureWindowsPath(l).as_posix() open_file.write(l) def copy_aether_dir(aether_path:str, out_dir: str): From bbe7f5582811caaed7d6208e84679a8a7f897444 Mon Sep 17 00:00:00 2001 From: BartolomeyKant Date: Thu, 27 Mar 2025 10:26:45 +0500 Subject: [PATCH 5/5] change deep header file search logic --- scripts/update_arduino_lib.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/scripts/update_arduino_lib.py b/scripts/update_arduino_lib.py index 11704761..38f56348 100755 --- a/scripts/update_arduino_lib.py +++ b/scripts/update_arduino_lib.py @@ -53,12 +53,11 @@ def remove_empty_folders(dir:str): # get file path to #include relative to base def deep_get_file_path_relative_to(file_name:str, dir: str): - n = os.path.split(file_name)[1] - name = n if len(n) else file_name - for (root, _, files) in os.walk(dir): - for f in files: - if f == name: - return os.path.join(root, f) + for (root, dirs, _) in os.walk(dir): + for d in dirs: + file_path = os.path.join(root, d, file_name) + if os.path.exists(file_path): + return file_path return '' # get file path to #include relative to base @@ -75,6 +74,7 @@ def get_file_path_relative_to(file_name:str, dir: str, base: str): deep_find = deep_get_file_path_relative_to(file_name, dir) if len(deep_find): return os.path.relpath(deep_find, base) + # go to parent dir = os.path.split(dir)[0] raise Exception('file not found', 'File {} should be somewhere in {}'.format(file_name, base))