Age | Commit message (Collapse) | Author |
|
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.
|
|
The .wait() wrapper always receives Python lists. There is only a single
IR pin (and its value isn't even used anywhere because appropriate edge
conditions get constructed). There is a delicate ss/es detail in the
.decode() routine concerning the IR frame's annotation's start. Don't
"continue" in the loop body's last statement, just "pass" and continue.
|
|
Concentrate the magic numbers for IR pulse widths at the top of the
source file. Drop more unused variables. Rename others to shorten more
text lines.
|
|
|
|
Eliminate redundancy in time to snum conversions and vice versa. Don't
locally overload .wait() with unexpected semantics and neither change
its parameters nor return values. Give reviewers and maintainers a
chance to see what's happening when they inspect call sites. The
'signals' identifier is unusual for pin states, use the more common
'pins' instead for consistency with other decoders. Reflect when return
values are not used, so that readers need to juggle fewer details in
their head.
|
|
|
|
Wrap the .put() routine which eliminates redundancy and shortens a few
code lines. Vertically align text variants for different zoom levels.
Prefer common helpers for bit accumulation which eliminates a local copy
of that feature. Address minor whitespace nits, alpha-sort imports.
|
|
The SIRC decoder was written to an older API, and failed to load in a
recent environment (tag missing, ambiguous annotation names). Unbreak
the decoder's boilerplate, and address other nits while we are here:
There is no Python output. Use the same declaration syntax as in other
decoders for improved maintenance (greppability). Call reset() from
__init__() to avoid surprises when a future version does have vars. Do
provide a doc string in the module initialization, to keep the URL for
the protocol description at hand.
|
|
|
|
|
|
|
|
Bug #897 and my own experience caused me to improve the SPDIF decoder.
The following issues were addressed and resolved:
1. The Error: "srd: ValueError: Protocol decoder instance spdif-1:
invalid literal for int() with base 2: '121111012112021111012120'"
This error can happen if the sample rate is marginal. The correct function
of the decoder depends on the position of the data stream. The pulse width
calculation was wrong and the pulse width detection sometimes thought the
same pulse classes to be different.
The new decoder explicitly checks for short pulses and reports an error
with a corresponding message.
2. Bitrates were calculated wrong: The shown results were not usable at all.
The new decoder uses the first ten frames to calculate the bit rates and
uses the correct measurement units.
Possible issue: The bit rate calculation assumes an ongoing data stream.
It uses the time between the first and 10th frame.
They need to be sent without interruption. But this should be no problem
because SPDIF is meant to be a continuous stream.
3. A missing samplerate, e.g. when used in sigrok-cli with binary input, lead
to an error message on the original decoder.
The new decoder just skips the output of the bitrate if the samplerate is
missing. A missing samplerate no longer raises an error but only a message
in the data output.
4. The user was not informed about the integral steps of the decoder.
The new decoder shows the results of the synchronisation process at the
beginning. This can help to understand the behaviour of the decoder.
This fixes bug #897.
|
|
The idea was taken from the vector slicer as suggested in github PR 17.
The code was rewritten to avoid cluttering the decoder set with lots of
tiny implementations. Create a single decoder which does all of the bit
accumulation as well as number format interpretation and also includes
number to text formatting with user selectable presentations. Optional
clock is supported, to avoid too many annotations in glitchy setups. The
IEEE 754 format was added as another interpretation. The enum code path
accepts data files in either the Python or JSON format (the latter feels
backwards to me). Putting enums on separate rows helps visualize state
transitions. Users can disable GUI traces or select CLI rows to silence
the output if it feels noisy.
The most appropriate (useful, and usable) number of supported channels
is yet to get determined. This version accepts up to 16 inputs.
|
|
Replace non-ASCII characters in the FDC keyboard map with their
respective number values, since the character presentation is
non-portable and results in compiler warnings.
A similar change was done in IRMP version 3.2.0 (SVN r192 as of
2020-06-22) which the sigrok project has not caught up with yet.
|
|
Support of the now common RGBW type LED strips (uses 4 bytes instead of 3).
Added an option to select RGB or RGBW
|
|
Unclutter the construction of the annotation text for measurements.
Prefer one code block over multiple scatterred lines. Only do string
formatting when an annotation gets emitted. Prefer .format() for its
better control over generated text. Fixup remaining Python idioms in
the unit conversion block while we are here.
|
|
The previous implementation unconditionally waited for up to 1ms, and
optionally handled the user configured timeout period. Use common code
instead to handle the full span of the timeout period. Which somewhat
unclutters the .decode() routine's body by eliminating an unnecessary
step in the sequence. This change also reduces indentation, and prefers
Python's .format() over the old syntax.
|
|
There is only one annotation, rename ss/es for consistency with other
decoders. Move a conversion constant to the top of the source file, and
rename some identifiers to increase readability of math expressions.
There is no point in constructing numbers in MSB first order and then
reversing their bit order. Prefer Python lists for accumulated bits, and
common code for number conversion. Use one code block for the extraction
and conversion of received data instead of a set of scattered lines.
This shall increase readability of the data extraction, and eliminates
redundancy in the implementation.
|
|
Move math expressions with always identical values out of the loop, and
improve readability of the packet timeout condition in the process.
|
|
Merge .reset_data() into .reset() since no other location called it.
Move self.options[] lookup out of the loop, drop state from self when
it's strictly local to .decode(). Use a common annotation emission
routine, and vertically align text variants for zoom levels. This
further reduces the lengths of a few text lines.
|
|
The caliper decoder was written against an older version of the library
and failed to load in recent environments. Fixup the decoder boilerplate
(eliminate ambiguous annotation class/row names, drop the IC tag) and
address other style nits while we are here (rephrase user visible text,
break a few long lines, adjust some of the indentation and whitespace
issues, drop dead code). Remaining issues get addressed later.
|
|
|
|
The IRMP core library is not prepared for threading or interleaved use
by multiple call sites for different data streams, internal state is
kept in global vars (MCU project heritage). Adjust the Python wrapper,
create one usable instance, and several more which fail to execute.
Fail late such that users see error messages.
The approach isn't pretty, but avoids segfaults when re-loaded sessions
assign multiple decoder instances, and raises user's awareness of the
"one instance" limitation by established means: "decoder error" bar, and
log messages, with a description to point out the cause.
This commit implements a dirty modification of a singleton. It's a pity
that Python appears to lack reliable destruction, hence the whole class
remains blocked even if the instance is released. Move all library use
into pd.py:decode() in the hope that Python's 'with' could help in a
future implementation. Prepare to either present a generic message that
is generated by pd.py, or pass on a text that originates in the Python
wrapper for the C library.
|
|
Recent upstream IRMP core versions introduced a "release" flag in
addition to the "repeat" flag. Prepare the decoder to present these
flags when libraries should pass them in results.
The flags' being orthogonal slightly complicates the logic which
constructs annotation texts. Do provide text variants for all previously
supported zoom levels, yet try to keep the implementation as simple as
possible: Match list lengths for simplified folding. Always print the
flags field even if none of the flags is active (kind of was done before
this change as well, just not visible). This approach easily accepts
more flags as needed in future versions.
|
|
Address Python and sigrok project coding style nits in the IRMP based
decoder for infrared signals. Re-add the attribution which was lost in a
previous copy and forgotten in the recent submission. Eliminate camel
case identifiers and adjust to the simplified Python binding API. Drop
remaining diagnostics from development and dead code (unused carrier
detection). Reword the boilerplate text to match other decoders. Avoid
Python f-strings since they are not portable. Prefer slightly less
cryptic variable names in the construction of annotation texts. Defer
the creation of the library instance until actual decoder use. Start
inspecting the input data at the very first samples in the input stream.
|
|
Commit the decoder as it was provided by Rene Staffen. Which appears to
be a slightly modified version of one of the other IR decoders, though
the boilerplate doesn't say so.
|
|
Detect the MacOS platform by checking for 'Darwin' with the Python
platform(3) module, and use the 'lib<stem>.dylib' filename scheme.
|
|
Rename the Python language binding's source file and identifiers to
eliminate camel case (most of it, stick with camel case in Python class
names as is the convention). Adjust whitespace and arrange tables such
that their indentation will last during maintenance.
Re-add the license text which was missing in the original submission's
copy of another decoder. Add copyright information for this submission.
Don't "import *" from ctypes(3), use explicit references instead. Avoid
double underscores as single leading underscore is already bad enough.
Adjust the Python side to the C library's renamed API routines.
Create a result data structure layout that only has a single level of
nesting, which better represents the C library's interface. Only flags
"get unfolded" in the Python binding, to eliminate magic numbers.
Prepare to support more platforms than Linux (detected) and Windows (the
default when nothing else got detected).
|
|
Commit the IrmpPythonWrap.py file as it was provided by Rene Staffen.
|
|
Add the irmp/ subdirectory to the automake build instructions. Make the
feature optional, provide an enable/disable switch (on by default).
It's an essential implementation detail that the irmp.c file is required
to build, but is not a compile unit of its own. It's yet to be seen how
to most appropriately declare the dependencies of libirmp_la (can get
refined in future commits).
Create a separate shared object from the IRMP source, which shall result
in a stable filename for the DLL/.so lookup. Decoder library code would
not know the application's executable name, neither is anonymous symbol
lookup "in the current process" portable across supported platforms.
The configure.ac macros were modelled after the autobook DLL section.
https://www.sourceware.org/autobook/autobook/autobook_137.html
Symbol export is simple because the library gets implemented and built
here, but is not used from C language code in this project. That's why
we don't do the full dance of symbol import which would be needed on
Windows.
|
|
The upstream IRMP project builds fine with direct gcc(1) invocation.
While the same imported source fails detection and then defaults to AVR
when built under libtool in the libsigrokdecode setup.
Provide the symbols which IRMP logic expects, to reduce changes against
upstream sources. Derive these symbols from conditions that are checked
in the sigrok project in other locations, too.
|
|
Workaround the default verbosity level of the IRMP core logic for
PC library build configurations. Silence the ANALYZE related output.
|
|
Address several style nits in the previous implementation of the PC
library, but keep the core as is to simplify future upstream tracking.
Eliminate camel case identifiers, and in(?)/out prefixes for variables,
only keep s_ for global(?) variables. Fixup whitespace, reduce a little
indentation where appropriate. Separate variable declaration from later
assignments and updates to improve readability. Use C style comments.
Drop initializer values for .bss variables. Decorate the declaration as
well as implementation of routines for symbol export. Improve robustness
of name lookups in the list of known protocols.
Prefer native C language data types in the public API. Normalize data in
the wrapper so that application code need not care. Make the byte buffer
API for IR frame detection optional. The API is limited and overloaded
at the same time, and may need more consideration.
Extend comments in spots which are essential for proper operation, or
which encode non-obvious details of the build system. Control visibility
of public API identifiers on non-Windows platforms, too. Rephrase the
doxygen comments for more formal API documentation. Discuss limitations
in the current implementation. Keep a TODO list in the source code.
|
|
Introduce sources which implement a shared object (DLL) which embeds the
IRMP core logic, receives pin values from an application, and makes IR
detection from previously captured data available in PC environments as
a library, in contrast to the text oriented desktop applications and the
MCU firmware which existed before in the upstream project.
Provided by: Rene Staffen
|
|
Introduce variables in the IRMP core logic which track the current
sample number, and the position where the start of an IR frame got
detected. The variables are conditional (ANALYZE builds only).
Provided by: Rene Staffen
Local modification: Drop the initializer for the static variables.
They reside in .bss and need not occupy .data space.
|
|
This change enables most IR protocol variants (35 of them), as well as
32bit wide counters, and uses the highest supported samplerate of 20kHz
by default. Which shall result in most reliable detection of protocols
and an appropriate feature set for PC library use.
Provided by: Rene Staffen
|
|
The sigrok project enforces warnings when public routines of compile
units lack prototypes. Add a prototype for the irmp.c:print_spectrum()
routine to silence a compiler warning. An alternative would have been to
mark the routine as static (it's exclusively used within the same file).
|
|
The #else inside a multi line comment in combination with the excess yet
commented #endif threw off my editor's syntax highlighting and parentheses
matching. Use "#if 0" instead to disable the empty side of ANALYZE macros
which some PIC compilers are said to not support. No change in behaviour.
|
|
Assume that IR command codes can get represented by a C language 'int'
data type. The other value in the comparison is another 'int' anyway.
|
|
Pick low hanging fruit. Stick with the previous implementation's format
specifiers, assume that they work on all platforms which IRMP supports.
Cast arguments to mere integers where necessary instead, again assume
that their range fits as they did in the previous implementation. This
silences several of these compiler warnings:
irmp.c:3332:25: warning: format ‘%d’ expects argument of type ‘int’, but argument 4 has type ‘long unsigned int’ [-Wformat=]
ANALYZE_PRINTF ("protocol = NIKON, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
^
|
|
Introduce a separate README-sigrok.txt file, to leave the upstream
project's README.txt file as is. Mention that libsigrokdecode only
contains a subset of the full IRMP project source code.
|
|
Introduce source files and documentation from the GPL'ed IRMP project.
Commit those files which represent the IRMP core logic (detection of
IR frames), and reference the project's homepage for the remainder.
These files correspond to
svn://mikrocontroller.net/irmp r191
|
|
This is inspired by the autobook sections on Windows DLL builds.
https://www.sourceware.org/autobook/autobook/autobook_137.html
The AC_C_CONST macro improves support for the C language 'const'
decoration in case the compiler does not understand it.
|
|
|
|
The PJDL decoder's previous implementation was incomplete. It assumed
that PAD bits always start with a rising edge. Which made the decoder
miss the next byte when a previous byte's MSB is set, and the last DATA
bit and the next PAD bit kept the signal HIGH between them (no LOW phase
was seen between these symbols).
Keep the check for the LOW level after the byte's last DATA bit within
the bit times' tolerance. But accept when the level remains HIGH, and
check for the HIGH bit's width starting from the end of the last DATA
bit. Also start the PAD bit's annotation from that "virtual" edge.
This patch is based on a fix that was
Submitted-By: Julio Aguirre <jcallano@gmail.com>
|
|
The previous implementation unconditionally assumed a CRC width of
one byte when it calculated the checksum for received frame data.
Do reflect on the CRC8/CRC32 choice instead.
This patch is based on a fix that was
Submitted-By: Julio Aguirre <jcallano@gmail.com>
|
|
|
|
|
|
|