Skip to content

refactor: support ESP-IDF 5.5/6.1 and ESP32-P4/S31 - #137

Draft
leeebo wants to merge 15 commits into
masterfrom
agent/idf-6.1-p4-s31-refactor
Draft

leeebo wants to merge 15 commits into
masterfrom
agent/idf-6.1-p4-s31-refactor

Conversation

@leeebo

@leeebo leeebo commented Aug 10, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

  • support ESP-IDF release/v5.5 and release/v6.1 only, with a fail-fast CMake version guard
  • build ESP32, ESP32-S2, ESP32-S3, and ESP32-P4 on both supported IDF branches; add ESP32-S31 as a 6.1 preview target
  • separate board profiles, SoC capabilities, and CRTP transport selection
  • add portable-safe/no-radio support for ESP32-P4 and portable-safe/native-Wi-Fi support for ESP32-S31
  • migrate ADC and I2C to current IDF driver APIs and replace the EEPROM stub with NVS-backed storage
  • harden UDP, CRTP, ESP-NOW, motor startup, and critical-sensor failure paths
  • audit and refresh the live English/Chinese documentation, including version guidance, safety instructions, navigation, and broken links

Why

The previous architecture coupled ESP32-S2 board details, native Wi-Fi, legacy peripheral APIs, and flight-core initialization. It also advertised and tested obsolete IDF 4.4/5.0 baselines. That prevented safe P4/S31 support and left several failure paths reporting success or resetting instead of propagating errors.

This change establishes explicit platform and transport boundaries, constrains supported IDF versions to 5.5 and 6.1, and defaults unvalidated hardware profiles to non-actuating diagnostic behavior.

Safety and behavior changes

  • startup is disarmed by default
  • motor startup rotation stays disabled unless explicitly enabled
  • LEDC initialization/runtime failures propagate to the flight self-test
  • a missing MPU6050 no longer causes an assert/reset loop; stabilization remains disabled and motor output is stopped
  • malformed UDP/CRTP and ESP-NOW inputs are rejected before copying or dispatch
  • configuration data is persisted through NVS and checked across reset
  • unused IPv6 tables are disabled because the exposed SoftAP/UDP transport is IPv4-only; this restores IDF 5.5/S2 internal-DRAM headroom without changing the wire protocol

Supported build matrix

ESP-IDF ESP32 ESP32-S2 ESP32-S3 ESP32-P4 ESP32-S31
release/v5.5 passed passed passed passed (portable-safe/no-radio) unsupported
release/v6.1 passed passed passed passed (portable-safe/no-radio) passed (preview, native Wi-Fi/UDP)

ESP32-P4 remote Wi-Fi still requires selection and validation of a companion/esp-extconn design. ESP32-S31 enhanced ESP-NOW remains disabled because the current IDF 6.1 preview definition of wifi_pkt_rx_ctrl_t is incompatible with espressif/esp-now 2.5.3.

Validation

  • all nine supported IDF/target combinations completed compile, link, partition-size checks, and image generation
  • pre-commit run --all-files (codespell), YAML parsing, and git diff --check
  • English and Chinese Sphinx 8.2.3 HTML builds with warnings treated as errors
  • English and Chinese Sphinx link checks; cross-language sibling builds and ST pages that reject automated probes are documented exclusions
  • ESP32-S2 image 86df9a3b74c4237b754dbc42d07db0738912ba98cb8fda647350e758504368b7 flashed to /dev/ttyUSB0 with write verification
  • ESP32-S2 native Wi-Fi, DHCP, UDP/2390, ESP-NOW 2.5.3, CRTP, and NVS config-block startup checks passed
  • approximately 45 seconds of missing-IMU observation: zero panic, zero assert, zero additional reset; stabilization remained disabled

Hardware validation limits

The connected S2 platform did not expose a working MPU6050, so sensor sampling and closed-loop flight were not validated. The host had no Wi-Fi interface, so external over-the-air UDP frame injection was not performed. PWM behavior was validated through the software-safe path only; no scope capture or active motor rotation was performed.

Detailed implementation and validation evidence is in docs/refactor-progress.md and docs/hardware-validation-esp32s2-2026-08-10.md.

@leeebo leeebo changed the title refactor: migrate to ESP-IDF 6.1 and add ESP32-P4/S31 targets refactor: support ESP-IDF 5.5/6.1 and ESP32-P4/S31 Aug 10, 2026
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.

1 participant