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 <noreply@anthropic.com>
This commit is contained in:
Cyd
2026-07-19 13:42:16 -05:00
co-authored by Claude Fable 5
parent 61e7d0f600
commit a0f49c8a7c
+6 -2
View File
@@ -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<string>();
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);