Browse Source

gw write: Emit a dummy final flux to ensure that real final flux
gets written (unless the write is aborted sooner, at INDEX).

Refs #60

Keir Fraser 4 years ago
parent
commit
5e0b9e0df8
1 changed files with 6 additions and 1 deletions
  1. 6 1
      scripts/greaseweazle/usb.py

+ 6 - 1
scripts/greaseweazle/usb.py

@@ -322,7 +322,12 @@ class Unit:
             dat.append(1 | (x>>6) & 255)
             dat.append(1 | (x>>13) & 255)
             dat.append(1 | (x>>20) & 255)
-        for val in flux:
+        # Emit a dummy final flux value. This is never written to disk because
+        # the write is aborted immediately the final flux is loaded into the
+        # WDATA timer. The dummy flux is sacrificial, ensuring that the real
+        # final flux gets written in full.
+        dummy_flux = round(100e-6 * self.sample_freq)
+        for val in it.chain(flux, [dummy_flux]):
             if val == 0:
                 pass
             elif val < 250: