12-06-2020 01:44 PM
I have one loop which handles I/O including analog inputs.
I have a second loop which contains a state machine. There are some 26 Cases and the process moves from state to state based on time AND analog input values.
I have used a notifier to send the analog input array to the second loop.
Unfortunately, each Case of the state machine has its own inner loop. The analog input values that I reference via local variables only update once the inner loop stops, consequently the analog input condition for proceeding to another step never occurs. This is a serious problem that is holding up the whole project.
Attached is the top level code
Solved! Go to Solution.
12-06-2020 02:21 PM
Don't put while loops inside the cases. You said you have a state machine. Instead of looping within a state, just set it up so that it returns to the same state. Each state should have a decision point as to whether it moves on to the next state, or returns to the same state such as when a given amount of time has not yet elapsed.
12-06-2020 02:33 PM
The state machine was originally generated using the JKI State Machine Toolkit (which has its own problems). Could you look at the example screen capture and tell me what I can safely remove? I'm not sure I can just strip out the innermost loops and make it work.
12-06-2020 05:20 PM
Thank you. I was able to figure it out with your hint. I have no idea why that innermost loop was put in there but I have changed five of the thirty cases of my State Machine already and it's going to work.
They probably wouldn't have fired me but this is going to make me a hero.