Skip to content

Commit 4bd8b7f

Browse files
tarikbcclaude
andcommitted
Docs: cover BYE/IP/PING protocol + clients/liveness; add release workflow
- PROTOCOL.md: document BYE, IP, and the PING liveness beacon (+ handshake diagram and the 5s board-disconnect timeout). - ARCHITECTURE.md / HOW-IT-WORKS.md: mention the join/leave/IP/PING events, the live clients view, and the loading / board-disconnected dashboard states. - CHANGELOG: note the live clients view, board-disconnect detection, loading screen, and PING beacon; date 0.3.0. - Add .github/workflows/release.yml: on a v* tag, build the fap + ESP firmware and publish a GitHub Release with the images attached. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 6c2d1da commit 4bd8b7f

5 files changed

Lines changed: 84 additions & 9 deletions

File tree

.github/workflows/release.yml

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
name: release
2+
3+
# Push a version tag (e.g. v0.3.0) to build both halves and publish a GitHub
4+
# Release with the fap + firmware images attached.
5+
on:
6+
push:
7+
tags: ["v*"]
8+
9+
permissions:
10+
contents: write
11+
12+
jobs:
13+
release:
14+
name: Build + publish release
15+
runs-on: ubuntu-latest
16+
steps:
17+
- uses: actions/checkout@v4
18+
- uses: actions/setup-python@v5
19+
with:
20+
python-version: "3.12"
21+
22+
- name: Build Flipper app (fap)
23+
run: |
24+
pip install --upgrade ufbt
25+
ufbt update --index-url=https://up.momentum-fw.dev/firmware/directory.json --channel=release --hw-target=f7
26+
cd flipper/flytrap && ufbt
27+
28+
- name: Build ESP32-S2 firmware
29+
run: |
30+
mkdir -p "$HOME/bin"
31+
curl -fsSL https://raw.githubusercontent.com/arduino/arduino-cli/master/install.sh | BINDIR="$HOME/bin" sh
32+
export PATH="$HOME/bin:$PATH"
33+
arduino-cli config init --overwrite
34+
arduino-cli config set board_manager.additional_urls https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json
35+
arduino-cli core update-index
36+
arduino-cli core install esp32:esp32@2.0.17
37+
mkdir -p esp32/libs
38+
git clone --depth 1 https://github.com/me-no-dev/AsyncTCP.git esp32/libs/AsyncTCP
39+
git clone --depth 1 https://github.com/me-no-dev/ESPAsyncWebServer.git esp32/libs/ESPAsyncWebServer
40+
arduino-cli compile \
41+
--fqbn esp32:esp32:esp32s2:PartitionScheme=huge_app \
42+
--libraries esp32/libs \
43+
--output-dir esp32/flytrap-fw/build \
44+
esp32/flytrap-fw
45+
46+
- name: Publish release
47+
env:
48+
GH_TOKEN: ${{ github.token }}
49+
TAG: ${{ github.ref_name }}
50+
REPO: ${{ github.repository }}
51+
run: |
52+
gh release create "$TAG" \
53+
--repo "$REPO" \
54+
--title "Flytrap $TAG" \
55+
--generate-notes \
56+
flipper/flytrap/dist/flytrap.fap \
57+
esp32/flytrap-fw/build/flytrap-fw.ino.bin \
58+
esp32/flytrap-fw/build/flytrap-fw.ino.bootloader.bin \
59+
esp32/flytrap-fw/build/flytrap-fw.ino.partitions.bin

CHANGELOG.md

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,10 @@
22

33
All notable changes to Flytrap are documented here.
44

5-
## [0.3.0]unreleased
5+
## [0.3.0]2026-07-17
66

7-
Interface polish, structured captures, docs, and an important bug fix.
7+
Interface polish, structured captures, a single offline social portal, a live
8+
clients view, board-liveness detection, docs, and an important bug fix.
89

910
### Fixed
1011
- **App no longer hangs on "loading" when closed.** The UART worker could block posting
@@ -17,6 +18,11 @@ Interface polish, structured captures, docs, and an important bug fix.
1718
update it live, so a device that disconnects is removed and the **Clients** counter is
1819
accurate (previously it only ever counted up). Console moved to the menu to keep the
1920
dashboard to two uncrowded buttons (**← Captures · → Clients**).
21+
- **Board-disconnect detection** — a 1s liveness tick watches the ESP's `PING` beacon; if
22+
nothing arrives for 5s the dashboard shows **Board disconnected** instead of falsely
23+
claiming **Broadcasting**, and recovers automatically when the board returns.
24+
- **Loading screen** — Start Portal now shows a *Starting…* screen while the ~38.5 KB
25+
portal streams over UART (which blocks the UI ~3s), instead of freezing on the dashboard.
2026
- **Refined dashboard** — status tokens mapped to clean words with a `` indicator
2127
(`portal_up ip=…`**Broadcasting**), evenly-aligned rows, buttons on left/right.
2228
- **Structured captures** — browse a **list → detail**; fields are **url-decoded** and shown
@@ -31,6 +37,8 @@ Interface polish, structured captures, docs, and an important bug fix.
3137
- **Station join/leave/IP events.** The ESP now emits `BYE mac=…` when a station leaves
3238
and `IP mac=… ip=…` when DHCP leases an address (MAC resolved from the soft-AP table),
3339
in addition to `HIT`. This is what powers the live client list and accurate counter.
40+
- **`PING` liveness beacon** (~every 2s) so the Flipper can tell the board is still
41+
attached and flag the link as lost when it isn't.
3442

