Bug 1231 - Counter PD operation is non-intuitive
Summary: Counter PD operation is non-intuitive
Status: CONFIRMED
Alias: None
Product: libsigrokdecode
Classification: Unclassified
Component: PD: counter (show other bugs)
Version: unreleased development snapshot
Hardware: All All
: Normal normal
Target Milestone: ---
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-06-12 11:34 CEST by Soeren Apel
Modified: 2018-06-12 18:46 CEST (History)
1 user (show)



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Soeren Apel 2018-06-12 11:34:21 CEST
When using the Counter PD, the first annotation has value "1" and spans from the beginning of the data to the first relevant signal change.

My expectation would be that the first annotation (with value "1") begins at the first relevant signal change and ends at the second relevant signal change, where the annotation with value "2" begins.
Comment 1 Gerhard Sittig 2018-06-12 18:34:46 CEST
The recent change was motivated by bug 1210.  Also see the source code comment 
on _any_ choice of where to start the annotation being as arbitrary or valid 
as any other choice would be. 
https://sigrok.org/gitweb/?p=libsigrokdecode.git;a=blob;f=decoders/counter/pd.py;h=798fb3a7fc8aa2b4cbc15cc1bed26949ac37c975;hb=HEAD#l105

Whoever comes up with a semantics that matches more users' expectations is free 
to change the implementation.  The spot which needs adjustment is identified 
above, the change might be obvious or straight forward.  I don't mind.  Go ahead.

Note that the behaviour is more intuitive in the absence of RESET before the 
first edge of interest.
Comment 2 Gerhard Sittig 2018-06-12 18:46:53 CEST
Of course the _presence_ of RESET avoids the observed unexpected behaviour 
in that specific exceptional situation.  Just for the record.