[Ovmsdev] SIM808/SIM908 GPS accuracy

HONDA S-2000 s2000 at audiobanshee.com
Wed Feb 8 14:25:14 HKT 2017


On Feb 7, 2017, at 4:30 AM, Edward Cheeseman <cheesemanedward at gmail.com> wrote:
>> On 7/02/2017, at 8:21 PM, HONDA S-2000 wrote:
>> On Feb 6, 2017, at 10:43 PM, Edward Cheeseman wrote:
>>> 
>>> Seconds * 3600 = degrees. So native units would be degrees * 3600 * 2048.
>> 
>> I see. While intermediate values are calculated in float, the return value is a fixed-point, signed 32-bit long value (a.k.a. Q19.11).
>> That allows for a maximum of ±145 degrees (?).
> I think its more like Q20.11? One bit sign, 11 bits of fractions of a second, 20bits of seconds/3600 = +/-291 degrees

Oops. I somehow subtracted the sign bit twice. Something about the number 11 must have freaked me out ;-)

That's good news, because Q20.11 can handle longitude better than the mythical Q19.11, i.e., ±291 degrees, as you point out. That's enough for up to 180°E and 180°W.

Brian

p.s. The rest of your comments are also correct. It seems that we don't have a lot of Flash space left for readable code solutions. Your idea to use comments to explain the source is a good one. That's assuming that any rewrite turns out to be an improvement, otherwise the code could stay as it was. Let us know what you find out.



More information about the OvmsDev mailing list