Cannot Hold Cycle Time very annoying issue

Topics about the Software of Revolution Pi
Post Reply
wmatte
Posts: 3
Joined: 03 Mar 2023, 16:14
Answers: 0

Cannot Hold Cycle Time very annoying issue

Post by wmatte »

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:
RuntimeWarning: cycle time of 20 ms exceeded - can not hold cycle time!
and I really can't get rid of it.

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!
User avatar
dirk
KUNBUS
Posts: 1948
Joined: 15 Dec 2016, 13:19
Answers: 4

Re: Cannot Hold Cycle Time very annoying issue

Post by dirk »

Post Reply