mirror of
https://github.com/DreamSourceLab/DSView.git
synced 2025-01-13 13:32:53 +08:00
Merge pull request #18 from flattermann/dsserial
Serial Decoder: Improved start/stop signal detection
This commit is contained in:
commit
5d7e3237b7
@ -148,11 +148,9 @@ void dsSerial::decode()
|
|||||||
stop_index = flag_index + ceil((_bits + (_parity != -1) + 1) * samplesPerBit);
|
stop_index = flag_index + ceil((_bits + (_parity != -1) + 1) * samplesPerBit);
|
||||||
|
|
||||||
if (left < right) {
|
if (left < right) {
|
||||||
for (i = 0; i < _stopbits * samplesPerBit; i++) {
|
left -= 0.5*samplesPerBit;
|
||||||
if (_idle_level != ((snapshot->get_sample(stop_index + i) & 1ULL << _serial_index) != 0)) {
|
if (_idle_level != ((snapshot->get_sample(stop_index + 0.5*samplesPerBit) & 1ULL << _serial_index) != 0)) {
|
||||||
stop_err = true;
|
stop_err = true;
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (stop_err) {
|
if (stop_err) {
|
||||||
cur_state = StopErr;
|
cur_state = StopErr;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user