Soeren Apel [Tue, 2 Jan 2018 10:07:36 +0000 (11:07 +0100)]
SignalBase: Don't terminate conversion when there's no data
Instead of terminating, we wait instead.
We do this because SignalBase::on_samples_added() somehow doesn't
reliably see that there's no conversion thread active anymore.
conversion_thread_.joinable() returns true when the thread was
already terminated for whatever reason, resulting in on_samples_added()
trying to notify a non-existant thread.
Soeren Apel [Wed, 27 Dec 2017 09:31:30 +0000 (10:31 +0100)]
DecodeSignal: Restructure metadata handling
Instead of handling the metadata separately from the mux/decode segments,
it's much neater to handle both together. Doing this also allows us to
remove the need for query_input_metadata() since we're taking the metadata
from the muxed logic segments.
Adjust trace view header width when signal names change
This change is primarily needed because before, newly
created decode signals had a name assigned to them at time
of the constructor call. This changed, and now the name
is empty upon creation, breaking the previously working
header size adjustment.
Fix #1024 by changing decode channel assigment to PDs
When assigning the decoder stack channels to the libsrd
instance's channels, channels that had no signal assigned
to them were still assigned anyway. This patch fixes this bug.
After doing this, another subtle bug became apparent:
The mapping between channels and bits in the data stream sent
to the PD was done via DecodeChannel->id. This is however
insufficient as the channels of the decoder stack have
IDs that may or may not match the ID needed for the data
stream. Example:
A PD has 4 channels: A, B, C and D. In PV, those channels
have the IDs 0, 1, 2 and 3. If the user only assigns A and D,
Decoder::create_decoder_inst() will use the IDs 0 and 3 as
the bit positions of those signals in the data stream sent
to libsrd. This is obviously wrong.
Hence, we now use a separate bit_id for this purpose.
Soeren Apel [Mon, 7 Aug 2017 19:41:11 +0000 (21:41 +0200)]
AnalogSignal: Draw analog thresholds differently
Instead of using a patterned region on top of the trace,
show the thresholds by using different background colors
for the individual areas: green/grey/red.
Soeren Apel [Sat, 5 Aug 2017 20:38:45 +0000 (22:38 +0200)]
View: Update ruler after restoring session
If we don't do this, the ruler is out-of-sync with the rest
of the view until the session is loaded and goes into stopped
state. At that point, the ruler is updated, which is too late.
Soeren Apel [Wed, 2 Aug 2017 16:42:34 +0000 (18:42 +0200)]
SignalBase: Default to dynamic conversion preset, not custom values
The reason for this change is that when you initially select a
conversion from the channel config popup dialog, the threshold
will be set to "0.0V" or "0.0V/0.0V", respectively.
This is of course not what we want and the root cause is that
when no preset is selected, NoPreset is assumed instead of
DynamicPreset. This patch changes this.
Soeren Apel [Wed, 2 Aug 2017 07:15:18 +0000 (09:15 +0200)]
Move delayed conversion starter to SignalBase
This way, we can use the same mechanism for changing
min/max as well, preventing multiple successive starts
of the conversion algorithm.
Preventing this is necessary because it makes the UI
stop updating for a significant amount of time, which
we obviously don't want.
Two issues here:
1) it's bad style to have an event handler for an event
that was triggered in the same class
2) supplying the current hover point along with the event
is a sensible thing to do
Uwe Hermann [Fri, 21 Jul 2017 05:08:06 +0000 (07:08 +0200)]
INSTALL/CMakeLists.txt: Bump libsigrokdecode requirement to >= 0.6.0.
PulseView now relies on e.g. the fact that multiple libsigrokdecode
calls from different threads don't cause issues (which has not been the
case prior to libsigrokdecode 0.6.0).
Uwe Hermann [Wed, 19 Jul 2017 18:55:59 +0000 (20:55 +0200)]
Fix the build with ENABLE_DECODE=n.
pv/dialogs/settings.cpp: In member function ‘QWidget* pv::dialogs::Settings::get_decoder_settings_form(QWidget*) const’:
pv/dialogs/settings.cpp:218:1: error: no return statement in function returning non-void [-Werror=return-type]
DecodeTrace: Resize trace when hiding/deleting a stacked PD
The trace height depends on DecodeTrace::max_visible_rows_,
which needs to be updated when a stacked PD is hidden or
deleted. In order to do this, we reset max_visible_rows_ to
0 and then request a repaint.
Make restack_items() available to all TraceTreeItemOwners
Currently, TTIO:restack_items() is empty and only the
TraceGroup actually implements it. For this reason, decode
traces (and analog traces) are correctly pushing other traces
around when their size changes.
Top-level traces that are not part of a group however aren't
handled properly, simply overlapping when they grow.
This patch makes the code available to all TTIO-derived
classes, allowing all owners (including View itself) to
properly handle this event.
DecodeSignal: Don't set name when creating the signal
The thought behind this was to have no unnamed signals because
this may make debugging harder. However, giving the signal a
long name and shortening it when decoders are added isn't working
well. The reason is that the width of the header area can be
expanded programmatically but we don't shrink it because we
don't want to hide things the user may want to see.
This behavior in turn leads to the header width expanding when
a signal labeled "Empty decoder signal" is added, only to see
this very signal be renamed to e.g. "SPI" immediately afterwards.
As we don't shrink the header width, the header is now too wide.
Soeren Apel [Thu, 29 Jun 2017 17:16:18 +0000 (19:16 +0200)]
SignalBase: Adjust Schmitt-trigger thresholds
Currently, the thresholds are determined by the minimum
and maximum values of a signal. From those, we derive the
high and low thresholds by using a 10% margin to min/max.
However, this approach doesn't work very well when the
measurement includes reset conditions or similar, causing
spikes that raise the min/max significantly.
This patch changes the thresholds margins to 35%. However,
they are expressed differently: (max-min)/2 is used as the
center line, from which 15% of the amplitude (max-min) is
used as the margin. This way seems a little more intuitive
for me since the percentage given (15) is directly proportional
to the hysteresis.
Make get_raw_samples() use provided mem instead of allocating
Until now, Segment::get_raw_samples() was allocating the required
amount of memory and returned it to the caller to use. This way,
there was always enough memory allocated for the data that was
written to that memory location.
However, in SignalBase::conversion_thread_proc() we want to use
one memory location multiple times because we will create several
layers of libsigrok wrapper objects around it. This only works
if Segment::get_raw_samples() uses a given memory location instead
of allocating it by itself.
libsigrokdecode commit 514b2edc54efda9c6698456748c4256bb901eddd
makes it thread-safe, so PV can now access it whenever it wants,
not needing to care about concurrent access.
Soeren Apel [Tue, 27 Jun 2017 16:32:30 +0000 (18:32 +0200)]
Decode: Improve signaling
Three issues that were fixed by this:
1) The SignalBase did notify PDs when its conversion changed
and new sample data was generated but this was dismissed as
the samples_cleared() signal was never fired nor used by the
PD stack.
2) The decode_finished() signal was added so that the decode
trace can immediately paint the trace once the PD is done.
Before, a repaint was only triggered when annotations came in,
resulting in a noticeable "unresolved period" visible if the
last stretch of signal didn't contain any annotations as the
trace wasn't repainted quickly enough.
3) The decode trace indirectly looks at the signal's
samples_decoded_ member when drawing the "unresolved period"
bar. Hence we should update this member before triggering the
repaint via new_annotations().