Undefined input on GUI webpage

Applications, development tools, FPGA, C, WEB
Post Reply
AlexH
Posts: 6
Joined: Sun Jul 05, 2015 8:24 am

Undefined input on GUI webpage

Post by AlexH » Fri Aug 07, 2015 1:43 pm

Hi,

I attempt to add a setpoint feature to Red Pitaya's oscilloscope. The idea is to add an offset value to the signal displayed on the oscilloscope.

I tried to implement this functionality on the html/javascipt file only. I have added a few lines of code in the generator & oscilloscope (I renamed it to My Scope) index.html file and it is in the link below. The added codes are in line 199-257, 943-944, 1154, 1160-1174, 2064-2101.

https://github.com/alex952158/generator-oscilloscope

However, for reasons that are not clear to me, the input for setpoint keep showing undefined on the GUI webpage and when values are entered, it switches back to undefined immediately. Any comments or thoughts as to what I'm doing wrong will be greatly appreciated. Thanks in advanced!

(No other codes were modified)

Luka G.
Posts: 10
Joined: Mon Dec 08, 2014 12:40 pm

Re: Undefined input on GUI webpage

Post by Luka G. » Wed Aug 12, 2015 4:04 pm

On the client side you have two arrays of parameters. params.local and params.original. Params.original are what you receive from C controller and are in turn copied to params.local. The client then checks if params.local are equal to params.original and if not, it makes an update to controller.so.

In your code you tried to access params.local.setpt_ch1, but you did not define them in C controller. These parameters are a direct mirror of the parameters defined on the C controller part. So what you need to do is define the parameters you want on your C controller, particularly in the main.c and main.h files, compile everything into controller.so once again and send it to your redpitaya. This way, the JSON object that parses these parameters will also contain the parameter you defined and will be directly available to the client.

If you want, you can give me permissions on your repository and I will make an example for you. My nickname on github is 1nfused.

AlexH
Posts: 6
Joined: Sun Jul 05, 2015 8:24 am

Re: Undefined input on GUI webpage

Post by AlexH » Thu Aug 13, 2015 7:50 am

Hi Luka,

I have added you to the github repository. Could you give me an example of how to fix the problem I'm getting?

Thanks

Luka G.
Posts: 10
Joined: Mon Dec 08, 2014 12:40 pm

Re: Undefined input on GUI webpage

Post by Luka G. » Thu Aug 13, 2015 12:27 pm

Okay, so I've added two files to your repository: main.c and main.h. I have added a new parameter for you, just to get a feeling what we're doing here. You need to add all the other files from the scope+gen repository to your src repository, compile those into controller.so and send it to your redpitaya. It ought to show the default value of the parameter we've set. Also, to test you did everything right, you can run your application in one tab then open another and input the IP/data. This will show you all the data that is being transmitted in one JSON packet, including parameters, which are located at the bottom. At the end of the list, you will see your newly added parameter, with it's default value (0 in our case).

One relevant thing. The main.c rp_main_params is a vector of parameters. It matches this structure:

typedef struct rp_app_params_s {
char *name;
float value;
int fpga_update;
int read_only;
float min_val;
float max_val;
} rp_app_params_t;

Hence, the number I used to define your parameter. You can change them anyway you want. Except the fpga_update and read_only element. fpga_update set to 1 simply means, that this parameter is going to affect the FPGA as well. On the other hand, if read_only is set to 1, you won't be able to change it from your client, but only read it's value.

Hope this helps a bit. If you have more questions, feel free to ask!

Cheerio, Luka.

Post Reply
jadalnie klasyczne ekskluzywne meble wypoczynkowe do salonu ekskluzywne meble tapicerowane ekskluzywne meble do sypialni ekskluzywne meble włoskie

Who is online

Users browsing this forum: No registered users and 89 guests