From cbeadbd4e69c8272701f258a3c21bde7265f91f9 Mon Sep 17 00:00:00 2001 From: nobody Date: Mon, 12 May 2014 13:43:47 +0200 Subject: [PATCH] Serial Decoder: Improved start/stop signal detection --- DSLogic-gui/pv/decoder/dsserial.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/DSLogic-gui/pv/decoder/dsserial.cpp b/DSLogic-gui/pv/decoder/dsserial.cpp index aee9a4ca..1039b578 100644 --- a/DSLogic-gui/pv/decoder/dsserial.cpp +++ b/DSLogic-gui/pv/decoder/dsserial.cpp @@ -148,11 +148,9 @@ void dsSerial::decode() stop_index = flag_index + ceil((_bits + (_parity != -1) + 1) * samplesPerBit); if (left < right) { - for (i = 0; i < _stopbits * samplesPerBit; i++) { - if (_idle_level != ((snapshot->get_sample(stop_index + i) & 1ULL << _serial_index) != 0)) { - stop_err = true; - break; - } + left -= 0.5*samplesPerBit; + if (_idle_level != ((snapshot->get_sample(stop_index + 0.5*samplesPerBit) & 1ULL << _serial_index) != 0)) { + stop_err = true; } if (stop_err) { cur_state = StopErr;