From 89efea7d9649377407f6b45c4766d9d478a09c89 Mon Sep 17 00:00:00 2001 From: Edward Firmo <94725493+edwardtfn@users.noreply.github.com> Date: Fri, 15 Dec 2023 07:07:54 +0100 Subject: [PATCH 1/4] UART changing at runtime (#3456) Based on esphome/esphome#5909 --- components/uart.rst | 78 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 78 insertions(+) diff --git a/components/uart.rst b/components/uart.rst index 0b8a6b390..e38db45af 100644 --- a/components/uart.rst +++ b/components/uart.rst @@ -180,6 +180,84 @@ In that case, either make sure that the debugger outputs less data per log line ``after.bytes`` option to a lower value) or increase the logger buffer size using the logger ``tx_buffer_size`` option. +.. _uart-runtime_change: + +Changing at runtime +------------------- + +There are scenarios where you might need to adjust UART parameters during runtime to enhance communication efficiency +and adapt to varying operational conditions. ESPHome facilitates this through lambda calls. +Below are the methods to read current settings and modify them dynamically: + +- **Reading Current Settings:** Access UART's current configuration using these read-only attributes: + + .. code-block:: cpp + + // RX buffer size + id(my_uart).get_rx_buffer_size(); + // Stop bits + id(my_uart).get_stop_bits(); + // Data bits + id(my_uart).get_data_bits(); + // Parity + id(my_uart).get_parity(); + // Baud rate + id(my_uart).get_baud_rate(); + +- **Modifying Settings at Runtime:** You can change certain UART parameters during runtime. + After setting new values, invoke ``load_settings()`` (ESP32 only) to apply these changes: + + .. code-block:: yaml + + select: + - id: change_baud_rate + name: Baud rate + platform: template + options: + - "2400" + - "9600" + - "38400" + - "57600" + - "115200" + - "256000" + - "512000" + - "921600" + initial_option: "115200" + optimistic: true + restore_value: True + internal: false + entity_category: config + icon: mdi:swap-horizontal + set_action: + - lambda: |- + id(my_uart).flush(); + uint32_t new_baud_rate = stoi(x); + ESP_LOGD("change_baud_rate", "Changing baud rate from %i to %i",id(my_uart).get_baud_rate(), new_baud_rate); + if (id(my_uart).get_baud_rate() != new_baud_rate) { + id(my_uart).set_baud_rate(new_baud_rate); + id(my_uart).load_settings(); + } + + Available methods for runtime changes: + + .. code-block:: cpp + + // Set TX/RX pins + id(my_uart).set_tx_pin(InternalGPIOPin *tx_pin); + id(my_uart).set_rx_pin(InternalGPIOPin *rx_pin); + // RX buffer size + id(my_uart).set_rx_buffer_size(size_t rx_buffer_size); + // Stop bits + id(my_uart).set_stop_bits(uint8_t stop_bits); + // Data bits + id(my_uart).set_data_bits(uint8_t data_bits); + // Parity + id(my_uart).set_parity(UARTParityOptions parity); + // Baud rate + id(my_uart).set_baud_rate(uint32_t baud_rate); + +This flexibility allows for dynamic adaptation to different communication requirements, enhancing the versatility of your ESPHome setup. + See Also -------- From 16c7e15ebc739517ab42488972862e2badc6ea77 Mon Sep 17 00:00:00 2001 From: Jesse Hills <3060199+jesserockz@users.noreply.github.com> Date: Fri, 22 Dec 2023 11:04:03 +0900 Subject: [PATCH 2/4] Bump version to 2023.12.2 --- Doxygen | 2 +- Makefile | 2 +- _static/version | 2 +- conf.py | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Doxygen b/Doxygen index 88b3c9aa4..269c31998 100644 --- a/Doxygen +++ b/Doxygen @@ -38,7 +38,7 @@ PROJECT_NAME = "ESPHome" # could be handy for archiving the generated documentation or if some version # control system is used. -PROJECT_NUMBER = 2023.12.1 +PROJECT_NUMBER = 2023.12.2 # Using the PROJECT_BRIEF tag one can provide an optional one line description # for a project that appears at the top of each page and should give viewer a diff --git a/Makefile b/Makefile index 26004aa9e..61f233c8a 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,5 @@ ESPHOME_PATH = ../esphome -ESPHOME_REF = 2023.12.1 +ESPHOME_REF = 2023.12.2 .PHONY: html html-strict cleanhtml deploy help live-html Makefile netlify netlify-api api netlify-dependencies svg2png copy-svg2png minify diff --git a/_static/version b/_static/version index 5f73c59e9..dbe03d474 100644 --- a/_static/version +++ b/_static/version @@ -1 +1 @@ -2023.12.1 \ No newline at end of file +2023.12.2 \ No newline at end of file diff --git a/conf.py b/conf.py index 55aaad6a2..e6e0d30dc 100644 --- a/conf.py +++ b/conf.py @@ -69,7 +69,7 @@ author = "ESPHome" # The short X.Y version. version = "2023.12" # The full version, including alpha/beta/rc tags. -release = "2023.12.1" +release = "2023.12.2" # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. From 407cef741c5fa04bb0288e58783971b5a32e8a24 Mon Sep 17 00:00:00 2001 From: Jesse Hills <3060199+jesserockz@users.noreply.github.com> Date: Fri, 22 Dec 2023 11:04:47 +0900 Subject: [PATCH 3/4] Update changelog for 2023.12.2 --- changelog/2023.12.0.rst | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/changelog/2023.12.0.rst b/changelog/2023.12.0.rst index f8e3f8c06..53e95261a 100644 --- a/changelog/2023.12.0.rst +++ b/changelog/2023.12.0.rst @@ -54,6 +54,15 @@ Release 2023.12.1 - December 21 - Fix replaced - in allowed characters during object_id sanitizing :esphomepr:`5983` by :ghuser:`jesserockz` +Release 2023.12.2 - December 22 +------------------------------- + +- ESP32-S3 and ESP-IDF don't play well with USB_CDC and need USB_SERIAL_JTAG :esphomepr:`5929` by :ghuser:`clydebarrow` +- Update libtiff6 :esphomepr:`5985` by :ghuser:`cvandesande` +- Override GPIOs 12 and 13 on the airm2m (LuatOS) board :esphomepr:`5982` by :ghuser:`davidmonro` +- Add workaround for crash in Arduino 2.0.9 when CDC is configured :esphomepr:`5987` by :ghuser:`kbx81` +- web_server.py: return empty content when file doesn't exist :esphomepr:`5980` by :ghuser:`jessicah` + Full list of changes -------------------- From 75c986611e09ee7eb69e238c7ea5e76ba309a933 Mon Sep 17 00:00:00 2001 From: Jesse Hills <3060199+jesserockz@users.noreply.github.com> Date: Fri, 22 Dec 2023 11:05:16 +0900 Subject: [PATCH 4/4] Update supporters for 2023.12.2 --- guides/supporters.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/guides/supporters.rst b/guides/supporters.rst index 4cef66f3d..26296355b 100644 --- a/guides/supporters.rst +++ b/guides/supporters.rst @@ -326,6 +326,7 @@ Contributors - `Dave Wongillies (@davewongillies) `__ - `David De Sloovere (@DavidDeSloovere) `__ - `David Beitey (@davidjb) `__ +- `davidmonro (@davidmonro) `__ - `David Newgas (@davidn) `__ - `David Noyes (@davidnoyes) `__ - `David Zovko (@davidzovko) `__ @@ -629,7 +630,6 @@ Contributors - `Jake Shirley (@JakeShirley) `__ - `jakub-medrzak (@jakub-medrzak) `__ - `James Braid (@jamesbraid) `__ -- `James Duke (@jamesduke) `__ - `James Hirka (@jameshirka) `__ - `James Lakin (@jamesorlakin) `__ - `Jason (@jamman9000) `__ @@ -1296,4 +1296,4 @@ Contributors - `Zsolt Zsiros (@ZsZs73) `__ - `Christian Zufferey (@zuzu59) `__ -*This page was last updated December 21, 2023.* +*This page was last updated December 22, 2023.*