[Ovmsdev] Higher resolution events

Mark Webb-Johnson mark at webb-johnson.net
Sun Nov 26 19:42:32 HKT 2017

You definitely don’t want to be spinning - that won’t give you any precision on the delay (other tasks may pre-empt), and is also wasteful.

How about a timer (xTimerCreate). Have it fire once every 50ms/100ms. You can xTimerStart start it, and stop when done.

One trick to use is that the freertos objects contain a void* user data you can use to point to ‘this’ (your C++ object).

Regards, Mark.

> On 26 Nov 2017, at 1:38 PM, Tom Parker <tom at carrott.org> wrote:
> Hi,
> To implement the Leaf's remote climate control, I need to send a frame, wait 50ms and then repeat another frame every 100ms for 25 repetitions.
> On the v2 hardware I implemented this with a 50ms delay and the ticker10th function. I wasn't able to find any delay functions in v3 so either I didn't look hard enough, nothing needs one, or busy-waiting isn't the right thing to do. Ticker10th isn't implemented. I could refactor the existing ticker task to fire 10 times a second instead of once per second, or I could register a new task for the climate control and cancel it after the the 25 repetitions. Or maybe something else altogether is appropriate?
> Thoughts?
> _______________________________________________
> OvmsDev mailing list
> OvmsDev at lists.teslaclub.hk
> http://lists.teslaclub.hk/mailman/listinfo/ovmsdev

More information about the OvmsDev mailing list