feat: add per-second GCP-format trials with history, watch and HTTP access (FPGA v10)

This commit is contained in:
randogoth 2026-10-25 18:23:18 +02:00
parent d821b77d3b
commit 6bee626b7f
12 changed files with 475 additions and 29 deletions

View file

@ -1,7 +1,7 @@
#!/usr/bin/env python3
"""Checks the STRIX firmware's Bluetooth LE API (arduino/strix/API.md) from this computer:
finds the device, sends commands over the command characteristic, reads the replies from the
reply notifications, and reads and streams the entropy characteristic."""
reply notifications (including `watch gcp` output), and reads and streams the entropy characteristic."""
import argparse
import asyncio
@ -57,6 +57,15 @@ async def main() -> None:
print(f"{'stats':<12} -> trial {stats.get('trial')}, combined total z "
f"{stats['channels'][-1]['total']['z'] if 'channels' in stats else None}")
print(f"{'watch gcp':<12} -> {await command(client, replies, 'watch gcp')}")
records = [json.loads(await asyncio.wait_for(replies.lines.get(), timeout=3)) for _ in range(2)]
await client.write_gatt_char(COMMAND, b"watch off", response=True)
await asyncio.sleep(1.5)
while not replies.lines.empty():
replies.lines.get_nowait() # the watch reply and any second pushed before it
print(f"{'gcp seconds':<12} -> {[r['second'] for r in records]}, healthy {records[-1]['healthy']}, "
f"sample sums {records[-1]['sample']['sums']}")
first = await client.read_gatt_char(ENTROPY)
second = await client.read_gatt_char(ENTROPY)
print(f"entropy read -> {len(first)} bytes, then {len(second)} bytes, "