Dual endstop workflow

New Home Forum Mostly Printed CNC – MPCNC Advice – MPCNC Dual endstop workflow

This topic contains 12 replies, has 6 voices, and was last updated by  Magnus Hacker 1 month, 1 week ago.

Viewing 13 posts - 1 through 13 (of 13 total)
  • Author
    Posts
  • #103032

    Magnus Hacker
    Participant

    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?

     

    #103033

    Barry
    Participant

    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 user thanked author for this post.
    #103034

    Magnus Hacker
    Participant

    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 🙂

    #103049

    Ryan
    Keymaster

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

    #103132

    Magnus Hacker
    Participant

    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?

    #103176

    Barry
    Participant

    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 user thanked author for this post.
    #103219

    Todd Hansen
    Participant

    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 users thanked author for this post.
    #103293

    Magnus Hacker
    Participant

    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.

    #103295

    Jamie
    Participant

    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.

    #103297

    Barry
    Participant

    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.

    Cool!

    #103348

    Magnus Hacker
    Participant

    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.

    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).

    #105465

    Niels P. Andersen
    Participant

    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…)

    #106140

    Magnus Hacker
    Participant

    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))
          set_home_offset((AxisEnum)i, -current_position);
      report_current_position();
    }

    I can get the TFT24 setup files later.

    • This reply was modified 1 month, 1 week ago by  Magnus Hacker.
Viewing 13 posts - 1 through 13 (of 13 total)

You must be logged in to reply to this topic.