Machsupport Forum
Mach Discussion => Mach4 General Discussion => Topic started by: gorf23 on November 27, 2017, 02:55:17 PM
-
Would like to know why when I run this in a dialog event function it runs no GUI lockup but have to hit enter or press ok button a lot
But if I remove the MessageBox then I get a GUI lockup...
Thanks
[/ mc.mcAxisSetPos(inst, AxisNumber, 0); --"Zero Dro (0 is x, 1 y, and so on)
mc.mcCntlGcodeExecute(inst, 'G90 G0'..AxisLetter .. AxisEnteredDistance..'F1000'); - Machine will stop at distance set
local pos = 0
repeat
pos = mc.mcAxisGetPos(inst, AxisNumber)
wx.wxMessageBox("pos = "..pos.." AxisEnteredDistance = "..AxisEnteredDistance)
until pos == tonumber(AxisEnteredDistance)code]
-
When you are running with the MessageBox, does the axis move and does it ever get out of the repeat loop?
-
Hi,
I think DBK is on to the right thing.
The way I read the code is that without the intervening wx.wxMessageBox statement there is no time delay between
pos = mc.mcAxisGetPos(inst, AxisNumber) and
until pos == tonumber(AxisEnteredDistance)code]
Try removing the wx.wxMessageBox and substituting some sort of delay.
Craig
-
Actually in other programming languages, when you are in a very intensive loop, that may not allow the GUI to do it's housekeeping. VB for instance has a DoEvents command that you would call every so many iterations of your loop to ensure the GUI could respond to other events in a timely manner. I'm not up to speed with wxLua to know it's inner workings and whether or not this would be an issue.
-
I have tried all the delays I could think of but no good
So I decided to try a event timer, that has worked I set the timer to 1000 for now and all went well.
I checked the pos = mc.mcAxisGetPos(inst, AxisNumber)
thought the timer function and seems ok the dro moves up and the gui doesn't lockup...
Thanks gary