Page 1 of 1

Negative number in memory

Posted: Mon Apr 29, 2013 5:44 pm
by lnevo
So, i am storing my latitude and longitude in memory and getting an error displaying it im the web page. looks like a closing > is not being sent...

Code: Select all

xena:~$ wget http://www.xxxxxxxx.com:2000/mi110
--2013-04-29 20:38:09--  http://www.xxxxxxxx.com:2000/mi110
Resolving www.xxxxxxxx.com... 98.113.xxx.xxx
Connecting to www.xxxxxxxx.com|98.113.xxx.xxx|:2000... connected.
HTTP request sent, awaiting response... 200 OK
Length: 15 [text/xml]
Saving to: `mi110'

100%[======================================>] 15          --.-K/s   in 0s      

2013-04-29 20:38:10 (916 KB/s) - `mi110' saved [15/15]
This page contains the following errors:

error on line 1 at column 20: expected '>'
Below is a rendering of the page up to the first error.
xena:~$ cat mi110
<M110>-73</M110xena:~$
this is the error I get trying to display it..

Code: Select all

This page contains the following errors:

error on line 1 at column 20: expected '>'
Below is a rendering of the page up to the first error.
I should add that it's working fine. I have not tried to update it the value...

Negative number in memory

Posted: Mon Apr 29, 2013 5:52 pm
by lnevo
Ok tried updating it...it dropped the negative value. :( Looks like I found a bug for sure..

Re: Negative number in memory

Posted: Mon Apr 29, 2013 6:09 pm
by rimai
I think it's because the controller doesn't have checks for uninitialized memory

Negative number in memory

Posted: Mon Apr 29, 2013 6:23 pm
by lnevo
I did initialize it...from the ino i can read and write negative numbers fine...

It looks like the http logic is getting hung up on it..

Re: Negative number in memory

Posted: Mon Apr 29, 2013 6:28 pm
by rimai
Ahhh... Sorry...
I should have read the post better.
You saved a negative number and you are trying to read....
The web server will break on neg numbers... You are correct.
The extra character "-" will make the xml string be short by 1 character, which is the > bracket of the last tag

Negative number in memory

Posted: Mon Apr 29, 2013 6:36 pm
by lnevo
And writing it drops the negative..

Re: Negative number in memory

Posted: Fri May 03, 2013 2:25 pm
by lnevo
Any ideas here or pointers. Do you think we can get around this? My only other option is to setup another set of variables to track whether it's a negative number or not.

Now that I can properly submit a git pull request... I don't mind working on this :)

Re: Negative number in memory

Posted: Fri May 03, 2013 2:34 pm
by rimai
It's easy to fix the neg return data.
It will be more complicated to do the writing through the /mb or /mi command. I'll have to look at the code again. Curt was the one who implemented it.

Posted: Fri May 03, 2013 2:55 pm
by binder
it can be more complicated doing the write, i guess i don't follow completely with what you are wanting to do. maybe I should read it more closely.