set shell := ["bash", "-cu"]

# RP docs only
update-docs-rp:
	./scripts/update-docs.sh

# RP docs fast path (no cleanup/check-docs/doc-images asset staging)
update-docs-rp-fast:
	cargo doc --target thumbv8m.main-none-eabihf --no-deps --release --features pico2,arm,wifi --no-default-features

# Build docs and open them in Windows Edge (via WSL)
show-docs-rp:
	just update-docs-rp
	./scripts/open-docs-rp.sh

# ESP docs only (pass-through)
update-docs-esp:
	cd ../device-envoy-esp && just update-docs-esp

# Build ESP docs and open them in a browser (pass-through)
show-docs-esp:
	cd ../device-envoy-esp && just show-docs-esp

run name board="1":
	./scripts/device-action.sh run {{name}} {{board}}

check name board="1":
	./scripts/device-action.sh check {{name}} {{board}}

build name board="1":
	./scripts/device-action.sh build {{name}} {{board}}

regenerate-text-pngs:
	./scripts/regenerate-text-pngs.sh

# Update led2d_graphics PNG expected output (host-only)
pngs-update-led2d-graphics:
        DEVICE_KIT_UPDATE_PNGS=1 cargo test --features host -p device-envoy-core --test pngs led2d_graphics_png_matches_expected

# Update all expected PNG outputs (host-only)
pngs-update-all:
        DEVICE_KIT_UPDATE_PNGS=1 cargo test --features host -p device-envoy-core --test pngs

# Full validation (docs + embedded + host PNGs)
verify-all:
        just update-docs-rp
        cargo check-all
        just pngs-check-all

# Host-only PNG checks without updating
pngs-check-all:
        cargo test --features host -p device-envoy-core --test pngs

# Generate video frames data (uses SANTA_VIDEO_PATH or SANTA_FRAMES_DIR)
# After regenerating, copy to device-envoy-core/tests/data/frame-data/ as well:
#   cp examples/data/frame-data/video_frames_data.rs ../device-envoy-core/tests/data/frame-data/

# Build an example for Pico 2 (ARM)
example name:
	cargo xtask example {{name}} --board pico2 --arch arm

# Build an example for Pico 2 (ARM) with WiFi
example-wifi name:
	cargo xtask example {{name}} --board pico2 --arch arm --wifi

# Build an example for Pico 1 with WiFi
example-pico1 name:
	cargo xtask example {{name}} --board pico1 --arch arm --wifi

# Build UF2 file for Pico 2 (ARM)
uf2 name:
	cargo xtask uf2 {{name}} --board pico2 --arch arm

# Build UF2 file for Pico 2 (ARM) with WiFi
uf2-wifi name:
	cargo xtask uf2 {{name}} --board pico2 --arch arm --wifi
