Skip to content

chore: Update components to support ESP-IDF v6.0#611

Open
finger563 wants to merge 4 commits intomainfrom
feat/esp-idf-6-update
Open

chore: Update components to support ESP-IDF v6.0#611
finger563 wants to merge 4 commits intomainfrom
feat/esp-idf-6-update

Conversation

@finger563
Copy link
Copy Markdown
Contributor

@finger563 finger563 commented Apr 8, 2026

Description

Update code (backwards compatible to release/v1) to compile in ESP-IDF v6.0.

Motivation and Context

Closese #610

Note: this doesn't make the upgrades to I2C (or other subsystems) necessary to remove the deprecation / EOL warnings. That will likely be breaking changes and will be targeted towards espp v2.x release in the very near future.

How has this been tested?

  • Build all examples using esp-idf v6.0
  • Build all examples using esp-idf v5.5 (CI)

Screenshots (if appropriate, e.g. schematic, board, console logs, lab pictures):

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation Update
  • Hardware (schematic, board, system design) change
  • Software change

Checklist:

  • My change requires a change to the documentation.
  • I have added / updated the documentation related to this change via either README or WIKI

Software

  • I have added tests to cover my changes.
  • I have updated the .github/workflows/build.yml file to add my new test to the automated cloud build github action.
  • All new and existing tests passed.
  • My code follows the code style of this project.

Copilot AI review requested due to automatic review settings April 8, 2026 03:00
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 8, 2026

⚡ Static analysis result ⚡

🔴 cppcheck found 108 issues! Click here to see details.

read_many((uint8_t *)&data_len, 2, ec);
if (ec) {
logger_.error("Failed to read data length: {}", ec.message());
return false;
}

!Line: 51 - warning: Potentially invalid type conversion in old-style C cast, clarify/fix with C++ cast [dangerousTypeCast]

const auto report_data = (const TouchReport *)data;
const auto touch_data = (const TouchRecord *)(&report_data->touch_record[0]);
x_ = touch_data->x;
y_ = touch_data->y;
num_touch_points_ = (data_len - sizeof(TouchReport)) / sizeof(TouchRecord);
logger_.debug("Touch event: #={}, [0]=({}, {})", num_touch_points_, x_, y_);

!Line: 81 - warning: Potentially invalid type conversion in old-style C cast, clarify/fix with C++ cast [dangerousTypeCast]

const auto button_data = (const ButtonRecord *)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);
new_data = true;

!Line: 92 - warning: Potentially invalid type conversion in old-style C cast, clarify/fix with C++ cast [dangerousTypeCast]

read_many((uint8_t *)&reg_val, 2, ec);
if (ec) {
logger_.error("Failed to read...");
return;
}
logger_.debug("reg_val: {:#04x}", reg_val);

!Line: 141 - warning: Potentially invalid type conversion in old-style C cast, clarify/fix with C++ cast [dangerousTypeCast]

read_many_from_register((uint8_t)Registers::DATA_START, (uint8_t *)&data, sizeof(data), ec);
if (ec)
return false;
num_touch_points_ = data.num;
x_ = (data.x_h << 8) | data.x_l;

!Line: 47 - warning: Potentially invalid type conversion in old-style C cast, clarify/fix with C++ cast [dangerousTypeCast]

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

!Line: 56 - style: Condition 'ec' is always false [knownConditionTrueFalse]

!Line: 42 - note: Assuming that condition 'ec' is not redundant
!Line: 46 - note: Assuming condition is false
!Line: 56 - note: Condition 'ec' is always false

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);
}
}
return 0.0f;

!Line: 115 - style: Consider using std::find_if algorithm instead of a raw loop. [useStlAlgorithm]

#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 "

!Line: 6 - error: failed to evaluate #if condition, undefined function-like macro invocation: ESP_IDF_VERSION_VAL( ... ) [syntaxError]

#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(5, 2, 0)
#include <esp_intr_alloc.h>
#endif // ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(5, 2, 0)
#include "interrupt.hpp"

!Line: 6 - error: failed to evaluate #if condition, undefined function-like macro invocation: ESP_IDF_VERSION_VAL( ... ) [syntaxError]

#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(5, 4, 0)
logger.info("Directory iterator:");
#else
logger.warn(
"NOTE: directory_iterator is not implemented in esp-idf less than 5.4, the following "
"listing will not work.");

!Line: 323 - error: failed to evaluate #if condition, undefined function-like macro invocation: ESP_IDF_VERSION_VAL( ... ) [syntaxError]

