Commit Graph

32 Commits

Author SHA1 Message Date
Soeren Apel 641574bcc1 Rename colour* to color* 2018-04-15 08:19:59 +02:00
Soeren Apel d13d95b3ea Channels: Let "Enable all changing" also check for sample data 2018-04-15 08:18:42 +02:00
Soeren Apel 784f6c75bf SignalBase: Speed up conversion and prevent leaving samples unconverted
Unconverted samples can happen due to a race condition: being notified
of new samples coming in is ignored when the thread is already executing.
If these notifications however were the last ones sent out because the
segment was completed right after, the currently ongoing conversion
will finish but not be restarted with the final sample range.

With this patch, this is prevented.
2018-03-12 15:58:06 +01:00
Soeren Apel 7f894d958e Fix #1132 by passing segment IDs, not segment instances
Passing segment instances fails because this creates a race condition.
When a long conversion is taking place, the SignalBase::samples_added
signal is called often but since it's in a separate thread, the calls
are queued and aren't executed immediately. Now if the conversion is
restarted - for example as a result of a changed conversion threshold -
then the segments holding the converted data are destroyed, rendering
the pointers submitted as parameters to samples_added invalid.

Once the signal queue is processed, those invalid pointers will be
accessed and PV segfaults.

Since the signal queue can neither be emptied nor flushed, this
leaves only two sensible choices:
1) Signal samples_added less often, thereby reducing the chance of
signals being queued
2) Supply the segment ID instead of the segment instance as that's
essentially the only thing we currently care about - in fact, the
only user of samples_added (ViewBase::on_samples_added) uses the
instance to query only this

As #1 is only a band-aid and not a waterproof solution, I chose
to go with #2.
2018-03-05 23:45:46 +01:00
Soeren Apel b5d20c6d00 Fix #1089 by updating the signal labels and group labels
Group names currently don't change, so this doesn't do much
but they may change in the future, so it's useful to do anyway.
2018-02-08 16:32:19 +01:00
Soeren Apel 558ad6ceb9 Implement Trace::ShowLastCompleteSegmentOnly display mode 2018-01-05 22:50:35 +01:00
Soeren Apel 63253d7271 SignalBase: Implement multi-segment conversion 2018-01-05 22:50:26 +01:00
Soeren Apel c6d9cf6582 Use min/max notification for autoranging of analog signals 2017-08-03 13:16:21 +02:00
Soeren Apel 932bc2461d 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.
2017-08-03 13:16:21 +02:00
Soeren Apel b4d448004a Remove SignalBase::A2LChannel 2017-08-03 13:06:27 +02:00
Soeren Apel f0f9c8566b Use identifiers for fixed conversion preset values 2017-08-03 13:06:27 +02:00
Soeren Apel 8e15445ccd Restart min-max-based conversion if min or max change 2017-08-03 13:06:27 +02:00
Soeren Apel b9cdbe03be Typo fix: treshold -> threshold 2017-08-01 14:42:20 +02:00
Soeren Apel 52c900ac86 Implement A2L presets and custom threshold handling 2017-08-01 14:42:20 +02:00
Soeren Apel 06b6ce2669 Use getter for the conversion type instead of a local copy
Don't ask me why I used a local copy in the first place,
even I can't figure it out :)
2017-07-25 16:09:08 +02:00
Soeren Apel 64845ac28f SignalBase: Minor doxygen comments 2017-07-24 08:57:51 +02:00
Soeren Apel ccccb91439 DecodeSignal: Provide conversion data container sooner
Before, the converted_data_ container was only created
once we had sample data coming in. This meant that it
wasn't possible to assign a converted signal to a decoder.

With this change, the data container is created even
when there is no data to fill it with, allowing logic_data()
to return a valid result and in turn allowing the user
to assign the signal to a decoder.
2017-07-06 00:37:08 +02:00
Soeren Apel 27a3f09baf Implement logic data muxer thread
Multiple changes in one commit due to complexity:
1) data::decode::Decoder: Make use of the DecodeChannel struct for
channel assigments

