µTasker Forum

µTasker Forum => µTasker general => Topic started by: FAQ on August 12, 2020, 12:47:39 AM

Title: Porting code to a task that originally ran in a forever loop
Post by: FAQ on August 12, 2020, 12:47:39 AM
Is the use of uTaskerStateChange(OWN_TASK, UTASKER_GO);
as suitable method to allow a task to operate continuously to allow code that originally ran in a forever loop to be used in a task?
Title: Re: Porting code to a task that originally ran in a forever loop
Post by: mark on August 12, 2020, 12:48:37 AM
Hi

Yes, the UTASKER_GO (or UTASKER_POLLING, which will continue polling after receiving events) is a way or emulating forever loops in ported code into a task.

The original functionality is usually quite easy to achieve and then you can look at increasing efficiency by stopping the polling (looping) operation when you know that a timer or event is being waited for before new activity is required.

Remember that, when low power mode is enabled, the processor is switched to low power mode when no tasks are running (that is, all are waiting for events or timers). Any task operating in polling mode will stop the low power mode from being entered and so also means that there is usually a higher power consumption.

Regards

Mark