Page 1 of 1

runtime errors

Posted: 09 Mar 2022, 15:22
by johnruk4670
can someone help? why do i get this?

/usr/lib/python3/dist-packages/revpimodio2/modio.py:1083: RuntimeWarning: can not execute all event functions in one cycle - optimize your event functions or rise .cycletime RuntimeWarning

Re: runtime errors

Posted: 11 Mar 2022, 15:14
by RevPiModIO
Hi johnruk4670!

That will happen, if your event function takes more time than the internal cycle time. If you register an event function it must be executed within a cycle, otherwise the functions will overlap.

Example: You push a button, the function will start work, take 1 second. In that second you pushed the button 3 times more, so the same function will be queued 3 times and will be executed one after one. So it will take 4 seconds to execute the same function 4 times, without any other Input-Action.

You can call the functions asynchronous by adding as_thread=True in the .reg_event call.
https://revpimodio.org/en/doc2/io/#reg_event