Hello Guest it is December 06, 2019, 03:03:46 AM

Author Topic: Unactivate button during programmerun  (Read 2101 times)

0 Members and 1 Guest are viewing this topic.

Unactivate button during programmerun
« on: February 05, 2010, 11:45:28 AM »
On my programme is a button to set zero on crosslight. If you accidentally press it while the machine runs, the zeropoint changes causing a lot of horrible consequences.
It would be safer to inactivate it  when the programme runs.
Does anybody know if this is possible to change?
Re: Unactivate button during programmerun
« Reply #1 on: February 05, 2010, 03:37:34 PM »
I have good news and bad news....

The good news:
It is possible to create a button that you can activate and deactivate. While this type of button is not a built in facility of Mach, you can do it with a bit of VB programming. The basic technique is to make a button with VB code of the form:

If <activate button LED> is ON then
     <Do whatever the original action of the button was>
else
     <do nothing, the button is not activated>
end if

The bad news:
The condition that you likely want to test for (program running) can not be reliably checked from VB in Mach3 V3.

This bug is an unfortunate side effect of the shift during the last year in the mach internal implementation from single threading code multiple threading code.

You might think you can check the state of the "run button LED" - but it won't work.
(The act of running button code, forks off another internal process, The fork process seems to have the side effect of temp stopping the running code - so the run led may actually be off when you check it...   :-[  There is an internal Mach timing hole you can fall into - the net result is that checking the Run led is unreliable).

What you have run into appears to be another example of MultiThreading locking issues - something I consider to be a pretty serious problem - and from dialog with Brian about it, I believe he has the same opinion.

here is another example of the problem:
It turns out that the MDI input is also live during gcode execution and will cause the same async gcode insert to happen.
Test case:
1) load the roadrunner, set things up to cut in air(!)
2) while roadrunner is cutting, use mdi to do G90 G0 X0
you will see a G0 to X0 happen in the middle of the roadrunner code.... yikes.

Brian tells me he is working on the problem.
Alas, I am not led to expect this to be fixed in V3 - it's a pretty major task to implement resource locking and I think this will only appear in V4.

So.... my conclusion is that for Mach3 V3...
You've heard the old joke about "Doctor it hurts when I do this.... don't do that...." ?

Dave
 
Author of the MachStdMill Extensions for Mach3
www.CalypsoVentures.com
Re: Unactivate button during programmerun
« Reply #2 on: February 05, 2010, 04:24:11 PM »
I'll try to be more carefull than! Thanks Dave