
Hi,
so this is just a minor issue, but the inconsistency is driving me so fubar crazy.
Why is there so much inconsistency in using run() and/or update() methods?
Because they both names pretty much do the same and one name is not better than the other one.
I would assume, that run() must be called unconditionally constantly in the main loop, and calls to update() can be scheduled at less frequency.
No, there is no such differentiation, at least not to my knowledge. The run() method of Protothread is named run() because of the similarity to Thread::run(). Which other classes use run()? I assumed everything else uses update().
Now, along comes a class inheriting privately from xpcc::pt::Protothread which encapsulates the run() method in its update() method, so it can do some scheduling of subthreads on its own.
But this is like Matlock is trying to give me a back rub, it's like Andy Runy telling me to shut up and dance, it's like the Bucket List but not uplifting, it's like Cocoon, but somehow more gross. [0] It's just wrong.
Why? Just call the method of your subclass run() and everything is fine.
Since the protothreads are only a nicer way to describe a switch case, the calls to the subthreads run() methods, should also occur in the superthread's public run() method, but before the call to PT_BEGIN().
There is nothing preventing someone to do that. With protothreads the user is even responsible for providing the `bool run()` method.
Is that an agreeable solution?
For which case in particular? Cheers, Fabian