Add BMA456 tap detection with ESP-NOW notify and host snapshot API.

Slaves forward configured tap kinds to the master; goTool exposes CLI, dashboard, REST, and WebSocket with separate notify vs receive and 2s display cache.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-05-29 20:42:57 +02:00
co-authored by Cursor
parent 3cb0b5bbe9
commit a8d4d42920
34 changed files with 3138 additions and 241 deletions
+50
View File
@@ -0,0 +1,50 @@
package main
import "sync"
// tapNotifyCtl tracks which slaves have tap notify enabled (mirrors firmware / dashboard).
type tapNotifyCtl struct {
mu sync.Mutex
flags map[uint32]tapNotifyFlags
}
type tapNotifyFlags struct {
single bool
doubleTap bool
triple bool
}
func newTapNotifyCtl() *tapNotifyCtl {
return &tapNotifyCtl{flags: make(map[uint32]tapNotifyFlags)}
}
func (c *tapNotifyCtl) Set(clientID uint32, single, doubleTap, triple bool) {
c.mu.Lock()
defer c.mu.Unlock()
if !single && !doubleTap && !triple {
delete(c.flags, clientID)
return
}
c.flags[clientID] = tapNotifyFlags{single: single, doubleTap: doubleTap, triple: triple}
}
func (c *tapNotifyCtl) Any() bool {
c.mu.Lock()
defer c.mu.Unlock()
return len(c.flags) > 0
}
func (c *tapNotifyCtl) SyncFromClients(clients []ClientView) {
c.mu.Lock()
defer c.mu.Unlock()
c.flags = make(map[uint32]tapNotifyFlags)
for _, cl := range clients {
if cl.TapNotifySingle || cl.TapNotifyDouble || cl.TapNotifyTriple {
c.flags[cl.ID] = tapNotifyFlags{
single: cl.TapNotifySingle,
doubleTap: cl.TapNotifyDouble,
triple: cl.TapNotifyTriple,
}
}
}
}