From fe8bfabc04f94d9cddfa54c20a82fd87355d0351 Mon Sep 17 00:00:00 2001 From: William Emfinger Date: Tue, 7 Apr 2026 22:00:23 -0500 Subject: [PATCH 1/9] chore: Update components to support ESP-IDF v6.0 --- components/adc/include/adc_types.hpp | 2 +- components/bldc_driver/CMakeLists.txt | 2 +- components/bldc_driver/include/bldc_driver.hpp | 8 +++++++- components/cli/CMakeLists.txt | 12 +++++++++++- components/cli/include/cli.hpp | 4 ++++ components/encoder/CMakeLists.txt | 2 +- components/esp-box/CMakeLists.txt | 2 +- components/esp-dsp | 2 +- components/esp32-timer-cam/CMakeLists.txt | 2 +- components/interrupt/CMakeLists.txt | 2 +- components/led/CMakeLists.txt | 2 +- components/m5stack-tab5/CMakeLists.txt | 2 +- components/m5stack-tab5/src/video.cpp | 17 ++++++++++++++++- components/monitor/src/heap_monitor.cpp | 15 +++++++++++++-- components/motorgo-mini/CMakeLists.txt | 2 +- components/motorgo-mini/src/motorgo-mini.cpp | 15 +++++---------- components/mt6701/example/CMakeLists.txt | 2 +- components/neopixel/CMakeLists.txt | 2 +- components/remote_debug/CMakeLists.txt | 2 +- components/rmt/CMakeLists.txt | 2 +- components/socket/src/socket.cpp | 2 +- .../example/main/Complex_generated_states.cpp | 4 ---- components/t-deck/CMakeLists.txt | 2 +- .../example/main/thermistor_example.cpp | 2 +- .../example/main/ws_s3_touch_example.cpp | 17 +++++++++-------- 25 files changed, 82 insertions(+), 44 deletions(-) diff --git a/components/adc/include/adc_types.hpp b/components/adc/include/adc_types.hpp index 89d3936a4..a69d902ba 100644 --- a/components/adc/include/adc_types.hpp +++ b/components/adc/include/adc_types.hpp @@ -12,7 +12,7 @@ struct AdcConfig { adc_unit_t unit; /**< Which adc unit is this channel associated with, e.g. ADC_UNIT_1. */ adc_channel_t channel; /**< The actual channel, e.g. ADC_CHANNEL_2. */ adc_atten_t - attenuation; /**< The attenuation associated with this channel, e.g. ADC_ATTEN_DB_11. */ + attenuation; /**< The attenuation associated with this channel, e.g. ADC_ATTEN_DB_12. */ }; static bool operator!=(const AdcConfig &lhs, const AdcConfig &rhs) { diff --git a/components/bldc_driver/CMakeLists.txt b/components/bldc_driver/CMakeLists.txt index 958dab252..306babb8b 100644 --- a/components/bldc_driver/CMakeLists.txt +++ b/components/bldc_driver/CMakeLists.txt @@ -1,4 +1,4 @@ idf_component_register( INCLUDE_DIRS "include" SRC_DIRS "src" - REQUIRES base_component driver) + REQUIRES base_component driver esp_driver_gpio esp_driver_mcpwm) diff --git a/components/bldc_driver/include/bldc_driver.hpp b/components/bldc_driver/include/bldc_driver.hpp index 3db2066f2..0255d0155 100644 --- a/components/bldc_driver/include/bldc_driver.hpp +++ b/components/bldc_driver/include/bldc_driver.hpp @@ -6,6 +6,8 @@ #include "driver/gpio.h" #include "driver/mcpwm_prelude.h" +#include "esp_idf_version.h" +#include "soc/soc_caps.h" #include "base_component.hpp" @@ -260,10 +262,12 @@ class BldcDriver : public BaseComponent { static int GROUP_ID; void init(const Config &config) { +#if defined(SOC_MCPWM_GROUPS) if (GROUP_ID >= SOC_MCPWM_GROUPS) { GROUP_ID = 0; logger_.error("Exceeded max number of MCPWM groups ({}), resetting to 0", SOC_MCPWM_GROUPS); } +#endif configure_enable_gpio(); configure_timer(); configure_operators(); @@ -324,8 +328,10 @@ class BldcDriver : public BaseComponent { gpio_fault_config.gpio_num = (gpio_num_t)gpio_fault_; gpio_fault_config.group_id = GROUP_ID; gpio_fault_config.flags.active_level = 1; // high level means fault, refer to TMC6300 datasheet - gpio_fault_config.flags.pull_down = true; // internally pull down +#if ESP_IDF_VERSION < ESP_IDF_VERSION_VAL(6, 0, 0) + gpio_fault_config.flags.pull_down = true; // internally pull down gpio_fault_config.flags.io_loop_back = true; // enable loop back to GPIO input +#endif ESP_ERROR_CHECK(mcpwm_new_gpio_fault(&gpio_fault_config, &fault_handle_)); logger_.info("Set brake mode on the fault event"); diff --git a/components/cli/CMakeLists.txt b/components/cli/CMakeLists.txt index dde0c216c..3b904b451 100644 --- a/components/cli/CMakeLists.txt +++ b/components/cli/CMakeLists.txt @@ -1,4 +1,14 @@ +include($ENV{IDF_PATH}/tools/cmake/version.cmake) + +set(cli_requires driver esp_driver_uart esp_driver_usb_serial_jtag vfs logger) + +if(IDF_VERSION_MAJOR GREATER_EQUAL 6) + list(APPEND cli_requires esp_stdio esp_usb_cdc_rom_console) +else() + list(APPEND cli_requires esp_vfs_console) +endif() + idf_component_register( INCLUDE_DIRS "include" "detail/cli/include" SRC_DIRS "src" - REQUIRES driver esp_driver_uart esp_driver_usb_serial_jtag vfs esp_vfs_console logger) + REQUIRES ${cli_requires}) diff --git a/components/cli/include/cli.hpp b/components/cli/include/cli.hpp index 9509b00d3..5d144aabd 100644 --- a/components/cli/include/cli.hpp +++ b/components/cli/include/cli.hpp @@ -15,7 +15,11 @@ #include "esp_vfs_cdcacm.h" #include "esp_vfs_dev.h" + +#include "esp_idf_version.h" +#if ESP_IDF_VERSION < ESP_IDF_VERSION_VAL(6, 0, 0) #include "esp_vfs_usb_serial_jtag.h" +#endif #include "line_input.hpp" diff --git a/components/encoder/CMakeLists.txt b/components/encoder/CMakeLists.txt index 4e90d84c0..ee92b315d 100644 --- a/components/encoder/CMakeLists.txt +++ b/components/encoder/CMakeLists.txt @@ -1,3 +1,3 @@ idf_component_register( INCLUDE_DIRS "include" - REQUIRES base_component driver) + REQUIRES base_component driver esp_driver_pcnt) diff --git a/components/esp-box/CMakeLists.txt b/components/esp-box/CMakeLists.txt index 110166c8f..09c5f20d8 100644 --- a/components/esp-box/CMakeLists.txt +++ b/components/esp-box/CMakeLists.txt @@ -1,6 +1,6 @@ idf_component_register( INCLUDE_DIRS "include" SRC_DIRS "src" - REQUIRES driver base_component codec display display_drivers i2c input_drivers interrupt gt911 task tt21100 icm42607 + REQUIRES driver esp_driver_i2s base_component codec display display_drivers i2c input_drivers interrupt gt911 task tt21100 icm42607 REQUIRED_IDF_TARGETS "esp32s3" ) diff --git a/components/esp-dsp b/components/esp-dsp index eedf2a508..921baa14c 160000 --- a/components/esp-dsp +++ b/components/esp-dsp @@ -1 +1 @@ -Subproject commit eedf2a50811195224f07f941250a99bf1368d69e +Subproject commit 921baa14ce8120831cdc1ddafb2d1f40ca1ea43f diff --git a/components/esp32-timer-cam/CMakeLists.txt b/components/esp32-timer-cam/CMakeLists.txt index 94c1f4057..2adb331ff 100644 --- a/components/esp32-timer-cam/CMakeLists.txt +++ b/components/esp32-timer-cam/CMakeLists.txt @@ -1,6 +1,6 @@ idf_component_register( INCLUDE_DIRS "include" SRC_DIRS "src" - REQUIRES driver adc base_component bm8563 i2c interrupt led math task + REQUIRES driver esp_driver_i2s esp_driver_spi adc base_component bm8563 i2c interrupt led math task REQUIRED_IDF_TARGETS "esp32" ) diff --git a/components/interrupt/CMakeLists.txt b/components/interrupt/CMakeLists.txt index 2d60c96bd..3740dd14e 100644 --- a/components/interrupt/CMakeLists.txt +++ b/components/interrupt/CMakeLists.txt @@ -1,4 +1,4 @@ idf_component_register( INCLUDE_DIRS "include" SRC_DIRS "src" - REQUIRES driver base_component task) + REQUIRES driver esp_driver_gpio base_component task) diff --git a/components/led/CMakeLists.txt b/components/led/CMakeLists.txt index 8c9da24c9..e812c8089 100644 --- a/components/led/CMakeLists.txt +++ b/components/led/CMakeLists.txt @@ -1,4 +1,4 @@ idf_component_register( INCLUDE_DIRS "include" SRC_DIRS "src" - REQUIRES base_component driver task) + REQUIRES base_component driver esp_driver_ledc task) diff --git a/components/m5stack-tab5/CMakeLists.txt b/components/m5stack-tab5/CMakeLists.txt index 20e5c74f3..6342405f1 100644 --- a/components/m5stack-tab5/CMakeLists.txt +++ b/components/m5stack-tab5/CMakeLists.txt @@ -1,6 +1,6 @@ idf_component_register( INCLUDE_DIRS "include" SRC_DIRS "src" - REQUIRES driver esp_lcd fatfs base_component bmi270 codec display display_drivers gt911 i2c ina226 input_drivers interrupt pi4ioe5v rx8130ce task + REQUIRES driver esp_driver_i2s esp_driver_sdmmc esp_driver_spi esp_lcd fatfs base_component bmi270 codec display display_drivers gt911 i2c ina226 input_drivers interrupt pi4ioe5v rx8130ce task REQUIRED_IDF_TARGETS "esp32p4" ) diff --git a/components/m5stack-tab5/src/video.cpp b/components/m5stack-tab5/src/video.cpp index 872c73b0a..8c10d8be8 100644 --- a/components/m5stack-tab5/src/video.cpp +++ b/components/m5stack-tab5/src/video.cpp @@ -3,6 +3,7 @@ #include #include +#include #include #include #include @@ -95,7 +96,7 @@ bool M5StackTab5::initialize_lcd() { .num_data_lanes = 2, .phy_clk_src = MIPI_DSI_PHY_CLK_SRC_DEFAULT, .lane_bit_rate_mbps = - (uint32_t)(detected_controller == DisplayController::ILI9881 ? 730 : 965), + static_cast(detected_controller == DisplayController::ILI9881 ? 730 : 965), }; ret = esp_lcd_new_dsi_bus(&bus_config, &lcd_handles_.mipi_dsi_bus); if (ret != ESP_OK) { @@ -135,7 +136,12 @@ bool M5StackTab5::initialize_lcd() { dpi_cfg.virtual_channel = 0; dpi_cfg.dpi_clk_src = MIPI_DSI_DPI_CLK_SRC_DEFAULT; dpi_cfg.dpi_clock_freq_mhz = 60; +#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(6, 0, 0) + dpi_cfg.in_color_format = LCD_COLOR_FMT_RGB565; + dpi_cfg.out_color_format = LCD_COLOR_FMT_RGB565; +#else dpi_cfg.pixel_format = LCD_COLOR_PIXEL_FORMAT_RGB565; +#endif dpi_cfg.num_fbs = 1; dpi_cfg.video_timing.h_size = display_width_; dpi_cfg.video_timing.v_size = display_height_; @@ -145,13 +151,20 @@ bool M5StackTab5::initialize_lcd() { dpi_cfg.video_timing.vsync_back_porch = 20; dpi_cfg.video_timing.vsync_pulse_width = 4; dpi_cfg.video_timing.vsync_front_porch = 20; +#if ESP_IDF_VERSION < ESP_IDF_VERSION_VAL(6, 0, 0) dpi_cfg.flags.use_dma2d = true; +#endif } else if (detected_controller == DisplayController::ST7123 && lcd_handles_.panel == nullptr) { dpi_cfg.virtual_channel = 0; dpi_cfg.dpi_clk_src = MIPI_DSI_DPI_CLK_SRC_DEFAULT; dpi_cfg.dpi_clock_freq_mhz = 100; +#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(6, 0, 0) + dpi_cfg.in_color_format = LCD_COLOR_FMT_RGB565; + dpi_cfg.out_color_format = LCD_COLOR_FMT_RGB565; +#else dpi_cfg.pixel_format = LCD_COLOR_PIXEL_FORMAT_RGB565; +#endif dpi_cfg.num_fbs = 1; dpi_cfg.video_timing.h_size = display_width_; dpi_cfg.video_timing.v_size = display_height_; @@ -161,7 +174,9 @@ bool M5StackTab5::initialize_lcd() { dpi_cfg.video_timing.vsync_back_porch = 8; dpi_cfg.video_timing.vsync_pulse_width = 2; dpi_cfg.video_timing.vsync_front_porch = 220; +#if ESP_IDF_VERSION < ESP_IDF_VERSION_VAL(6, 0, 0) dpi_cfg.flags.use_dma2d = true; +#endif } if (lcd_handles_.panel == nullptr) { diff --git a/components/monitor/src/heap_monitor.cpp b/components/monitor/src/heap_monitor.cpp index 0932e0eb1..2dec92cfe 100644 --- a/components/monitor/src/heap_monitor.cpp +++ b/components/monitor/src/heap_monitor.cpp @@ -1,5 +1,16 @@ #include "heap_monitor.hpp" +#include "esp_idf_version.h" + +// MALLOC_CAP_TCM was renamed to MALLOC_CAP_SPM in ESP-IDF v6.0 +#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(6, 0, 0) +#define ESPP_MALLOC_CAP_TCM MALLOC_CAP_SPM +#define ESPP_MALLOC_CAP_TCM_NAME "SPM " +#else +#define ESPP_MALLOC_CAP_TCM MALLOC_CAP_TCM +#define ESPP_MALLOC_CAP_TCM_NAME "TCM " +#endif + using namespace espp; std::string HeapMonitor::get_region_name(int heap_flags) { @@ -25,8 +36,8 @@ std::string HeapMonitor::get_region_name(int heap_flags) { if (heap_flags & MALLOC_CAP_RTCRAM) { name += "RTCRAM "; } - if (heap_flags & MALLOC_CAP_TCM) { - name += "TCM "; + if (heap_flags & ESPP_MALLOC_CAP_TCM) { + name += ESPP_MALLOC_CAP_TCM_NAME; } if (heap_flags & MALLOC_CAP_DMA_DESC_AHB) { name += "DMA AHB "; diff --git a/components/motorgo-mini/CMakeLists.txt b/components/motorgo-mini/CMakeLists.txt index 4fd247e6d..68fb249ca 100644 --- a/components/motorgo-mini/CMakeLists.txt +++ b/components/motorgo-mini/CMakeLists.txt @@ -1,6 +1,6 @@ idf_component_register( INCLUDE_DIRS "include" SRC_DIRS "src" - REQUIRES base_component interrupt filters led math mt6701 pid task bldc_driver bldc_motor i2c adc + REQUIRES base_component interrupt filters led math mt6701 pid task bldc_driver bldc_motor i2c adc esp_driver_spi REQUIRED_IDF_TARGETS "esp32s3" ) diff --git a/components/motorgo-mini/src/motorgo-mini.cpp b/components/motorgo-mini/src/motorgo-mini.cpp index f146fa25b..1efcbe936 100644 --- a/components/motorgo-mini/src/motorgo-mini.cpp +++ b/components/motorgo-mini/src/motorgo-mini.cpp @@ -208,16 +208,11 @@ float MotorGoMini::breathe(float breathing_period, uint64_t start_us, bool resta bool IRAM_ATTR MotorGoMini::read_encoder(const auto &encoder_handle, uint8_t *data, size_t size) { static constexpr uint8_t SPIBUS_READ = 0x80; - spi_transaction_t t = { - .flags = 0, - .cmd = 0, - .addr = SPIBUS_READ, - .length = size * 8, - .rxlength = size * 8, - .user = nullptr, - .tx_buffer = nullptr, - .rx_buffer = data, - }; + spi_transaction_t t{}; + t.addr = SPIBUS_READ; + t.length = size * 8; + t.rxlength = size * 8; + t.rx_buffer = data; if (size <= 4) { t.flags = SPI_TRANS_USE_RXDATA; t.rx_buffer = nullptr; diff --git a/components/mt6701/example/CMakeLists.txt b/components/mt6701/example/CMakeLists.txt index 290570849..041db1485 100644 --- a/components/mt6701/example/CMakeLists.txt +++ b/components/mt6701/example/CMakeLists.txt @@ -12,7 +12,7 @@ set(EXTRA_COMPONENT_DIRS set( COMPONENTS - "main esptool_py driver filters i2c task mt6701" + "main esptool_py driver esp_driver_spi filters i2c task mt6701" CACHE STRING "List of components to include" ) diff --git a/components/neopixel/CMakeLists.txt b/components/neopixel/CMakeLists.txt index 520f47b74..356220cc0 100644 --- a/components/neopixel/CMakeLists.txt +++ b/components/neopixel/CMakeLists.txt @@ -1,5 +1,5 @@ idf_component_register( INCLUDE_DIRS "include" SRC_DIRS "src" - REQUIRES base_component color rmt + REQUIRES base_component color esp_driver_gpio rmt ) diff --git a/components/remote_debug/CMakeLists.txt b/components/remote_debug/CMakeLists.txt index bd6b97c6b..d156de9b9 100644 --- a/components/remote_debug/CMakeLists.txt +++ b/components/remote_debug/CMakeLists.txt @@ -1,5 +1,5 @@ idf_component_register( INCLUDE_DIRS "include" SRC_DIRS "src" - REQUIRES esp_http_server driver adc base_component file_system timer + REQUIRES esp_http_server driver esp_driver_gpio adc base_component file_system timer ) diff --git a/components/rmt/CMakeLists.txt b/components/rmt/CMakeLists.txt index a069fc182..a13314281 100644 --- a/components/rmt/CMakeLists.txt +++ b/components/rmt/CMakeLists.txt @@ -1,4 +1,4 @@ idf_component_register( INCLUDE_DIRS "include" - REQUIRES base_component driver + REQUIRES base_component driver esp_driver_rmt ) diff --git a/components/socket/src/socket.cpp b/components/socket/src/socket.cpp index e6265c0e1..83df9d1bd 100644 --- a/components/socket/src/socket.cpp +++ b/components/socket/src/socket.cpp @@ -127,7 +127,7 @@ bool Socket::set_receive_timeout(const std::chrono::duration &timeout) { return true; } float intpart; - float fractpart = modf(seconds, &intpart); + float fractpart = modff(seconds, &intpart); const time_t response_timeout_s = (int)intpart; const time_t response_timeout_us = (int)(fractpart * 1E6); //// Alternatively we could do this: diff --git a/components/state_machine/example/main/Complex_generated_states.cpp b/components/state_machine/example/main/Complex_generated_states.cpp index 48b26ea96..d176f7c58 100644 --- a/components/state_machine/example/main/Complex_generated_states.cpp +++ b/components/state_machine/example/main/Complex_generated_states.cpp @@ -867,8 +867,6 @@ bool Root::State_2::ChildState3::Grand2::handleEvent(GeneratedEventBase *event) // take care of all event types that this branch will not handle - // for more consistent run-time performnace switch (event->get_type()) { - handled = true; - break; default: handled = false; break; @@ -1631,8 +1629,6 @@ bool Root::State3::ChildState::handleEvent(GeneratedEventBase *event) { // take care of all event types that this branch will not handle - // for more consistent run-time performnace switch (event->get_type()) { - handled = true; - break; default: handled = false; break; diff --git a/components/t-deck/CMakeLists.txt b/components/t-deck/CMakeLists.txt index 08a1d816a..1a70a27c3 100644 --- a/components/t-deck/CMakeLists.txt +++ b/components/t-deck/CMakeLists.txt @@ -2,6 +2,6 @@ idf_component_register( INCLUDE_DIRS "include" SRC_DIRS "src" - REQUIRES driver base_component display display_drivers fatfs i2c input_drivers interrupt gt911 task t_keyboard + REQUIRES driver esp_driver_i2s esp_driver_spi base_component display display_drivers fatfs i2c input_drivers interrupt gt911 task t_keyboard REQUIRED_IDF_TARGETS "esp32s3" ) diff --git a/components/thermistor/example/main/thermistor_example.cpp b/components/thermistor/example/main/thermistor_example.cpp index b00a3cefb..927299649 100644 --- a/components/thermistor/example/main/thermistor_example.cpp +++ b/components/thermistor/example/main/thermistor_example.cpp @@ -75,7 +75,7 @@ extern "C" void app_main(void) { // create a continuous ADC which will sample and filter the thermistor // voltage on ADC1 channel 7 std::vector channels{ - {.unit = ADC_UNIT_1, .channel = ADC_CHANNEL_7, .attenuation = ADC_ATTEN_DB_11}}; + {.unit = ADC_UNIT_1, .channel = ADC_CHANNEL_7, .attenuation = ADC_ATTEN_DB_12}}; // this initailizes the DMA and filter task for the continuous adc espp::ContinuousAdc adc( {.sample_rate_hz = 20 * 1000, diff --git a/components/ws-s3-touch/example/main/ws_s3_touch_example.cpp b/components/ws-s3-touch/example/main/ws_s3_touch_example.cpp index 774714168..6158021b0 100644 --- a/components/ws-s3-touch/example/main/ws_s3_touch_example.cpp +++ b/components/ws-s3-touch/example/main/ws_s3_touch_example.cpp @@ -115,14 +115,15 @@ extern "C" void app_main(void) { return; } // now set the time on the RTC - std::tm timeinfo{ - .tm_sec = 0, - .tm_min = 42, - .tm_hour = 13, - .tm_mday = 24, - .tm_mon = 10, // 0-11, so 10 is November - .tm_year = 123 // years since 1900, so 100 is 2000 - }; + std::tm timeinfo{.tm_sec = 0, + .tm_min = 42, + .tm_hour = 13, + .tm_mday = 24, + .tm_mon = 10, // 0-11, so 10 is November + .tm_year = 123, // years since 1900, so 100 is 2000 + .tm_wday = 0, + .tm_yday = 0, + .tm_isdst = -1}; std::error_code ec; bsp.rtc()->set_time(timeinfo, ec); if (ec) { From f0b75fc2db415ba81161ac64a723bc92dbee700e Mon Sep 17 00:00:00 2001 From: William Emfinger Date: Wed, 8 Apr 2026 08:55:01 -0500 Subject: [PATCH 2/9] fix m5stack tab5 type change from 5.5 to 6.0 --- components/m5stack-tab5/src/video.cpp | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/components/m5stack-tab5/src/video.cpp b/components/m5stack-tab5/src/video.cpp index 8c10d8be8..28e2a4666 100644 --- a/components/m5stack-tab5/src/video.cpp +++ b/components/m5stack-tab5/src/video.cpp @@ -1,5 +1,7 @@ #include "m5stack-tab5.hpp" +#include "esp_idf_version.h" + #include #include @@ -92,11 +94,15 @@ bool M5StackTab5::initialize_lcd() { if (lcd_handles_.mipi_dsi_bus == nullptr) { logger_.info("Creating MIPI DSI bus"); esp_lcd_dsi_bus_config_t bus_config = { - .bus_id = 0, - .num_data_lanes = 2, - .phy_clk_src = MIPI_DSI_PHY_CLK_SRC_DEFAULT, - .lane_bit_rate_mbps = - static_cast(detected_controller == DisplayController::ILI9881 ? 730 : 965), + .bus_id = 0, + .num_data_lanes = 2, + .phy_clk_src = MIPI_DSI_PHY_CLK_SRC_DEFAULT, + .lane_bit_rate_mbps = +#if ESP_IDF_VERSION < ESP_IDF_VERSION_VAL(6, 0, 0) + static_cast(detected_controller == DisplayController::ILI9881 ? 730 : 965), +#else + static_cast(detected_controller == DisplayController::ILI9881 ? 730 : 965), +#endif }; ret = esp_lcd_new_dsi_bus(&bus_config, &lcd_handles_.mipi_dsi_bus); if (ret != ESP_OK) { From 532ee225df38745ce1e1a205522265fc6f4dfa76 Mon Sep 17 00:00:00 2001 From: William Emfinger Date: Wed, 8 Apr 2026 08:57:08 -0500 Subject: [PATCH 3/9] address comments --- .../example/main/ws_s3_touch_example.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/components/ws-s3-touch/example/main/ws_s3_touch_example.cpp b/components/ws-s3-touch/example/main/ws_s3_touch_example.cpp index 6158021b0..4f9bf85f5 100644 --- a/components/ws-s3-touch/example/main/ws_s3_touch_example.cpp +++ b/components/ws-s3-touch/example/main/ws_s3_touch_example.cpp @@ -115,15 +115,15 @@ extern "C" void app_main(void) { return; } // now set the time on the RTC - std::tm timeinfo{.tm_sec = 0, - .tm_min = 42, - .tm_hour = 13, - .tm_mday = 24, - .tm_mon = 10, // 0-11, so 10 is November - .tm_year = 123, // years since 1900, so 100 is 2000 - .tm_wday = 0, - .tm_yday = 0, - .tm_isdst = -1}; + std::tm timeinfo{}; + timeinfo.tm_sec = 0; + timeinfo.tm_min = 42; + timeinfo.tm_hour = 13; + timeinfo.tm_mday = 24; + timeinfo.tm_mon = 10; // 0-11, so 10 is November + timeinfo.tm_year = 2023 - 1900; // years since 1900 + std::mktime(&timeinfo); + std::error_code ec; bsp.rtc()->set_time(timeinfo, ec); if (ec) { From 9d07f8834899a174aea9b54c3dc8838bc3bb6669 Mon Sep 17 00:00:00 2001 From: William Emfinger Date: Fri, 22 May 2026 16:20:16 -0500 Subject: [PATCH 4/9] update libfmt to latest; update binary-log to latest (which fixes binary log compile issue with esp-idf v6.x --- components/binary-log/detail | 2 +- components/format/detail/fmt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/components/binary-log/detail b/components/binary-log/detail index b8b9f5cff..66f8c5a94 160000 --- a/components/binary-log/detail +++ b/components/binary-log/detail @@ -1 +1 @@ -Subproject commit b8b9f5cffc84272c52849150451ce6f786238f29 +Subproject commit 66f8c5a94731c1084086b3bd2b1210243252c1a5 diff --git a/components/format/detail/fmt b/components/format/detail/fmt index 730fd4d9a..93e26fa57 160000 --- a/components/format/detail/fmt +++ b/components/format/detail/fmt @@ -1 +1 @@ -Subproject commit 730fd4d9a7a9f5973a47c5c540becc71b62b8387 +Subproject commit 93e26fa578712891ee0a5302e7563e0ba79efef9 From a3878b77f9a0c253991524f45305b0a7fd6865fd Mon Sep 17 00:00:00 2001 From: William Emfinger Date: Fri, 22 May 2026 22:06:09 -0500 Subject: [PATCH 5/9] add format.hpp shim for issue with int128 on esp --- components/format/include/format.hpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/components/format/include/format.hpp b/components/format/include/format.hpp index 52382b1d4..5eca29b3e 100644 --- a/components/format/include/format.hpp +++ b/components/format/include/format.hpp @@ -11,3 +11,13 @@ #include #include #include + +#if !FMT_USE_INT128 +namespace fmt { +inline namespace v12 { +namespace detail { +constexpr auto operator~(const uint128 &value) -> uint128 { return {~value.high(), ~value.low()}; } +} // namespace detail +} // namespace v12 +} // namespace fmt +#endif From 35df0fc341cd03aaf2517247e139a88c512b20ae Mon Sep 17 00:00:00 2001 From: William Emfinger Date: Fri, 22 May 2026 22:22:58 -0500 Subject: [PATCH 6/9] test esp-idf v5.5 and v6.0 builds with updated gfps library --- components/gfps_service/detail/nearby | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/gfps_service/detail/nearby b/components/gfps_service/detail/nearby index c6b6cf4d5..7269ecbcd 160000 --- a/components/gfps_service/detail/nearby +++ b/components/gfps_service/detail/nearby @@ -1 +1 @@ -Subproject commit c6b6cf4d5155b4f4e0ab7ecc7ed0e84931a44194 +Subproject commit 7269ecbcd4e7cedb8b7dd72d1caf06b670fa8171 From 8ecfdbbdcbfa660deba68c783d6d05ccacd5a379 Mon Sep 17 00:00:00 2001 From: William Emfinger Date: Fri, 22 May 2026 22:38:05 -0500 Subject: [PATCH 7/9] ensure we have latest gfps changes in fix branch :sweat_smile: --- components/gfps_service/detail/nearby | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/gfps_service/detail/nearby b/components/gfps_service/detail/nearby index 7269ecbcd..9fb0d0b75 160000 --- a/components/gfps_service/detail/nearby +++ b/components/gfps_service/detail/nearby @@ -1 +1 @@ -Subproject commit 7269ecbcd4e7cedb8b7dd72d1caf06b670fa8171 +Subproject commit 9fb0d0b750c36e879e473e945634ad6873f7a52e From 93c3beba05ab0b8cd973380b96d3283847fb806d Mon Sep 17 00:00:00 2001 From: William Emfinger Date: Sat, 23 May 2026 20:41:22 -0500 Subject: [PATCH 8/9] fix static analysis --- .../ads7138/example/main/ads7138_example.cpp | 6 ++- components/ads7138/include/ads7138.hpp | 2 +- .../bldc_driver/include/bldc_driver.hpp | 6 +++ .../chsc6x/example/main/chsc6x_example.cpp | 4 -- components/cli/include/cli.hpp | 6 +++ .../cst816/example/main/cst816_example.cpp | 4 -- components/cst816/include/cst816.hpp | 3 +- .../esp-box/example/main/esp_box_example.cpp | 2 - .../example/main/file_system_example.cpp | 8 +++ components/ftp/include/ftp_client_session.hpp | 2 +- components/gfps_service/src/nearby_ble.cpp | 10 ++-- .../gt911/example/main/gt911_example.cpp | 4 -- components/gt911/include/gt911.hpp | 2 +- components/hid-rp/include/hid-rp-gamepad.hpp | 2 +- .../hid-rp/include/hid-rp-playstation.hpp | 4 +- .../hid-rp/include/hid-rp-switch-pro.hpp | 7 ++- components/hid-rp/include/hid-rp-xbox.hpp | 12 ++--- components/icm42607/include/icm42607.hpp | 4 +- .../example/main/interrupt_example.cpp | 6 +++ components/led/include/led.hpp | 8 +++ components/led/src/led.cpp | 7 +++ .../example/main/m5stack_tab5_example.cpp | 2 - components/m5stack-tab5/src/video.cpp | 7 ++- components/math/include/fast_math.hpp | 11 ++-- components/monitor/src/heap_monitor.cpp | 6 +++ components/nvs/include/nvs.hpp | 4 +- components/nvs/include/nvs_handle_espp.hpp | 4 +- components/pid/include/pid.hpp | 2 +- components/qmi8658/include/qmi8658.hpp | 4 +- components/socket/src/socket.cpp | 50 +++++++++++-------- components/socket/src/tcp_socket.cpp | 27 ++++++---- components/socket/src/udp_socket.cpp | 21 ++++---- components/st25dv/include/st25dv.hpp | 9 ++-- .../t-deck/example/main/t_deck_example.cpp | 2 - components/tla2528/include/tla2528.hpp | 2 +- components/tt21100/include/tt21100.hpp | 14 +++--- components/vl53l/include/vl53l.hpp | 9 ++-- components/wifi/include/wifi.hpp | 4 +- 38 files changed, 174 insertions(+), 113 deletions(-) diff --git a/components/ads7138/example/main/ads7138_example.cpp b/components/ads7138/example/main/ads7138_example.cpp index 086a66ad5..001e294dd 100644 --- a/components/ads7138/example/main/ads7138_example.cpp +++ b/components/ads7138/example/main/ads7138_example.cpp @@ -67,8 +67,9 @@ using namespace std::chrono_literals; // change the digital output value by pressing the button on the joystick. static QueueHandle_t gpio_evt_queue; +// cppcheck-suppress constParameterCallback static void gpio_isr_handler(void *arg) { - uint32_t gpio_num = (uint32_t)arg; + uint32_t gpio_num = static_cast(reinterpret_cast(arg)); xQueueSendFromISR(gpio_evt_queue, &gpio_num, NULL); } @@ -129,7 +130,8 @@ extern "C" void app_main(void) { // install gpio isr service gpio_install_isr_service(0); - gpio_isr_handler_add(ALERT_PIN, gpio_isr_handler, (void *)ALERT_PIN); + gpio_isr_handler_add(ALERT_PIN, gpio_isr_handler, + reinterpret_cast(static_cast(ALERT_PIN))); // start the gpio task auto alert_task = espp::Task::make_unique({ diff --git a/components/ads7138/include/ads7138.hpp b/components/ads7138/include/ads7138.hpp index 2f3e95b25..0dc8a6d70 100644 --- a/components/ads7138/include/ads7138.hpp +++ b/components/ads7138/include/ads7138.hpp @@ -1510,7 +1510,7 @@ class Ads7138 : public BasePeripheral<> { } void write_two_(Register reg, uint16_t value, std::error_code &ec) { - write_block_(reg, (uint8_t *)&value, 2, ec); + write_block_(reg, reinterpret_cast(&value), 2, ec); } void write_block_(Register reg, const uint8_t *data, uint8_t len, std::error_code &ec) { diff --git a/components/bldc_driver/include/bldc_driver.hpp b/components/bldc_driver/include/bldc_driver.hpp index 0255d0155..3f2324d9a 100644 --- a/components/bldc_driver/include/bldc_driver.hpp +++ b/components/bldc_driver/include/bldc_driver.hpp @@ -7,6 +7,12 @@ #include "driver/gpio.h" #include "driver/mcpwm_prelude.h" #include "esp_idf_version.h" +#ifndef ESP_IDF_VERSION_VAL +#define ESP_IDF_VERSION_VAL(major, minor, patch) (((major) << 16) | ((minor) << 8) | (patch)) +#endif +#ifndef ESP_IDF_VERSION +#define ESP_IDF_VERSION ESP_IDF_VERSION_VAL(0, 0, 0) +#endif #include "soc/soc_caps.h" #include "base_component.hpp" diff --git a/components/chsc6x/example/main/chsc6x_example.cpp b/components/chsc6x/example/main/chsc6x_example.cpp index 9ddb79245..70d4e353e 100644 --- a/components/chsc6x/example/main/chsc6x_example.cpp +++ b/components/chsc6x/example/main/chsc6x_example.cpp @@ -50,10 +50,6 @@ extern "C" void app_main(void) { uint8_t num_touch_points = 0; uint16_t x = 0, y = 0; chsc6x.get_touch_point(&num_touch_points, &x, &y); - if (ec) { - fmt::print("Could not get touch point\n"); - return false; - } fmt::print("num_touch_points: {}, x: {}, y: {}\n", num_touch_points, x, y); // NOTE: sleeping in this way allows the sleep to exit early when the // task is being stopped / destroyed diff --git a/components/cli/include/cli.hpp b/components/cli/include/cli.hpp index 5d144aabd..fd0577e5d 100644 --- a/components/cli/include/cli.hpp +++ b/components/cli/include/cli.hpp @@ -17,6 +17,12 @@ #include "esp_vfs_dev.h" #include "esp_idf_version.h" +#ifndef ESP_IDF_VERSION_VAL +#define ESP_IDF_VERSION_VAL(major, minor, patch) (((major) << 16) | ((minor) << 8) | (patch)) +#endif +#ifndef ESP_IDF_VERSION +#define ESP_IDF_VERSION ESP_IDF_VERSION_VAL(0, 0, 0) +#endif #if ESP_IDF_VERSION < ESP_IDF_VERSION_VAL(6, 0, 0) #include "esp_vfs_usb_serial_jtag.h" #endif diff --git a/components/cst816/example/main/cst816_example.cpp b/components/cst816/example/main/cst816_example.cpp index bc0f52bac..cd374ed2c 100644 --- a/components/cst816/example/main/cst816_example.cpp +++ b/components/cst816/example/main/cst816_example.cpp @@ -53,10 +53,6 @@ extern "C" void app_main(void) { uint8_t num_touch_points = 0; uint16_t x = 0, y = 0; cst816.get_touch_point(&num_touch_points, &x, &y); - if (ec) { - fmt::print("Could not get touch point\n"); - return false; - } fmt::print("num_touch_points: {}, x: {}, y: {}\n", num_touch_points, x, y); // NOTE: sleeping in this way allows the sleep to exit early when the // task is being stopped / destroyed diff --git a/components/cst816/include/cst816.hpp b/components/cst816/include/cst816.hpp index 095f3f4a1..a3ac94e72 100644 --- a/components/cst816/include/cst816.hpp +++ b/components/cst816/include/cst816.hpp @@ -44,7 +44,8 @@ class Cst816 : public BasePeripheral { bool update(std::error_code &ec) { bool new_data = false; Data data{}; - read_many_from_register((uint8_t)Registers::DATA_START, (uint8_t *)&data, sizeof(data), ec); + read_many_from_register(static_cast(Registers::DATA_START), + reinterpret_cast(&data), sizeof(data), ec); if (ec) return false; diff --git a/components/esp-box/example/main/esp_box_example.cpp b/components/esp-box/example/main/esp_box_example.cpp index e8f9cb33b..451e2f0cf 100644 --- a/components/esp-box/example/main/esp_box_example.cpp +++ b/components/esp-box/example/main/esp_box_example.cpp @@ -390,9 +390,7 @@ static bool load_audio(size_t &out_size, size_t &out_sample_rate) { // load the audio data. these are configured in the CMakeLists.txt file - // cppcheck-suppress syntaxError extern const uint8_t click_wav_start[] asm("_binary_click_wav_start"); - // cppcheck-suppress syntaxError extern const uint8_t click_wav_end[] asm("_binary_click_wav_end"); audio_bytes = std::vector(click_wav_start, click_wav_end); // ensure we have at least a wav header diff --git a/components/file_system/example/main/file_system_example.cpp b/components/file_system/example/main/file_system_example.cpp index 747c0a169..e3f789d34 100644 --- a/components/file_system/example/main/file_system_example.cpp +++ b/components/file_system/example/main/file_system_example.cpp @@ -3,6 +3,14 @@ #include #include +#include "esp_idf_version.h" +#ifndef ESP_IDF_VERSION_VAL +#define ESP_IDF_VERSION_VAL(major, minor, patch) (((major) << 16) | ((minor) << 8) | (patch)) +#endif +#ifndef ESP_IDF_VERSION +#define ESP_IDF_VERSION ESP_IDF_VERSION_VAL(0, 0, 0) +#endif + #include "logger.hpp" #include "file_system.hpp" diff --git a/components/ftp/include/ftp_client_session.hpp b/components/ftp/include/ftp_client_session.hpp index 1ca006993..b535936b3 100644 --- a/components/ftp/include/ftp_client_session.hpp +++ b/components/ftp/include/ftp_client_session.hpp @@ -383,7 +383,7 @@ class FtpClientSession : public BaseComponent { } bool parse_ftp_command(std::string_view request, std::string_view &command, - std::string_view &arguments) { + std::string_view &arguments) const { // parses the command from the FTP client's request. The command is the // first word in the request. The command is case insensitive. // The command is followed by a space and then the arguments. diff --git a/components/gfps_service/src/nearby_ble.cpp b/components/gfps_service/src/nearby_ble.cpp index a22409ed7..975ee460e 100644 --- a/components/gfps_service/src/nearby_ble.cpp +++ b/components/gfps_service/src/nearby_ble.cpp @@ -98,12 +98,12 @@ int espp::gfps::ble_gap_event_handler(ble_gap_event *event, void *arg) { if (pairing_succeeded) { logger.info("Pairing succeeded with {}", addr.toString()); if (g_bt_interface) { - g_bt_interface->on_paired(uint64_t(addr)); + g_bt_interface->on_paired(static_cast(addr)); } } else { logger.error("Pairing failed with {}", addr.toString()); if (g_bt_interface) { - g_bt_interface->on_pairing_failed(uint64_t(addr)); + g_bt_interface->on_pairing_failed(static_cast(addr)); } } // set the IO capability of the device (GFPS uses the passkey through a @@ -129,7 +129,7 @@ uint64_t nearby_platform_GetBleAddress() { // explicitly get the random address here, since the GetPublicAddress function // will call NimBLEDevice::getAddress() which will return the public address uint64_t address = 0; - auto rc = ble_hs_id_copy_addr(BLE_ADDR_RANDOM, (uint8_t *)&address, nullptr); + auto rc = ble_hs_id_copy_addr(BLE_ADDR_RANDOM, reinterpret_cast(&address), nullptr); if (rc != 0) { logger.error("Failed to get ble address"); return 0; @@ -205,7 +205,7 @@ nearby_platform_status nearby_platform_GattNotify(uint64_t peer_address, // interval - Advertising interval code. nearby_platform_status nearby_platform_SetAdvertisement(const uint8_t *payload, size_t length, nearby_fp_AvertisementInterval interval) { - logger.info("Setting advertisement, interval code: {}", (int)interval); + logger.info("Setting advertisement, interval code: {}", static_cast(interval)); // For information of the contents of the payload, see: // https://btprodspecificationrefs.blob.core.windows.net/assigned-numbers/Assigned%20Number%20Types/Assigned_Numbers.pdf @@ -246,7 +246,7 @@ uint64_t nearby_platform_GetPublicAddress() { #if CONFIG_BT_NIMBLE_ENABLED auto address = NimBLEDevice::getAddress(); logger.info("GetPublicAddress: {}", address.toString()); - return uint64_t(address); + return static_cast(address); #else return 0; #endif // CONFIG_BT_NIMBLE_ENABLED diff --git a/components/gt911/example/main/gt911_example.cpp b/components/gt911/example/main/gt911_example.cpp index 5bbe15892..0d8baea72 100644 --- a/components/gt911/example/main/gt911_example.cpp +++ b/components/gt911/example/main/gt911_example.cpp @@ -57,10 +57,6 @@ extern "C" void app_main(void) { uint8_t num_touch_points = 0; uint16_t x = 0, y = 0; gt911.get_touch_point(&num_touch_points, &x, &y); - if (ec) { - fmt::print("Could not get touch point\n"); - return false; - } fmt::print("num_touch_points: {}, x: {}, y: {}\n", num_touch_points, x, y); // NOTE: sleeping in this way allows the sleep to exit early when the // task is being stopped / destroyed diff --git a/components/gt911/include/gt911.hpp b/components/gt911/include/gt911.hpp index 49b2aa54f..fc5ebb1ad 100644 --- a/components/gt911/include/gt911.hpp +++ b/components/gt911/include/gt911.hpp @@ -71,7 +71,7 @@ class Gt911 : public BasePeripheral { if (ec) return false; // convert the data pointer to a GTPoint* - const GTPoint *point = (GTPoint *)&data[0]; + const auto *point = reinterpret_cast(&data[0]); x_ = point->x; y_ = point->y; logger_.debug("Touch at ({}, {})", x_, y_); diff --git a/components/hid-rp/include/hid-rp-gamepad.hpp b/components/hid-rp/include/hid-rp-gamepad.hpp index fb85b60cb..913e3d786 100644 --- a/components/hid-rp/include/hid-rp-gamepad.hpp +++ b/components/hid-rp/include/hid-rp-gamepad.hpp @@ -59,7 +59,7 @@ class GamepadInputReport : public hid::report::base #include "esp_idf_version.h" +#ifndef ESP_IDF_VERSION_VAL +#define ESP_IDF_VERSION_VAL(major, minor, patch) (((major) << 16) | ((minor) << 8) | (patch)) +#endif +#ifndef ESP_IDF_VERSION +#define ESP_IDF_VERSION ESP_IDF_VERSION_VAL(0, 0, 0) +#endif #if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(5, 2, 0) #include diff --git a/components/led/include/led.hpp b/components/led/include/led.hpp index 1f70cfc89..0b169d0e7 100644 --- a/components/led/include/led.hpp +++ b/components/led/include/led.hpp @@ -6,6 +6,14 @@ #include #include +#include "esp_idf_version.h" +#ifndef ESP_IDF_VERSION_VAL +#define ESP_IDF_VERSION_VAL(major, minor, patch) (((major) << 16) | ((minor) << 8) | (patch)) +#endif +#ifndef ESP_IDF_VERSION +#define ESP_IDF_VERSION ESP_IDF_VERSION_VAL(0, 0, 0) +#endif + #include #include #include diff --git a/components/led/src/led.cpp b/components/led/src/led.cpp index 6f3f8dd37..81dd8807a 100644 --- a/components/led/src/led.cpp +++ b/components/led/src/led.cpp @@ -1,5 +1,12 @@ #include "led.hpp" +#ifndef ESP_IDF_VERSION_VAL +#define ESP_IDF_VERSION_VAL(major, minor, patch) (((major) << 16) | ((minor) << 8) | (patch)) +#endif +#ifndef ESP_IDF_VERSION +#define ESP_IDF_VERSION ESP_IDF_VERSION_VAL(0, 0, 0) +#endif + using namespace espp; std::mutex Led::fade_service_mutex; diff --git a/components/m5stack-tab5/example/main/m5stack_tab5_example.cpp b/components/m5stack-tab5/example/main/m5stack_tab5_example.cpp index 281b7209e..d5034a3c8 100644 --- a/components/m5stack-tab5/example/main/m5stack_tab5_example.cpp +++ b/components/m5stack-tab5/example/main/m5stack_tab5_example.cpp @@ -530,9 +530,7 @@ static bool load_audio(size_t &out_size, size_t &out_sample_rate) { // load the audio data. these are configured in the CMakeLists.txt file - // cppcheck-suppress syntaxError extern const uint8_t click_wav_start[] asm("_binary_click_wav_start"); - // cppcheck-suppress syntaxError extern const uint8_t click_wav_end[] asm("_binary_click_wav_end"); audio_bytes = std::vector(click_wav_start, click_wav_end); // ensure we have at least a wav header diff --git a/components/m5stack-tab5/src/video.cpp b/components/m5stack-tab5/src/video.cpp index 28e2a4666..afae25224 100644 --- a/components/m5stack-tab5/src/video.cpp +++ b/components/m5stack-tab5/src/video.cpp @@ -1,11 +1,16 @@ #include "m5stack-tab5.hpp" #include "esp_idf_version.h" +#ifndef ESP_IDF_VERSION_VAL +#define ESP_IDF_VERSION_VAL(major, minor, patch) (((major) << 16) | ((minor) << 8) | (patch)) +#endif +#ifndef ESP_IDF_VERSION +#define ESP_IDF_VERSION ESP_IDF_VERSION_VAL(0, 0, 0) +#endif #include #include -#include #include #include #include diff --git a/components/math/include/fast_math.hpp b/components/math/include/fast_math.hpp index 0f2a47f07..20a2baef9 100644 --- a/components/math/include/fast_math.hpp +++ b/components/math/include/fast_math.hpp @@ -111,11 +111,12 @@ template int sgn(T x) { return (T(0) < x) - (x < T(0)); } if (x >= points[points.size() - 1].first) { return points[points.size() - 1].second; } - for (size_t i = 1; i < points.size(); i++) { - if (x <= points[i].first) { - float t = inv_lerp(points[i - 1].first, points[i].first, x); - return lerp(points[i - 1].second, points[i].second, t); - } + const auto it = std::find_if(points.begin() + 1, points.end(), + [x](const auto &point) { return x <= point.first; }); + if (it != points.end()) { + const auto prev = std::prev(it); + float t = inv_lerp(prev->first, it->first, x); + return lerp(prev->second, it->second, t); } return 0.0f; } diff --git a/components/monitor/src/heap_monitor.cpp b/components/monitor/src/heap_monitor.cpp index 2dec92cfe..2cf02c1e8 100644 --- a/components/monitor/src/heap_monitor.cpp +++ b/components/monitor/src/heap_monitor.cpp @@ -1,6 +1,12 @@ #include "heap_monitor.hpp" #include "esp_idf_version.h" +#ifndef ESP_IDF_VERSION_VAL +#define ESP_IDF_VERSION_VAL(major, minor, patch) (((major) << 16) | ((minor) << 8) | (patch)) +#endif +#ifndef ESP_IDF_VERSION +#define ESP_IDF_VERSION ESP_IDF_VERSION_VAL(0, 0, 0) +#endif // MALLOC_CAP_TCM was renamed to MALLOC_CAP_SPM in ESP-IDF v6.0 #if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(6, 0, 0) diff --git a/components/nvs/include/nvs.hpp b/components/nvs/include/nvs.hpp index e9f29cc4b..c4bd4a419 100644 --- a/components/nvs/include/nvs.hpp +++ b/components/nvs/include/nvs.hpp @@ -53,7 +53,7 @@ class Nvs : public BaseComponent { /// @brief Erase a namespace from the NVS /// @param[in] ns_name Namespace of the variable to erase /// @param[out] ec Saves a std::error_code representing success or failure - bool erase(std::string_view ns_name, std::error_code &ec) { + bool erase(std::string_view ns_name, std::error_code &ec) const { espp::NvsHandle handle(ns_name.data(), ec); if (ec) return false; @@ -68,7 +68,7 @@ class Nvs : public BaseComponent { /// @param[in] ns_name Namespace of the variable to erase /// @param[in] key NVS Key of the variable to erase /// @param[out] ec Saves a std::error_code representing success or failure - bool erase(std::string_view ns_name, std::string_view key, std::error_code &ec) { + bool erase(std::string_view ns_name, std::string_view key, std::error_code &ec) const { espp::NvsHandle handle(ns_name.data(), ec); if (ec) return false; diff --git a/components/nvs/include/nvs_handle_espp.hpp b/components/nvs/include/nvs_handle_espp.hpp index 1afc597d1..ea3cc706c 100644 --- a/components/nvs/include/nvs_handle_espp.hpp +++ b/components/nvs/include/nvs_handle_espp.hpp @@ -500,7 +500,9 @@ class NvsHandle : public BaseComponent { /** * @brief overload of std::make_error_code used by custom error codes. */ - std::error_code make_error_code(NvsErrc e) { return {static_cast(e), theNvsErrCategory}; } + static std::error_code make_error_code(NvsErrc e) { + return {static_cast(e), theNvsErrCategory}; + } }; // Class NvsHandle } // namespace espp diff --git a/components/pid/include/pid.hpp b/components/pid/include/pid.hpp index 3b09f8328..99fd29eff 100644 --- a/components/pid/include/pid.hpp +++ b/components/pid/include/pid.hpp @@ -151,7 +151,7 @@ class Pid : public BaseComponent { * @brief Get the configuration for the PID (gains, etc.). * @return Config structure containing gains, etc. */ - Config get_config() const { return config_; } + const Config &get_config() const { return config_; } protected: Config config_; diff --git a/components/qmi8658/include/qmi8658.hpp b/components/qmi8658/include/qmi8658.hpp index 1726ab5c3..dc5317c66 100644 --- a/components/qmi8658/include/qmi8658.hpp +++ b/components/qmi8658/include/qmi8658.hpp @@ -235,7 +235,7 @@ class Qmi8658 : public espp::BasePeripheral(&raw); } struct sockaddr_in6 *Socket::Info::ipv6_ptr() { - return (struct sockaddr_in6 *)&raw; + return reinterpret_cast(&raw); } void Socket::Info::update() { if (raw.ss_family == PF_INET) { - address = inet_ntoa(((struct sockaddr_in *)&raw)->sin_addr); - port = ((struct sockaddr_in *)&raw)->sin_port; + const auto *ipv4 = reinterpret_cast(&raw); + address = inet_ntoa(ipv4->sin_addr); + port = ipv4->sin_port; } else if (raw.ss_family == PF_INET6) { + const auto *ipv6 = reinterpret_cast(&raw); #if defined(ESP_PLATFORM) - address = inet_ntoa(((struct sockaddr_in6 *)&raw)->sin6_addr); + address = inet_ntoa(ipv6->sin6_addr); #else char str[INET6_ADDRSTRLEN]; - inet_ntop(AF_INET6, &(((struct sockaddr_in6 *)&raw)->sin6_addr), str, INET6_ADDRSTRLEN); + inet_ntop(AF_INET6, &(ipv6->sin6_addr), str, INET6_ADDRSTRLEN); address = str; #endif - port = ((struct sockaddr_in6 *)&raw)->sin6_port; + port = ipv6->sin6_port; } } @@ -112,7 +114,7 @@ bool Socket::is_valid_fd(sock_type_t socket_fd) { std::optional Socket::get_ipv4_info() { struct sockaddr_storage addr; socklen_t addr_len = sizeof(addr); - if (getsockname(socket_, (struct sockaddr *)&addr, &addr_len) < 0) { + if (getsockname(socket_, reinterpret_cast(&addr), &addr_len) < 0) { logger_.error("getsockname() failed: {}", error_string()); return {}; } @@ -128,8 +130,8 @@ bool Socket::set_receive_timeout(const std::chrono::duration &timeout) { } float intpart; float fractpart = modff(seconds, &intpart); - const time_t response_timeout_s = (int)intpart; - const time_t response_timeout_us = (int)(fractpart * 1E6); + const auto response_timeout_s = static_cast(intpart); + const auto response_timeout_us = static_cast(fractpart * 1E6f); //// Alternatively we could do this: // int microseconds = // (int)(std::chrono::duration_cast(timeout).count()) % (int)1E6; @@ -139,7 +141,8 @@ bool Socket::set_receive_timeout(const std::chrono::duration &timeout) { struct timeval tv; tv.tv_sec = response_timeout_s; tv.tv_usec = response_timeout_us; - int err = setsockopt(socket_, SOL_SOCKET, SO_RCVTIMEO, (const char *)&tv, sizeof(tv)); + int err = + setsockopt(socket_, SOL_SOCKET, SO_RCVTIMEO, reinterpret_cast(&tv), sizeof(tv)); if (err < 0) { return false; } @@ -153,7 +156,8 @@ bool Socket::enable_reuse() { #else // CONFIG_LWIP_SO_REUSE || !defined(ESP_PLATFORM) int err = 0; int enabled = 1; - err = setsockopt(socket_, SOL_SOCKET, SO_REUSEADDR, (const char *)&enabled, sizeof(enabled)); + err = setsockopt(socket_, SOL_SOCKET, SO_REUSEADDR, reinterpret_cast(&enabled), + sizeof(enabled)); if (err < 0) { fmt::print(fg(fmt::color::red), "Couldn't set SO_REUSEADDR: {}\n", error_string()); return false; @@ -161,13 +165,15 @@ bool Socket::enable_reuse() { #if !defined(ESP_PLATFORM) #ifdef _MSC_VER // NOTE: according to stackoverflow, we have to set broadcast instead of reuseport - err = setsockopt(socket_, SOL_SOCKET, SO_BROADCAST, (const char *)&enabled, sizeof(enabled)); + err = setsockopt(socket_, SOL_SOCKET, SO_BROADCAST, reinterpret_cast(&enabled), + sizeof(enabled)); if (err < 0) { fmt::print(fg(fmt::color::red), "Couldn't set SO_BROADCAST: {}\n", error_string()); return false; } #else - err = setsockopt(socket_, SOL_SOCKET, SO_REUSEPORT, (const char *)&enabled, sizeof(enabled)); + err = setsockopt(socket_, SOL_SOCKET, SO_REUSEPORT, reinterpret_cast(&enabled), + sizeof(enabled)); if (err < 0) { fmt::print(fg(fmt::color::red), "Couldn't set SO_REUSEPORT: {}\n", error_string()); return false; @@ -181,15 +187,15 @@ bool Socket::enable_reuse() { bool Socket::make_multicast(uint8_t time_to_live, uint8_t loopback_enabled) { int err = 0; // Assign multicast TTL - separate from normal interface TTL - err = setsockopt(socket_, IPPROTO_IP, IP_MULTICAST_TTL, (const char *)&time_to_live, - sizeof(uint8_t)); + err = setsockopt(socket_, IPPROTO_IP, IP_MULTICAST_TTL, + reinterpret_cast(&time_to_live), sizeof(uint8_t)); if (err < 0) { fmt::print(fg(fmt::color::red), "Couldn't set IP_MULTICAST_TTL: {}\n", error_string()); return false; } // select whether multicast traffic should be received by this device, too - err = setsockopt(socket_, IPPROTO_IP, IP_MULTICAST_LOOP, (const char *)&loopback_enabled, - sizeof(uint8_t)); + err = setsockopt(socket_, IPPROTO_IP, IP_MULTICAST_LOOP, + reinterpret_cast(&loopback_enabled), sizeof(uint8_t)); if (err < 0) { fmt::print(fg(fmt::color::red), "Couldn't set IP_MULTICAST_LOOP: {}\n", error_string()); return false; @@ -225,14 +231,14 @@ bool Socket::add_multicast_group(const std::string &multicast_group) { // Assign the IPv4 multicast source interface, via its IP // (only necessary if this socket is IPV4 only) struct in_addr iaddr; - err = setsockopt(socket_, IPPROTO_IP, IP_MULTICAST_IF, (const char *)&iaddr, + err = setsockopt(socket_, IPPROTO_IP, IP_MULTICAST_IF, reinterpret_cast(&iaddr), sizeof(struct in_addr)); if (err < 0) { fmt::print(fg(fmt::color::red), "Couldn't set IP_MULTICAST_IF: {}\n", error_string()); return false; } - err = setsockopt(socket_, IPPROTO_IP, IP_ADD_MEMBERSHIP, (const char *)&imreq, + err = setsockopt(socket_, IPPROTO_IP, IP_ADD_MEMBERSHIP, reinterpret_cast(&imreq), sizeof(struct ip_mreq)); if (err < 0) { fmt::print(fg(fmt::color::red), "Couldn't set IP_ADD_MEMBERSHIP: {}\n", error_string()); @@ -280,7 +286,7 @@ int Socket::select(const std::chrono::microseconds &timeout) { bool Socket::init(Socket::Type type) { // actually make the socket - socket_ = socket(address_family_, (int)type, ip_protocol_); + socket_ = socket(address_family_, static_cast(type), ip_protocol_); if (!is_valid()) { logger_.error("Cannot create socket: {}", error_string()); return false; @@ -320,7 +326,7 @@ std::string Socket::error_string(int err) const { } else if (err == WSANOTINITIALISED) { return "WSANOTINITIALISED"; } else { - return fmt::format("Unknown error: {0} ({0:#x})", (int)err); + return fmt::format("Unknown error: {0} ({0:#x})", static_cast(err)); } #else return fmt::format("{} - '{}'", err, strerror(err)); diff --git a/components/socket/src/tcp_socket.cpp b/components/socket/src/tcp_socket.cpp index 55a16212c..d14d3d03b 100644 --- a/components/socket/src/tcp_socket.cpp +++ b/components/socket/src/tcp_socket.cpp @@ -35,7 +35,8 @@ bool TcpSocket::connect(const TcpSocket::ConnectConfig &connect_config) { auto server_address = server_info.ipv4_ptr(); logger_.info("Client connecting to {}", server_info); // connect - int error = ::connect(socket_, (struct sockaddr *)server_address, sizeof(*server_address)); + int error = ::connect(socket_, reinterpret_cast(server_address), + sizeof(*server_address)); if (error != 0) { logger_.error("Could not connect to the server: {}", error_string()); return false; @@ -116,7 +117,7 @@ bool TcpSocket::receive(std::vector &data, size_t max_num_bytes) { int num_bytes_received = receive(receive_buffer.get(), max_num_bytes); if (num_bytes_received > 0) { logger_.info("Received {} bytes", num_bytes_received); - uint8_t *data_ptr = (uint8_t *)receive_buffer.get(); + uint8_t *data_ptr = receive_buffer.get(); data.assign(data_ptr, data_ptr + num_bytes_received); return true; } @@ -134,7 +135,7 @@ size_t TcpSocket::receive(uint8_t *data, size_t max_num_bytes) { } logger_.info("Receiving up to {} bytes", max_num_bytes); // now actually read data from the socket - int num_bytes_received = ::recv(socket_, (char *)data, max_num_bytes, 0); + int num_bytes_received = ::recv(socket_, reinterpret_cast(data), max_num_bytes, 0); // if we didn't receive anything return false and don't do anything else if (num_bytes_received < 0) { // if we got an error, log it and return 0 @@ -155,13 +156,14 @@ bool TcpSocket::bind(int port) { logger_.error("Socket invalid, cannot bind."); return false; } - struct sockaddr_in server_addr; + struct sockaddr_in server_addr {}; // configure the server socket accordingly - assume IPV4 and bind to the // any address "0.0.0.0" server_addr.sin_addr.s_addr = htonl(INADDR_ANY); server_addr.sin_family = address_family_; server_addr.sin_port = htons(port); - auto err = ::bind(socket_, (struct sockaddr *)&server_addr, sizeof(server_addr)); + auto err = + ::bind(socket_, reinterpret_cast(&server_addr), sizeof(server_addr)); if (err < 0) { logger_.error("Unable to bind: {}", error_string()); return false; @@ -191,7 +193,8 @@ std::unique_ptr TcpSocket::accept() { auto sender_address = connected_client_info.ipv4_ptr(); socklen_t socklen = sizeof(*sender_address); // accept connection - auto accepted_socket = ::accept(socket_, (struct sockaddr *)sender_address, &socklen); + auto accepted_socket = + ::accept(socket_, reinterpret_cast(sender_address), &socklen); if (accepted_socket < 0) { logger_.info("Could not accept connection: {}", error_string()); return nullptr; @@ -218,7 +221,8 @@ bool TcpSocket::set_keepalive(const std::chrono::seconds &idle_time, } int optval = 1; // enable keepalive - auto err = setsockopt(socket_, SOL_SOCKET, SO_KEEPALIVE, (const char *)&optval, sizeof(optval)); + auto err = setsockopt(socket_, SOL_SOCKET, SO_KEEPALIVE, reinterpret_cast(&optval), + sizeof(optval)); if (err < 0) { logger_.error("Unable to set keepalive: {}", error_string()); return false; @@ -229,7 +233,8 @@ bool TcpSocket::set_keepalive(const std::chrono::seconds &idle_time, #else // set the idle time optval = idle_time.count(); - err = setsockopt(socket_, IPPROTO_TCP, TCP_KEEPIDLE, (const char *)&optval, sizeof(optval)); + err = setsockopt(socket_, IPPROTO_TCP, TCP_KEEPIDLE, reinterpret_cast(&optval), + sizeof(optval)); if (err < 0) { logger_.error("Unable to set keepalive idle time: {}", error_string()); return false; @@ -238,14 +243,16 @@ bool TcpSocket::set_keepalive(const std::chrono::seconds &idle_time, // set the interval optval = interval.count(); - err = setsockopt(socket_, IPPROTO_TCP, TCP_KEEPINTVL, (const char *)&optval, sizeof(optval)); + err = setsockopt(socket_, IPPROTO_TCP, TCP_KEEPINTVL, reinterpret_cast(&optval), + sizeof(optval)); if (err < 0) { logger_.error("Unable to set keepalive interval: {}", error_string()); return false; } // set the max probes optval = max_probes; - err = setsockopt(socket_, IPPROTO_TCP, TCP_KEEPCNT, (const char *)&optval, sizeof(optval)); + err = setsockopt(socket_, IPPROTO_TCP, TCP_KEEPCNT, reinterpret_cast(&optval), + sizeof(optval)); if (err < 0) { logger_.error("Unable to set keepalive max probes: {}", error_string()); return false; diff --git a/components/socket/src/udp_socket.cpp b/components/socket/src/udp_socket.cpp index 4b39da870..584cce2d8 100644 --- a/components/socket/src/udp_socket.cpp +++ b/components/socket/src/udp_socket.cpp @@ -46,8 +46,9 @@ bool UdpSocket::send(std::span data, const UdpSocket::SendConfig auto server_address = server_info.ipv4_ptr(); logger_.info("Client sending {} bytes to {}:{}", data.size(), send_config.ip_address, send_config.port); - int num_bytes_sent = sendto(socket_, reinterpret_cast(data.data()), data.size(), 0, - (struct sockaddr *)server_address, sizeof(*server_address)); + int num_bytes_sent = + sendto(socket_, reinterpret_cast(data.data()), data.size(), 0, + reinterpret_cast(server_address), sizeof(*server_address)); if (num_bytes_sent < 0) { logger_.error("Error occurred during sending: {}", error_string()); return false; @@ -91,15 +92,16 @@ bool UdpSocket::receive(size_t max_num_bytes, std::vector &data, std::unique_ptr receive_buffer(new uint8_t[max_num_bytes]()); // now actually receive logger_.info("Receiving up to {} bytes", max_num_bytes); - int num_bytes_received = recvfrom(socket_, (char *)receive_buffer.get(), max_num_bytes, 0, - (struct sockaddr *)remote_address, &socklen); + int num_bytes_received = + recvfrom(socket_, reinterpret_cast(receive_buffer.get()), max_num_bytes, 0, + reinterpret_cast(remote_address), &socklen); // if we didn't receive anything return false and don't do anything else if (num_bytes_received < 0) { logger_.info("Receive failed: {}", error_string()); return false; } // we received data, so call the callback function if one was provided. - uint8_t *data_ptr = (uint8_t *)receive_buffer.get(); + uint8_t *data_ptr = receive_buffer.get(); data.assign(data_ptr, data_ptr + num_bytes_received); remote_info.update(); logger_.debug("Received {} bytes from {}", num_bytes_received, remote_info); @@ -118,13 +120,13 @@ bool UdpSocket::start_receiving(Task::BaseConfig &task_config, } server_receive_callback_ = receive_config.on_receive_callback; // bind - struct sockaddr_in server_addr; + struct sockaddr_in server_addr {}; // configure the server socket accordingly - assume IPV4 and bind to the // any address "0.0.0.0" server_addr.sin_addr.s_addr = htonl(INADDR_ANY); server_addr.sin_family = address_family_; server_addr.sin_port = htons(receive_config.port); - int err = bind(socket_, (struct sockaddr *)&server_addr, sizeof(server_addr)); + int err = bind(socket_, reinterpret_cast(&server_addr), sizeof(server_addr)); if (err < 0) { logger_.error("Unable to bind: {}", error_string()); return false; @@ -183,8 +185,9 @@ bool UdpSocket::server_task_function(size_t buffer_size, std::mutex &m, std::con // sendto logger_.info("Server responding to {} with message of length {}", sender_info, response.size()); auto sender_address = sender_info.ipv4_ptr(); - int num_bytes_sent = sendto(socket_, (const char *)response.data(), response.size(), 0, - (struct sockaddr *)sender_address, sizeof(*sender_address)); + int num_bytes_sent = + sendto(socket_, reinterpret_cast(response.data()), response.size(), 0, + reinterpret_cast(sender_address), sizeof(*sender_address)); if (num_bytes_sent < 0) { logger_.error("Error occurred responding: {}", error_string()); } diff --git a/components/st25dv/include/st25dv.hpp b/components/st25dv/include/st25dv.hpp index 2fe0ae48e..08d9d5cda 100644 --- a/components/st25dv/include/st25dv.hpp +++ b/components/st25dv/include/st25dv.hpp @@ -182,7 +182,8 @@ class St25dv : public BasePeripheral { offset += ndef_size; // add the TLV terminator (0xFE) full_record[offset] = (uint8_t)Type5TagType::TERMINATOR; - write(std::string_view{(const char *)full_record.data(), full_record.size()}, ec); + write(std::string_view{reinterpret_cast(full_record.data()), full_record.size()}, + ec); } /** @@ -441,9 +442,9 @@ class St25dv : public BasePeripheral { void present_password(std::error_code &ec) { // length of messsage is 17 bytes, plus 2 for address uint8_t data[2 + 17] = {0}; - data[0] = (uint16_t)Registers::I2C_PWD >> 8; - data[1] = (uint16_t)Registers::I2C_PWD & 0xFF; - const uint8_t *pswd_data = (uint8_t *)&password_; + data[0] = static_cast(Registers::I2C_PWD) >> 8; + data[1] = static_cast(Registers::I2C_PWD) & 0xFF; + const auto *pswd_data = reinterpret_cast(&password_); // validation code in the middle data[8 + 2] = 0x09; for (int i = 0; i < 4; i++) { diff --git a/components/t-deck/example/main/t_deck_example.cpp b/components/t-deck/example/main/t_deck_example.cpp index 5bd27d87f..6d4cf6a80 100644 --- a/components/t-deck/example/main/t_deck_example.cpp +++ b/components/t-deck/example/main/t_deck_example.cpp @@ -239,9 +239,7 @@ static bool load_audio(size_t &out_size, size_t &out_sample_rate) { // load the audio data. these are configured in the CMakeLists.txt file - // cppcheck-suppress syntaxError extern const uint8_t click_wav_start[] asm("_binary_click_wav_start"); - // cppcheck-suppress syntaxError extern const uint8_t click_wav_end[] asm("_binary_click_wav_end"); audio_bytes = std::vector(click_wav_start, click_wav_end); // ensure we have at least a wav header diff --git a/components/tla2528/include/tla2528.hpp b/components/tla2528/include/tla2528.hpp index 6f8b09564..b0b05c503 100644 --- a/components/tla2528/include/tla2528.hpp +++ b/components/tla2528/include/tla2528.hpp @@ -930,7 +930,7 @@ class Tla2528 : public BasePeripheral<> { } void write_two_(Register reg, uint16_t value, std::error_code &ec) { - write_block_(reg, (uint8_t *)&value, 2, ec); + write_block_(reg, reinterpret_cast(&value), 2, ec); } void write_block_(Register reg, const uint8_t *data, uint8_t len, std::error_code &ec) { diff --git a/components/tt21100/include/tt21100.hpp b/components/tt21100/include/tt21100.hpp index 500f43c16..6658d2824 100644 --- a/components/tt21100/include/tt21100.hpp +++ b/components/tt21100/include/tt21100.hpp @@ -48,7 +48,7 @@ class Tt21100 : public BasePeripheral<> { { std::lock_guard lock(base_mutex_); - read_many((uint8_t *)&data_len, 2, ec); + read_many(reinterpret_cast(&data_len), 2, ec); if (ec) { logger_.error("Failed to read data length: {}", ec.message()); return false; @@ -78,8 +78,8 @@ class Tt21100 : public BasePeripheral<> { case 17: case 27: { // touch event - NOTE: this only gets the first touch record - const auto report_data = (const TouchReport *)data; - const auto touch_data = (const TouchRecord *)(&report_data->touch_record[0]); + const auto report_data = reinterpret_cast(data); + const auto touch_data = reinterpret_cast(&report_data->touch_record[0]); x_ = touch_data->x; y_ = touch_data->y; num_touch_points_ = (data_len - sizeof(TouchReport)) / sizeof(TouchRecord); @@ -89,11 +89,11 @@ class Tt21100 : public BasePeripheral<> { } case 14: { // button event - const auto button_data = (const ButtonRecord *)data; + const auto button_data = reinterpret_cast(data); home_button_pressed_ = button_data->btn_val; auto btn_signal = button_data->btn_signal[0]; - logger_.debug("Button event({}): {}, {}", (int)(button_data->length), home_button_pressed_, - btn_signal); + logger_.debug("Button event({}): {}, {}", static_cast(button_data->length), + home_button_pressed_, btn_signal); new_data = true; break; } @@ -138,7 +138,7 @@ class Tt21100 : public BasePeripheral<> { int num_tries = 0; do { using namespace std::chrono_literals; - read_many((uint8_t *)®_val, 2, ec); + read_many(reinterpret_cast(®_val), 2, ec); if (ec) { logger_.error("Failed to read..."); return; diff --git a/components/vl53l/include/vl53l.hpp b/components/vl53l/include/vl53l.hpp index 4790c17f5..1f66bd716 100644 --- a/components/vl53l/include/vl53l.hpp +++ b/components/vl53l/include/vl53l.hpp @@ -128,8 +128,8 @@ class Vl53l : public espp::BasePeripheral { info.model_id = data[0]; info.module_type = data[1]; logger_.debug("Model ID: {:#04x}, Module Type: {:#04x}", info.model_id, info.module_type); - if (info.model_id != MODEL_ID || (info.module_type != MODULE_TYPE_CD && - info.module_type != MODULE_TYPE_CX)) { + if (info.model_id != MODEL_ID || + (info.module_type != MODULE_TYPE_CD && info.module_type != MODULE_TYPE_CX)) { logger_.warn("Model ID ({:#04x}) or Module Type ({:#04x}) does not match expected values " "for VL53L4CD ({:#04x}, {:#04x}) or VL53L4CX ({:#04x}, {:#04x}). " "Ensure you are using a VL53L4CD or VL53L4CX sensor.", @@ -414,7 +414,7 @@ class Vl53l : public espp::BasePeripheral { /// \see set_timing_budget_us() /// \see set_inter_measurement_period_ms() /// \see get_inter_measurement_period_ms() - float get_timing_budget_seconds() { return get_timing_budget_ms() / 1000.0f; } + float get_timing_budget_seconds() const { return get_timing_budget_ms() / 1000.0f; } /// \brief Read the current timing budget in seconds /// \details @@ -719,7 +719,8 @@ class Vl53l : public espp::BasePeripheral { } // write 0x0500 to RANGE_CONFIG_MIN_COUNT_RATE_RTN_LIMIT_MCPS (0x0066) uint16_t val = 0x0005; - if (!write_reg(Register::RANGE_CONFIG_MIN_COUNT_RATE_RTN_LIMIT_MCPS, (uint8_t *)&val, 2, ec)) { + if (!write_reg(Register::RANGE_CONFIG_MIN_COUNT_RATE_RTN_LIMIT_MCPS, + reinterpret_cast(&val), 2, ec)) { return false; } return true; diff --git a/components/wifi/include/wifi.hpp b/components/wifi/include/wifi.hpp index 69fb4b785..0cf96744f 100644 --- a/components/wifi/include/wifi.hpp +++ b/components/wifi/include/wifi.hpp @@ -405,14 +405,14 @@ class Wifi : public espp::BaseComponent { /// @brief Get all registered STA configurations. /// @return Unordered map of registered STA configurations. - std::unordered_map get_registered_sta_configs() { + std::unordered_map get_registered_sta_configs() const { std::lock_guard lock(mutex_); return sta_configs_; } /// @brief Get all registered AP configurations. /// @return Unordered map of registered AP configurations. - std::unordered_map get_registered_ap_configs() { + std::unordered_map get_registered_ap_configs() const { std::lock_guard lock(mutex_); return ap_configs_; } From 6b156b85abe8ff73a322dc02e50d26b5852e05ab Mon Sep 17 00:00:00 2001 From: William Emfinger Date: Sat, 23 May 2026 20:53:08 -0500 Subject: [PATCH 9/9] fix sa --- components/m5stack-tab5/src/video.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/components/m5stack-tab5/src/video.cpp b/components/m5stack-tab5/src/video.cpp index afae25224..e42b8aeaf 100644 --- a/components/m5stack-tab5/src/video.cpp +++ b/components/m5stack-tab5/src/video.cpp @@ -381,8 +381,8 @@ void IRAM_ATTR M5StackTab5::flush(lv_display_t *disp, const lv_area_t *area, uin lv_draw_sw_rotate(px_map, third_buffer, ww, hh, w_stride, h_stride, LV_DISPLAY_ROTATION_270, cf); } - px_map = (uint8_t *)third_buffer; - lv_display_rotate_area(disp, (lv_area_t *)area); + px_map = reinterpret_cast(third_buffer); + lv_display_rotate_area(disp, const_cast(area)); offsetx1 = area->x1; offsetx2 = area->x2; offsety1 = area->y1;