Hello Guest it is December 07, 2019, 08:01:35 PM

Author Topic: Jog ON/OFF brain quirks  (Read 2961 times)

0 Members and 1 Guest are viewing this topic.

Jog ON/OFF brain quirks
« on: March 09, 2011, 02:48:12 PM »
Howdy folks,
I spent too many hours yesterday tweaking brain files ... and still don't have quite what I wanted, so I'm hoping for some enlightenment.

Here's the story:  5 axis CNC laser welding system.  Mach3 + Galil (DMC 4060) + CNC4PC pendant (MPG4, with the enable button rewired to NC).  When doing welding moves that are just a 4th or 5th axis rotation move, we want to be able to jog the X and Y axis with the MPG to follow contours (usually making up for slightly bent or eccentric parts).  But whenever an axis starts moving, the jogging gets deactivated (I think by the Galil plugin.  Makes sense for lathe or mill).

So here was my intended workaround:  write a custom M-code script that can activate the jog override ability for appropriate sections of a part program by setting a flag (I used output 5, since it wasn't used for anything else.  But I think a UserLED would have worked, too).  Then have a brain that looks for the MPG to be on either X or Y axis (OEMTRIG 2 or 3 = FALSE (inverted)), AND the override flag (OUTPUT5), AND the jog LED (57) = false (meaning that Galil has deactivated it).  If all that is true, press the jog button to turn it back on.  This does, in effect, set up a small war between whatever code is trying to turn off the jogging and my brain file turning it back on.  But it works well enough to get pretty seamless jogging action for small corrections via the MPG.

The other piece of the puzzle is the brain that enables/disables jogging under normal circumstances (not running G code).  Since the Enable button on the MPG is the common for the axis_select and speed_select switches (and logic is inverted), look for all the corresponding OEMTRIGGERS (2-9) to go TRUE at the same time, and cause a button press to the Jog On/Off button.  This creates latching on/off toggle action.  (Credit to Ken Crouch)

It all works fine when I'm not executing G-Code.  If Output5 is set, then whenever I try to disable jogging (on the screen via mouse or the MPG Enable button) and the MPG is set to X or Y axis, the brain re-enables jogging.  And if I'm not on X or Y, the MPG Enable button happily toggles the Jog On/Off state.

BUT...as soon as I am running G-Code (with OUTPUT5 set), I have to use the mouse on the actual button (Jog On/Off - 103) or the keyboard shortcut to get the Jog Enable to latch on and stick.  If I use the MPG Enable button, the Jog blinks on and then back off again.  !!!!! :-\  Having to use the keyboard or mouse and then jump back to the MPG doesn't cut it for usability.

So my questions:
1) what is really different about a brain file causing a "ButtonPress" as compared to a mouse or keyboard press?  Something, evidently...
2) It seems there is an underlying variable for Jog Enabled state, since if it is enabled before a GCode run, it gets re-enabled after the run (and between moving steps, actually).  How can this be accessed by brains or vb scripts?
3) Is there something I'm missing about the cycle timing of brain processing (10Hz, from what I've read) and debouncing the switch?  I haven't found any really good reference for explaining how the timer lobes really work.  Anyone?
4) Can anybody see a better way to get the functionality I'm after?

Big thanks....
Tad