Machsupport Forum

Mach Discussion => General Mach Discussion => Topic started by: Charlie_M on April 27, 2016, 08:09:46 PM

Title: using auto tool zero with xbox controller
Post by: Charlie_M on April 27, 2016, 08:09:46 PM
 Hello everyone,

         I just got a new cnc router up and running and I use a xbox controller to jog the machine around and other various things. What I was wondering is is it possible
to assign a button on the xbox controller to initiate the auto tool zero function? Thanks

Charlie Moore
Title: Re: using auto tool zero with xbox controller
Post by: Charlie_M on April 29, 2016, 07:15:17 AM
OK I figured out what I need to do. Can someone either tell me the OEM button code for the auto tool zero button or tell me where I might find it?


Thanks

Charlie
Title: Re: using auto tool zero with xbox controller
Post by: Tweakie.CNC on April 29, 2016, 08:19:55 AM
Hi Charlie,

Unfortunately not quite that easy because the Auto Tool Zero button on the standard screen (1024.set) is set as a 'VB button' and therefore does not have a specific OEM button code.

Now I am sure this has all been done before but I have not yet found the answer (but I will keep looking). Perhaps someone else knows the answer to this ?

Tweakie.
Title: Re: using auto tool zero with xbox controller
Post by: Tweakie.CNC on April 29, 2016, 11:40:07 AM
An update...

There is probably more than one way to achieve this but by using a Screen Editor, such as Mach3Screen, you can assign a hotkey to the 'Auto Tool Zero' VB button. Hopefully, this can be one of your XBox buttons (I have only tested it with my keyboard).

Tweakie.
Title: Re: using auto tool zero with xbox controller
Post by: Charlie_M on April 29, 2016, 11:43:36 AM
 Hi Tweakie Thanks. I will look into this and post my results.

Charlie
Title: Re: using auto tool zero with xbox controller
Post by: Charlie_M on April 30, 2016, 07:51:54 AM
Ok I got my xbox controller to work as I wanted with the auto too zero. turns out not to be hard at all. Its all in the documentation for the xbox plugin. ::)
Title: Re: using auto tool zero with xbox controller
Post by: Tweakie.CNC on April 30, 2016, 08:13:04 AM
 :)

Tweakie.
Title: Re: using auto tool zero with xbox controller
Post by: Ford Prefect on August 13, 2016, 08:40:57 AM
Hi Charlie M,

Are you still coming here?

I too want use my Xbox controller to initiate the auto tool zero function :)

Its a shame you only gave hints on how to do it, I wonder if you could go through it as I dont know much about coding etc.

Regards
Title: Re: using auto tool zero with xbox controller
Post by: Charlie_M on August 13, 2016, 10:12:11 AM
let me get some info together and I will get back to you. Its all in the xbox plugin docs.
Title: Re: using auto tool zero with xbox controller
Post by: Charlie_M on August 13, 2016, 10:38:52 AM
OK this is what I did. I opened mach3 then when to operator/vb script editor. I then copy and pasted the auto tool zero script( I found on the web and changed the plate thickness to suit my needs) into the the form. I saved it as M701.m1s to C:\Mach3/macros/Your profile( this is the profile that you are using to run your cnc). then went to config/config plugins and selected the xbox config. I selected the right shoulder button and in the drop down menu, selected custom macro #1. In the custom macro macro #1 field I put M701.m1s.  So what happens when you push the right shoulder button it calls the M701.m1s macro. Hope this makes sense. Let me know if I can help further.
Title: Re: using auto tool zero with xbox controller
Post by: Ford Prefect on August 13, 2016, 12:20:12 PM
Gosh that was quick.... thanks I will try afterwards or tommorrow, I drank wine with my dinner so its not a good time right now lol

Um which Xbox controller "script" did you use? one is called Shilling Systems and one is by Lee Davis?

I follow GuruBrew on Utube and he has both a "film" for Zeroing and using an Xbox controller

Regards
Title: Re: using auto tool zero with xbox controller
Post by: Charlie_M on August 13, 2016, 12:53:46 PM
I use the xbox controller by lee Davis. I have watched teh Guru brew also. Lots of good info.
Title: Re: using auto tool zero with xbox controller
Post by: Ford Prefect on August 14, 2016, 09:58:38 AM
Done and done :)

I had a bit of problem finding the field to put the "custom macro macro #1 field I put M701.m1s." but it was to left on the xbox config window, I was looking for a file or something

I put my "ref all" macro on there too while I was on a roll

once again thanks Charlie

regards
Title: Re: using auto tool zero with xbox controller
Post by: Charlie_M on August 14, 2016, 10:54:50 AM
Your welcome. glad you got it working.
Title: Re: using auto tool zero with xbox controller
Post by: Ford Prefect on September 14, 2016, 12:50:38 PM
At present I use the mouse to increase and decrease the feedrate speeds, I wanna use these commands from the XBoxC

I looked up the OEM codes for

feedrate reset = 1014
feedrate +      =277
feedrate -       =278

I will make three files as per documentation
Macro-XBtn1.mls Macro-XBtn2.mls Macro-XBtn3.mls
and assign them to buttons etc on the xbox 360 controller

my question is:-

what do I write in Macro-XBtn1.mls if I want the to "for example" reset the feedrate

regards

Title: Re: using auto tool zero with xbox controller
Post by: Ford Prefect on September 15, 2016, 06:58:53 AM
got a bit nearer, still doesnt work though

rem code start
DoOEMButton (1014) 'feedrate reset
Title: Re: using auto tool zero with xbox controller
Post by: Ford Prefect on September 16, 2016, 04:23:17 AM
I have figured it out last night took me a while, I ended up downloading a pdf called

Mach3 V3.x Programmer Reference Draft v0.11a.pdf at the bottom of page 15

See also:   DoButton(), DoOEMButton()   
Mach3 v3.x VB Programmers Reference Manual 
Page 16
DoOEMButton Sub DoOEMButton(OEMButtonCode As Integer) 
This function allows a macro to execute any on-screen button function which has an assigned Button OEM code.  The specified function is invoked exactly as if the user had clicked the corresponding onscreen button with the mouse.  Note that no actual on-screen button need exist for this function to work.  This is simply an easy means to execute any of the “OEM Button” functions through VB. 
Arguments: OEMButtonCode must be one of the pre-defined Mach3 OEM Button Code constants (see VB Constants), or other value or expression that evaluates to one of those values.
Return Value:  None
Example: ‘ Define OEM codes for Mist On and Mist Off

Dim OEMButtonMistOn As Integer OEMButtonMistOn = 226
Dim OEMButtonMistOff As Integer OEMButtonMistOff = 227
‘ Turn Mist coolant on for 3 seconds
DoOEMButton(OEMButtonMistOn)
Sleep(3000)
DoOEMButton(OEMButtonMistOff)


See also:   DoButton(), DoOEMButton(), DoMenu()


so I figured this was the way to go


------*******------


   rem title DoOEMButton (278) 'feedrate -

   rem Define OEM codes feedrate down

Dim OEMButtonfeedrateDown  As Integer
OEMButtonfeedrateDown = 278

   rem Turn the feedrate down

DoOEMButton(OEMButtonfeedrateDown)
DoOEMButton(OEMButtonfeedrateDown)

------*******------

if you need bigger increments just add more of the last 2 lines
Title: Re: using auto tool zero with xbox controller
Post by: Charlie_M on September 16, 2016, 04:43:04 AM
 Thanks for sharing your results. I had no idea of how to do what you wanted.
Title: xbox shilling controller problem
Post by: Weldster on January 23, 2017, 10:46:21 AM
I've been trying to get the shilling controller going for way too long I have two computers doing the same thing one has a fresh install windows 7 .I get the same message every time if anyone knows what I'm doing wrong I would appreciate it. I have followed all the instructions several times but I'm sure at this point I have something wrong.
Title: Re: using auto tool zero with xbox controller
Post by: rockaukum on January 11, 2018, 02:09:28 PM
Charlie,
I have been working on getting the xbox controller up and running and got it now.  My quest to have auto tool zero work from the controller has come up short.  When I get to configuring the controller, when I enter "M701.m1s" into the "custom Macro #1" field, I get and error that states "please enter and integer"  got any help for this?  I am attempting this on the house computer before I head to the shop and give it a go there.  No internet service in the shop.
Thanks much,
ra
Title: Re: using auto tool zero with xbox controller
Post by: rockaukum on January 11, 2018, 03:34:55 PM
So after re-reading the posts on this topic, I see someone mentioned there are complete instructions on the download page.  After reading that I find that instead of entering "M701.m1s" into the "custom macro field" i should only enter the "701" portion and not the whole enchilada.  Took this information to the shop and gave it a go.  All works great!
Many thanks to those who post this valuable information!
ra