[Ovmsdev] [Open-Vehicle-Monitoring-System] First implemention of net_fnbits NET_FN_CARTIME (1a97b92)
mark at webb-johnson.net
Tue Oct 21 15:16:36 HKT 2014
My thinking is that losing 1 ms every second or so means 1,000 seconds (16 minutes) to lose 1 second. As we poll the GSM modem for clock once every 60 seconds that should be fine and we should maintain accuracy. The GSM modem includes a real-time clock, so even if it loses GSM connectivity it should still keep good time.
P.S. There is a simple slight improvement I thought about last night. I use a 16bit unsigned integer to count milliseconds, adding 105 to it every 104.8576ms timer interrupt, and taking off 1,000ms every time it gets >1,000. Leading to an inaccuracy of 0.1424ms every timer tick. I could simply count 50ms instead, adding 5243 every timer tick of equivalent 5242.88 50ms chunks, and then taking off 50,000 every time if gets >50,000. That would lead to an inaccuracy of 0.12ms every timer tick. We could also mess around with the timer functions to try to get something more divisible into 1ms. But, with the GSM polling, I just don't think it will be necessary.
On 21 Oct, 2014, at 2:55 pm, Gianluca <notifications at github.com> wrote:
> After quick math every 7 interrupts you "loose" one ms. Maybe you could count interrupts and adjust ms count. To be more precise every 44 adjustments you should skip the increment. Let's say is a gregorian solution :)
> Reply to this email directly or view it on GitHub.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the OvmsDev