From 5f6d99f138254f54356cbf682c8db22be9c96b66 Mon Sep 17 00:00:00 2001 From: David Given Date: Sat, 9 Jan 2021 00:37:37 +0100 Subject: [PATCH] Attempt that fix again. --- lib/usb/fluxengineusb.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/usb/fluxengineusb.cc b/lib/usb/fluxengineusb.cc index 91672fb8..02b9a5d2 100644 --- a/lib/usb/fluxengineusb.cc +++ b/lib/usb/fluxengineusb.cc @@ -233,12 +233,12 @@ public: Bytes read(int side, bool synced, nanoseconds_t readTime, nanoseconds_t hardSectorThreshold) { - hardSectorThreshold += 5e5; /* Round to nearest ms. */ + uint8_t threshold_ms = (hardSectorThreshold + 5e5) / 1e6; /* round to nearest ms */ struct read_frame f = { .f = { .type = F_FRAME_READ_CMD, .size = sizeof(f) }, .side = (uint8_t) side, .synced = (uint8_t) synced, - .hardsec_threshold_ms = (uint8_t) (hardSectorThreshold / 1e6), + .hardsec_threshold_ms = threshold_ms, }; uint16_t milliseconds = readTime / 1e6; ((uint8_t*)&f.milliseconds)[0] = milliseconds;