From 2f6c57eadc17ac9b15b493843229f1eae43cfaa2 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Sun, 5 Oct 2014 13:35:45 -0700 Subject: [PATCH] Proposed feature: Set Home Offsets MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add an item to the LCD menu that applies the current axis position to the “add_homeing” offset. --- Marlin/language.h | 11 +++++++++++ Marlin/ultralcd.cpp | 18 ++++++++++++++++++ 2 files changed, 29 insertions(+) diff --git a/Marlin/language.h b/Marlin/language.h index 54ca5bc622..0028722095 100644 --- a/Marlin/language.h +++ b/Marlin/language.h @@ -155,6 +155,7 @@ #define MSG_AUTOSTART "Autostart" #define MSG_DISABLE_STEPPERS "Disable steppers" #define MSG_AUTO_HOME "Auto home" + #define MSG_SET_HOME_OFFSETS "Set home offsets" #define MSG_SET_ORIGIN "Set origin" #define MSG_PREHEAT_PLA "Preheat PLA" #define MSG_PREHEAT_PLA0 "Preheat PLA 1" @@ -279,6 +280,7 @@ #define MSG_AUTOSTART "Autostart" #define MSG_DISABLE_STEPPERS "Wylacz silniki" #define MSG_AUTO_HOME "Auto. poz. zerowa" + #define MSG_SET_HOME_OFFSETS "Set home offsets" #define MSG_SET_ORIGIN "Ustaw punkt zero" #define MSG_PREHEAT_PLA "Rozgrzej PLA" #define MSG_PREHEAT_PLA0 "Rozgrzej PLA 1" @@ -406,6 +408,7 @@ #define MSG_AUTOSTART "Demarrage auto" #define MSG_DISABLE_STEPPERS "Arreter moteurs" #define MSG_AUTO_HOME "Home auto." + #define MSG_SET_HOME_OFFSETS "Set home offsets" #define MSG_SET_ORIGIN "Regler origine" #define MSG_PREHEAT_PLA " Prechauffage PLA" #define MSG_PREHEAT_PLA0 "Prechauff. PLA 1" @@ -534,6 +537,7 @@ #define MSG_AUTOSTART "Autostart" #define MSG_DISABLE_STEPPERS "Stepper abschalt." #define MSG_AUTO_HOME "Auto Nullpunkt" + #define MSG_SET_HOME_OFFSETS "Set home offsets" #define MSG_SET_ORIGIN "Setze Nullpunkt" #define MSG_PREHEAT_PLA "Vorwärmen PLA" #define MSG_PREHEAT_PLA0 "Vorwärmen PLA 1" @@ -661,6 +665,7 @@ #define MSG_AUTOSTART " Autostart" #define MSG_DISABLE_STEPPERS "Apagar motores" #define MSG_AUTO_HOME "Llevar al origen" + #define MSG_SET_HOME_OFFSETS "Set home offsets" #define MSG_SET_ORIGIN "Establecer cero" #define MSG_PREHEAT_PLA "Precalentar PLA" #define MSG_PREHEAT_PLA0 "Precalentar PLA 1" @@ -794,6 +799,7 @@ #define MSG_AUTOSTART "Автостарт" #define MSG_DISABLE_STEPPERS "Выкл. двигатели" #define MSG_AUTO_HOME "Парковка" + #define MSG_SET_HOME_OFFSETS "Set home offsets" #define MSG_SET_ORIGIN "Запомнить ноль" #define MSG_PREHEAT_PLA "Преднагрев PLA" #define MSG_PREHEAT_PLA0 "Преднагрев PLA0" @@ -919,6 +925,7 @@ #define MSG_AUTOSTART "Autostart" #define MSG_DISABLE_STEPPERS "Disabilita Motori" #define MSG_AUTO_HOME "Auto Home" + #define MSG_SET_HOME_OFFSETS "Set home offsets" #define MSG_SET_ORIGIN "Imposta Origine" #define MSG_PREHEAT_PLA "Preriscalda PLA" #define MSG_PREHEAT_PLA0 "Preriscalda PLA 1" @@ -1044,6 +1051,7 @@ #define MSG_AUTOSTART "Autostart" #define MSG_DISABLE_STEPPERS " Apagar motores" #define MSG_AUTO_HOME "Ir para origen" + #define MSG_SET_HOME_OFFSETS "Set home offsets" #define MSG_SET_ORIGIN "Estabelecer orig." #define MSG_PREHEAT_PLA "Pre-aquecer PLA" #define MSG_PREHEAT_PLA0 " pre-aquecer PLA 1" @@ -1176,6 +1184,7 @@ #define MSG_AUTOSTART "Automaatti" #define MSG_DISABLE_STEPPERS "Vapauta moottorit" #define MSG_AUTO_HOME "Aja referenssiin" + #define MSG_SET_HOME_OFFSETS "Set home offsets" #define MSG_SET_ORIGIN "Aseta origo" #define MSG_PREHEAT_PLA "Esilammita PLA" #define MSG_PREHEAT_PLA0 "Esilammita PLA 1" @@ -1299,6 +1308,7 @@ #define MSG_AUTOSTART " Autostart" #define MSG_DISABLE_STEPPERS "Amortar motors" #define MSG_AUTO_HOME "Levar a l'orichen" + #define MSG_SET_HOME_OFFSETS "Set home offsets" #define MSG_SET_ORIGIN "Establir zero" #define MSG_PREHEAT_PLA "Precalentar PLA" #define MSG_PREHEAT_PLA0 "Precalentar PLA0" @@ -1431,6 +1441,7 @@ #define MSG_AUTOSTART "Autostart" #define MSG_DISABLE_STEPPERS "Motoren uit" #define MSG_AUTO_HOME "Auto home" + #define MSG_SET_HOME_OFFSETS "Set home offsets" #define MSG_SET_ORIGIN "Nulpunt instellen" #define MSG_PREHEAT_PLA "PLA voorverwarmen" #define MSG_PREHEAT_PLA0 "PLA voorverw. 0" diff --git a/Marlin/ultralcd.cpp b/Marlin/ultralcd.cpp index fb2ddbfffa..dfe0658c1f 100644 --- a/Marlin/ultralcd.cpp +++ b/Marlin/ultralcd.cpp @@ -307,6 +307,23 @@ static void lcd_autostart_sd() } #endif +void lcd_set_home_offsets() +{ + for(int8_t i=0; i < NUM_AXIS; i++) { + if (i != E_AXIS) { + add_homeing[i] -= current_position[i]; + current_position[i] = 0.0; + } + } + plan_set_position(0.0, 0.0, 0.0, current_position[E_AXIS]); + + // Audio feedback + enquecommand_P(PSTR("M300 S659 P200")); + enquecommand_P(PSTR("M300 S698 P200")); + lcd_return_to_status(); +} + + #ifdef BABYSTEPPING static void lcd_babystep_x() { @@ -566,6 +583,7 @@ static void lcd_prepare_menu() #endif MENU_ITEM(gcode, MSG_DISABLE_STEPPERS, PSTR("M84")); MENU_ITEM(gcode, MSG_AUTO_HOME, PSTR("G28")); + MENU_ITEM(function, MSG_SET_HOME_OFFSETS, lcd_set_home_offsets); //MENU_ITEM(gcode, MSG_SET_ORIGIN, PSTR("G92 X0 Y0 Z0")); #if TEMP_SENSOR_0 != 0 #if TEMP_SENSOR_1 != 0 || TEMP_SENSOR_2 != 0 || TEMP_SENSOR_BED != 0