[Ovmsdev] Higher resolution events

Geir Øyvind Vælidalo geir at validalo.net
Mon Nov 27 03:00:43 HKT 2017


I use vTaskDelay(50 / portTICK_PERIOD_MS) to delay 50ms. Not sure if that is the correct way, though.

Geir


> 26. nov. 2017 kl. 12:42 skrev Mark Webb-Johnson <mark at webb-johnson.net>:
> 
> 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
> 
> _______________________________________________
> OvmsDev mailing list
> OvmsDev at lists.teslaclub.hk
> http://lists.teslaclub.hk/mailman/listinfo/ovmsdev

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


More information about the OvmsDev mailing list