3543
### Portals
3644
- **Single `social.html` portal replaces the old template pile.** One page with a picker that

docs/ARCHITECTURE.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,10 @@ flowchart LR
3636
A single Arduino sketch. It holds the portal HTML in RAM (streamed from the
3737
Flipper), runs an open `WiFi.softAP`, a wildcard `DNSServer`, and an
3838
`ESPAsyncWebServer` catch-all handler. Submitted form fields go back over UART as
39-
`CRED` lines; station joins as `HIT`. All protocol output is serialized behind a
40-
mutex so the loop / WiFi-event / async-server tasks can't interleave a line. It
41-
touches no filesystem — see [PROTOCOL.md](PROTOCOL.md).
39+
`CRED` lines; stations report as `HIT` / `IP` / `BYE` (join / DHCP lease / leave),
40+
and a `PING` beacon (~2s) lets the Flipper notice an unplugged board. All protocol
41+
output is serialized behind a mutex so the loop / WiFi-event / async-server tasks
42+
can't interleave a line. It touches no filesystem — see [PROTOCOL.md](PROTOCOL.md).
4243

4344
## Flipper app (`flipper/flytrap/`)
4445

@@ -51,7 +52,7 @@ A standard `ViewDispatcher` + `SceneManager` app.
5152
| `helpers/flytrap_session.c` | start/stop the portal, parse ESP lines, store captures, fire alerts |
5253
| `helpers/flytrap_storage.c` | FlipperFormat config, portal/HTML + log file I/O, RTC timestamps |
5354
| `helpers/flytrap_format.c` | url-encode/decode + `key=value` → readable field pretty-printer |
54-
| `scenes/flytrap_scene_*.c` | main menu, ssid input, settings, dashboard (live), captures list, capture detail, textview (console/log) |
55+
| `scenes/flytrap_scene_*.c` | main menu, ssid input, settings, dashboard (live, with loading + board-disconnect states), captures list/detail, clients list/detail, textview (console/log) |
5556

5657
### Threading model
5758

docs/HOW-IT-WORKS.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,12 @@ touches any filesystem — see [PROTOCOL.md](PROTOCOL.md).
6464

6565
The app is a standard Flipper `ViewDispatcher` + `SceneManager` structure:
6666

67-
- **Main menu** → start/stop the portal, pick a portal HTML, set the SSID, view logs.
68-
- **Dashboard** (a `Widget`) → live status, credential + client counters.
67+
- **Main menu** → start/stop the portal, pick a portal HTML, set the SSID, view logs, console.
68+
- **Dashboard** (a `Widget`) → live status (with a *Starting…* screen and a *Board
69+
disconnected* state when the ESP's beacon stops), credential + client counters.
6970
- **Captures** → a list of captures → a detail screen that url-decodes each field.
71+
- **Clients** → who's connected right now (MAC, IP, joined time); updates live as
72+
stations join, get a DHCP lease, and leave.
7073
- **Console** → the raw serial stream, exactly as in [PROTOCOL.md](PROTOCOL.md).
7174

7275
A background thread reads UART bytes; all parsing happens on the GUI thread (so there

docs/PROTOCOL.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ All line-oriented. The Flipper parser matches on the leading token.
3737
| `BYE mac=<AA:BB:...>` | A station left the AP — the Flipper drops it from the live client list. |
3838
| `IP mac=<AA:BB:...> ip=<ip>` | DHCP assigned a station its IP (MAC resolved from the soft-AP table). Falls back to `IP ip=<ip>` when the MAC can't be resolved; the Flipper then pairs it to the most recent client without an IP. |
3939
| `CRED ip=<ip>&<field>=<val>&...` | A form was submitted — the client IP plus every submitted field, url-encoded. One line per submission. |
40+
| `PING` | Liveness beacon, emitted ~every 2s. The Flipper uses it to detect an unplugged board (no `PING`/traffic for 5s ⇒ link lost); it's dropped from the console so it doesn't spam. |
4041

4142
## Handshake
4243

@@ -56,12 +57,15 @@ Flipper ESP
5657
| <---- IP mac=... ip=...(DHCP leases it an address)
5758
| <---- CRED ip=...&... (a form is submitted)
5859
| <---- BYE mac=... (the phone leaves)
60+
| <---- PING (~every 2s, all the while)
5961
| |
6062
| stop\n / reset\n ----> | (tear down / reboot)
6163
```
6264

6365
If the ESP emits `STATUS boot` mid-session (it rebooted), the Flipper re-sends
64-
`sethtml` automatically to recover.
66+
`sethtml` automatically to recover. If `PING` (and all other traffic) stops for
67+
5s, the Flipper flags the link as lost and the dashboard shows **Board
68+
disconnected** until the board returns.
6569

6670
## Notes
6771

0 commit comments

Comments
 (0)