Commit d88bd66
Ravi Singh
feat: full app shell (animated logo + sticky header) + 20Hz WS + motion v2 (median + adaptive)
User reported visible jitter and missing UI elements. Three-pronged fix.
Frontend — full app shell port from design-source/app.jsx:
- LogoMark: animated triangle "A" with 3 concentric pulse rings
emanating outward, radial proximity-glow that breathes (scale +
opacity), corner-tick chip details. Pulse strength scales with live
distance (closer target = brighter glow). Uses lm-grad
(amber→orange→pink) and lm-core radial gradients verbatim from
design.
- Wordmark: "Ambi" in slate-gradient + "Sense" in accent-gradient,
with "v6.x · ESP32" caps subtitle.
- Sticky header (.app-header) with backdrop-filter blur — page name +
hostname.local breadcrumb + live distance chip + RSSI chip +
sun/moon theme toggle.
- Sidebar with logo block + nav + bottom IP/board chip
(10.0.0.x · ESP32-C3 · LD2410C style).
- styles.css: keyframes logo-pulse, logo-breath, pulse-acc; .app-header,
.brand-block, .sidebar-foot, .btn-icon classes.
Firmware — kill the visible 200ms stair-step jitter:
- ws_broadcast_task: 200 ms (5 Hz) → 50 ms (20 Hz). Bandwidth: ~2.5 KB/s,
trivial. Browser sparkline now updates 4× more often, no flat dwells.
- main.c telemetry_pump_task: same bump 5 Hz → 20 Hz, also publishes
raw_cm now (median-filtered but un-smoothed) so the Motion screen
graph shows what the firmware *actually* feeds the LED engine,
removing 200 ms client-side simulation lag.
- webui_live_t and the WS JSON gain a 'raw' field.
Firmware — motion algorithm v2:
- Median-of-5 filter on raw radar samples before the smoother. Single-
sample LD2410 spurious readings (every few minutes) get out-voted;
rejection is total. Insertion-sort over 5 ints — cheap.
- Adaptive smoothing: alpha scales with motion magnitude. Stationary
(|delta| < 30 cm/sample) uses configured pos_smooth; fast-moving
(>= 30 cm/sample) ramps alpha up to 4× the configured value (capped
at 0.9). Result: calm reading when still, snappy when moving — best
of both worlds.
- target_t exposes raw_cm alongside distance_cm.
Frontend — Live sparkline + Motion graph fixes:
- ScreenLive: useEffect deps changed from [dist] to [live] so the
sparkline advances on every WS frame at 20 Hz, even when the integer
cm value hasn't changed (was freezing during stationary periods).
- ScreenMotion: raw and smoothed lines come straight from firmware
WS payload, no client-side alpha simulation. Graph now reflects the
real on-device smoother instead of a 200 ms-lagged copy.
Build: 1.17 MB binary, 19%% free in 1.4 MB app slot. UI gzipped 25.4 KB.
Both C3s flashed.1 parent 40661ca commit d88bd66
11 files changed
Lines changed: 265 additions & 69 deletions
File tree
- firmware
- components
- motion
- include
- webui
- include
- main
- frontend/src
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
25 | 29 | | |
26 | 30 | | |
27 | 31 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
| 4 | + | |
4 | 5 | | |
5 | 6 | | |
6 | 7 | | |
| |||
14 | 15 | | |
15 | 16 | | |
16 | 17 | | |
| 18 | + | |
| 19 | + | |
17 | 20 | | |
18 | 21 | | |
19 | 22 | | |
| |||
28 | 31 | | |
29 | 32 | | |
30 | 33 | | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
31 | 42 | | |
32 | 43 | | |
33 | 44 | | |
| |||
37 | 48 | | |
38 | 49 | | |
39 | 50 | | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
40 | 63 | | |
41 | 64 | | |
42 | 65 | | |
| |||
55 | 78 | | |
56 | 79 | | |
57 | 80 | | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
58 | 88 | | |
59 | 89 | | |
60 | 90 | | |
| 91 | + | |
61 | 92 | | |
62 | | - | |
| 93 | + | |
63 | 94 | | |
64 | 95 | | |
65 | 96 | | |
66 | 97 | | |
67 | 98 | | |
68 | 99 | | |
69 | 100 | | |
70 | | - | |
71 | | - | |
| 101 | + | |
| 102 | + | |
72 | 103 | | |
73 | 104 | | |
74 | | - | |
75 | | - | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
76 | 117 | | |
77 | 118 | | |
78 | 119 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
30 | | - | |
31 | | - | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
32 | 35 | | |
33 | 36 | | |
34 | 37 | | |
| |||
Large diffs are not rendered by default.
Binary file not shown.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
961 | 961 | | |
962 | 962 | | |
963 | 963 | | |
964 | | - | |
| 964 | + | |
965 | 965 | | |
966 | 966 | | |
967 | 967 | | |
| |||
971 | 971 | | |
972 | 972 | | |
973 | 973 | | |
974 | | - | |
| 974 | + | |
975 | 975 | | |
976 | | - | |
977 | | - | |
| 976 | + | |
| 977 | + | |
978 | 978 | | |
979 | 979 | | |
980 | 980 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
80 | 80 | | |
81 | 81 | | |
82 | 82 | | |
83 | | - | |
84 | | - | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
85 | 88 | | |
86 | 89 | | |
87 | 90 | | |
88 | 91 | | |
89 | 92 | | |
| 93 | + | |
| 94 | + | |
90 | 95 | | |
91 | 96 | | |
92 | 97 | | |
93 | 98 | | |
94 | 99 | | |
95 | 100 | | |
96 | 101 | | |
| 102 | + | |
97 | 103 | | |
98 | 104 | | |
99 | | - | |
| 105 | + | |
100 | 106 | | |
101 | 107 | | |
102 | 108 | | |
103 | 109 | | |
104 | 110 | | |
105 | | - | |
| 111 | + | |
106 | 112 | | |
107 | 113 | | |
108 | 114 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
218 | 218 | | |
219 | 219 | | |
220 | 220 | | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
0 commit comments