Zero all axis automatically

This may be common knowledge to most people here but thought I would share anyways. I’m not using end stops in my setup, and I some times forget to reset my Arduino when I line up my spindle before I begin my cut. I found just adding “G92 X0 Y0 Z0” to your beginning gcode will do the trick every time. Just thought I’d share…

I use that as one of the scripts in repetier, then button 1 on the manual control tab will set 0 for me.

Hah, that is a great idea. I wouldn’t use it when I 3D print but I will definitely add it to estlcam’s beginning gcode. I screw that up all the time and never thought about pre-zeroing it.

I’m thinking about incorporating this command to all of the programs that allow to edit the beginning gcode. Think it would help with 3D printing and Laser etching as well, right?

For me it wouldn’t be good for 3D printing. Once you set the 0,0,0 point and it finishes a job I just start another and it goes home by itself (the home I set). If you used this command you would have to set the home every time. I might be a little unusual as I rarely turn off the machine and it runs constantly.

I added it to my LCD menu a week ago :slight_smile:

You just need to edit the ultralcd.cpp file of the sketch. I’m on Marlin RC6 so the menu code is slightly different but here’s what I modified:

/**
 *
 * "Main" menu
 *
 */

static void lcd_main_menu() {
  START_MENU();
  MENU_ITEM(back, MSG_WATCH);
  if (movesplanned() || IS_SD_PRINTING) {
    MENU_ITEM(submenu, MSG_TUNE, lcd_tune_menu);
  }
  else {
    MENU_ITEM(submenu, MSG_PREPARE, lcd_prepare_menu);
    #if ENABLED(DELTA_CALIBRATION_MENU)
      MENU_ITEM(submenu, MSG_DELTA_CALIBRATE, lcd_delta_calibrate_menu);
    #endif
  }
  MENU_ITEM(gcode, MSG_SETHOME, PSTR("G92 X0 Y0 Z0"));
  MENU_ITEM(gcode, "Needle Off", PSTR("M280 P0 S0"));
  MENU_ITEM(gcode, "Needle Low", PSTR("M280 P0 S90"));
  MENU_ITEM(gcode, "Needle Med", PSTR("M280 P0 S135"));
  MENU_ITEM(gcode, "Needle Full", PSTR("M280 P0 S180"));

  MENU_ITEM(submenu, MSG_CONTROL, lcd_control_menu);

  #if ENABLED(SDSUPPORT)
    if (card.cardOK) {
      if (card.isFileOpen()) {
        if (card.sdprinting)
          MENU_ITEM(function, MSG_PAUSE_PRINT, lcd_sdcard_pause);
        else
          MENU_ITEM(function, MSG_RESUME_PRINT, lcd_sdcard_resume);
        MENU_ITEM(function, MSG_STOP_PRINT, lcd_sdcard_stop);
      }
      else {
        MENU_ITEM(submenu, MSG_CARD_MENU, lcd_sdcard_menu);
        #if !PIN_EXISTS(SD_DETECT)
          MENU_ITEM(gcode, MSG_CNG_SDCARD, PSTR("M21"));  // SD-card changed by user
        #endif
      }
    }
    else {
      MENU_ITEM(submenu, MSG_NO_CARD, lcd_sdcard_menu);
      #if !PIN_EXISTS(SD_DETECT)
        MENU_ITEM(gcode, MSG_INIT_SDCARD, PSTR("M21")); // Manually initialize the SD-card via user interface
      #endif
    }
  #endif //SDSUPPORT

  END_MENU();
}

The following lines are what I added:

 
MENU_ITEM(gcode, MSG_SETHOME, PSTR("G92 X0 Y0 Z0"));
MENU_ITEM(gcode, "Needle Off", PSTR("M280 P0 S0"));
MENU_ITEM(gcode, "Needle Low", PSTR("M280 P0 S90"));
MENU_ITEM(gcode, "Needle Med", PSTR("M280 P0 S135"));
MENU_ITEM(gcode, "Needle Full", PSTR("M280 P0 S180"));

The first line adds the new “set zero” command, the next 4 lines send servo commands to control the speed of the needle cutter I’m working on. This all shows up in my LCD on the main menu.

Oh yeah…you also have to edit language_en.h and add this at the end:
#define MSG_SETHOME "Set XYZ to 000"

I’ve actually since updated my code to use configurable strings for all of those commands…
I also ended up moving this all into a sub-menu and am working on adding other commands like “Raise Z by 15” and “Lower Z to 0” that are helpful. You can see my work in progress on my github, here’s the changes I’ve made to the menu’s so far: Moved MPCNC commands to submenu · jhitesma/Marlin-Folger@6988f45 · GitHub