Move the helper routines which arrange for the data feed to an earlier
spot, so that references resolve without forward declarations. Rename
routines to reflect that they deal with logic data.
Slightly unobfuscate column text to logic data conversion, and reduce
redundancy. Move sample data preset to a central location.
Rephrase error messages, provide stronger hints as to why the input text
for a conversion was considered invalid.
The previous implementation assumed that in multi-column mode each cell
communicates exactly one bit of input (a logic channel). But only the
first character got tested. Tighten the check, to cover the whole input
text. This rejects fully invalid input, as well as increases robustness
since multi-bit input like "100" was mistaken as a value of 1 before.
Add documentation to the bin/hex/oct text parse routines, and move the
bin/hex/oct dispatcher to the location where its invoked routines are.
Stick with a TODO comment for parse_line() to reduce the diff size.
The parse_line() routine is rather complex, optionally accepts an upper
limit for the number of columns, but unconditionally assumes a first one
and drops preceeding fields. The rather generic n and k identifiers are
not helpful.
Use the 'seen' and 'taken' names instead which better reflect what's
actually happening. Remove empty lines which used to tear apart groups
of instructions which are strictly related. This organization neither
was helpful during maintenance.
Accept when comments are indented, trim the whitespace from text lines
after stripping off the comment. This avoids the processing of lines
which actually are empty, and improves robustness (avoids errors for a
non-fatal situation). Also results in more appropriate diagnostics at
higher log levels.
The CSV input module has grown so many options, that counting them by
hand became tedious and error prone. Eliminate the magic numbers in the
associated code paths.
This also has the side effect that the set is easy to re-order just by
adjusting the enum, no other code is affected. Help text and default
values is much easier to verify and adjust with the symbolic references.
[ see 'git diff --word-diff' for the essence of the change ]
Use size_t for things that get counted: column indices, channel numbers
(line numbers already used size_t). De-anonymize an enum to avoid 'int'
where it gets referenced. Adjust printf(3) format strings. Get unsigned
values from option lookups (stick with 32bits, should be acceptable for
spreadsheet columns and channel counts).
Address other minor nits while we are here: Also terminate the last item
in an enum declaration. Add a doxygen comment for parse_line(). Rename a
parameter to achieve tabular doc text layout.
Rephrase the #include statements in the CSV input module. "config" is
not a system header but is provided by the application source code.
Separate the config and system and application groups (their order is
essential). Alpha-sort the files within their group for simplified
maintenance.
Do for the CSV input module what commit 08f8421a9e did for VCD. Check
the channel list for consistency across re-imports of the same file.
This addresses the CSV part of bug #1241.
The cleanup() routine gets invoked upon shutdown, as well as before
re-importing another file. The cleanup() routine must not release
resources which get allocated in the init() routine, as the init()
routine won't run again in the module's lifetime. The cleanup() routine
must void those context fields which get evaluated in the next receive()
calls.
The previous implementation inspected the input stream's samplerate, and
simply used the next 1kHz/1MHz/1GHz timescale for VCD export. Re-import
of the exported file might suffer from rather high an overhead, where
users might have to downsample the input stream. Also exported data
might use an "odd" timescale which doesn't represent the input stream's
timing well.
Rephrase the samplerate to VCD timescale conversion such that the lowest
frequency is used which satisfies the file format's constraints as well
as provides high enough a resolution to communicate the input stream's
timing with minimal loss. Do limit this scaling support to at most three
orders above the input samplerate, to most appropriately cope with odd
rates.
As a byproduct the rephrased implementation transparently supports rates
above 1GHz. Input streams with no samplerate now result in 1s timescale
instead of the 1ms timescale of the previous implementation.
The 'period' member of the VCD output module's context is supposed to
hold frequencies that correspond to the timescale used during export.
An 'int' (in combination with VCD's 1/10/100 constraint) thus would
result in a 1GHz limit, use uint64_t instead to support higher rates.
Iterate over the received sample set first, before iterating over the
respective sample's number of channels. This avoids redundant extraction
of sampled bits (which saves only little), but also increases locality
of processed data (though string accumulation still may be expensive).
It also adds the future option of RLE compression during accumulation of
output data, which perfectly matches the WaveDrom syntax for repeated
bit patterns.
Rearrange the order of routines in the wavedrom output module. Keep the
flow of .receive() -> .process_logic() -> .wavedrom_render() in one common
group of routines, which is not disrupted by the .init() and .cleanup()
routines which are kind of boilerplate in the source file. This increases
readability and maintainability.
Adjust brace style, use C language comments, drop camel case. Use size_t
for indices and offsets. Unobfuscate the open/close logic of rendered
output. Allocate zero-filled memory, reduce sizeof() redundancy. Don't
SHOUT in the module's .name property.
[ Changes indentation, see 'git diff -w -b' for review. ]
Add a comment on the logic which skips the upper 64 bytes of a 512 bytes
chunk in the Asix Sigma's sample memory. Move the initial assignment and
the subsequent update from a value which was retrieved from a hardware
register closer together for awareness during maintenance. Pre-setting a
high position value that will never match when the feature is not in use
is very appropriate.
Adjust the sigma_read_pos() routine to handle triggerpos identically to
stoppos. The test condition's intention is to check whether a decrement
of the position ends up in the meta data section of a chunk. The previous
implementation tested whether a pointer to the position variable ended in
0x1ff when decremented -- which is unrelated to the driver's operation.
It's assumed that no harm was done because the trigger feature is
unsupported (see bug #359).
This silences the compiler warning reported in bug #1411.
The handler for fluke 18x and 28x DMMs allocates several data
structures on the stack that are used after they have been freed when
creating a data feed packet.
Restructure the code so that all handlers send their own packets. As a
bonus, this avoid a couple of small heap allocations.
By separating the variables that holds the get and set values, the output
state, OVP and OCP can now be set while the acquisition is running.
Also some variables are named more clearly.
The communication with the rdtech power supplies is not very reliable,
especially during the start. Because of that, the driver tries to read the
modbus registers up to three times.
Nevertheless there is the chance, that the communication fails.
Introduce quirks support for devices which provide incomplete metadata.
Add conservative logic to unbreak the Logic Shrimp. Amend previously
received information when it was incomplete, but don't interfere if a
future firmware version fixes the issue.
Without this change, the device gets detected but "has zero channels"
and would be unusable. Because when a device provides metadata, these
details are used exclusively, no fallbacks apply.
There is no reason to close the entire device in acquisition_stop and
this actually breaks pulseview on serial devices using this callback
when running multiple acquisition cycles
This fixes bug #1271.
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
The Mooshimeter driver uses mem*() and str*() library calls. Include the
<string.h> header file to silence compiler warnings.
...
./src/hardware/mooshimeter-dmm/protocol.c: In function 'lookup_tree_path':
./src/hardware/mooshimeter-dmm/protocol.c:275:3: warning: implicit declaration of function 'strchr' [-Wimplicit-function-declaration]
end = strchr(path, ':');
^
./src/hardware/mooshimeter-dmm/protocol.c:275:9: warning: incompatible implicit declaration of built-in function 'strchr' [enabled by default]
end = strchr(path, ':');
^
...
Even working BLE devices won't immediately succeed in the first call to
connect(2), which is why the "in progress" phase was added. But absent
peers made the previous implementation try forever, getting stuck in the
sr_bt_connect_ble() call.
Try to balance these two constraints. Do terminate BLE connect attempts
after a generous timeout. When this 20s period passed, there probably is
a configuration error or unresponsive peer. Yet the timeout needs to be
in this ballpark to not erroneously fail for working setups.
This adds support for the Mooshim Engineering BLE based Mooshimeter.
Because the meter requires raw BLE packets, the driver uses the BLE
layer directly. Since the meter has no physical way of configuring it,
the actual configuration is set entirely with sigrok device options.
When libsigrok is compiled with link-time-optimization, the linker
stumbles over the section named the same as the function. Whether this
is a compiler/linker bug or a coding error is unknown.
Renaming the special section (to the same as already used on OS X) avoids
the problem.
This fixes bug #1416.
Doxygen version 1.8.16 introduced an issue which breaks the compilation
of sigrok's C++ binding (https://github.com/doxygen/doxygen/issues/7190).
Don't set the FILE_PATTERNS variable at all, instead of assigning an
empty value. This resolves bug #1422.