Files
powerpods/goTool/cmd_ble_rtt.go
skrueckenandCursor af20635047 Harden BLE host link and expose latency tools in the dashboard.
Add BLE RTT/stream tests and live tick median in the UI, fix concurrent WebSocket writes and late BATTERY replies, and skip 2M PHY updates that assert under ESP-NOW coexistence.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-10-23 23:27:39 +02:00

27 lines
828 B
Go

package main
import (
"flag"
"fmt"
"time"
)
func runBleRtt(h hostConn, args []string) error {
fs := flag.NewFlagSet("ble-rtt", flag.ExitOnError)
count := fs.Int("count", 50, "number of measured VERSION round-trips")
settle := fs.Float64("settle", 0, "extra settle seconds before measurement (0 = already settled on connect)")
warmup := fs.Int("warmup", 5, "discarded warm-up round-trips")
if err := fs.Parse(args); err != nil {
return err
}
out := measureBleRtt(h, *count, *warmup, time.Duration(*settle*float64(time.Second)))
if !out.Success {
return fmt.Errorf("%s", out.Error)
}
fmt.Printf("ble-rtt (VERSION): n=%d warmup=%d\n", out.Stats.N, out.Warmup)
fmt.Printf(" min=%.3f median=%.3f mean=%.3f max=%.3f ms\n",
out.Stats.MinMs, out.Stats.MedMs, out.Stats.MeanMs, out.Stats.MaxMs)
return nil
}