Debug displays freeze during class function delay() call


Recommended Posts

While regular sequences will update both the Watch pane and the Command window with variable values and the result of debug statements like ?"message", if a class function contains one or more delay(n) statements and is called from the command line in the command window, no debug statements are written to the command window and the watch pane does not update until all of the delays have completed and the function has terminated, making it quite hard to debug certain sequences.  The class function with delays will update the debug statements and command window if called from another sequence, but that makes it to directly test class functions.  I've attached an example.  Running init will update the command window and watch pane (you have to put ElapsedSecs and Test.ElapsedSecs in to watch), but if you then invoke test.testupdate() from the command line DAQFactory will freeze until the function completes, as if no other system display updates are being processed during the delay() call (like a tight loop with no delay would do), but then the results will be updated.  Suggestions for a work around or can this be fixed?

DisplayTest.ctl

Link to comment
Share on other sites

That's because commands typed into the command/alert window run in the main application thread, much the same way as quick sequence actions on button clicks.  So, while the command you typed is executing, DAQFactory can't update any screens, nor take any other input (though, of course, background threads, I/O etc. will continue).  The workaround is to simply create a sequence that contains the function call, say, test.testupdate() and then start the sequence instead of calling it as a function.

It would be interesting to see if command/alert could be made to run in the background.  Maybe put a suggestion in that forum.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.