Jump to content

event structure into a state machine problem


Recommended Posts

hello lavas,

I developed the entire application as a standard state machine, which has an "Idle" state with an event structure inside.
The event structure captures UI buttons value change events.

My aim is to capture ui events *ONLY* when the main state machine is waiting, that's all.

In other words, if tasks have been completed and the state machine returns to the idle state, the user is allowed to perform another task by clicking on its button.

However, when I start a task, the SM correctly switches from Idle to the correct state (i.e. DAQ INITIALIZE), but if I intentionally push a again a button, the execution freezes up.

Since the event structure is not being in execution so far, I'm expecting the button event should be simply ignored.


Is it a normal behave of labview?
Are there some options in the event structure setup should I check?
thnx
 

Link to comment

You have the event setup to freeze the front panel to until the event completes.  This is the default setting.  So what happens is if you are not regularly checking for events with the event structure, the panel will freeze once you hit that button.  Once the state machine comes back to the idle state, it should call the event structure, react to the event, and go running again.

 

The simple solution to this is to disable and gray out the button.  Use a property node to set the Disabled state.  Use the "Enable" and the "Disable and Gray Out" options.  So after the button is pressed, you disable the button.  When you go back to the idle state, you reenable it.

Link to comment

thanks for your reply.

I'm aware of "lock front panel" checkbox on each event case editor, but the program is not affected by this. And it shouldn't, of course.

The event structure cases are merely control cases, I've just put inside an enum constant to properly address de main SM.

I forgot saying the "time consuming" task is into a SM's state, not into an ES case.

 

Is disabling buttons the only way to keep them out of firing unwanted events? It'll be quite a wire jam to manage buttons gray out.

What about saying something like this: "hey... stop listening to events now..."

Link to comment

OK, I think the view and the controller should operate correctly independently of one another.  This means the view should enable and disable buttons properly, but it also means the controller should be able to handle any command at any time (discarding inappropriate commands and perhaps returning an exception).  The "Idle" state approach is not, in my opinion, the best approach to achieve this.

 

If you do stick to the approach you have chosen, you should be able to use the debugging tools to follow the execution to reveal where the controller is hanging.

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.