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

Feeding multiple traces to scope #872

Closed
srcejon opened this issue Apr 26, 2021 · 12 comments
Closed

Feeding multiple traces to scope #872

srcejon opened this issue Apr 26, 2021 · 12 comments
Assignees
Milestone

Comments

@srcejon
Copy link
Collaborator

srcejon commented Apr 26, 2021

Hi,

I'm trying to use the scope to help debug a demodulator. This is pretty good at displaying two signals from the demod, but it would be helpful if it could display more than 2 simultaneously (I've set up 15 different signals to probe, but not all need to be visible simultaneously).

Currently, I have combo boxes that select the different signals to send to the scope on the real and imag parts of the input. I've tried embedding two scopes, for 4 signals, but the triggering isn't synchronised, and so they get out of sync (unless only start/stop acquisition is used)

It seems the scope can display more than 2 traces in the waveform display, but these only come from one IQ input, as far as I can see? Is there a way to support more input channels?

image

This is perhaps similar to #16

@f4exb
Copy link
Owner

f4exb commented Apr 26, 2021

Yes similar but not exactly the same. #16 is for a channel analyzer that would accept a MIMO (MI that is) baseband thus being fed by multiple synchronous I/Q streams. Of course to make it really useful one would have to be able to combine traces from different inputs in the scope. So in fact this one would be a prerequisite for #16

@f4exb
Copy link
Owner

f4exb commented May 6, 2021

The scope component being rather sensitive and brittle I'd rather make it a new multiscope component possibly carrying out some redesign. The scope is one of the oldest components and has probably accumulated a good amount of technical debt.

@f4exb
Copy link
Owner

f4exb commented May 14, 2021

For the scope part this is to be covered by #898

@f4exb f4exb added this to the v6.14.0 milestone Jun 12, 2021
@f4exb f4exb closed this as completed Jun 12, 2021
@f4exb
Copy link
Owner

f4exb commented Jun 12, 2021

@srcejon
Copy link
Collaborator Author

srcejon commented Jun 13, 2021

Great, thanks. Will give it a try.

@srcejon
Copy link
Collaborator Author

srcejon commented Jun 22, 2021

Just giving this a try.

During initialisation, I call:

m_scopeSink->setNbStreams(2);

Then in the channel in sampleToScope(), I have:

    Real r = std::real(sample) * SDR_RX_SCALEF;
    Real i = std::imag(sample) * SDR_RX_SCALEF;
    SampleVector m_sampleBuffer1;
    SampleVector m_sampleBuffer2;
    m_sampleBuffer1.push_back(Sample(r, i));                    
    m_sampleBuffer2.push_back(Sample(r, i));
    std::vector<SampleVector::const_iterator> vbegin;
    vbegin.push_back(m_sampleBuffer1.begin());
    vbegin.push_back(m_sampleBuffer2.begin());
    m_scopeSink->feed(vbegin, m_sampleBuffer1.end() - m_sampleBuffer1.begin());
    m_sampleBuffer1.clear();        
    m_sampleBuffer2.clear();  

But this results in a "vector subscript out of range" exception in:

image

with streamIndex=1

Is there something else I need to add / change?

@f4exb f4exb reopened this Jun 23, 2021
@f4exb
Copy link
Owner

f4exb commented Jun 23, 2021

This should work. From the screenshot it seems initialization is not complete when setNbStreams is invoked. There should be 50 items on the second cell as well.

Edit: this loop https://github.com/f4exb/sdrangel/blob/master/sdrbase/dsp/scopevis.h#L610 is missing in setNbStreams

@f4exb f4exb self-assigned this Jun 23, 2021
@f4exb f4exb closed this as completed in c4cef5f Jun 23, 2021
@srcejon
Copy link
Collaborator Author

srcejon commented Jun 24, 2021

Thanks - it no longer crashes.

However, I only see 0 in the "trace stream source" combo box. How should this be initialised? It would obviously be nice to initialise it with names corresponding to what each stream is.

Looking through glscopegui.cpp, I can't see anything that adds items to ui->traceStream, and Ui::GLScopeGUI* ui; is private, so I don't know how to access it from the ChannelGUI to add items. (E.g. ui->scopeGUI->ui->traceStream->addItem("Therehsold"); doesn't compiler)

@f4exb
Copy link
Owner

f4exb commented Jun 24, 2021

There is very little room in the combo and certainly not enough for more that a few characters. So having a relatively long word here like "Threshold" is a bad idea.
image

Yes Ui::GLScopeGUI* ui; is private, this is normal because it should be handled by GLScopeGUI exclusively. I think however that it is missing methods around ui->traceStream to effectively handle multiple traces.

@f4exb f4exb reopened this Jun 24, 2021
@f4exb f4exb closed this as completed in bd04ee5 Jun 24, 2021
@f4exb
Copy link
Owner

f4exb commented Jun 24, 2021

Two new methods in GLScopeGUI:

  • void setNbStreams(unsigned int nbStreams);: sets the number of streams with default names (index numbers)
  • void setStreams(const QStringList& streamNames);: sets the stream names from a list of strings. Thus the number of strings sets the number of streams.

@srcejon
Copy link
Collaborator Author

srcejon commented Jul 8, 2021

I'm not sure if you missed the comments in PR #939, but as you didn't reopen the bug, I thought I'd mention it again. It seems multiple streams do not work for the Radio Clock plugin. I just see 0s on the scope. (A single stream is fine).

@srcejon srcejon reopened this Jul 8, 2021
@f4exb f4exb closed this as completed in 989de2a Jul 13, 2021
@f4exb f4exb modified the milestones: v6.15.0, v6.16.0 Jul 13, 2021
@srcejon
Copy link
Collaborator Author

srcejon commented Jul 14, 2021

I can now select the different streams for X trace, thanks.

However, it doesn't appear to work for Y. If I add a Y trace, I seem to get the same data on Y as X, regardless of the stream selection.

E.g. I have TH selected here - but the Y trace is showing the MagSq signal.

image

@srcejon srcejon reopened this Jul 14, 2021
@f4exb f4exb closed this as completed in 95923e8 Jul 15, 2021
@f4exb f4exb removed this from the v6.16.0 milestone Jul 15, 2021
@f4exb f4exb added this to the v6.16.1 milestone Jul 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants