From 81eba8bc5c523d4d7aec47ac04531e5642d622ec Mon Sep 17 00:00:00 2001 From: Jonathan Hogg Date: Wed, 29 Jul 2020 18:39:46 +0100 Subject: [PATCH] Fixes to clock scale selection for slow capture. --- scope.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/scope.py b/scope.py index c1e5ed1..a5fa7fc 100755 --- a/scope.py +++ b/scope.py @@ -174,9 +174,11 @@ class Scope(vm.VirtualMachine): if capture_mode.analog_channels == len(analog_channels) and capture_mode.logic_channels == bool(logic_channels): Log.debug(f"Considering trace mode {capture_mode.trace_mode.name}...") if ticks > capture_mode.clock_high and capture_mode.clock_divide > 1: - clock_scale = int(math.ceil(period / self.primary_clock_period / nsamples / capture_mode.clock_high)) + clock_scale = min(capture_mode.clock_divide, int(math.ceil(period / self.primary_clock_period / nsamples / capture_mode.clock_high))) ticks = int(round(period / self.primary_clock_period / nsamples / clock_scale)) - if ticks in range(capture_mode.clock_low, capture_mode.clock_high+1): + if ticks > capture_mode.clock_low: + if ticks > capture_mode.clock_high: + ticks = capture_mode.clock_high Log.debug(f"- try with tick count {ticks} x {clock_scale}") else: continue