Cannot Hold Cycle Time very annoying issue
Posted: 13 Oct 2023, 15:02
Dear community,
I am close to my project completion and it looks a bit "heavy" for the RevPi.
I made it work using an infinite loop cycle that embeds the logic of the program levereaging OOP.
The hardware setup comprehends a RevPi Core SE and the expansion RevPi DIO. Of the RevPi DIO I currently use 23 pins.
Actually I have a more than 10 classes, with several objects instantiated, 5 mqtt clients active etc. etc... I.e. is moderately big.
I still have in the log the very annoying:
I have to say, I had several time.sleep and while loops that could had slow down the code execution. Nevertheless, I converted them into threads, that however had to wait with thread.join() for the thread itself to execute. With the thread trick, the RunTimeWarning has been strongly mitigated, but I cannot understand how to completely solve it.
One of the options I have in mind is to move from a "big cyclic approach" to an "event oriented approach", but it would let me write most of the code from the ground up. Before doing it, I would like to know if I have other alternatives.
I ask for help, as I am running out of bullets. Thanks in advance to anyone that passes from here!
I am close to my project completion and it looks a bit "heavy" for the RevPi.
I made it work using an infinite loop cycle that embeds the logic of the program levereaging OOP.
The hardware setup comprehends a RevPi Core SE and the expansion RevPi DIO. Of the RevPi DIO I currently use 23 pins.
Actually I have a more than 10 classes, with several objects instantiated, 5 mqtt clients active etc. etc... I.e. is moderately big.
I still have in the log the very annoying:
and I really can't get rid of it.RuntimeWarning: cycle time of 20 ms exceeded - can not hold cycle time!
I have to say, I had several time.sleep and while loops that could had slow down the code execution. Nevertheless, I converted them into threads, that however had to wait with thread.join() for the thread itself to execute. With the thread trick, the RunTimeWarning has been strongly mitigated, but I cannot understand how to completely solve it.
One of the options I have in mind is to move from a "big cyclic approach" to an "event oriented approach", but it would let me write most of the code from the ground up. Before doing it, I would like to know if I have other alternatives.
I ask for help, as I am running out of bullets. Thanks in advance to anyone that passes from here!