Assisted Tramming improvements (#20298)

This commit is contained in:
qwewer0 2021-01-02 09:33:31 +01:00 committed by GitHub
parent 5eaa10e2ad
commit e685950d97
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 86 additions and 42 deletions

View File

@ -813,8 +813,8 @@
#define RESTORE_LEVELING_AFTER_G35 // Enable to restore leveling setup after operation #define RESTORE_LEVELING_AFTER_G35 // Enable to restore leveling setup after operation
//#define REPORT_TRAMMING_MM // Report Z deviation (mm) for each point relative to the first //#define REPORT_TRAMMING_MM // Report Z deviation (mm) for each point relative to the first
//#define ASSISTED_TRAMMING_MENU_ITEM // Add a menu item to run G35 Assisted Tramming (MarlinUI) //#define ASSISTED_TRAMMING_WIZARD // Add a Tramming Wizard to the LCD menu
//#define ASSISTED_TRAMMING_WIZARD // Make the menu item open a Tramming Wizard sub-menu
//#define ASSISTED_TRAMMING_WAIT_POSITION { X_CENTER, Y_CENTER, 30 } // Move the nozzle out of the way for adjustment //#define ASSISTED_TRAMMING_WAIT_POSITION { X_CENTER, Y_CENTER, 30 } // Move the nozzle out of the way for adjustment
/** /**

View File

@ -0,0 +1,63 @@
/**
* Marlin 3D Printer Firmware
* Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
*
* Based on Sprinter and grbl.
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
*/
#include "../inc/MarlinConfigPre.h"
#if ENABLED(ASSISTED_TRAMMING)
#include "tramming.h"
#define DEBUG_OUT ENABLED(DEBUG_LEVELING_FEATURE)
#include "../core/debug_out.h"
PGMSTR(point_name_1, TRAMMING_POINT_NAME_1);
PGMSTR(point_name_2, TRAMMING_POINT_NAME_2);
PGMSTR(point_name_3, TRAMMING_POINT_NAME_3);
#ifdef TRAMMING_POINT_NAME_4
PGMSTR(point_name_4, TRAMMING_POINT_NAME_4);
#ifdef TRAMMING_POINT_NAME_5
PGMSTR(point_name_5, TRAMMING_POINT_NAME_5);
#endif
#endif
PGM_P const tramming_point_name[] PROGMEM = {
point_name_1, point_name_2, point_name_3
#ifdef TRAMMING_POINT_NAME_4
, point_name_4
#ifdef TRAMMING_POINT_NAME_5
, point_name_5
#endif
#endif
};
#ifdef ASSISTED_TRAMMING_WAIT_POSITION
// Move to the defined wait position
void move_to_tramming_wait_pos() {
constexpr xyz_pos_t wait_pos = ASSISTED_TRAMMING_WAIT_POSITION;
if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("Moving away");
do_blocking_move_to(wait_pos, XY_PROBE_FEEDRATE_MM_S);
}
#endif
#endif // ASSISTED_TRAMMING

View File

@ -19,8 +19,9 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
* *
*/ */
#pragma once
#include "../inc/MarlinConfigPre.h" #include "../inc/MarlinConfig.h"
#include "../module/probe.h" #include "../module/probe.h"
#if !WITHIN(TRAMMING_SCREW_THREAD, 30, 51) || TRAMMING_SCREW_THREAD % 10 > 1 #if !WITHIN(TRAMMING_SCREW_THREAD, 30, 51) || TRAMMING_SCREW_THREAD % 10 > 1
@ -62,3 +63,9 @@ static_assert(_NR_TRAM_NAMES >= G35_PROBE_COUNT, "Define enough TRAMMING_POINT_N
#undef _NR_TRAM_NAMES #undef _NR_TRAM_NAMES
extern PGM_P const tramming_point_name[]; extern PGM_P const tramming_point_name[];
#ifdef ASSISTED_TRAMMING_WAIT_POSITION
void move_to_tramming_wait_pos();
#else
inline void move_to_tramming_wait_pos() {}
#endif

View File

@ -40,27 +40,7 @@
// Define tramming point names. // Define tramming point names.
// //
#include "../../feature/tramming.h" // Validate #include "../../feature/tramming.h"
PGMSTR(point_name_1, TRAMMING_POINT_NAME_1);
PGMSTR(point_name_2, TRAMMING_POINT_NAME_2);
PGMSTR(point_name_3, TRAMMING_POINT_NAME_3);
#ifdef TRAMMING_POINT_NAME_4
PGMSTR(point_name_4, TRAMMING_POINT_NAME_4);
#ifdef TRAMMING_POINT_NAME_5
PGMSTR(point_name_5, TRAMMING_POINT_NAME_5);
#endif
#endif
PGM_P const tramming_point_name[] PROGMEM = {
point_name_1, point_name_2, point_name_3
#ifdef TRAMMING_POINT_NAME_4
, point_name_4
#ifdef TRAMMING_POINT_NAME_5
, point_name_5
#endif
#endif
};
/** /**
* G35: Read bed corners to help adjust bed screws * G35: Read bed corners to help adjust bed screws
@ -178,11 +158,10 @@ void GcodeSuite::G35() {
// the probe deployed if it was successful. // the probe deployed if it was successful.
probe.stow(); probe.stow();
move_to_tramming_wait_pos();
// After this operation the Z position needs correction // After this operation the Z position needs correction
set_axis_never_homed(Z_AXIS); set_axis_never_homed(Z_AXIS);
// Home Z after the alignment procedure
process_subcommands_now_P(PSTR("G28Z"));
} }
#endif // ASSISTED_TRAMMING #endif // ASSISTED_TRAMMING

View File

@ -541,6 +541,8 @@
#else #else
#error "FIL_RUNOUT_INVERTING false is now FIL_RUNOUT_STATE LOW." #error "FIL_RUNOUT_INVERTING false is now FIL_RUNOUT_STATE LOW."
#endif #endif
#elif defined(ASSISTED_TRAMMING_MENU_ITEM)
#error "ASSISTED_TRAMMING_MENU_ITEM is deprecated and should be removed."
#endif #endif
/** /**

View File

@ -365,8 +365,6 @@ void menu_motion() {
// //
#if ENABLED(ASSISTED_TRAMMING_WIZARD) #if ENABLED(ASSISTED_TRAMMING_WIZARD)
SUBMENU(MSG_TRAMMING_WIZARD, goto_tramming_wizard); SUBMENU(MSG_TRAMMING_WIZARD, goto_tramming_wizard);
#elif ENABLED(ASSISTED_TRAMMING_MENU_ITEM)
GCODES_ITEM(MSG_ASSISTED_TRAMMING, PSTR("G35"));
#endif #endif
// //

View File

@ -42,24 +42,18 @@
float z_measured[G35_PROBE_COUNT] = { 0 }; float z_measured[G35_PROBE_COUNT] = { 0 };
static uint8_t tram_index = 0; static uint8_t tram_index = 0;
bool probe_single_point() { static bool probe_single_point() {
do_blocking_move_to_z(TERN(BLTOUCH, Z_CLEARANCE_DEPLOY_PROBE, Z_CLEARANCE_BETWEEN_PROBES)); do_blocking_move_to_z(TERN(BLTOUCH, Z_CLEARANCE_DEPLOY_PROBE, Z_CLEARANCE_BETWEEN_PROBES));
// Stow after each point with BLTouch "HIGH SPEED" mode for push-pin safety // Stow after each point with BLTouch "HIGH SPEED" mode for push-pin safety
const float z_probed_height = probe.probe_at_point(screws_tilt_adjust_pos[tram_index], TERN(BLTOUCH_HS_MODE, PROBE_PT_STOW, PROBE_PT_RAISE), 0, true); const float z_probed_height = probe.probe_at_point(screws_tilt_adjust_pos[tram_index], TERN(BLTOUCH_HS_MODE, PROBE_PT_STOW, PROBE_PT_RAISE), 0, true);
DEBUG_ECHOLNPAIR("probe_single_point: ", z_probed_height, "mm"); DEBUG_ECHOLNPAIR("probe_single_point: ", z_probed_height, "mm");
z_measured[tram_index] = z_probed_height; z_measured[tram_index] = z_probed_height;
move_to_tramming_wait_pos();
#ifdef ASSISTED_TRAMMING_WAIT_POSITION
// Move XY to safe position
if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("Moving away");
const xyz_pos_t wait_pos = ASSISTED_TRAMMING_WAIT_POSITION;
do_blocking_move_to(wait_pos, XY_PROBE_FEEDRATE_MM_S);
#endif
return !isnan(z_probed_height); return !isnan(z_probed_height);
} }
void _menu_single_probe(const uint8_t point) { static void _menu_single_probe(const uint8_t point) {
tram_index = point; tram_index = point;
DEBUG_ECHOLNPAIR("Screen: single probe screen Arg:", point); DEBUG_ECHOLNPAIR("Screen: single probe screen Arg:", point);
START_MENU(); START_MENU();
@ -70,7 +64,7 @@ void _menu_single_probe(const uint8_t point) {
END_MENU(); END_MENU();
} }
void tramming_wizard_menu() { static void tramming_wizard_menu() {
DEBUG_ECHOLNPAIR("Screen: tramming_wizard_menu"); DEBUG_ECHOLNPAIR("Screen: tramming_wizard_menu");
START_MENU(); START_MENU();
STATIC_ITEM(MSG_SELECT_ORIGIN); STATIC_ITEM(MSG_SELECT_ORIGIN);
@ -91,7 +85,6 @@ void goto_tramming_wizard() {
DEBUG_ECHOLNPAIR("Screen: goto_tramming_wizard", 1); DEBUG_ECHOLNPAIR("Screen: goto_tramming_wizard", 1);
tram_index = 0; tram_index = 0;
ui.defer_status_screen(); ui.defer_status_screen();
//probe_single_point(); // Probe first point to get differences
// Inject G28, wait for homing to complete, // Inject G28, wait for homing to complete,
set_all_unhomed(); set_all_unhomed();

View File

@ -14,7 +14,8 @@ opt_set TEMP_SENSOR_BED 2
opt_set GRID_MAX_POINTS_X 16 opt_set GRID_MAX_POINTS_X 16
opt_set FANMUX0_PIN 53 opt_set FANMUX0_PIN 53
opt_enable S_CURVE_ACCELERATION EEPROM_SETTINGS GCODE_MACROS \ opt_enable S_CURVE_ACCELERATION EEPROM_SETTINGS GCODE_MACROS \
FIX_MOUNTED_PROBE Z_SAFE_HOMING CODEPENDENT_XY_HOMING ASSISTED_TRAMMING ASSISTED_TRAMMING_WIZARD \ FIX_MOUNTED_PROBE Z_SAFE_HOMING CODEPENDENT_XY_HOMING \
ASSISTED_TRAMMING ASSISTED_TRAMMING_WIZARD REPORT_TRAMMING_MM ASSISTED_TRAMMING_WAIT_POSITION \
EEPROM_SETTINGS SDSUPPORT BINARY_FILE_TRANSFER \ EEPROM_SETTINGS SDSUPPORT BINARY_FILE_TRANSFER \
BLINKM PCA9533 PCA9632 RGB_LED RGB_LED_R_PIN RGB_LED_G_PIN RGB_LED_B_PIN LED_CONTROL_MENU \ BLINKM PCA9533 PCA9632 RGB_LED RGB_LED_R_PIN RGB_LED_G_PIN RGB_LED_B_PIN LED_CONTROL_MENU \
NEOPIXEL_LED CASE_LIGHT_ENABLE CASE_LIGHT_USE_NEOPIXEL CASE_LIGHT_MENU \ NEOPIXEL_LED CASE_LIGHT_ENABLE CASE_LIGHT_USE_NEOPIXEL CASE_LIGHT_MENU \

View File

@ -106,6 +106,7 @@ default_src_filter = +<src/*> -<src/config> -<src/HAL> +<src/HAL/shared>
-<src/feature/solenoid.cpp> -<src/gcode/control/M380_M381.cpp> -<src/feature/solenoid.cpp> -<src/gcode/control/M380_M381.cpp>
-<src/feature/spindle_laser.cpp> -<src/gcode/control/M3-M5.cpp> -<src/feature/spindle_laser.cpp> -<src/gcode/control/M3-M5.cpp>
-<src/feature/tmc_util.cpp> -<src/module/stepper/trinamic.cpp> -<src/feature/tmc_util.cpp> -<src/module/stepper/trinamic.cpp>
-<src/feature/tramming.cpp>
-<src/feature/twibus.cpp> -<src/feature/twibus.cpp>
-<src/feature/z_stepper_align.cpp> -<src/feature/z_stepper_align.cpp>
-<src/gcode/bedlevel/G26.cpp> -<src/gcode/bedlevel/G26.cpp>
@ -323,7 +324,7 @@ MECHANICAL_GANTRY_CAL.+ = src_filter=+<src/gcode/calibrate/G34.cpp>
Z_MULTI_ENDSTOPS = src_filter=+<src/gcode/calibrate/G34_M422.cpp> Z_MULTI_ENDSTOPS = src_filter=+<src/gcode/calibrate/G34_M422.cpp>
Z_STEPPER_AUTO_ALIGN = src_filter=+<src/feature/z_stepper_align.cpp> +<src/gcode/calibrate/G34_M422.cpp> Z_STEPPER_AUTO_ALIGN = src_filter=+<src/feature/z_stepper_align.cpp> +<src/gcode/calibrate/G34_M422.cpp>
G26_MESH_VALIDATION = src_filter=+<src/gcode/bedlevel/G26.cpp> G26_MESH_VALIDATION = src_filter=+<src/gcode/bedlevel/G26.cpp>
ASSISTED_TRAMMING = src_filter=+<src/gcode/bedlevel/G35.cpp> ASSISTED_TRAMMING = src_filter=+<src/feature/tramming.cpp> +<src/gcode/bedlevel/G35.cpp>
HAS_MESH = src_filter=+<src/gcode/bedlevel/G42.cpp> HAS_MESH = src_filter=+<src/gcode/bedlevel/G42.cpp>
HAS_LEVELING = src_filter=+<src/gcode/bedlevel/M420.cpp> HAS_LEVELING = src_filter=+<src/gcode/bedlevel/M420.cpp>
DELTA_AUTO_CALIBRATION = src_filter=+<src/gcode/calibrate/G33.cpp> DELTA_AUTO_CALIBRATION = src_filter=+<src/gcode/calibrate/G33.cpp>