Hello Guest it is April 19, 2024, 10:49:08 AM

Author Topic: Lua Script to disable and enable MPG Handwheel  (Read 1929 times)

0 Members and 1 Guest are viewing this topic.

Lua Script to disable and enable MPG Handwheel
« on: June 06, 2017, 01:49:49 PM »
Is there a command to disable and enable an MPG handwheel in Lua. I was thinking that mc.mcMpgSetShuttleMode() would work to turn it off and on but it's not working for me. I'm basically trying to set it up so that when the "deadman switch" is pressed the MPG is enabled. On release it's disabled.

Any help is greatly appreciated.
Thanks.

Offline CRS

*
  •  61 61
    • View Profile
Re: Lua Script to disable and enable MPG Handwheel
« Reply #1 on: June 07, 2017, 12:29:04 AM »
Hi mjwaldner, I don't know the answer, but in case you have never seen this I will attach.  I used it to get my external MPG wheels all working.

It is written for a CNC4PC pendant if I remenber correctly and .  It was originally uploaded by Chaoticone.

Hope it helps.

CRS
Re: Lua Script to disable and enable MPG Handwheel
« Reply #2 on: June 07, 2017, 09:29:07 AM »
Thanks, CRS. It looks like your just selecting the "-1" axis. I will try this approach and see if it works.
Appreciate the help.

Offline CRS

*
  •  61 61
    • View Profile
Re: Lua Script to disable and enable MPG Handwheel
« Reply #3 on: June 07, 2017, 04:59:42 PM »
Hi mjwaldne,

While helping a friend with his mill recently, we actually commented out the line for the "-1" selection (no axis selected) and using a 5 position rotary switch made the first position (most left or CCW) the off position, isolating the A & B phases.  Had a few spare poles on the switch to do it.  Then X, Y, Z and A for the other four positions.

On my mill, I will also comment that line out and isolate the Phases, just seems a safer way.  I found if the MPGs can stay active, all is fine while running G Code as they are rendered unusable, as are the on screen jogging.  But when you hit feed hold, then if you somehow accidentally touch an MPG wheel, it starts the G Code running again.  I am sure there is a way of stopping this somehow in the code.  But I am not there yet.  So hence the want to have a hard wired off state somewhere.  Guess what I am saying is, I am not sure that line in the code is good enough.  Doing it in the hardware is the best.

Craig
Re: Lua Script to disable and enable MPG Handwheel
« Reply #4 on: June 08, 2017, 10:32:18 AM »
Thanks again. I have the same setup you described but be off axis is just not wired to anything. I was thinking about wiring the power for the MPG encoder through the deadman switch but didn't know if I was going to get undesirable signals when it powers up and down each time I push the button. In Mach3 it has always worked fine for me so I was just hoping I could transition this same setup to mach4.