07-12-2020 08:56 PM
Hi everyone, now I'm learning about using a state machine for my project. I made 4 cases in my project, Init, Main, Clear, and Stop. Using "Select", when I click Stop button it will change the state into Stop case. Is it possible to use the same way with my Clear button? But I want to use these buttons inside the Main case. Please suggest me what should I do about this. Thank you.
Solved! Go to Solution.
07-12-2020 09:26 PM - edited 07-12-2020 09:26 PM
In this case, 'Stop' has higher priority than 'Clear', which means if both ('Clear' and 'Stop') are True, 'Stop' will be given preference.
07-12-2020 09:32 PM
Wow! That's so much simpler. I was using OR condition and it worked also actually. But your solution is way better. Thanks!
07-13-2020 05:55 AM - edited 07-13-2020 05:55 AM
As a side note, I would suggest that you make your enum into a typedef. If you add a state later you don't want to have to track down all of these constants to change them.
07-13-2020 09:35 AM
@johntrich1971 wrote:
As a side note, I would suggest that you make your enum into a typedef. If you add a state later you don't want to have to track down all of these constants to change them.
Just to complete your thought:
You'll still have to track down all the constants to change them to replace all the regular enums with the typedef'd version, but this happens exactly once, and from then on you don't have to worry about manually updating them again.