Stopping a slow scan freezes the trace until the scan is finished
Ho-Ro opened this issue · comments
The event processing is blocked during this while loop
while tinySA.threadrunning:
time.sleep(0.1) # wait until the measurement thread stops using the serial comms
The solution is to continue processing the events while waiting for the thread to finish, this gives visual feedback of the pending time:
diff --git a/QtTinySA.py b/QtTinySA.py
index 033900c..c5342e4 100644
--- a/QtTinySA.py
+++ b/QtTinySA.py
@@ -360,6 +360,7 @@ def scan():
tinySA.sweeping = False # tells the measurement thread to stop once current scan complete
ui.scan_button.setEnabled(False) # prevent repeat presses of 'stop'
while tinySA.threadrunning:
+ app.processEvents()
time.sleep(0.1) # wait until the measurement thread stops using the serial comms
ui.scan_button.setEnabled(True)
activeButtons(True)
I had noticed this behaviour but hadn't realised why. Your solution included in code.