Author Topic: Changing the schedule time of a task under program control  (Read 11796 times)

Offline mhoneywill

  • Full Member
  • ***
  • Posts: 173
    • View Profile
Changing the schedule time of a task under program control
« on: November 08, 2010, 05:42:52 PM »
Hi Mark,

I want to change the "period" of a task depending on particular conditions. This period is defined in ctTaskTable and as its defined as a Const it can't be changed. Is there a simple way to achieve this.

I could remove the "const" definition of ctTaskTable which would mean it would then reside in RAM, entries could then be modified. Would this be your suggested way of doing this.

I suppose the Task state could also start a monstable timer for my new period and change the task state to UTASKER_SUSPENDED. But this does seem a bit clumsy.

Cheers

Martin

Offline mark

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3240
    • View Profile
    • uTasker
Re: Changing the schedule time of a task under program control
« Reply #1 on: November 09, 2010, 01:39:43 AM »
Hi Martin

The values in the configuration table are initial values - they are configured in RAM and can thus be changed.

To change the period of a period task you can use

uTaskerMonoTimer(TASK_NAME, (DELAY_LIMIT)(0.25*SEC), 0);

If the event (the last parameter) is set to zero it will not start a monostable timer on the task but instead set/change the task's periodic rate.
To stop a periodic task a periodic value of 0 can be used. To start again, set a period value of non-zero.

Regards

Mark