Commit Graph

118 Commits

Author SHA1 Message Date
Soeren Apel a66e286e02 Session: Fix trigger handling 2018-03-04 00:25:07 +01:00
Soeren Apel feeb4a7ea1 Session: Add error messages 2018-02-24 00:13:13 +01:00
Soeren Apel 0fb98cf80d Tiny whitespace fix 2018-02-21 18:46:29 +01:00
Soeren Apel 7ea2a4ff07 Session/View: Save triggers in a list and use it 2018-02-07 19:41:56 +01:00
Soeren Apel 89914a8657 Add segment display mode UI controls and some related changes 2018-01-10 00:40:44 +01:00
Soeren Apel 9009d9b5ca Session: Make get_segment_count() consider all segments
Also changes the type for the getters to uint32_t.
2018-01-10 00:34:39 +01:00
Soeren Apel 85a702806a Add segment_id to all segment classes 2018-01-10 00:34:39 +01:00
Soeren Apel 558ad6ceb9 Implement Trace::ShowLastCompleteSegmentOnly display mode 2018-01-05 22:50:35 +01:00
Soeren Apel 341d9a7975 Flesh out segment display mode handling 2017-12-27 18:40:19 +01:00
Philipp Marek f9274b6890 Session: Fix mismatched delete operator.
Valgrind reported this here:

Mismatched free() / delete / delete []
   at 0x4C2D31B: operator delete(void*) (vg_replace_malloc.c:576)
   by 0x1C76D0: operator() (unique_ptr.h:78)
   by 0x1C76D0: ~unique_ptr (unique_ptr.h:268)
   by 0x1C76D0: pv::data::AnalogSegment::append_interleaved_samples(float const*, unsigned long, unsigned long) (analogsegment.cpp:78)
   by 0x1AFDD5: pv::Session::feed_in_analog(std::shared_ptr<sigrok::Analog>) (session.cpp:1142)
   by 0x1B043C: pv::Session::data_feed_in(std::shared_ptr<sigrok::Device>, std::shared_ptr<sigrok::Packet>) (session.cpp:1187)
...
 Address 0x1cbf6b90 is 0 bytes inside a block of size 940 alloc'd
   at 0x4C2C97F: operator new[](unsigned long) (vg_replace_malloc.c:423)
   by 0x1C765E: pv::data::AnalogSegment::append_interleaved_samples(float const*, unsigned long, unsigned long) (analogsegment.cpp:78)
   by 0x1AFDD5: pv::Session::feed_in_analog(std::shared_ptr<sigrok::Analog>) (session.cpp:1142)
2017-11-17 11:55:37 +01:00
Soeren Apel 4e86ec7042 Rework new segment notification mechanism 2017-10-29 23:38:06 +01:00
Soeren Apel b5940cf0ef Session: Query the device's sample rate when needed, not sooner 2017-10-09 17:47:19 +02:00
Soeren Apel 7f9654641c Add segment selector UI + helpers 2017-09-22 20:58:16 +02:00
Soeren Apel 837bb15a1c Session: Rework frame handling 2017-08-14 17:52:43 +02:00
Soeren Apel b4d448004a Remove SignalBase::A2LChannel 2017-08-03 13:06:27 +02:00
Soeren Apel 419ec4e11e Make sigrok::Context semi-global and use libsigrok A2L methods 2017-07-06 00:37:08 +02:00
Soeren Apel 88870fffb6 Fix #888 by incrementing i only once per iteration 2017-07-06 00:37:08 +02:00
Soeren Apel c8e60bdf0f Fix #832 by saving/restoring the decoder stack without settings 2017-07-06 00:37:08 +02:00
Soeren Apel e771b42d65 Session: Break up add_decoder() 2017-07-06 00:37:08 +02:00
Soeren Apel f5a5b019c5 Fix #981 by adding non-device signals upon view creation 2017-07-06 00:37:08 +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 132a5c6d4b Rework decode channel auto-assignment 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
Uwe Hermann 3083cda853 Minor Doxygen comment cosmetics. 2017-06-27 13:21:19 +02:00
Gerhard Sittig 724f29f311 session: Add support for input format options (-I cmdline parameter)
The previous implementation supported the selection of an input format
by means of the -I command line option. This commit extends the feature
by adding support for colon separated input format options similar to
sigrok-cli.

This allows users to open files from the command line which previously
became only available after filling in dialogs, and resulted in errors
in the absence of options. Here is an example of how to use the option:

  $ pulseview -I csv:header:first-channel=2 -i filename.csv

This fixes bug #951.
2017-06-27 13:19:46 +02:00
Soeren Apel f23c46921d Adjust trace view namespace 2017-06-10 15:37:45 +02:00
Soeren Apel 1573bf16ba Move trace view files 2017-06-10 15:37:28 +02:00
Soeren Apel dc4ada2bfd Fix #775 by catching and handling the thrown exception 2017-06-06 19:46:00 +02:00
Soeren Apel 303eec78f3 Fix #958 by using new method that auto-converts analog samples 2017-05-27 22:58:31 +02:00
Uwe Hermann b8f1cdeba7 Drop unused boost-thread dependency.
We no longer use boost-thread currently (in favor of C++11 thread
facilities), so drop the obsolete dependency from code and docs.
2017-03-28 18:23:43 +02:00
Uwe Hermann aca9aa834c Use alphabetical order for #includes.
This patch was generated using clang-tidy:

  clang-tidy -checks="-*,llvm-include-order" -fix
