Add runtime BMA456 tap config with NVS persistence and goTool UI.

Expose multitap parameters over UART/ESP-NOW (like deadzone), store per node in NVS, and allow get/set from CLI, REST, and the dashboard without poll-overwrite while editing.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
simon
2026-09-26 13:07:13 +02:00
co-authored by Cursor
parent f006f8b912
commit d7441cb85f
32 changed files with 1859 additions and 150 deletions
+54
View File
@@ -0,0 +1,54 @@
package main
import (
"flag"
"fmt"
"powerpod/gotool/pb"
)
func runTapConfig(sp *serialPort, args []string) error {
fs := flag.NewFlagSet("tap-config", flag.ExitOnError)
write := fs.Bool("set", false, "write tap config (default: read)")
clientID := fs.Uint("client", 0, "client id (0=local master BMA456)")
all := fs.Bool("all", false, "apply to all registered slaves (master only)")
sens := fs.Uint("sens", 5, "tap_sens_thres 0=most … 15=least")
maxGest := fs.Uint("max-gest", 100, "max_gest_dur (×5 ms)")
shock := fs.Uint("shock", 6, "tap_shock_dur (×5 ms)")
quiet := fs.Uint("quiet", 60, "quite_time_after_gest (×5 ms)")
wait := fs.Uint("wait", 0, "wait_for_timeout 0|1")
axis := fs.Uint("axis", 2, "axis_sel 0=X 1=Y 2=Z")
single := fs.Bool("single", true, "enable single tap")
doubleTap := fs.Bool("double", true, "enable double tap")
triple := fs.Bool("triple", true, "enable triple tap")
if err := fs.Parse(args); err != nil {
return err
}
r, err := sp.tapConfig(&pb.TapConfigRequest{
Write: *write,
ClientId: uint32(*clientID),
AllClients: *all,
TapSensThres: uint32(*sens),
MaxGestDur: uint32(*maxGest),
TapShockDur: uint32(*shock),
QuiteTimeAfterGest: uint32(*quiet),
WaitForTimeout: uint32(*wait),
AxisSel: uint32(*axis),
EnableSingle: *single,
EnableDouble: *doubleTap,
EnableTriple: *triple,
})
if err != nil {
return err
}
fmt.Printf("client_id=%d success=%v slaves_updated=%d\n",
r.GetClientId(), r.GetSuccess(), r.GetSlavesUpdated())
fmt.Printf(" sens=%d max_gest=%d shock=%d quiet=%d wait=%d axis=%d\n",
r.GetTapSensThres(), r.GetMaxGestDur(), r.GetTapShockDur(),
r.GetQuiteTimeAfterGest(), r.GetWaitForTimeout(), r.GetAxisSel())
fmt.Printf(" enable single=%v double=%v triple=%v\n",
r.GetEnableSingle(), r.GetEnableDouble(), r.GetEnableTriple())
return nil
}