MyFirstApp example : does not work

Applications, development tools, FPGA, C, WEB
Post Reply
hvanmunster@gmail.com
Posts: 9
Joined: Sat Feb 18, 2017 6:00 pm

MyFirstApp example : does not work

Post by hvanmunster@gmail.com » Mon Oct 23, 2017 10:01 pm

Hi,
I did all the preparations which are explained here: http://redpitaya.readthedocs.io/en/late ... stApp.html
So 'myFirstApp' was created.
Then I tried to follow these instructions: http://redpitaya.readthedocs.io/en/late ... EDbut.html

FIRST QUESTION (WEB UI section):
I pasted the code for the button in index.html, but where do I have to paste the following code?
< div id='led_off'>LED Off</div>
< div id='led_on'>LED On</div>
The button is displayed, but the above code appears right behind the button. Do I have to put that code somewhere else?
The instructions are not clear about this point for me.

2ND QUESTION (WEB UI section / file app.js):
I pasted the code for APP.LED_State = false just above the $function{} line in app.js
I have no idea if this is OK. The instructions are not mentionning where exactly these lines need to be pasted.

3TH QUESTION (Section 'Controller')
I opened src/main.cpp
Where do I have to paste the code "CBooleanParameter ledState("LED_STATE", CBaseParameter::RW, false, 0);"
I pasted the ledstate.update() code at the end of main.cpp, just above the list of void procedures.
Is that OK?

4TH QUESTION
The instructions tell me not to forget to initApp() and release it elsewhere (rp_app_init() etc...)
Where? How?

Then I compiled the application (not the congtroller??) in ...MyFirstApp directory using the make INSTALL_DIR command.
message from syste:: nothing to be done for 'all'

Button is visible, but no led is switched on/off

Any help is welcome.
Best regards,
Herman.

amike88
Posts: 78
Joined: Tue Mar 29, 2016 7:41 pm

Re: MyFirstApp example : does not work

Post by amike88 » Thu Oct 26, 2017 9:14 am

Hi there was a resent update to the docs

There was a note added
Note:
Requierment for manipulating leds using api is to first load fpga_0.94.bit fpga bitstream image. That can be done using next command line instruction: “cat /opt/redpitaya/fpga/fpga_0.94.bit > /dev/xdevcfg”
Try loading the fpga_0.94.bit FPGA image as stated in the note and try again.

best of luck

JackTheRippchen
Posts: 12
Joined: Tue Sep 26, 2017 10:55 am

Re: MyFirstApp example : does not work

Post by JackTheRippchen » Thu Nov 02, 2017 2:38 pm

I just tried to do the "myFirstApp" example on my own, and I experienced the same issues.
First of all, basic knowledge in HTML, JavaScript and C(++) programming seems to be required implicitly.
I solved the issues by looking into "/root/RedPitaya/Examples/web-tutorial/2.led/" directory. There, all files are already modified in the required way.
hvanmunster@gmail.com wrote:FIRST QUESTION (WEB UI section):
I pasted the code for the button in index.html, but where do I have to paste the following code?
< div id='led_off'>LED Off</div>
< div id='led_on'>LED On</div>
The code has to be pasted within the body tags.
I recommend to paste it within the div tag called "content".
hvanmunster@gmail.com wrote:The button is displayed, but the above code appears right behind the button. Do I have to put that code somewhere else?
The instructions are not clear about this point for me.
You can insert a <br> tag between </div><div> to create a new line.
hvanmunster@gmail.com wrote:2ND QUESTION (WEB UI section / file app.js):
I pasted the code for APP.LED_State = false just above the $function{} line in app.js
I have no idea if this is OK. The instructions are not mentionning where exactly these lines need to be pasted.
The code has to be pasted between "$(function() {" and "APP.startApp();". I can neither explain why.
hvanmunster@gmail.com wrote:3TH QUESTION (Section 'Controller')
I opened src/main.cpp
Where do I have to paste the code "CBooleanParameter ledState("LED_STATE", CBaseParameter::RW, false, 0);"
In C(++), global variables have to be declared between the #inlcude-part and the first function. Therefore, put it after "#include "main.h"".
hvanmunster@gmail.com wrote:I pasted the ledstate.update() code at the end of main.cpp, just above the list of void procedures.
Is that OK?
It has to be pasted within the {} brackets of the "OnNewParams" function.
I'd also like to know what's the difference between "UpdateParams" and "OnNewParams" functions.
hvanmunster@gmail.com wrote:4TH QUESTION
The instructions tell me not to forget to initApp() and release it elsewhere (rp_app_init() etc...)
Where? How?
"rpApp_Init()" must be pasted within {} brackets of "rp_app_init()" function.
"rpApp_Release()" must be pasted within {} brackets of "rp_app_exit()" function.
If you want to understand these parts, you will have to study the API files and you need basic knowledge how to adress/write/read registers (microcontroller programming).
hvanmunster@gmail.com wrote:Then I compiled the application (not the congtroller??) in ...MyFirstApp directory using the make INSTALL_DIR command.
message from syste:: nothing to be done for 'all'
Interesting. I would have expected compiler errors because of how you modified "main.cpp" file.
Nevertheless, two more things:
  1. Even if you did all things right till here, you would experience a compiler error. To complete compiling successfully, you still have to modify "main.h" file.
  2. If you compile directly "/root/RedPitaya/Examples/web-tutorial/2.led/", the compiler will still report a couple of warnings. Confusing in some way.
Sincerely, JackTheRippchen

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: Google [Bot] and 1 guest