From 6fe86bc310fced4b76d049e7fd5fe0825030e364 Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 3 Apr 2026 13:15:06 +0200 Subject: [PATCH] feat(01-01): PlatformIO scaffold + config.h - platformio.ini with -DESP32_ARDUINO_NO_RGB_BUILTIN, NeoPixelBus ^2.8.0, ArduinoJson ^7.4.0 - config.h defines all pin, LED count, brightness, timing, and FreeRTOS constants --- firmware/platformio.ini | 14 ++++++++++++ firmware/src/config.h | 49 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 63 insertions(+) create mode 100644 firmware/platformio.ini create mode 100644 firmware/src/config.h diff --git a/firmware/platformio.ini b/firmware/platformio.ini new file mode 100644 index 0000000..94abf82 --- /dev/null +++ b/firmware/platformio.ini @@ -0,0 +1,14 @@ +[env:esp32c3_supermini] +platform = espressif32 +board = esp32-c3-devkitm-1 +framework = arduino +monitor_speed = 115200 + +build_flags = + -DARDUINO_USB_CDC_ON_BOOT=1 + -DARDUINO_USB_MODE=1 + -DESP32_ARDUINO_NO_RGB_BUILTIN + +lib_deps = + makuna/NeoPixelBus @ ^2.8.0 + bblanchon/ArduinoJson @ ^7.4.0 diff --git a/firmware/src/config.h b/firmware/src/config.h new file mode 100644 index 0000000..145195f --- /dev/null +++ b/firmware/src/config.h @@ -0,0 +1,49 @@ +#pragma once + +// GPIO6/GPIO7 for WS2801 SPI — validate on hardware, fallback: GPIO0/GPIO1 if JTAG conflict + +#include +#include + +// --------------------------------------------------------------------------- +// Pin assignments (ESP32-C3 SuperMini safe GPIOs) +// --------------------------------------------------------------------------- +constexpr uint8_t PIN_SK6812 = 3; // RMT channel 0, confirmed safe +constexpr uint8_t PIN_WS2801_MOSI = 7; // Hardware SPI MOSI +constexpr uint8_t PIN_WS2801_CLK = 6; // Hardware SPI CLK + +// --------------------------------------------------------------------------- +// LED strip lengths +// --------------------------------------------------------------------------- +constexpr uint16_t LED_COUNT_SCHRANK = 160; // WS2801 strip (Schrank, U-turn) +constexpr uint16_t LED_COUNT_WAND = 300; // SK6812 strip (Wand, RGBW) + +// --------------------------------------------------------------------------- +// Brightness limits (per D-09: peak 27A at full brightness, cap at 40%) +// --------------------------------------------------------------------------- +constexpr float BRIGHTNESS_CAP = 0.40f; // 40% hardware max (per D-09) +constexpr float BRIGHTNESS_MAX = 0.60f; // 60% user-settable ceiling + +// --------------------------------------------------------------------------- +// Network +// --------------------------------------------------------------------------- +constexpr uint16_t UDP_PORT = 4210; // Pi-to-ESP command port + +// --------------------------------------------------------------------------- +// Animation engine (per D-04: 50fps tick rate) +// --------------------------------------------------------------------------- +constexpr uint8_t ANIM_FPS = 50; // 50fps tick rate + +// --------------------------------------------------------------------------- +// FreeRTOS task priorities (higher number = higher priority on single core) +// --------------------------------------------------------------------------- +constexpr UBaseType_t PRIORITY_LED_OUTPUT = 3; +constexpr UBaseType_t PRIORITY_ANIM_TICK = 2; +constexpr UBaseType_t PRIORITY_WIFI_RECV = 1; + +// --------------------------------------------------------------------------- +// FreeRTOS stack sizes (bytes) +// --------------------------------------------------------------------------- +constexpr uint32_t STACK_WIFI = 8192; +constexpr uint32_t STACK_ANIM = 4096; +constexpr uint32_t STACK_LED = 2048;