const uint8_t *pswd_data = (uint8_t *)&password_;
// validation code in the middle
data[8 + 2] = 0x09;
for (int i = 0; i < 4; i++) {
data[2 + i] = pswd_data[i];
data[2 + i + 4] = pswd_data[i + 4];

!Line: 446 - warning: Potentially invalid type conversion in old-style C cast, clarify/fix with C++ cast [dangerousTypeCast]

constexpr XboxRumbleOutputReport() = default;
/// Reset the rumble effect
constexpr void reset() {
enabled = 0;
std::fill(magnitude.begin(), magnitude.end(), 0);

!Line: 155 - warning: Member variable 'XboxRumbleOutputReport < 3 >::enabled' is not initialized in the constructor. [uninitMemberVar]

constexpr GamepadInputReport() = default;
/// Reset the gamepad inputs
constexpr void reset() {
std::fill(joystick_axes.begin(), joystick_axes.end(), joystick_center);
std::fill(trigger_axes.begin(), trigger_axes.end(), trigger_center);

!Line: 62 - warning: Member variable 'GamepadInputReport < 15 , std :: uint16_t , std :: uint16_t , 0 , 65535 , 0 , 1023 , 1 >::consumer_record' is not initialized in the constructor. [uninitMemberVar]

constexpr auto get_enabled() { return enabled; }
/// Set the enabled mask for the rumble motors
/// \param new_enabled The enabled mask for the rumble motors
constexpr void set_enabled(std::uint8_t new_enabled) { enabled = new_enabled; }

!Line: 168 - style: inconclusive: Either there is a missing 'override', or the member function 'espp::XboxRumbleOutputReport < 3 >::get_enabled' can be const. [functionConst]

constexpr auto get_magnitude(std::size_t motor) { return magnitude[motor]; }
/// Set the magnitude of the rumble effect for the specified motor
/// \param motor The motor for which you want to set the magnitude.
/// \param value The magnitude of the rumble effect for the specified motor.
/// \note The value should be in the range [0, 100].

!Line: 177 - style: inconclusive: Either there is a missing 'override', or the member function 'espp::XboxRumbleOutputReport < 3 >::get_magnitude' can be const. [functionConst]

constexpr auto get_duration() { return duration; }
/// Set the duration of the rumble effect
/// \param value The duration of the rumble effect.
/// \note The value should be in the range [0, 255].
constexpr void set_duration(std::uint8_t value) { duration = value; }

!Line: 195 - style: inconclusive: Either there is a missing 'override', or the member function 'espp::XboxRumbleOutputReport < 3 >::get_duration' can be const. [functionConst]

constexpr auto get_start_delay() { return start_delay; }
/// Set the start delay of the rumble effect
/// \param value The start delay of the rumble effect.
/// \note The value should be in the range [0, 255].
constexpr void set_start_delay(std::uint8_t value) { start_delay = value; }

!Line: 204 - style: inconclusive: Either there is a missing 'override', or the member function 'espp::XboxRumbleOutputReport < 3 >::get_start_delay' can be const. [functionConst]

constexpr auto get_loop_count() { return loop_count; }
/// Set the loop count of the rumble effect
/// \param value The loop count of the rumble effect.
/// \note The value should be in the range [0, 255].
constexpr void set_loop_count(std::uint8_t value) { loop_count = value; }

!Line: 213 - style: inconclusive: Either there is a missing 'override', or the member function 'espp::XboxRumbleOutputReport < 3 >::get_loop_count' can be const. [functionConst]

constexpr GamepadInputReport() = default;
/// Reset the gamepad inputs
constexpr void reset() {
std::fill(joystick_axes.begin(), joystick_axes.end(), joystick_center);
std::fill(trigger_axes.begin(), trigger_axes.end(), trigger_center);

!Line: 62 - warning: Member variable 'GamepadInputReport::consumer_record' is not initialized in the constructor. [uninitMemberVar]

constexpr SwitchProGamepadInputReport() = default;
/// Reset the gamepad inputs
constexpr void reset() {
uint8_t prev_counter = counter;
// fill all 0s

!Line: 186 - warning: Member variable 'SwitchProGamepadInputReport < 0x30 >::counter' is not initialized in the constructor. [uninitMemberVar]

constexpr SwitchProGamepadInputReport() = default;
/// Reset the gamepad inputs
constexpr void reset() {
uint8_t prev_counter = counter;
// fill all 0s

!Line: 186 - warning: Member variable 'SwitchProGamepadInputReport < 0x30 >::connection_info' is not initialized in the constructor. [uninitMemberVar]

constexpr SwitchProGamepadInputReport() = default;
/// Reset the gamepad inputs
constexpr void reset() {
uint8_t prev_counter = counter;
// fill all 0s

!Line: 186 - warning: Member variable 'SwitchProGamepadInputReport < 0x30 >::battery_charging' is not initialized in the constructor. [uninitMemberVar]

constexpr SwitchProGamepadInputReport() = default;
/// Reset the gamepad inputs
constexpr void reset() {
uint8_t prev_counter = counter;
// fill all 0s

!Line: 186 - warning: Member variable 'SwitchProGamepadInputReport < 0x30 >::battery_level' is not initialized in the constructor. [uninitMemberVar]

constexpr SwitchProGamepadInputReport() = default;
/// Reset the gamepad inputs
constexpr void reset() {
uint8_t prev_counter = counter;
// fill all 0s

!Line: 186 - warning: Member variable 'SwitchProGamepadInputReport < 0x30 >::btn_y' is not initialized in the constructor. [uninitMemberVar]

constexpr SwitchProGamepadInputReport() = default;
/// Reset the gamepad inputs
constexpr void reset() {
uint8_t prev_counter = counter;
// fill all 0s

!Line: 186 - warning: Member variable 'SwitchProGamepadInputReport < 0x30 >::btn_x' is not initialized in the constructor. [uninitMemberVar]

constexpr SwitchProGamepadInputReport() = default;
/// Reset the gamepad inputs
constexpr void reset() {
uint8_t prev_counter = counter;
// fill all 0s

!Line: 186 - warning: Member variable 'SwitchProGamepadInputReport < 0x30 >::btn_b' is not initialized in the constructor. [uninitMemberVar]

constexpr SwitchProGamepadInputReport() = default;
/// Reset the gamepad inputs
constexpr void reset() {
uint8_t prev_counter = counter;
// fill all 0s

!Line: 186 - warning: Member variable 'SwitchProGamepadInputReport < 0x30 >::btn_a' is not initialized in the constructor. [uninitMemberVar]

constexpr SwitchProGamepadInputReport() = default;
/// Reset the gamepad inputs
constexpr void reset() {
uint8_t prev_counter = counter;
// fill all 0s

!Line: 186 - warning: Member variable 'SwitchProGamepadInputReport < 0x30 >::btn_right_sr' is not initialized in the constructor. [uninitMemberVar]

constexpr SwitchProGamepadInputReport() = default;
/// Reset the gamepad inputs
constexpr void reset() {
uint8_t prev_counter = counter;
// fill all 0s

!Line: 186 - warning: Member variable 'SwitchProGamepadInputReport < 0x30 >::btn_right_sl' is not initialized in the constructor. [uninitMemberVar]

constexpr SwitchProGamepadInputReport() = default;
/// Reset the gamepad inputs
constexpr void reset() {
uint8_t prev_counter = counter;
// fill all 0s

!Line: 186 - warning: Member variable 'SwitchProGamepadInputReport < 0x30 >::btn_r' is not initialized in the constructor. [uninitMemberVar]

constexpr SwitchProGamepadInputReport() = default;
/// Reset the gamepad inputs
constexpr void reset() {
uint8_t prev_counter = counter;
// fill all 0s

!Line: 186 - warning: Member variable 'SwitchProGamepadInputReport < 0x30 >::btn_zr' is not initialized in the constructor. [uninitMemberVar]

constexpr SwitchProGamepadInputReport() = default;
/// Reset the gamepad inputs
constexpr void reset() {
uint8_t prev_counter = counter;
// fill all 0s

!Line: 186 - warning: Member variable 'SwitchProGamepadInputReport < 0x30 >::btn_minus' is not initialized in the constructor. [uninitMemberVar]

constexpr SwitchProGamepadInputReport() = default;
/// Reset the gamepad inputs
constexpr void reset() {
uint8_t prev_counter = counter;
// fill all 0s

!Line: 186 - warning: Member variable 'SwitchProGamepadInputReport < 0x30 >::btn_plus' is not initialized in the constructor. [uninitMemberVar]

constexpr SwitchProGamepadInputReport() = default;
/// Reset the gamepad inputs
constexpr void reset() {
uint8_t prev_counter = counter;
// fill all 0s

!Line: 186 - warning: Member variable 'SwitchProGamepadInputReport < 0x30 >::btn_thumb_r' is not initialized in the constructor. [uninitMemberVar]

constexpr SwitchProGamepadInputReport() = default;
/// Reset the gamepad inputs
constexpr void reset() {
uint8_t prev_counter = counter;
// fill all 0s

!Line: 186 - warning: Member variable 'SwitchProGamepadInputReport < 0x30 >::btn_thumb_l' is not initialized in the constructor. [uninitMemberVar]

constexpr SwitchProGamepadInputReport() = default;
/// Reset the gamepad inputs
constexpr void reset() {
uint8_t prev_counter = counter;
// fill all 0s

!Line: 186 - warning: Member variable 'SwitchProGamepadInputReport < 0x30 >::btn_home' is not initialized in the constructor. [uninitMemberVar]

constexpr SwitchProGamepadInputReport() = default;
/// Reset the gamepad inputs
constexpr void reset() {
uint8_t prev_counter = counter;
// fill all 0s

!Line: 186 - warning: Member variable 'SwitchProGamepadInputReport < 0x30 >::btn_capture' is not initialized in the constructor. [uninitMemberVar]

constexpr SwitchProGamepadInputReport() = default;
/// Reset the gamepad inputs
constexpr void reset() {
uint8_t prev_counter = counter;
// fill all 0s

!Line: 186 - warning: Member variable 'SwitchProGamepadInputReport < 0x30 >::dummy' is not initialized in the constructor. [uninitMemberVar]

constexpr SwitchProGamepadInputReport() = default;
/// Reset the gamepad inputs
constexpr void reset() {
uint8_t prev_counter = counter;
// fill all 0s

!Line: 186 - warning: Member variable 'SwitchProGamepadInputReport < 0x30 >::charging_grip' is not initialized in the constructor. [uninitMemberVar]

constexpr SwitchProGamepadInputReport() = default;
/// Reset the gamepad inputs
constexpr void reset() {
uint8_t prev_counter = counter;
// fill all 0s

!Line: 186 - warning: Member variable 'SwitchProGamepadInputReport < 0x30 >::dpad_down' is not initialized in the constructor. [uninitMemberVar]

constexpr SwitchProGamepadInputReport() = default;
/// Reset the gamepad inputs
constexpr void reset() {
uint8_t prev_counter = counter;
// fill all 0s

!Line: 186 - warning: Member variable 'SwitchProGamepadInputReport < 0x30 >::dpad_up' is not initialized in the constructor. [uninitMemberVar]

constexpr SwitchProGamepadInputReport() = default;
/// Reset the gamepad inputs
constexpr void reset() {
uint8_t prev_counter = counter;
// fill all 0s

!Line: 186 - warning: Member variable 'SwitchProGamepadInputReport < 0x30 >::dpad_right' is not initialized in the constructor. [uninitMemberVar]

constexpr SwitchProGamepadInputReport() = default;
/// Reset the gamepad inputs
constexpr void reset() {
uint8_t prev_counter = counter;
// fill all 0s

!Line: 186 - warning: Member variable 'SwitchProGamepadInputReport < 0x30 >::dpad_left' is not initialized in the constructor. [uninitMemberVar]

constexpr SwitchProGamepadInputReport() = default;
/// Reset the gamepad inputs
constexpr void reset() {
uint8_t prev_counter = counter;
// fill all 0s

!Line: 186 - warning: Member variable 'SwitchProGamepadInputReport < 0x30 >::btn_left_sr' is not initialized in the constructor. [uninitMemberVar]

constexpr SwitchProGamepadInputReport() = default;
/// Reset the gamepad inputs
constexpr void reset() {
uint8_t prev_counter = counter;
// fill all 0s

!Line: 186 - warning: Member variable 'SwitchProGamepadInputReport < 0x30 >::btn_left_sl' is not initialized in the constructor. [uninitMemberVar]

constexpr SwitchProGamepadInputReport() = default;
/// Reset the gamepad inputs
constexpr void reset() {
uint8_t prev_counter = counter;
// fill all 0s

!Line: 186 - warning: Member variable 'SwitchProGamepadInputReport < 0x30 >::btn_l' is not initialized in the constructor. [uninitMemberVar]

constexpr SwitchProGamepadInputReport() = default;
/// Reset the gamepad inputs
constexpr void reset() {
uint8_t prev_counter = counter;
// fill all 0s

!Line: 186 - warning: Member variable 'SwitchProGamepadInputReport < 0x30 >::btn_zl' is not initialized in the constructor. [uninitMemberVar]

constexpr SwitchProGamepadInputReport() = default;
/// Reset the gamepad inputs
constexpr void reset() {
uint8_t prev_counter = counter;
// fill all 0s

!Line: 186 - warning: Member variable 'SwitchProGamepadInputReport < 0x30 >::analog' is not initialized in the constructor. [uninitMemberVar]

constexpr SwitchProGamepadInputReport() = default;
/// Reset the gamepad inputs
constexpr void reset() {
uint8_t prev_counter = counter;
// fill all 0s

!Line: 186 - warning: Member variable 'SwitchProGamepadInputReport < 0x30 >::joy_lx' is not initialized in the constructor. [uninitMemberVar]

constexpr SwitchProGamepadInputReport() = default;
/// Reset the gamepad inputs
constexpr void reset() {
uint8_t prev_counter = counter;
// fill all 0s

!Line: 186 - warning: Member variable 'SwitchProGamepadInputReport < 0x30 >::joy_ly' is not initialized in the constructor. [uninitMemberVar]

constexpr SwitchProGamepadInputReport() = default;
/// Reset the gamepad inputs
constexpr void reset() {
uint8_t prev_counter = counter;
// fill all 0s

!Line: 186 - warning: Member variable 'SwitchProGamepadInputReport < 0x30 >::joy_rx' is not initialized in the constructor. [uninitMemberVar]

constexpr SwitchProGamepadInputReport() = default;
/// Reset the gamepad inputs
constexpr void reset() {
uint8_t prev_counter = counter;
// fill all 0s

!Line: 186 - warning: Member variable 'SwitchProGamepadInputReport < 0x30 >::joy_ry' is not initialized in the constructor. [uninitMemberVar]

constexpr SwitchProGamepadInputReport() = default;
/// Reset the gamepad inputs
constexpr void reset() {
uint8_t prev_counter = counter;
// fill all 0s

!Line: 186 - warning: Member variable 'SwitchProGamepadInputReport < 0x30 >::vibrator_input_report' is not initialized in the constructor. [uninitMemberVar]

constexpr SwitchProGamepadInputReport() = default;
/// Reset the gamepad inputs
constexpr void reset() {
uint8_t prev_counter = counter;
// fill all 0s

!Line: 186 - warning: Member variable 'SwitchProGamepadInputReport < 0x30 >::raw_input_report' is not initialized in the constructor. [uninitMemberVar]

constexpr SwitchProGamepadInputReport() = default;
/// Reset the gamepad inputs
constexpr void reset() {
uint8_t prev_counter = counter;
// fill all 0s

!Line: 186 - warning: Member variable 'SwitchProGamepadInputReport < 0x30 >::imuData' is not initialized in the constructor. [uninitMemberVar]

constexpr SwitchProGamepadInputReport() = default;
/// Reset the gamepad inputs
constexpr void reset() {
uint8_t prev_counter = counter;
// fill all 0s

!Line: 186 - warning: Member variable 'SwitchProGamepadInputReport < 0x30 >::subcmd_ack' is not initialized in the constructor. [uninitMemberVar]

constexpr SwitchProGamepadInputReport() = default;
/// Reset the gamepad inputs
constexpr void reset() {
uint8_t prev_counter = counter;
// fill all 0s

!Line: 186 - warning: Member variable 'SwitchProGamepadInputReport < 0x30 >::subcmd_id' is not initialized in the constructor. [uninitMemberVar]

constexpr SwitchProGamepadInputReport() = default;
/// Reset the gamepad inputs
constexpr void reset() {
uint8_t prev_counter = counter;
// fill all 0s

!Line: 186 - warning: Member variable 'SwitchProGamepadInputReport < 0x30 >::subcmd_reply' is not initialized in the constructor. [uninitMemberVar]

constexpr SwitchProGamepadInputReport() = default;
/// Reset the gamepad inputs
constexpr void reset() {
uint8_t prev_counter = counter;
// fill all 0s

!Line: 186 - warning: Member variable 'SwitchProGamepadInputReport < 0x30 >::raw_report' is not initialized in the constructor. [uninitMemberVar]

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

!Line: 53 - style: Condition 'ec' is always false [knownConditionTrueFalse]

!Line: 42 - note: Assuming that condition 'ec' is not redundant
!Line: 46 - note: Assuming condition is false
!Line: 53 - note: Condition 'ec' is always false

std::unordered_map<std::string, WifiSta::Config> get_registered_sta_configs() {
std::lock_guard<std::recursive_mutex> lock(mutex_);
return sta_configs_;
}
/// @brief Get all registered AP configurations.

!Line: 408 - style: inconclusive: Either there is a missing 'override', or the member function 'espp::Wifi::get_registered_sta_configs' can be const. [functionConst]

std::unordered_map<std::string, WifiAp::Config> get_registered_ap_configs() {
std::lock_guard<std::recursive_mutex> lock(mutex_);
return ap_configs_;
}
/// @brief Switch to a different registered AP configuration.

!Line: 415 - style: inconclusive: Either there is a missing 'override', or the member function 'espp::Wifi::get_registered_ap_configs' can be const. [functionConst]

if (getsockname(socket_, (struct sockaddr *)&addr, &addr_len) < 0) {
logger_.error("getsockname() failed: {}", error_string());
return {};
}
Info info;
info.from_sockaddr(addr);

!Line: 115 - warning: Potentially invalid type conversion in old-style C cast, clarify/fix with C++ cast [dangerousTypeCast]

int err = setsockopt(socket_, SOL_SOCKET, SO_RCVTIMEO, (const char *)&tv, sizeof(tv));
if (err < 0) {
return false;
}
return true;
}

!Line: 142 - warning: Potentially invalid type conversion in old-style C cast, clarify/fix with C++ cast [dangerousTypeCast]

err = setsockopt(socket_, SOL_SOCKET, SO_REUSEADDR, (const char *)&enabled, sizeof(enabled));
if (err < 0) {
fmt::print(fg(fmt::color::red), "Couldn't set SO_REUSEADDR: {}\n", error_string());
return false;
}
#if !defined(ESP_PLATFORM)

!Line: 156 - warning: Potentially invalid type conversion in old-style C cast, clarify/fix with C++ cast [dangerousTypeCast]

err = setsockopt(socket_, SOL_SOCKET, SO_REUSEPORT, (const char *)&enabled, sizeof(enabled));
if (err < 0) {
fmt::print(fg(fmt::color::red), "Couldn't set SO_REUSEPORT: {}\n", error_string());
return false;
}
#endif // _MSC_VER

!Line: 170 - warning: Potentially invalid type conversion in old-style C cast, clarify/fix with C++ cast [dangerousTypeCast]

err = setsockopt(socket_, IPPROTO_IP, IP_MULTICAST_IF, (const char *)&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;
}

!Line: 228 - warning: Potentially invalid type conversion in old-style C cast, clarify/fix with C++ cast [dangerousTypeCast]

err = setsockopt(socket_, IPPROTO_IP, IP_ADD_MEMBERSHIP, (const char *)&imreq,
sizeof(struct ip_mreq));
if (err < 0) {
fmt::print(fg(fmt::color::red), "Couldn't set IP_ADD_MEMBERSHIP: {}\n", error_string());
return false;
}

!Line: 235 - warning: Potentially invalid type conversion in old-style C cast, clarify/fix with C++ cast [dangerousTypeCast]

err = setsockopt(socket_, SOL_SOCKET, SO_BROADCAST, (const char *)&enabled, sizeof(enabled));
if (err < 0) {
fmt::print(fg(fmt::color::red), "Couldn't set SO_BROADCAST: {}\n", error_string());
return false;
}
#else

!Line: 164 - warning: Potentially invalid type conversion in old-style C cast, clarify/fix with C++ cast [dangerousTypeCast]

auto err = ::bind(socket_, (struct sockaddr *)&server_addr, sizeof(server_addr));
if (err < 0) {
logger_.error("Unable to bind: {}", error_string());
return false;
}
return true;

!Line: 164 - warning: Potentially invalid type conversion in old-style C cast, clarify/fix with C++ cast [dangerousTypeCast]

auto err = setsockopt(socket_, SOL_SOCKET, SO_KEEPALIVE, (const char *)&optval, sizeof(optval));
if (err < 0) {
logger_.error("Unable to set keepalive: {}", error_string());
return false;
}

!Line: 221 - warning: Potentially invalid type conversion in old-style C cast, clarify/fix with C++ cast [dangerousTypeCast]

err = setsockopt(socket_, IPPROTO_TCP, TCP_KEEPIDLE, (const char *)&optval, sizeof(optval));
if (err < 0) {
logger_.error("Unable to set keepalive idle time: {}", error_string());
return false;
}
#endif

!Line: 232 - warning: Potentially invalid type conversion in old-style C cast, clarify/fix with C++ cast [dangerousTypeCast]

err = setsockopt(socket_, IPPROTO_TCP, TCP_KEEPINTVL, (const char *)&optval, sizeof(optval));
if (err < 0) {
logger_.error("Unable to set keepalive interval: {}", error_string());
return false;
}
// set the max probes

!Line: 241 - warning: Potentially invalid type conversion in old-style C cast, clarify/fix with C++ cast [dangerousTypeCast]

err = setsockopt(socket_, IPPROTO_TCP, TCP_KEEPCNT, (const char *)&optval, sizeof(optval));
if (err < 0) {
logger_.error("Unable to set keepalive max probes: {}", error_string());
return false;
}
return true;

!Line: 248 - warning: Potentially invalid type conversion in old-style C cast, clarify/fix with C++ cast [dangerousTypeCast]

int err = bind(socket_, (struct sockaddr *)&server_addr, sizeof(server_addr));
if (err < 0) {
logger_.error("Unable to bind: {}", error_string());
return false;
}
if (receive_config.is_multicast_endpoint) {

!Line: 127 - warning: Potentially invalid type conversion in old-style C cast, clarify/fix with C++ cast [dangerousTypeCast]

static void gpio_isr_handler(void *arg) {
uint32_t gpio_num = (uint32_t)arg;
xQueueSendFromISR(gpio_evt_queue, &gpio_num, NULL);
}
extern "C" void app_main(void) {

!Line: 70 - style: Parameter 'arg' can be declared as pointer to const. However it seems that 'gpio_isr_handler' is a callback function, if 'arg' is declared with const you might also need to cast function pointer(s). [constParameterCallback]

!Line: 132 - note: You might need to cast the function pointer here
!Line: 70 - note: Parameter 'arg' can be declared as pointer to const

#if ESP_IDF_VERSION < ESP_IDF_VERSION_VAL(6, 0, 0)
static_cast<uint32_t>(detected_controller == DisplayController::ILI9881 ? 730 : 965),
#else
static_cast<float>(detected_controller == DisplayController::ILI9881 ? 730 : 965),
#endif
};

!Line: 101 - error: failed to evaluate #if condition, undefined function-like macro invocation: ESP_IDF_VERSION_VAL( ... ) [syntaxError]

write_block_(reg, (uint8_t *)&value, 2, ec);
}
void write_block_(Register reg, const uint8_t *data, uint8_t len, std::error_code &ec) {
std::lock_guard<std::recursive_mutex> lock(base_mutex_);
uint8_t total_len = len + 2;

!Line: 1513 - warning: Potentially invalid type conversion in old-style C cast, clarify/fix with C++ cast [dangerousTypeCast]

bool parse_ftp_command(std::string_view request, std::string_view &command,
std::string_view &arguments) {
// 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.
// The arguments are separated by spaces.

!Line: 385 - style: inconclusive: Either there is a missing 'override', or the member function 'espp::FtpClientSession::parse_ftp_command' can be const. [functionConst]

float get_accelerometer_sensitivity() {
return accelerometer_range_to_sensitivty(imu_config_.accelerometer_range);
}
/// Read the accelerometer sensitivity
/// @param ec The error code to set if an error occurs

!Line: 238 - style: inconclusive: Either there is a missing 'override', or the member function 'espp::Qmi8658::get_accelerometer_sensitivity' can be const. [functionConst]

float get_gyroscope_sensitivity() {
return gyroscope_range_to_sensitivty(imu_config_.gyroscope_range);
}
/// Read the gyroscope sensitivity
/// @param ec The error code to set if an error occurs

!Line: 262 - style: inconclusive: Either there is a missing 'override', or the member function 'espp::Qmi8658::get_gyroscope_sensitivity' can be const. [functionConst]

const GTPoint *point = (GTPoint *)&data[0];
x_ = point->x;
y_ = point->y;
logger_.debug("Touch at ({}, {})", x_, y_);
}
new_data = true;

!Line: 74 - warning: Potentially invalid type conversion in old-style C cast, clarify/fix with C++ cast [dangerousTypeCast]

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

!Line: 60 - style: Condition 'ec' is always false [knownConditionTrueFalse]

!Line: 46 - note: Assuming that condition 'ec' is not redundant
!Line: 50 - note: Assuming condition is false
!Line: 60 - note: Condition 'ec' is always false

#if ESP_IDF_VERSION < ESP_IDF_VERSION_VAL(6, 0, 0)
#include "esp_vfs_usb_serial_jtag.h"
#endif
#include "line_input.hpp"

!Line: 20 - error: failed to evaluate #if condition, undefined function-like macro invocation: ESP_IDF_VERSION_VAL( ... ) [syntaxError]

write_block_(reg, (uint8_t *)&value, 2, ec);
}
void write_block_(Register reg, const uint8_t *data, uint8_t len, std::error_code &ec) {
std::lock_guard<std::recursive_mutex> lock(base_mutex_);
uint8_t total_len = len + 2;

!Line: 933 - warning: Potentially invalid type conversion in old-style C cast, clarify/fix with C++ cast [dangerousTypeCast]

#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_));

!Line: 331 - error: failed to evaluate #if condition, undefined function-like macro invocation: ESP_IDF_VERSION_VAL( ... ) [syntaxError]

#pragma once
#include <algorithm>
#include <array>
#include <atomic>

!Line: 0 - information: This file is not analyzed. No working configuration could be extracted. Use -v for more details. [noValidConfiguration]

float get_timing_budget_seconds() { return get_timing_budget_ms() / 1000.0f; }
/// \brief Read the current timing budget in seconds
/// \details
/// The timing budget is the time allowed for one measurement. Valid range
/// is 10ms to 200ms. It cannot be greater than the inter-measurement

!Line: 417 - style: inconclusive: Either there is a missing 'override', or the member function 'espp::Vl53l::get_timing_budget_seconds' can be const. [functionConst]

if (!write_reg(Register::RANGE_CONFIG_MIN_COUNT_RATE_RTN_LIMIT_MCPS, (uint8_t *)&val, 2, ec)) {
return false;
}
return true;
}

!Line: 722 - warning: Potentially invalid type conversion in old-style C cast, clarify/fix with C++ cast [dangerousTypeCast]

auto rc = ble_hs_id_copy_addr(BLE_ADDR_RANDOM, (uint8_t *)&address, nullptr);
if (rc != 0) {
logger.error("Failed to get ble address");
return 0;
}
logger.debug("radio mac address: {:#x}", address);

!Line: 132 - warning: Potentially invalid type conversion in old-style C cast, clarify/fix with C++ cast [dangerousTypeCast]

std::error_code make_error_code(NvsErrc e) { return {static_cast<int>(e), theNvsErrCategory}; }
}; // Class NvsHandle
} // namespace espp

!Line: 503 - style: inconclusive: Either there is a missing 'override', or the member function 'espp::NvsHandle::make_error_code' can be const. [functionConst]

bool erase(std::string_view ns_name, std::error_code &ec) {
espp::NvsHandle handle(ns_name.data(), ec);
if (ec)
return false;
if (!handle.erase(ec))

!Line: 56 - style: inconclusive: Either there is a missing 'override', or the member function 'espp::Nvs::erase' can be const. [functionConst]

bool erase(std::string_view ns_name, std::string_view key, std::error_code &ec) {
espp::NvsHandle handle(ns_name.data(), ec);
if (ec)
return false;
if (!handle.erase(key, ec))

!Line: 71 - style: inconclusive: Either there is a missing 'override', or the member function 'espp::Nvs::erase' can be const. [functionConst]

#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(5, 4, 0)
channel_conf.sleep_mode = conf.sleep_mode;
#endif
channel_conf.hpoint = 0;
channel_conf.timer_sel = conf.timer;
channel_conf.flags.output_invert = conf.output_invert;

!Line: 44 - error: failed to evaluate #if condition, undefined function-like macro invocation: ESP_IDF_VERSION_VAL( ... ) [syntaxError]

#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(5, 4, 0) || defined(_DOXYGEN_)
ledc_sleep_mode_t sleep_mode{
LEDC_SLEEP_MODE_KEEP_ALIVE}; /**< The LEDC sleep mode you want for this
LED channel. Default is
LEDC_SLEEP_MODE_KEEP_ALIVE which will
keep the LEDC output when the system

!Line: 40 - error: failed to evaluate #if condition, undefined function-like macro invocation: ESP_IDF_VERSION_VAL( ... ) [syntaxError]

#pragma once
#include <algorithm>
#include <cmath>
#include <mutex>

!Line: 0 - information: This file is not analyzed. No working configuration could be extracted. Use -v for more details. [noValidConfiguration]

Config get_config() const { return config_; }
protected:
Config config_;
std::atomic<float> error_{0};
std::atomic<float> previous_error_{0};

!Line: 154 - performance: Function 'get_config()' should return member 'config_' by const reference. [returnByReference]

float get_accelerometer_sensitivity() {
return accelerometer_range_to_sensitivty(imu_config_.accelerometer_range);
}
/// Read the accelerometer sensitivity
/// @param ec The error code to set if an error occurs

!Line: 286 - style: inconclusive: Either there is a missing 'override', or the member function 'espp::Icm42607::get_accelerometer_sensitivity' can be const. [functionConst]

float get_gyroscope_sensitivity() {
return gyroscope_range_to_sensitivty(imu_config_.gyroscope_range);
}
/// Read the gyroscope sensitivity
/// @param ec The error code to set if an error occurs

!Line: 310 - style: inconclusive: Either there is a missing 'override', or the member function 'espp::Icm42607::get_gyroscope_sensitivity' can be const. [functionConst]

counter = prev_counter; // cppcheck-suppress redundantAssignment
// set the joysticks to 0 since their config may not put them at 0
set_left_joystick(0, 0);
set_right_joystick(0, 0);
}

!Line: 194 - information: Unmatched suppression: redundantAssignment [unmatchedSuppression]

timestamp = prev_timestamp; // cppcheck-suppress redundantAssignment
counter = prev_counter; // cppcheck-suppress redundantAssignment
vendor_defined.coarse_timestamp = prev_coarse_timestamp;
vendor_defined.fine_timestamp1 = prev_fine_timestamp1;
vendor_defined.fine_timestamp2 = prev_fine_timestamp2;
set_battery_level(prev_battery, prev_charging);

!Line: 778 - information: Unmatched suppression: redundantAssignment [unmatchedSuppression]

counter = prev_counter; // cppcheck-suppress redundantAssignment
vendor_defined.coarse_timestamp = prev_coarse_timestamp;
vendor_defined.fine_timestamp1 = prev_fine_timestamp1;
vendor_defined.fine_timestamp2 = prev_fine_timestamp2;
set_battery_level(prev_battery, prev_charging);
set_hat(Hat::CENTERED);

!Line: 779 - information: Unmatched suppression: redundantAssignment [unmatchedSuppression]

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<uint8_t>(click_wav_start, click_wav_end);
// ensure we have at least a wav header
if (audio_bytes.size() < 44) {

!Line: 534 - information: Unmatched suppression: syntaxError [unmatchedSuppression]

extern const uint8_t click_wav_end[] asm("_binary_click_wav_end");
audio_bytes = std::vector<uint8_t>(click_wav_start, click_wav_end);
// ensure we have at least a wav header
if (audio_bytes.size() < 44) {
audio_bytes.clear();
return false;

!Line: 536 - information: Unmatched suppression: syntaxError [unmatchedSuppression]

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<uint8_t>(click_wav_start, click_wav_end);
// ensure we have at least a wav header
if (audio_bytes.size() < 44) {

!Line: 394 - information: Unmatched suppression: syntaxError [unmatchedSuppression]

extern const uint8_t click_wav_end[] asm("_binary_click_wav_end");
audio_bytes = std::vector<uint8_t>(click_wav_start, click_wav_end);
// ensure we have at least a wav header
if (audio_bytes.size() < 44) {
audio_bytes.clear();
return false;

!Line: 396 - information: Unmatched suppression: syntaxError [unmatchedSuppression]

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<uint8_t>(click_wav_start, click_wav_end);
// ensure we have at least a wav header
if (audio_bytes.size() < 44) {

!Line: 243 - information: Unmatched suppression: syntaxError [unmatchedSuppression]

extern const uint8_t click_wav_end[] asm("_binary_click_wav_end");
audio_bytes = std::vector<uint8_t>(click_wav_start, click_wav_end);
// ensure we have at least a wav header
if (audio_bytes.size() < 44) {
audio_bytes.clear();
return false;

!Line: 245 - information: Unmatched suppression: syntaxError [unmatchedSuppression]


Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates several ESPP components and examples to build against ESP-IDF v6.0 by adjusting component dependencies and adding small compatibility shims for renamed/changed ESP-IDF APIs.

Changes:

  • Update multiple component REQUIRES lists to include the new ESP-IDF v6 split driver components (e.g., esp_driver_gpio, esp_driver_spi, esp_driver_rmt, etc.).
  • Add ESP-IDF version-conditional code for API/constant changes (e.g., heap capability rename, LCD DPI config field changes, CLI console component selection).
  • Minor code tweaks for toolchain/libc/API differences (e.g., modff, SPI transaction init, ADC attenuation constant).

Reviewed changes

Copilot reviewed 25 out of 25 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
components/ws-s3-touch/example/main/ws_s3_touch_example.cpp Expands std::tm initialization used for RTC set-time in the example.
components/thermistor/example/main/thermistor_example.cpp Updates ADC attenuation constant in the example.
components/t-deck/CMakeLists.txt Adds ESP-IDF v6 driver component dependencies (I2S/SPI).
components/state_machine/example/main/Complex_generated_states.cpp Removes dead/unreachable statements in generated switch blocks.
components/socket/src/socket.cpp Uses modff for float fractional splitting.
components/rmt/CMakeLists.txt Adds esp_driver_rmt dependency.
components/remote_debug/CMakeLists.txt Adds esp_driver_gpio dependency.
components/neopixel/CMakeLists.txt Adds esp_driver_gpio dependency.
components/mt6701/example/CMakeLists.txt Adds esp_driver_spi to example component list.
components/motorgo-mini/src/motorgo-mini.cpp Changes SPI transaction initialization to zero-init + field assignment.
components/motorgo-mini/CMakeLists.txt Adds esp_driver_spi dependency.
components/monitor/src/heap_monitor.cpp Adds IDF-version mapping for MALLOC_CAP_TCMMALLOC_CAP_SPM in v6.
components/m5stack-tab5/src/video.cpp Adds IDF-version conditionals for LCD DPI config and adjusts DSI bus config init.
components/m5stack-tab5/CMakeLists.txt Adds ESP-IDF v6 driver component dependencies (I2S/SDMMC/SPI).
components/led/CMakeLists.txt Adds esp_driver_ledc dependency.
components/interrupt/CMakeLists.txt Adds esp_driver_gpio dependency.
components/esp32-timer-cam/CMakeLists.txt Adds ESP-IDF v6 driver component dependencies (I2S/SPI).
components/esp-box/CMakeLists.txt Adds esp_driver_i2s dependency.
components/encoder/CMakeLists.txt Adds esp_driver_pcnt dependency.
components/cli/include/cli.hpp Adds IDF-version conditional include for esp_vfs_usb_serial_jtag.h.
components/cli/CMakeLists.txt Selects console-related component dependencies based on IDF major version.
components/bldc_driver/include/bldc_driver.hpp Adds IDF/soc capability guards for MCPWM-related fields that differ across versions.
components/bldc_driver/CMakeLists.txt Adds esp_driver_gpio and esp_driver_mcpwm dependencies.
components/adc/include/adc_types.hpp Updates documentation comment for attenuation example value.

Comment thread components/m5stack-tab5/src/video.cpp
Comment thread components/ws-s3-touch/example/main/ws_s3_touch_example.cpp Outdated
@finger563 finger563 self-assigned this Apr 8, 2026
@finger563 finger563 linked an issue Apr 8, 2026 that may be closed by this pull request
2 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Doesn't compile in esp-idf 6.0

2 participants