2017-03-28 11:43:40 +02:00
Uwe Hermann c063290ac7 Random simplifications, cosmetics/whitespace/consistency fixes. 2017-03-23 19:42:18 +01:00
Uwe Hermann 0402d7a3e4 Use bool literals for boolean values.
This patch was generated using clang-tidy:

  clang-tidy -checks="-*,modernize-use-bool-literals" -fix
2017-03-23 17:59:00 +01:00
Uwe Hermann 83b1c8d251 Remove unused "using" declarations.
This patch was generated using clang-tidy:

  clang-tidy -checks="-*,misc-unused-using-decls" -fix

(with manual add-on fixes such as dropping unused headers as well,
and commenting some false-positive cases)
2017-03-23 17:59:00 +01:00
Soeren Apel 12ea361676 SignalBase: Implement A2D conversions 2017-03-22 23:03:21 +01:00
Soeren Apel a7336fb2d5 Session: Make sure we don't try to add a non-existant decoder
This can happen if either the saved configuration is wrong
or a decoder simply doesn't exist. We don't want to crash then.
2017-03-22 22:47:26 +01:00
Soeren Apel 04e1acc23e LogicSegment: Remove constructor requiring sigrok::Logic 2017-03-22 22:47:20 +01:00
Soeren Apel 79c4a9c8a2 Use presence of logic/analog data as indicator of channel type
However, don't do this for the StoreSession. Reason is that we
only want to save the original data and not treat any converted
data as its own channel.
2017-03-22 22:46:26 +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
Soeren Apel 53bb2e1de7 Session: Don't reset session name for file devices 2017-03-12 15:42:12 +01:00
Uwe Hermann 326cf6feb8 Use emplace_back() where possible.
This patch was generated using clang-tidy:

  clang-tidy -checks="-*,modernize-use-emplace" -fix

Using emplace_back() has multiple advantages:

 - It's usually shorter and easier to read.

 - It's more efficient.

   V1: v.push_back("foo");
   V2: v.emplace_back("foo");

   V1 will construct a temporary std::string from the string literal "foo",
   another copy of that temporary object will be constructed and placed
   into the vector 'v', then the temporary object's destructor will be called.

   V2 will simply create a std::string directly in the vector 'v', i.e.
   there's only one construction (not 2) and no destructor needs to be called.
2017-03-11 13:06:03 +01:00
Uwe Hermann 067bb62415 Prefer std::make_shared().
This patch was generated using clang-tidy:

  clang-tidy -checks="-*,modernize-make-shared" -fix

(with some additional manual fixups)

Using make_shared() over manual construction has multiple advantages:

 - It's shorter to write and easier to read.

   V1: auto sb = shared_ptr<Foo>(new Foo());
   V2: auto sb = make_shared<Foo>();

 - The type "Foo" is repeated less often (less code duplication, lower
   risk of forgetting to update one of the "Foo"s upon copy-paste etc.)

 - Manual construction leads to two individual allocations (actual data and
   the control block of the shared_ptr). Using make_shared() will only lead
   to one allocation, which has performance, cache-locality and memory
   consumption benefits.

 - It's exception-safe, whereas manual construction is not necessarily:

   V1: func(shared_ptr<Foo>(new Foo()), shared_ptr<Foo>(new Foo()));
   V2: func(make_shared<Foo>(), make_shared<Foo>());

   In "V1", one of the "new" invocations could throw, potentially
   causing memory leaks. No leaks will happen with make_shared().
2017-03-11 13:06:03 +01:00
Soeren Apel bcd64b9b7a Fix #829 by not throwing when device can't be used 2017-03-07 22:59:23 +01:00
Uwe Hermann 7b254679cb Name session tabs "Session 1" per default.
This is a bit more specific than "Untitled-1".
2017-03-04 15:48:24 +01:00
Soeren Apel 7db61e770a Provide notifiers for when signal data changes 2017-02-15 12:12:51 +01:00
Soeren Apel 0a4162a4bd Session: Handle frame markers properly 2017-02-10 08:09:55 +01:00
Soeren Apel 5e6967cb2b Free unused segment memory after acquisition
Segments allocate chunks of MaxChunkSize bytes each.
Most likely, the last allocated chunk isn't fully used,
so there's memory going to waste. This patch fixes this
by allocating a chunk of the required size that replaces
the last standard chunk.
2017-02-08 20:33:48 +01:00
Soeren Apel 26a883ede0 Switch segment storage from single vector to vector of arrays
Previously, PV would run out of storage space for the data
segments because data was stored in a vector. As a vector allows
contiguous access to the underlying data (much like an array),
it needs a contiguous section of memory. With incoming data and
constant resizing of the vector, the OS at some point can no
longer supply such a section of memory, causing PV to abort
acquisition.

This change fixes this by using several chunks that are never
grown in size. Instead, new chunks are allocated and added to
the vector as needed. This way, the OS will be able to provide
memory until it runs out of system memory.
2017-02-08 18:30:41 +01:00
Soeren Apel 5ccfc97e20 Confirm with user when trying to close sessions with unsaved data 2017-01-19 22:01:43 +01:00