Page 1 of 1

App with 4 Signal Channels

Posted: Mon Sep 04, 2017 10:32 am
by GeorgB613
Hi everyone,

First of all I have to mention that I am still using the very first Ecosystem. (I don't know if that's relevant at all for the nginx server I address here).

I used to edit the standard oscilloscope app to accomodate that to my needs. Up to now it worked very fine for me but now I need 4 signal channels instead of the default 2.
I do know how to adapt my Firmware to get memory for four channels but then I fail when the data is transferred via nginx.
Obviously it's not sufficient to update the rp_osc_get_signal() in main.c
(Beside all relevant initialisations of the rp_osc_signal) I just extended the aforementioned function to this:

Code: Select all

/*----------------------------------------------------------------------------------*/
int rp_osc_get_signals(float ***signals, int *sig_idx)
{
    float **s = *signals;
    pthread_mutex_lock(&rp_osc_sig_mutex);
    if(rp_osc_signals_dirty == 0) {
        *sig_idx = rp_osc_sig_last_idx;
        pthread_mutex_unlock(&rp_osc_sig_mutex);
        return -1;
    }

    memcpy(&s[0][0], &rp_osc_signals[0][0], sizeof(float)*SIGNAL_LENGTH);
    memcpy(&s[1][0], &rp_osc_signals[1][0], sizeof(float)*SIGNAL_LENGTH);
    memcpy(&s[2][0], &rp_osc_signals[2][0], sizeof(float)*SIGNAL_LENGTH);
    memcpy(&s[3][0], &rp_osc_signals[3][0], sizeof(float)*SIGNAL_LENGTH);

    *sig_idx = rp_osc_sig_last_idx;

    rp_osc_signals_dirty = 0;
    pthread_mutex_unlock(&rp_osc_sig_mutex);
    return 0;
}
Is the nginx server only designed to tranfer 2 channels?
What is it that I forget here?

Hope you guys can help. And thanx in advance.
Georg

Re: App with 4 Signal Channels

Posted: Mon Sep 04, 2017 3:46 pm
by JamesW
Hi,
I see three possibilities.

1) You can make your signal half size length. Then it is possible to use 4 signals.
2) To keep the same length, it is necessary change memory allocation and change hard coded constants in https://github.com/RedPitaya/RedPitaya/ ... data_cmd.c a recompile. It probably break compatibility with others apps.
3) Use WebSocket interface - for future this is the best way, but you will need rewrite your app and web interface.

Re: App with 4 Signal Channels

Posted: Wed Sep 06, 2017 12:43 pm
by GeorgB613
Thanx for your suggestions.

As halfen the signal size length is no sufficient option for me, I will have to touch the nginx files.
However, I don't know what I have to consider here and how to compile alltogether and which compile file is needed where.

On my SD-card, I found a file called "nginx" in the sbin directory. Is it that one I have to recompile?
Is there a guide available or could you give me some hints?