2) DecodeSignal: Store DecodeChannel list in vector, not map

3) DecodeSignal: Remove unused get_data()

4) Remove boost::optional usage

5) Use DecodeSignal::segment_ as the container for muxed
logic data

6) Implement the DecodeSignal::logic_mux_proc thread and its
helper method mux_logic_samples()

7) Update DecodeSignal::decode_proc() to interface with the
logic muxer thread

8) Remove no longer needed DecodeSignal::wait_for_data()
2017-07-06 00:37:07 +02:00
Soeren Apel bcaf033478 SignalBase: Make ConversionBlockSize a class constant 2017-07-06 00:37:04 +02:00
Soeren Apel 4774721873 Merge DecoderStack into DecodeSignal
Several changes make up this commit, which unfortunately
can't be separated:

1) Move decoder stack management from DecoderStack to
DecodeSignal, thereby making DecoderStack unnecessary

2) Change the decoder stack from std::list to an
std::vector for direct decoder access

3) Introduce logic_mux_thread which will take care
of muxing the individual SignalBases' logic data into
(cached) logic data that libsigrokdecode expects.
This is necessary as we can no longer do simple bit
mapping within a single logic data segment's logic
data as we now may feed from multiple logic data
segments at once

4) Refactored the creation of decode traces, making
it more streamlined and flexible while simplifying
the class interface

5) Refactored the auto-assignment of channels

6) Refactored is_decode_signal()

7) Reworked decode signal save/restore, allowing
proper handling and with the decoder stack now
being part of the signal, easier save/restore of
the stack and its settings
2017-07-04 23:14:36 +02:00
Soeren Apel ad908057e1 Introduce DecodeSignal class
For starters, we equip it with some basic wrappers
around the decode stack, rework the annotation signal
a little and use the new DecodeSignal in favor of the
SignalBase class.
2017-07-04 23:14:36 +02:00
Soeren Apel eae3bbbbfd SignalBase: Also emit data related signals
If we have a SignalBase instance we don't want to hook into
every single segment just to be notified when data changes.
2017-05-26 19:36:04 +02:00
Soeren Apel 5d9fe823db SignalBase: Don't use static state
It's used across all SessionBase instances, d'oh.
Let's not do this.
2017-03-23 21:52:51 +01:00
Soeren Apel 12ea361676 SignalBase: Implement A2D conversions 2017-03-22 23:03:21 +01:00
Soeren Apel 472a80c58c Introduce PV-internal channel types 2017-03-22 22:45:41 +01:00
Uwe Hermann 6f925ba9d6 Don't use std:: in the code directly (where possible).
Use "using std::foo" to make the actual code itself a lot more readable.

There are some exceptions where we usually cannot do this, e.g. std::thread
often conflicts with "thread" from Qt or Boost.
2017-03-18 20:00:51 +01:00
Gerhard Sittig efdec55aec license: remove FSF postal address from boiler plate license text
Remove the FSF postal address as it might change (it did in the past).
Reference the gnu.org website instead which is more stable.
2017-01-07 16:11:15 +01:00
Soeren Apel 6de38b17e7 Let SignalBase store/restore its internal data 2016-08-29 18:08:11 +02:00
Soeren Apel 050b5a6c7d SignalBase: Add internal name 2016-08-28 17:44:42 +02:00
Soeren Apel bb7dd726eb Move view-independent data from view::DecodeTrace to SignalBase 2016-08-19 00:36:03 +02:00
Soeren Apel cbd2a2de84 Move signal data to SignalBase and adjust view::AnalogSignal
The signal data belongs to the signal base (M) and not
the view's AnalogSignal (V). Hence we need to move it.
2016-08-19 00:36:02 +02:00
Soeren Apel bf0edd2b0c Introduce pv::data::SignalBase 2016-08-19 00:36:02 +02:00