# airflash demo A small ESP32-S3 app to try airflash on: flash it over Wi-Fi, watch its logs over Wi-Fi, crash it on purpose and download the crash dump, all without a USB cable after the first install. - It joins your Wi-Fi with ESP-IDF's `example_connect()`, then calls `airflash_start()`: that call (and `#include "airflash.h"`) is all the airflash code in `main/main.c`. - A "sensor" task logs a made-up reading every 2 s. - A web page on port 80 shows the app's version, uptime and last reset reason, and has links that crash the app in four ways: `abort()`, a write through a NULL pointer, a stack overflow, and a task watchdog. ## Steps 1. **Get the project:** ```bash idf.py create-project-from-example "hexcore/airflash^0.1.0:demo" cd demo ``` (In the airflash repository, it's `components/airflash/examples/demo`.) 2. **Set your Wi-Fi** (2.4 GHz): `idf.py menuconfig` → Example Connection Configuration → WiFi SSID and WiFi Password. The app uses it, and the USB install gives it to the airflash updater too. 3. **Build, and add the `idf.py airflash-*` commands** to the project (once). The build prints the exact line: ```bash idf.py build ln -s managed_components/hexcore__airflash/tool/idf_ext.py idf_ext.py ``` (In the airflash repository: `ln -s ../../tool/idf_ext.py idf_ext.py`. On Windows, copy the file instead.) 4. **Install over USB, once:** `idf.py -p <port> airflash-install`. It ends with `done: airflash_demo is running`. Unplug USB; a USB power supply is enough from now on. 5. **Watch it over Wi-Fi:** `idf.py airflash-monitor` (quit with Ctrl+]). It starts at the first boot line: look for `open http://<ip>/ in a browser`, then the readings every 2 s. 6. **Change it and flash it over Wi-Fi:** set `PROJECT_VER` to `"1.0.1"` in `CMakeLists.txt`, run `idf.py airflash-flash`, and reload the page: it shows 1.0.1. ## What to try - **Crash it** from the web page while `idf.py airflash-monitor` runs. You see the countdown, then ESP-IDF's own crash text (`abort() was called`, `Guru Meditation Error ... StoreProhibited`, `A stack overflow in task stack_eater`), then the reboot. Then `idf.py airflash-coredump` downloads the crash dump and shows where it crashed (task, backtrace with file and line) and the app's last log lines. - **Task watchdog:** with ESP-IDF's default settings it only prints the watchdog's report; the app keeps running and doesn't reboot. To make it a crash with a dump, turn on menuconfig → Component config → ESP System Settings → Invoke panic handler on Task Watchdog timeout, then `idf.py airflash-flash`. - **A broken Wi-Fi setting can't lock you out:** set a wrong Wi-Fi password in menuconfig and `idf.py airflash-flash`. The new app can't get on the network, so 60 s after it starts airflash rolls it back to the updater (which kept the Wi-Fi from the install), and `airflash-flash` tells you why. Fix the password and flash again. - `idf.py airflash-info` shows what's running on the board, its version and whether a crash dump is waiting.
To create a project from this example, run:
idf.py create-project-from-example "hexcore/airflash=0.1.0:demo"