- get_ltchiptool_path: use 'Scripts/' on Windows, 'bin/' elsewhere when
falling back to PlatformIO's libretiny penv. CPython venvs put scripts
under Scripts/ on win32 and bin/ on POSIX; the prior hardcoded 'bin'
would never have found ltchiptool on Windows.
- _load_idedata: wrap json.loads on the prebuilt idedata.json in a
try/except and re-raise as EsphomeError with a one-line diagnostic so
the failure mode is a clean error instead of an unhandled
JSONDecodeError stack trace. Update the surrounding comment to match
the new behavior.
- CORE.prebuilt_dir docstring: drop the dead 'docs/architecture/...'
pointer (no docs/ tree in this repo); point at esphome-docs#6600 and
device-builder#572 instead.
New regression test:
- test_load_idedata_prebuilt_malformed_json_raises_esphomeerror
Updated test:
- test_get_ltchiptool_path_pio_penv now uses Scripts/ on win32 to match
the new platform-aware lookup.
Issue: esphome/device-builder#572
Issue: esphome/device-builder#570
The libretiny upload path on `upload_program` SERIAL dispatch re-invokes
PlatformIO (`pio run -t upload -t nobuild`), which needs a full build
tree and `platformio.ini`. That makes it incompatible with a dashboard
that only has prebuilt artifacts.
Bypass PlatformIO for the libretiny+SERIAL+--prebuilt-dir case by calling
`ltchiptool flash write -d <port> <firmware.uf2>` directly. The .uf2
encodes the chip family in its header so no extra config is needed.
ltchiptool ships with the libretiny PlatformIO platform under
~/.platformio/penv/.libretiny/bin/ltchiptool; `get_ltchiptool_path()`
prefers PATH first (pip install ltchiptool) and falls back to the
PlatformIO penv. Without --prebuilt-dir the existing PlatformIO path
remains in place, so this is purely additive.
Issue: esphome/device-builder#572
Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
Co-authored-by: J. Nick Koston <nick@koston.org>
Co-authored-by: J. Nick Koston <nick@home-assistant.io>