Convert BikeAudio from Arduino .ino to PlatformIO #1

Open
blue wants to merge 1 commits from blue/platformio-conversion into main
Collaborator

PlatformIO conversion

Converts the Arduino IDE sketch (BikeAudio.ino) to a PlatformIO project so it can be built and flashed from the CLI. All build specs from the original .ino header are preserved.

Structure

Before After
BikeAudio.ino (repo root) src/main.cpp
platformio.ini

src/main.cpp gains #include <Arduino.h> and a print_status() forward declaration — PlatformIO compiles .cpp directly and, unlike the Arduino IDE, does not auto-generate function prototypes.

platformio.ini

  • platform = espressif32 @ ~6.6.0ESP32 Arduino core 2.0.17 (no 3.x — BT stack regression)
  • board = esp32dev (ESP32 DevKitC v4)
  • board_build.partitions = huge_app.csv (Huge APP, 3 MB no-OTA — required for the BT stack)
  • monitor_speed = 115200
  • lib_deps: pschatzmann ESP32-A2DP + arduino-audio-tools, pinned to exact commits (ESP32-A2DP 1.8.11, audio-tools 1.2.4) for reproducible builds

Source adaptation (behavior preserved)

The sketch targeted an older pschatzmann API. Three minimal edits bring it to the pinned versions:

  1. RingBuffer<uint8_t>::read()bool read(T&)
  2. Connection-state callbacks: dropped the esp_bd_addr_t arg → (esp_a2d_connection_state_t, void*)
  3. BluetoothA2DPSource::start(name, bool)start(name) (auto-reconnect already set via set_auto_reconnect(true))

Verification

pio run -e esp32devSUCCESS. RAM 14.5% (47.6 KB), Flash 42.0% (1.32 MB / 3 MB) — confirms huge_app is needed (firmware exceeds the default app partition).

Hardware flash to the ESP32 (on mbpi5, /dev/ttyUSB0) is the next step after this lands.

🤖 Generated with Claude Code

## PlatformIO conversion Converts the Arduino IDE sketch (`BikeAudio.ino`) to a PlatformIO project so it can be built and flashed from the CLI. **All build specs from the original `.ino` header are preserved.** ### Structure | Before | After | |---|---| | `BikeAudio.ino` (repo root) | `src/main.cpp` | | — | `platformio.ini` | `src/main.cpp` gains `#include <Arduino.h>` and a `print_status()` forward declaration — PlatformIO compiles `.cpp` directly and, unlike the Arduino IDE, does not auto-generate function prototypes. ### `platformio.ini` - `platform = espressif32 @ ~6.6.0` → **ESP32 Arduino core 2.0.17** (no 3.x — BT stack regression) - `board = esp32dev` (ESP32 DevKitC v4) - `board_build.partitions = huge_app.csv` (Huge APP, 3 MB no-OTA — required for the BT stack) - `monitor_speed = 115200` - `lib_deps`: pschatzmann **ESP32-A2DP** + **arduino-audio-tools**, pinned to exact commits (ESP32-A2DP 1.8.11, audio-tools 1.2.4) for reproducible builds ### Source adaptation (behavior preserved) The sketch targeted an older pschatzmann API. Three minimal edits bring it to the pinned versions: 1. `RingBuffer<uint8_t>::read()` → `bool read(T&)` 2. Connection-state callbacks: dropped the `esp_bd_addr_t` arg → `(esp_a2d_connection_state_t, void*)` 3. `BluetoothA2DPSource::start(name, bool)` → `start(name)` (auto-reconnect already set via `set_auto_reconnect(true)`) ### Verification `pio run -e esp32dev` → **SUCCESS**. RAM 14.5% (47.6 KB), Flash 42.0% (1.32 MB / 3 MB) — confirms huge_app is needed (firmware exceeds the default app partition). Hardware flash to the ESP32 (on mbpi5, `/dev/ttyUSB0`) is the next step after this lands. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
blue added 1 commit 2026-06-10 09:44:44 -04:00
Restructure BikeAudio for PlatformIO while preserving the original
build specs from the .ino header:
  - platform espressif32 @ ~6.6.0  -> ESP32 Arduino core 2.0.17
  - board esp32dev (ESP32 DevKitC v4)
  - board_build.partitions = huge_app.csv (Huge APP, required for BT stack)
  - monitor_speed = 115200

Changes:
  - BikeAudio.ino -> src/main.cpp (+ #include <Arduino.h>, print_status()
    forward declaration; PlatformIO compiles .cpp directly and does not
    auto-generate prototypes like the Arduino IDE).
  - Add platformio.ini with pschatzmann ESP32-A2DP + arduino-audio-tools
    pinned to exact commits (ESP32-A2DP 1.8.11, audio-tools 1.2.4) for
    reproducible builds.
  - Adapt three spots to the current library API (behavior preserved):
      * RingBuffer<uint8_t>::read() -> bool read(T&)
      * connection-state callbacks: drop esp_bd_addr_t arg
        -> (esp_a2d_connection_state_t, void*)
      * BluetoothA2DPSource::start(name, bool) -> start(name)
        (auto-reconnect already configured via set_auto_reconnect(true))

Verified: pio run -e esp32dev succeeds.
RAM 14.5% (47.6 KB), Flash 42.0% (1.32 MB / 3 MB).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This pull request can be merged automatically.
You are not authorized to merge this pull request.

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin blue/platformio-conversion:blue/platformio-conversion
git checkout blue/platformio-conversion
Sign in to join this conversation.
No Reviewers
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: seb/blue-repeat#1
No description provided.