Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Trigger scrolling proof of concept #24

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

simonschmidt
Copy link

@simonschmidt simonschmidt commented Oct 26, 2019

An initial attempt at pseudo scope idea

Current behaviour:

  • View is left-triggered
  • Zero offset gets reset to the trigger time
  • Scrolls to next trigger only if
    1. There is enough samples behind the event to fill up the view
    2. The event happened after current offset OR current offset is later than last sample

I've only played around with the fx2lafw driver so far, which required some changes in libsigrok:

libsigrok changes
diff --git a/src/hardware/fx2lafw/protocol.c b/src/hardware/fx2lafw/protocol.c
index ec2b5c01..dc6cf212 100644
--- a/src/hardware/fx2lafw/protocol.c
+++ b/src/hardware/fx2lafw/protocol.c
@@ -465,7 +465,7 @@ static void LIBUSB_CALL receive_transfer(struct libusb_transfer *transfer)
        } else {
                devc->empty_transfer_count = 0;
        }
-       if (devc->trigger_fired) {
+       if (!devc->stl) {
                if (!devc->limit_samples || devc->sent_samples < devc->limit_samples) {
                        /* Send the incoming transfer to the session bus. */
                        if (devc->limit_samples && devc->sent_samples + cur_sample_count > devc->limit_samples)
@@ -493,6 +493,9 @@ static void LIBUSB_CALL receive_transfer(struct libusb_transfer *transfer)
                        devc->sent_samples += num_samples;
 
                        devc->trigger_fired = TRUE;
+               } else {
+                       pre_trigger_send(devc->stl, &pre_trigger_samples);
+                       devc->sent_samples += pre_trigger_samples;
                }
        }
 
diff --git a/src/libsigrok-internal.h b/src/libsigrok-internal.h
index a0f00b24..9d49d7e9 100644
--- a/src/libsigrok-internal.h
+++ b/src/libsigrok-internal.h
@@ -1138,6 +1138,8 @@ SR_PRIV int logic_channel_unitsize(GSList *channels);
 SR_PRIV struct soft_trigger_logic *soft_trigger_logic_new(
                const struct sr_dev_inst *sdi, struct sr_trigger *trigger,
                int pre_trigger_samples);
+SR_PRIV void pre_trigger_send(struct soft_trigger_logic *stl,
+                int *pre_trigger_samples);
 SR_PRIV void soft_trigger_logic_free(struct soft_trigger_logic *st);
 SR_PRIV int soft_trigger_logic_check(struct soft_trigger_logic *st, uint8_t *buf,
                int len, int *pre_trigger_samples);
diff --git a/src/soft-trigger.c b/src/soft-trigger.c
index 245eb4ff..db779c91 100644
--- a/src/soft-trigger.c
+++ b/src/soft-trigger.c
@@ -107,7 +107,7 @@ static void pre_trigger_append(struct soft_trigger_logic *stl,
        }
 }
 
-static void pre_trigger_send(struct soft_trigger_logic *stl,
+SR_PRIV void pre_trigger_send(struct soft_trigger_logic *stl,
                int *pre_trigger_samples)
 {
        struct sr_datafeed_packet packet;

To try it out:

  1. Apply diff above to libsigrok
  2. Select a fx2lafw device in pulseview
  3. Use just one channel
  4. Make sure the pre-trigger capture ratio is non-zero (1% should be fine)
  5. Enable a trigger for the channel
  6. Click the trigger-icon next to the zoom-level icons

If you move around the view, the trigger scroll will get deactivated, just click it again


There some things that needs to be thought about for this to work nicely

  • The drivers only sends one trigger event
  • It would be nice if the triggers were disabled until needed (i.e. after the duration of one view-width) and then re-armed
    • Currently lots of markers in the view that mainly add noise
  • Should there be a configurable holf-off period?
  • Should it be possible to center the view around the trigger events?
  • What's the performance like? (also on libsigrok side)
  • How should the UI look like for all this?
  • What changes are needed in libsigrok to handle re-arming triggers?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant