disk91 / stm32-it-sdk

Disk91 STM32 IoT SDK
https://www.disk91.com
GNU General Public License v3.0
45 stars 19 forks source link

Add a function to allow schedule parameters modification when halted #59

Closed disk91 closed 4 years ago

zokl commented 4 years ago

Hello,

I have tried your function itdt_sched_changeSched but I have a problem with sleep time. After using the function in the followed way:

uint32_t sleep = status.sleep_time_s * S_TO_MS;
itdt_sched_haltSched(sched_id);
itdt_sched_changeSched(sched_id, sleep, NULL);
itdt_sched_runSched(sched_id);

The system sleeps twice the time that I set if I disable the condition haltSched and modify only period, sleeping works that I imagine.

Thank you, Zbynek Kocur

disk91 commented 4 years ago

when you call itdt_sched_runSched(sched_id); Then next period is defined like this:

__scheds[schedId].nextRun = itsdk_time_get_ms()+__scheds[schedId].period;

So I don't see why you have twice the duration. Can you take a looks to details and provide some please ?

disk91 commented 4 years ago

Ok, I got it with your pull-request. See my comment on it. Paul