# SqueezeLite ESP32 - PlatformIO Configuration This project has been configured to work with PlatformIO while maintaining compatibility with the original ESP-IDF structure. ## Project Structure ``` squeezelite-esp32-gronod/ ├── platformio.ini # PlatformIO configuration file ├── src/ # Main source files │ ├── esp_app_main.c # Application entry point │ ├── platform_esp32.h # ESP32 platform definitions │ └── Params.txt # Configuration parameters ├── lib/ # Component libraries (moved from components/) │ ├── wifi-manager/ # WiFi management component │ ├── squeezelite/ # Squeezelite audio player │ ├── platform_console/ # Platform console │ ├── display/ # Display drivers │ ├── telnet/ # Telnet interface │ ├── audio/ # Audio processing │ ├── codecs/ # Audio codecs │ ├── spotify/ # Spotify integration (CSpot) │ └── ... # Other components ├── include/ # Global headers ├── partitions.csv # Partition table └── build_scripts/ # Custom build scripts ``` ## Key Differences from ESP-IDF ### 1. Directory Structure - `main/` → `src/` (PlatformIO standard) - `components/` → `lib/` (PlatformIO libraries) - `include/` created for global headers ### 2. Build System - Uses PlatformIO's build system instead of CMake - Components are configured as libraries with `library.json` files - Build flags and options configured in `platformio.ini` ### 3. Multiple Targets The original ESP-IDF project builds both `recovery` and `squeezelite` binaries. PlatformIO builds the main squeezelite application. Recovery functionality can be added as a separate build environment if needed. ## Building with PlatformIO ### Prerequisites - PlatformIO IDE or command-line tools - ESP32 development board ### Build Commands ```bash # Build the project pio run # Upload to device pio run --target upload # Monitor serial output pio device monitor # Clean build pio run --target clean ``` ### Configuration - Edit `platformio.ini` for board-specific settings - Adjust `src/Params.txt` for application configuration - Modify build flags in `platformio.ini` as needed ## Component Libraries Each major component has been converted to a PlatformIO library with a `library.json` file: - **wifi-manager**: WiFi network management - **squeezelite**: Core audio player functionality - **platform_console**: System console and commands - **display**: Display drivers and UI - **telnet**: Telnet interface for remote control - **audio**: Audio processing and output - **codecs**: Audio codec support - **spotify**: Spotify integration via CSpot ## ESP-IDF Compatibility The project maintains ESP-IDF compatibility: - All ESP-IDF components are still available - ESP-IDF configuration files (sdkconfig.*) are preserved - Original ESP-IDF build system can still be used ## Migration Notes ### What Changed 1. **platformio.ini**: Main configuration file 2. **Directory structure**: Reorganized for PlatformIO 3. **Library metadata**: Added library.json files 4. **Build flags**: Migrated to platformio.ini format ### What Remained - All source code files remain unchanged - ESP-IDF component structure preserved in lib/ - Configuration files (sdkconfig, partitions.csv) - Original functionality maintained ### Known Limitations 1. **Multiple ELF files**: PlatformIO doesn't natively support building both recovery and squeezelite binaries in one build 2. **Complex build scripts**: Some advanced ESP-IDF features may need custom PlatformIO scripts 3. **Kconfig**: ESP-IDF's Kconfig system is not directly supported in PlatformIO ## Troubleshooting ### Build Issues - Ensure all required libraries are in lib/ directory - Check build flags in platformio.ini - Verify ESP-IDF environment variables if using local ESP-IDF ### Component Issues - Each component needs a library.json file - Check component dependencies in platformio.ini - Verify include paths and source file locations ### Flash Issues - Check partition table configuration - Verify flash size settings - Ensure correct board configuration in platformio.ini