Stream slave accel via ESP-NOW with master snapshot cache.

Slaves push BMA456 samples at 16ms when enabled; the master caches per
client and exposes ACCEL_SNAPSHOT and ACCEL_STREAM over UART. goTool adds
dashboard stream controls, HTTP accel-stream routes, and an external
WebSocket API with per-connection receive/interval and slave stream commands.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-05-29 19:11:36 +02:00
co-authored by Cursor
parent ba20544762
commit 47c75110c9
35 changed files with 2409 additions and 300 deletions
+40
View File
@@ -0,0 +1,40 @@
package main
import "sync"
// accelStreamCtl tracks which slaves the host wants to poll for accel (mirrors firmware).
type accelStreamCtl struct {
mu sync.Mutex
enabled map[uint32]struct{}
}
func newAccelStreamCtl() *accelStreamCtl {
return &accelStreamCtl{enabled: make(map[uint32]struct{})}
}
func (c *accelStreamCtl) Set(clientID uint32, on bool) {
c.mu.Lock()
defer c.mu.Unlock()
if on {
c.enabled[clientID] = struct{}{}
} else {
delete(c.enabled, clientID)
}
}
func (c *accelStreamCtl) Any() bool {
c.mu.Lock()
defer c.mu.Unlock()
return len(c.enabled) > 0
}
func (c *accelStreamCtl) SyncFromClients(clients []ClientView) {
c.mu.Lock()
defer c.mu.Unlock()
c.enabled = make(map[uint32]struct{})
for _, cl := range clients {
if cl.AccelStream {
c.enabled[cl.ID] = struct{}{}
}
}
}