feat: migrate to Arduino 3.0 (pioarduino)#438
Conversation
I'd prefer to be able to distinguish between the different types easily in support chat.
…o feat/arduino-3.0
Merge develop into feat/arduino-3.0. Replace remaining tcb::span with std::span, add missing WiFi.h include. Build not yet clean — remaining issues: Serial namespace rename (SerialCmds), USBSerial API, and CaptivePortalConfig struct changes. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
Migrates the firmware project to Arduino 3.0 (via pioarduino’s espressif32 platform), updating APIs impacted by the new core/IDF and modernizing several internal interfaces.
Changes:
- Switch project platform to pioarduino’s Arduino 3.0–based espressif32 and adjust related dependencies/tools.
- Replace the bundled
tcb::spanwith C++20std::spanacross HTTP/WebSocket/serialization/captive portal APIs. - Update Serial command handler namespace usage and refactor RMT-based transmit code for Arduino 3.0.
Reviewed changes
Copilot reviewed 49 out of 49 changed files in this pull request and generated 10 comments.
Show a summary per file
| File | Description |
|---|---|
| src/wifi/WiFiManager.cpp | Adjust WiFi init and IP formatting |
| src/util/Base64Utils.cpp | Switch to std::span in encode |
| src/serial/command_handlers/version.cpp | Serial command handler namespace update |
| src/serial/command_handlers/validgpios.cpp | Serial command handler namespace update |
| src/serial/command_handlers/sysinfo.cpp | Remove IPv6 reporting; namespace update |
| src/serial/command_handlers/rftxpin.cpp | Serial command handler namespace update |
| src/serial/command_handlers/rftransmit.cpp | Serial command handler namespace update |
| src/serial/command_handlers/restart.cpp | Serial command handler namespace update |
| src/serial/command_handlers/rawconfig.cpp | Serial command handler namespace update |
| src/serial/command_handlers/networks.cpp | Update TAG + namespace update |
| src/serial/command_handlers/keepalive.cpp | Serial command handler namespace update |
| src/serial/command_handlers/jsonconfig.cpp | Serial command handler namespace update |
| src/serial/command_handlers/hostname.cpp | Update TAG + namespace update |
| src/serial/command_handlers/factoryreset.cpp | Serial command handler namespace update |
| src/serial/command_handlers/estop.cpp | Serial command handler namespace update |
| src/serial/command_handlers/echo.cpp | Serial command handler namespace update |
| src/serial/command_handlers/domain.cpp | Update TAG + namespace update |
| src/serial/command_handlers/authtoken.cpp | Serial command handler namespace update |
| src/serial/command_handlers/CommandEntry.cpp | Update using namespace to SerialCmds |
| src/serial/SerialInputHandler.cpp | Use SerialCmds command groups/registry |
| src/radio/RFTransmitter.cpp | Update RMT init/write API usage |
| src/message_handlers/websocket/Local.cpp | Switch handler payload to std::span |
| src/message_handlers/websocket/Gateway.cpp | Switch handler payload to std::span |
| src/http/HTTPRequestManager.cpp | Add WiFi include; switch to std::span |
| src/captiveportal/Manager.cpp | Switch BIN send APIs to std::span |
| src/captiveportal/CaptivePortalInstance.cpp | Switch WS payload to std::span |
| src/WebSocketDeFragger.cpp | Switch callback payload to std::span |
| src/OtaUpdateManager.cpp | Update task WDT configuration API |
| src/GatewayConnectionManager.cpp | Switch BIN send APIs to std::span |
| src/GatewayClient.cpp | Switch BIN send APIs to std::span |
| platformio.ini | Use pioarduino platform + tool packages |
| include/wifi/WiFiManager.h | Remove IPv6 address API |
| include/visual/RgbLedDriver.h | Remove RMT handle member declaration |
| include/util/Base64Utils.h | Switch to std::span, include <span> |
| include/span.h | Remove bundled span implementation |
| include/serialization/CallbackFn.h | Switch serialization callback to std::span |
| include/serial/command_handlers/CommandEntry.h | Move types to OpenShock::SerialCmds |
| include/radio/RFTransmitter.h | Remove RMT handle member; update ok() |
| include/message_handlers/WebSocket.h | Switch handler payloads to std::span |
| include/http/HTTPRequestManager.h | Add <span> + Response constructor |
| include/captiveportal/Manager.h | Switch BIN send APIs to std::span |
| include/captiveportal/CaptivePortalInstance.h | Switch BIN send/WS payload to std::span |
| include/WebSocketDeFragger.h | Switch event callback to std::span |
| include/TinyVec.h | Include <span>; add span conversions/iterators |
| include/Hashing.h | Update mbedTLS hashing API calls |
| include/GatewayConnectionManager.h | Include <span>; switch BIN send API |
| include/GatewayClient.h | Include <span>; switch BIN send API |
| include/Common.h | Enforce C++20 requirement messaging |
| include/Checksum.h | Add C++20 concept-based overloads |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Change file check
If this change should show up in the release notes, add one with |
|
Ready to review this PR? Stage has broken it down into 11 individual chapters for you: Chapters generated by Stage for commit 9f602e8 on Jun 29, 2026 3:02pm UTC. |
- Prefix shared-enum includes with enums/ instead of widening common's public include path, so consumers reference enums/<Name>.h explicitly. - Register the protocols component (was an empty CMakeLists): move its public headers under include/radio/rmt/ and the private Shared.h under src/radio/rmt/internal/, wire SRCS/INCLUDE_DIRS/REQUIRES, and add protocols to the main component's REQUIRES. - Convert the decoupled domain enums (OtaUpdateChannel/OtaUpdateStep/ FirmwareBootType) to their flatbuffer counterparts at the serialization boundaries with static_cast (values are aligned).
- Stop committing generated sdkconfig.<env> files (DO NOT EDIT). They are derived by ESP-IDF from sdkconfig.defaults[.<target>]; track only the editable defaults. Untrack the 4 stray per-env files and dependencies.lock, and git-ignore them going forward. - Per-chip overrides use ESP-IDF's native sdkconfig.defaults.<idf_target> auto-layering (kconfig.cmake), no custom scripting. - Wemos-Lolin-S3-Mini: add -DARDUINO_USB_MODE=1 so Serial resolves to the built-in USB-Serial-JTAG (HWCDCSerial) instead of native USB CDC, which would require the TinyUSB component. Brings per-board builds to 12/13. - Document remaining S2-Mini TinyUSB work in BEFORE_MERGE_WORK.md.
CI was red on every PR: scripts/embed_env_vars.py does `import git` (GitPython), which the old espressif32 platform pulled in transitively but the pioarduino platform does not, so every `pio run` died at SCons config time with ModuleNotFoundError. Pin GitPython==3.1.46 explicitly. Also add `restore-keys: pio-<os>-` to the three PlatformIO cache steps so a platformio.ini edit reuses the latest prior cache (only fetching deltas) instead of re-downloading the whole pioarduino platform + toolchains. Document the root cause, caching change, remaining ccache opportunity, and the outstanding functional regressions in BEFORE_MERGE_WORK.md.
The PlatformIO cache only stored platforms/packages/.cache, but pioarduino
installs toolchains, esp-idf, the Arduino core and its own Python venv under
~/.platformio/{tools,penv}. Those were never cached, so every board did a full
reinstall even on a confirmed cache hit. Cache the whole ~/.platformio tree
(excluding dist/ and .cache/, which are redundant download archives + transient
install junk) and bump the cache key to pio-v2- so the stale incomplete cache
under the old key is replaced.
embed_env_vars.py imported 'git' at module top, which runs at SCons config time
in the pioarduino build environment where GitPython isn't reliably importable,
killing every build with ModuleNotFoundError. GitPython is only a local-build
fallback; in CI the commit and version come from OPENSHOCK_FW_* env vars. Import
it lazily inside get_git_repo() and degrade gracefully on ImportError.
Cpp-Linter Report
|
- Checksum.h: include <type_traits>; shift on unsigned representation in Sum8(integral) to avoid implementation-defined behavior for negatives - HTTPRequestManager.h: include <utility> for std::move - OtaUpdateManager: use esp_task_wdt_reconfigure() to apply OTA WDT timeout (esp_task_wdt_init returns ESP_ERR_INVALID_STATE when already initialized), falling back to init when not yet initialized - WiFiManager::GetIPAddress: pass ip.toString().c_str() and size the buffer with IP4ADDR_STRLEN_MAX instead of the IPv6 length constant; remove dead commented-out setAutoConnect/DNS blocks
No description provided.