[Ovmsdev] SIM808 GPS float bug

Edward Cheeseman cheesemanedward at gmail.com
Mon Jan 23 15:12:57 HKT 2017


Hello,

I am new to OVMS. I have a Gen2 Leaf on Dexters server. Tom has helped me set it up.

I found my GPS data was off up to two degrees. I’ve traced it to myatof() in utils.c.
It adds the fractional part with both positive and negative numbers, where it should subtract for negative numbers.

myatof() is used in SIM808 lat and long conversions, and somewhere in Twizy which I didn’t look into.
I suppose there isn’t that many SIM808 based OVMSs in the Southern or Western hemispheres?

It is easy to fix, but maybe going through float in the first place isn’t necessary?
Looks like there is 31bits of information coming out of the GPS where float will drop this to 23bits.
I’ve started rewriting gps2latlon() to use a long long (64bit) integer multiply and divide.
I see reference to SIM808 and 908 on an arduino shield, so I might have a look to see what they have done.


Edward

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openvehicles.com/pipermail/ovmsdev/attachments/20170123/b44330db/attachment.htm>


More information about the OvmsDev mailing list