Age | Commit message (Collapse) | Author |
|
The 0.652ms STOP bit width must have been a typo (though consistent in
the previous implementation), it's not half of the 1.125ms ZERO symbol.
Notice that this is an incompatible change to the decoder implementation.
It affects the annotations for STOP bits and overall REMOTE button codes.
|
|
Extend comments on the IR NEC timing details. Sort the symbols by their
width to reflect their relation (ONE to ZERO to STOP is each half of
their predecessor's width).
Increase the open coded tolerance percentage, and remove the option for
the value. Make sure leader and repeat codes still can be told from each
other.
|
|
Move IR NEC protocol timing details to the top of the source file, for
raised awareness and easier adjustment. Specs are "unit-less" (only have
comments), but are scaled for improved readability. Values are copies of
the previous implementation.
|
|
Provide an option to have the decoder automatically detect the IR signal's
polarity. Stick with active-low by default for backwards compatibility,
because this auto-detect implementation assumes that the capture starts
with an idle phase.
[ gsi: rephrased message and implementation, auto-detect off by default ]
|
|
Provide an option to adjust the IR NEC decoder's tolerance. Which makes
signals accessible that are generated by cheap remotes which would not
decode at all with the previous implementation and its fixed limit.
[ gsi: rephrased commit message and implementation ]
|
|
Emit annotations for the current IR frame as soon as possible, at the
very end of the STOP bit. Don't defer annotation emission until the
start of the next frame is seen. This unbreaks captures where the last
IR frame would not decode before.
[ gsi: rephrased commit message, updated comment in the implementation ]
|
|
Don't terminate IR frame inspection when successfully decoded fields
fail the validity check. Reset internal state on long periods of idle
level instead (beware of the late detection of the STOP condition).
Unconditionally annotate received fields, and optionally amend them with
a warning annotation. It's unexpected to not see the address field value
at all just because the number was not acceptable for the potentially
incorrect protocol selection.
Rename a variable in the decode() routine. The 'b' identifier suggested
a bit value, but it was used for the pulse width.
|
|
Add support for the extended NEC protocol, where the address field spans
16 bits and the complement is not sent. Commands still span 8 bits and
are sent in normal and in inverted form. The user needs to select the
extended protocol (off by default for compatibility), the input data
does not allow automatic detection of the protocol variant. It's also
not appropriate to assume the extended format when the address field
happens to fail the validity check.
The unfortunate mix of data value checks and annotation emission in
combination with "global" state makes this implementation more redundant
than I would like. A later cleanup is desirable.
This resolves bug #1583.
|
|
The input signal's polarity ('active' variable) is strictly local to the
decode() method. The 'count' becomes obsolete when 'data' is kept in a
Python list. Conversion of bit patterns to numbers is provided by common
helpers. Alpha-sort Python imports while we are here.
This commit also renames a few variables in the normal/inverted check
for valid input data. Which can help the introduction of support for the
extended protocol, by decoupling what gets checked and what gets shown.
|
|
Eliminate redundancy in the check for database entries of button events.
Tighten the check for valid address and command bit patterns. The former
implementation did something unexpected, wanted the AND of the first and
second 8bit patterns to become zero. But the second 8bit item has not yet
become available when the test runs after the reception of the first 8bit
item. So the test happened to "pass" unexpectedly in intermediate steps,
and failed to catch invalid input data when all fields became available.
Unfortunately the check for valid data and the emission of annotations
was combined in the implementation. So it's essential to keep running
the "check" routine to get the annotations, and update internal ss/es
state. But only emit warnings when the check fails after all involved
data became available. Check for strict XOR as per the protocol spec.
|
|
The metadata() method unconditionally referenced the samplerate even
though the value is only available conditionally. Move the references to
a location after the samplerate presence check.
|
|
Eliminate magic numbers, use symbolic names for annotation classes and
pin numbers. Also vertically align text variants for zoom levels in the
more complex cases, to simplify maintenance. Prefer .format() calls to
improve readability in the more complex invocations.
|
|
|
|
|
|
Only add items to 'outputs' if the respective PD actually has
OUTPUT_PYTHON support implemented as of right now.
Various decoders might get OUTPUT_PYTHON support later, but the
'outputs' field should reflect the current status.
|
|
|
|
Introduce optional detection of a carrier signal. Immediately "go active"
when edges are seen. "Go inactive" again in the absence of edges in a
specified period of time. Cope with input signals that already had the
carrier removed.
By default carrier detection is disabled, to remain pixel compatible to
the previous implementation. When a carrier frequency is specified and
thus detection is enabled, edges of already filtered input are shifted
by one carrier period, and thus changes the output of the decoder. For
unfiltered inputs that still contain the carrier, detection of activity
is reliable and immediate, but the active phase is extended by one
period of the carrier frequency (which is considered acceptable).
|
|
Move initialization code of protocol decoders from the constructor to a
new reset() helper method. The libsigrokdecode backend could run this
method several times to clear the decoder's internal state, before new
data from another acquisition gets fed to decode() calls.
|
|
This replaces the fixed timing margin with a percentage based tolerance
to better allow for timing inaccuracies, especially for longer timings
like the Leader and Repeat codes.
|
|
This allows frontends to set the assumed initial pins (i.e., the assumed
state of the pins before the first sample of a capture) to user-specified
values.
The assumed initial pins can be either low, or high, or "use same value
as the first sample of the capture".
The special self.initial_pins decoder attribute is now removed.
|
|
Remove the FSF postal address as it might change (it did in the past).
Reference the gnu.org website instead which is more stable.
|
|
|
|
The previous **kwargs some PDs had is not actually ever used, so drop it.
|
|
- No newlines at the end of files.
- No trailing ';' characters.
- Comparison with None: Use 'is None' or 'is not None'.
- Comparison with True/False: Use 'if cond:' or 'if not cond:'.
- Various minor whitespace fixes.
|
|
Also, use the "if not self.samplerate" form, which catches both the case
where self.samplerate is None, as well as the case where it is 0.
|
|
In all current PDs it is not necessary to raise an exception upon
invalid states (of the PD's state machine), since we can guarantee that
no such invalid state can ever be reached in these PDs.
|
|
Older libsigrokdecode versions are no longer able to use the current
versions of the PDs (various changes in syntax etc).
|
|
|
|
Variables of type 'struct srd_channel *' are consistently named 'pdch' to
make them easily distinguishable from libsigrok's 'struct sr_channel *'
variables that are consistently named 'ch'.
|
|
|
|
|
|
|
|
Also show the AGC field(s) and pauses, the stop bit, and the individual
address / address# and command / command# fields.
|
|
The timing of the protocol is not really configurable, valid data in
this protocol must always adhere to the same timing parameters, making them
configurable should not be needed.
Also: Only check for the "interesting" edges and simplify the code a bit.
|
|
This IR protocol is commonly referred to as "the NEC protocol", and can be
generated by various means (not only via the NEC µPD6121/µPD6122 ICs).
Drop some unneeded variables and fix/simplify the code a bit.
|