Files
mangavalkandClaude Opus 5.5 ad77b06c36 Initial import: robot firmware + PlatformIO two-env scaffold
Robot-side firmware (Teensy 4.0) imported unchanged as extracted.
platformio.ini defines [env:robot] (teensy40) and [env:remote]
(teensy41); scripts/select_src_dir.py points each env at its own
sketch folder so robot/ and remote/ stay Arduino-style sketches.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 15:36:37 +02:00

17 lines
781 B
Python

# PlatformIO pre-build script: point each environment at its own sketch folder.
#
# PlatformIO only has one global `src_dir`, and it only converts .ino files in
# the root of that directory. Each env sets `custom_src_dir = robot` (or
# `remote`) and this script swaps PROJECT_SRC_DIR before the build starts, so
# robot/ and remote/ stay plain Arduino-style sketch folders (one .ino plus
# paired .h/.cpp files) that also open in the Arduino IDE.
import os
Import("env") # noqa: F821 - injected by PlatformIO/SCons
sub = env.GetProjectOption("custom_src_dir") # noqa: F821
src = os.path.join(env.subst("$PROJECT_DIR"), sub) # noqa: F821
if not os.path.isdir(src):
raise SystemExit("custom_src_dir '%s' does not exist" % src)
env.Replace(PROJECT_SRC_DIR=src) # noqa: F821