Dangerous Prototypes

Other projects => Past projects => Web platform => Topic started by: youritronics on June 27, 2011, 07:50:56 am

Title: adding new functions to StackApplications()
Post by: youritronics on June 27, 2011, 07:50:56 am
Hi,
I'm not sure if I got the subject of the topic right but here is what I want to do: After applying "Fixes for Microchip MDD Demo TCPIP Stack 5.31" I managed to compile the MDD Demo with C30 v3.21. I successfully enabled AN0 and I was able to show the reading on the web page through the existing HTTPPrint_pot() function from CustomHTTPApp.c. Now I would like to read a second channel AN1, and also send it to the webpage.

I believe these are the steps to do it:
1.create a new function in CustomHTTPApp.c for example HTTPPrint_pot1()
2.call that function in the StackApplications() so it runs in the loop once every tick (1 sec?)
3.edit status.xml to add the new variable for parsing
4.edit index.html to print the new variable

I am able to do steps 1,3,4 but I cannot find the place where I need to call my newly created function from.
Is it supposed to be called inside StackApplications() ? If so where is that defined ? because I couldn't find it..

Thanks,
Florin
Title: Re: adding new functions to StackApplications()
Post by: megabug on July 23, 2011, 11:26:40 am
Hi,

You don't need to add it into StackApplications()! Just Add it into CustomHTTPApp.c and status.xml.

This way if you put ~pot1~ into your website it will call your HTTPPrint_pot1() in CustomHTTPApp.c.

I have several new functions included in my project and this works just fine!
Title: Re: adding new functions to StackApplications()
Post by: youritronics on July 23, 2011, 11:32:30 am
thanks, I figured it out eventually. The trick is to add it to CustomHTTApp.c and then when you run the MPFS2 utility to generate your HTTPPrint.h file it will automatically add a case for calling the custom function.

Thanks anyway!

( ! ) Fatal error: Uncaught exception 'Elk_Exception' with message 'Please try again. If you come back to this error screen, report the error to an administrator.' in /var/www/dangerousprototypes/forum/sources/database/Db-mysql.class.php on line 696
( ! ) Elk_Exception: Please try again. If you come back to this error screen, report the error to an administrator. in /var/www/dangerousprototypes/forum/sources/database/Db-mysql.class.php on line 696
Call Stack
#TimeMemoryFunctionLocation
10.00922057120session_write_close ( )...(null):0
20.00952188712ElkArte\sources\subs\SessionHandler\DatabaseHandler->write( )...(null):0
30.00952189488Database_MySQL->query( ).../DatabaseHandler.php:119
40.05332328224Database_MySQL->error( ).../Db-mysql.class.php:273