Dual endstop workflow

So, I’ve rebuilt the MPCNC and I have now added the dual endstop feature.

How do I take advantage of this when creating my gcode? There are features in Marlin for switching coordinate spaces (G54-59), should I look into this somehow? Currently I begin every file with G92 X0 Y0 Z0.

What I’m thinking is that I create my toolpaths like normal in F360, using a stock point or model point as origin, then when I’m at the machine I jog to this position and have marlin record the offset against the machine origin, so I can return to it even after powering off. How do I accomplish this?

 

I do it by hand. Home everything, move to what I want my new zero is, write it down. Not using the dual firmware though.

1 Like

Yep, I was hoping for a slightly more automated approach. Then again, I used the machine for 2 months using only pronterface since the LCD screen was broken :slight_smile:

Yes you can use multiple workspaces with the newest firmware. I just do it all in CAM though, knowing my offset if needed.

But what if you don’t know your work offset in CAM? Maybe I’m misunderstanding the workflow, but it’s only when you’re at the machine that you actually know exactly where in the machine coordinate space the stock origin is, correct?

Is there a G-code to take the current position and use it as work offset, effectively setting origin to the current position? E.g so I can start out by homing, then jog to the position where I want it to be. I then adjust the work offset and make current position my new origin. Now I can always return to this point with G0 X0 Y0, even after shutting off steppers, changing tools and rehoming again?

If you turn the machine off, it loses all it’s coordinates, that’s why I write down the new z position. You always get a repeatable zero by homing, then just G0 X123 Y134(or whatever), set your height then G92 X0 Y0 Z0 and you’re off to the races.

1 Like

You have to change the way you think about your project setup when you are using dual end stop homing.

I use it all the time and love the way tool changes work and the repeatability. I have the X0 Y0 set to the front left corner of the MPCNC and always set my project up with that in mind.

I have resurfaced my spoil board and now have a small ridge that runs along the X0 and Y0 that make it easy to set up a project.

2 Likes

So I think I have a manageable solution now. This is similar to how Barry does it, but I don’t have to write down the coordinates.

I added a command M429 that takes the current position and sets it as the (negative) work offset along the specified axis. There is already M428 that does almost the same, but it only works if you’re close to an endpoint and always sets for all three axis.

So now I can power up, home XY, jog to my zero pos on the workpiece, then issue “M429 XY” and this is now my new zero point. This survives if I rehome, and if I do M500, the work offset is stored in EEPROM and is restored on power up again.

Slick.

I wonder if there is something that can be done with existing commands, in particular G54-G59. I have used these work offsets for tool changes, but I haven’t tried saving to EEPROM and I dont know how they interact with homing.

I can envision an implementation where G28, G54, M114 always produces the same nonzero location regardless of where you have been, but I dont know if this is the actual behavior.

By the way, it appears that G53 does not work, so keep that in mind if you decide to experiment with this.

Cool!

I started looking into G54-G59, but it seemed as if everything is reset by G28 and those settings are never stored in EEPROM so I couldn’t get it to work the way I wanted. The solution I have now seems to work fine, I guess I’ll see if I run into a use case where it doesn’t work anymore.

I have a MKS TFT24 touch screen, which was kind of useless for CNC (it came with the MKS Gen L board) until I learned I can customize the buttons on it. Now I have buttons for directly homing XY, setting zero XY at current position and moving to zero XY (and the same set for Z).

Can you share the code for the TFT24 with us?

I plan on using a TFT32 for my MPCNC.

(Heck! My MPCNC is not even fully up and running yet, and I am already planning upgrades/changes - sigh…)

Here are my changes for the M429 command. In src\gcode\gcode.h, line 745, add a declaration of the function:

static void M429();

and in gcode.cpp, line 628, add a case statement to call it:

case 429: M429(); break; // M429: Apply current_position to home_offset, unconditionally

Then, in src\gcode\geometry\M206_M428.cpp, I put the actual code (at the end):

void GcodeSuite::M429() {
LOOP_XYZ(i)
if (parser.seen(axis_codes[i]))
set_home_offset((AxisEnum)i, -current_position[i]);
report_current_position();
}

I can get the TFT24 setup files later.