feat: add BUILD_TOKEN to firmware and consolidate build system

- Generate BUILD_TOKEN from 'git describe --always --dirty'
- Include via -include flag in justfile compile recipe
- Print BUILD_TOKEN in boot banners (DoorbellLogic + uno-r4-wifi)
- Remove all [tasks] from mise.toml; keep only [tools] + [env]
- Update AGENTS.md to use just commands as single source of truth
- Add 'just full' recipe (compile -> upload -> monitor -> watch)
- Switch BOARD var to env_var_or_default for mise set compatibility
- DRY clean/clean-temp with wildcard patterns
This commit is contained in:
2026-05-29 20:17:42 -07:00
parent ece874a8ed
commit 6f9d2912d3
5 changed files with 99 additions and 253 deletions
+33 -23
View File
@@ -5,35 +5,40 @@ Multi-target Arduino/ESP32 doorbell alert system using ntfy.sh. Default BOARD: `
## Build Commands
```bash
# All tasks use just (see justfile). Default BOARD: esp32-s3-lcd-43
# Set target board
mise set BOARD=esp32-32e-4 # ESP32-32E 4" (320x480 ST7796)
mise set BOARD=esp32-32e # ESP32-32E 3.5" (320x240 ILI9341)
mise set BOARD=esp32-s3-lcd-43 # ESP32-S3-Touch-LCD-4.3 (800x480 RGB)
just BOARD=esp32-32e-4 compile # ESP32-32E 4" (320x480 ST7796)
just BOARD=esp32-32e compile # ESP32-32E 3.5" (320x240 ILI9341)
just BOARD=esp32-s3-lcd-43 compile # ESP32-S3-Touch-LCD-4.3 (800x480 RGB)
just BOARD=uno-r4-wifi compile # Arduino Uno R4 WiFi (12x8 LED matrix)
# Core commands
mise run compile # compile for current BOARD
mise run upload # upload (auto-kills monitor first)
mise run monitor # start JSON monitor daemon
mise run kill # kill monitor/release serial port
just compile # compile for current BOARD
just upload # upload (auto-kills monitor first)
just monitor # start JSON monitor daemon (background)
just kill # kill monitor/release serial port
just full # compile + upload + monitor + log-tail (full feedback loop)
just watch # tail colored logs
# Formatting & cleanup
mise run format # format code with clang-format
mise run clean # remove build artifacts
just format # format code with clang-format
just clean # remove build artifacts
just clean-temp # remove monitor logs/FIFOs/state files
# Debugging
mise run log-tail # tail colored logs
mise run cmd COMMAND=dashboard # send command to device
mise run state # show device state
mise run monitor-raw # raw serial monitor (115200 baud)
mise run monitor-tio # show tio command for terminal UI
just cmd dashboard # send command to device
just state # show device state
just monitor-raw # raw serial monitor (115200 baud)
just monitor-tio # show tio command for terminal UI
# Install dependencies
mise run install-libs-shared # shared libs (ArduinoJson, NTPClient)
mise run install # shared + board-specific libs
just install-libs-shared # shared libs (ArduinoJson, NTPClient)
just install # shared + board-specific libs
# LSP / IDE
mise run gen-compile-commands # generate compile_commands.json
mise run gen-crush-config # generate .crush.json for BOARD
just gen-compile-commands # generate compile_commands.json
just gen-crush-config # generate .crush.json for BOARD
```
**Serial debug commands** (115200 baud): `alert`, `silence`, `dashboard`, `off`, `status`, `reboot`
@@ -47,7 +52,7 @@ mise run gen-crush-config # generate .crush.json for BOARD
- 4-space indentation, no tabs
- Column limit: 100
- Opening brace on same line (`BreakBeforeBraces: Attach`)
- Run `mise run format` to format code
- Run `just format` to format code
### Header Guards
Use `#pragma once` (not `#ifndef` guards).
@@ -109,17 +114,22 @@ libraries/KlubhausCore/src/
boards/{BOARD}/
├── {BOARD}.ino # Main sketch
├── board_config.h # Board-specific config
├── secrets.h # WiFi credentials
├── board_config.h # Board-specific config (ESP32 boards)
├── secrets.h # WiFi credentials (optional, use env vars)
├── tft_user_setup.h # TFT_eSPI config (TFT boards)
└── DisplayDriver*.{h,cpp} # Concrete IDisplayDriver
└── DisplayDriver*.{h,cpp} # Concrete IDisplayDriver (ESP32 boards)
boards/uno-r4-wifi/ # Uno R4 WiFi (LED matrix display)
├── uno-r4-wifi.ino # Main sketch (standalone)
├── test_messages.sh # Test script to send ntfy messages
└── README.md # Quick start guide
```
## Gotchas
1. **secrets.h**: Boards with `-DLOCAL_SECRETS` use local `secrets.h`; others use `KlubhausCore/src/secrets.h`
2. **Vendored libs**: Each board links only its display lib — never TFT_eSPI + LovyanGFX together
3. **LSP errors**: Run `mise run gen-compile-commands` then restart LSP; build works regardless
3. **LSP errors**: Run `just gen-compile-commands` then restart LSP; build works regardless
4. **Serial port**: `upload`/`monitor` auto-depend on `kill` to release port
5. **State tags**: Use `[STATE] → DASHBOARD`, `[ADMIN]`, `[TOUCH]`, `[ALERT]` for monitor parsing