From a0f49c8a7c4424152ce90eef7a617fee63dd0320 Mon Sep 17 00:00:00 2001 From: Cyd Date: Sun, 19 Jul 2026 13:42:16 -0500 Subject: [PATCH] Mash tool: --poll flag for FastRIO bandwidth harvesting Overrides the legacy 55ms analog poll interval (e.g. --poll 20 at 31250 -> ~50Hz analog). Summary's expected-poll-slots math follows. Co-Authored-By: Claude Fable 5 --- tools/RioSerialMonitor/MashTest.cs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/tools/RioSerialMonitor/MashTest.cs b/tools/RioSerialMonitor/MashTest.cs index 5480bc9..731286b 100644 --- a/tools/RioSerialMonitor/MashTest.cs +++ b/tools/RioSerialMonitor/MashTest.cs @@ -52,6 +52,7 @@ internal static class MashTest double wedgeSec = 2.0; bool selftest = false; int baud = 9600; + int pollMs = 55; // legacy cadence; FastRIO can sustain much faster var positional = new List(); for (int i = 0; i < args.Length; i++) @@ -66,6 +67,8 @@ internal static class MashTest wedgeSec = w; i++; break; case "--baud" when i + 1 < args.Length && int.TryParse(args[i + 1], out int b): baud = b; i++; break; + case "--poll" when i + 1 < args.Length && int.TryParse(args[i + 1], out int p) && p > 0: + pollMs = p; i++; break; default: positional.Add(args[i]); break; } } @@ -101,7 +104,7 @@ internal static class MashTest Raw($"== RIO mash test :: {port} @ {baud} 8N1, {seconds}s, chip label '{label}' =="); Raw($" lamp echo {(lampEcho ? "ON (drives reply/lamp collisions)" : "OFF")}, " + - $"wedge threshold {wedgeSec:F1}s, app auto-recovery DISABLED"); + $"wedge threshold {wedgeSec:F1}s, poll {pollMs}ms, app auto-recovery DISABLED"); Raw($" log: {Path.GetFullPath(logPath)}"); IRioTransport transport; @@ -120,6 +123,7 @@ internal static class MashTest var link = new RioSerialLink(transport, new RioSerialLinkOptions { AnalogRecoveryTimeout = TimeSpan.FromDays(365), + AnalogPollInterval = TimeSpan.FromMilliseconds(pollMs), }); // --- shared state (guarded by 'gate') --------------------------------- @@ -308,7 +312,7 @@ internal static class MashTest // --- summary (fixed layout for diffing runs) ------------------------------ double mins = Math.Max(sw.Elapsed.TotalMinutes, 0.001); - long expectedPolls = (long)(seconds * 1000.0 / 55.0); + long expectedPolls = (long)(seconds * 1000.0 / pollMs); bool anyWedge = wedges.Count > 0; bool endedWedged = wedges.Any(w => w.Unresolved); bool anyButtonRevival = wedges.Any(w => w.RevivedByButton);