util/bridge: drain leftover samples
This prevents sending leftover samples to the client instead of the RTL0 header required for it to properly control gain.
This commit is contained in:
parent
8aff0a31b3
commit
9648c344bf
|
@ -50,7 +50,13 @@ def bridge(frequency):
|
|||
|
||||
with serial.Serial("/dev/ttyACM0", baudrate=10_000_000, timeout=0.1) as fp:
|
||||
print(f"Starting RX @ {frequency}")
|
||||
fp.write(struct.pack(">BBL", 0, 1, int(frequency)))
|
||||
|
||||
# Remove any leftovers.
|
||||
while fp.read(64):
|
||||
fp.write(b"\x00")
|
||||
fp.flush()
|
||||
|
||||
fp.write(struct.pack(">BL", 1, int(frequency)))
|
||||
fp.flush()
|
||||
|
||||
print("Begin")
|
||||
|
@ -82,6 +88,7 @@ def bridge(frequency):
|
|||
|
||||
finally:
|
||||
fp.write(b"\x00")
|
||||
fp.flush()
|
||||
print("Bye.")
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue