Hi all!
I’m trying to find the uncompiled code for SpindleWarmup that comes with the Mach 4 Avid profile. I want to modify it for my specific spindle to turn on the air before hand, and turn it off when done.
Is that located anywhere? Otherwise I have to write my own in Lua.
You can ask AVID for it, but I would expect they won’t give it to you. They don’t provide any of the source code for thier modules as far as I know.
However, for what you want to do, you should be able to edit the code in the screen for the button to enable the warmup so that it turns on the air before calling the warmup routine, and then turns it off after. I see its a coroutine, so you might have to put a timer on the last part to turn off the air since I’m not sure if it will wait for the routine to be done before returning to the button code…I’m not a SW guy so I don’t know much about how the coroutines work in Lua.
That’s kind of what I figured. Looking at the screen script I see they have a global variable that they are setting and check when the spindle switch is hit.
AvidCNC is only licensed to use the compiled version and they actually do not have the source for a lot of that stuff.
AvidCNC’s Mach4 install is the bare minimum to get up and running. It is NOT a negative statement against AvidCNC, they never intended it to be everything to everyone. It’s more a starting place to set you off on the right track.
Ah, of course! I actually would be interested in a programmer job with Avid…I just need to learn a little more about Mach 4. So far, I added some code to turn on some signals. One is for the ATC, and the other is for turning on air pressure and the spindle fan when M3 starts. Lua has been pretty easy to program with.
Be careful, Lua doesn’t stop when you hit that cycle stop, pause or even worse, when you hit the e-stop.
About half my ATC code is checking error states in Mach4 and there are roughly 15 ways right now where I can still drop a tool if an error occurs during the M6.
Essentially the Lua engine is separate and independent of Mach4. Mach4 will update the values Lua needs when it feels like it…
I have broken a lot of very expensive equipment so yes, very scary. Mach4 is not on the same level as LinuxCNC or other commercial motion planners.
I am hoping April will be the big month. To be fair to AvidCNC and to respect their forum, my progress is covered under build logs. It is looking like the dust manifold will be first and will be independent of the tool carousel. So if you want static posts it will be a minor install. I think I might even make it a state machine for those who don’t mind losing the top 12 inches off the work envelop. The last foot will trigger the dust manifold to open so you can do a tool change.
Awesome! I checked out the thread. The build is looking really cool. I’ll definitely be following along. My Tormach run’s path pilot, which I’m sure you know is based off LinuxCNC. It is quite nice.