Fix compilation errors with ESP-IDF 5.x and Arduino Core 3.x#22
Fix compilation errors with ESP-IDF 5.x and Arduino Core 3.x#22
Conversation
- Console.cpp: Cast uint8_t channel to uart_port_t in UART function calls - Console.cpp: Use new uart_vfs_dev_* API in ESP-IDF 5.0+ with version guards - GPIOCommands.cpp: Add missing #include <string> and <stdexcept> - NetworkCommands.cpp: Guard WiFi.localIPv6() for Arduino Core < 3 only - SystemCommands.cpp: Conditionally include esp_chip_info.h, guard core_version.h and xtruntime.h with __has_include, provide fallback XTSTR for non-Xtensa chips Co-authored-by: jbtronics <5410681+jbtronics@users.noreply.github.com>
|
@copilot Is this still compatible with the older arduino core versions? Especially if uart_port_t is not available? |
Yes, fully backward compatible with older Arduino Core versions:
|
|
@copilot Make the uart_channel_ field and channel argument of type uart_port_t, and add a overloaded version which accepts an uint8_t |
…8_t overload for backward compat Co-authored-by: jbtronics <5410681+jbtronics@users.noreply.github.com>
Done in commit
|
The library fails to compile against ESP-IDF 5.x / Arduino Core 3.x due to stricter type checking, API deprecations, removed WiFi methods, and chip info headers being reorganized.
Changes
Console.h— Add#include "driver/uart.h". Changeuart_channel_field fromuint8_ttouart_port_t. Change the primarybegin()overload to acceptuart_port_t channel = UART_NUM_0. Add abegin(int, int, int, uint8_t)overload for backward compatibility with older code passing plain integers oruint8_tvalues.Console.cpp— Updatebegin()definition to useuart_port_t channel. Gate VFS include and calls on ESP-IDF version: useuart_vfs_dev_*(5.0+) vsesp_vfs_dev_uart_*(legacy).GPIOCommands.cpp— Add missing#include <string>and#include <stdexcept>required forstd::stoul/std::invalid_argument.NetworkCommands.cpp— GuardWiFi.localIPv6()behindESP_ARDUINO_VERSION_MAJOR < 3; method was removed in Arduino Core 3.x.SystemCommands.cpp:<esp_chip_info.h>via__has_include(esp_chip_info_tmoved out ofesp_system.hin ESP-IDF 5.x).<core_version.h>and<xtensa/xtruntime.h>with__has_include; provide a portableXTSTRfallback for RISC-V targets (ESP32-C3/C6/H2).printfondefined(ARDUINO_ESP32_GIT_DESC).💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.