Browse Source

Assisted Tramming improvements (#20298)

vanilla_fb_2.0.x
qwewer0 4 years ago
committed by GitHub
parent
commit
e685950d97
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      Marlin/Configuration_adv.h
  2. 63
      Marlin/src/feature/tramming.cpp
  3. 9
      Marlin/src/feature/tramming.h
  4. 27
      Marlin/src/gcode/bedlevel/G35.cpp
  5. 2
      Marlin/src/inc/SanityCheck.h
  6. 2
      Marlin/src/lcd/menu/menu_motion.cpp
  7. 15
      Marlin/src/lcd/menu/menu_tramming.cpp
  8. 3
      buildroot/tests/DUE-tests
  9. 3
      platformio.ini

4
Marlin/Configuration_adv.h

@ -813,8 +813,8 @@
#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 ASSISTED_TRAMMING_MENU_ITEM // Add a menu item to run G35 Assisted Tramming (MarlinUI)
//#define ASSISTED_TRAMMING_WIZARD // Make the menu item open a Tramming Wizard sub-menu
//#define ASSISTED_TRAMMING_WIZARD // Add a Tramming Wizard to the LCD menu
//#define ASSISTED_TRAMMING_WAIT_POSITION { X_CENTER, Y_CENTER, 30 } // Move the nozzle out of the way for adjustment
/**

63
Marlin/src/feature/tramming.cpp

@ -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

9
Marlin/src/feature/tramming.h

@ -19,8 +19,9 @@
* 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"
#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
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

27
Marlin/src/gcode/bedlevel/G35.cpp

@ -40,27 +40,7 @@
// Define tramming point names.
//
#include "../../feature/tramming.h" // Validate
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
};
#include "../../feature/tramming.h"
/**
* G35: Read bed corners to help adjust bed screws
@ -178,11 +158,10 @@ void GcodeSuite::G35() {
// the probe deployed if it was successful.
probe.stow();
move_to_tramming_wait_pos();
// After this operation the Z position needs correction
set_axis_never_homed(Z_AXIS);
// Home Z after the alignment procedure
process_subcommands_now_P(PSTR("G28Z"));
}
#endif // ASSISTED_TRAMMING

2
Marlin/src/inc/SanityCheck.h

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

2
Marlin/src/lcd/menu/menu_motion.cpp

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

15
Marlin/src/lcd/menu/menu_tramming.cpp

@ -42,24 +42,18 @@
float z_measured[G35_PROBE_COUNT] = { 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));
// 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);
DEBUG_ECHOLNPAIR("probe_single_point: ", z_probed_height, "mm");
z_measured[tram_index] = z_probed_height;
#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
move_to_tramming_wait_pos();
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;
DEBUG_ECHOLNPAIR("Screen: single probe screen Arg:", point);
START_MENU();
@ -70,7 +64,7 @@ void _menu_single_probe(const uint8_t point) {
END_MENU();
}
void tramming_wizard_menu() {
static void tramming_wizard_menu() {
DEBUG_ECHOLNPAIR("Screen: tramming_wizard_menu");
START_MENU();
STATIC_ITEM(MSG_SELECT_ORIGIN);
@ -91,7 +85,6 @@ void goto_tramming_wizard() {
DEBUG_ECHOLNPAIR("Screen: goto_tramming_wizard", 1);
tram_index = 0;
ui.defer_status_screen();
//probe_single_point(); // Probe first point to get differences
// Inject G28, wait for homing to complete,
set_all_unhomed();

3
buildroot/tests/DUE-tests

@ -14,7 +14,8 @@ opt_set TEMP_SENSOR_BED 2
opt_set GRID_MAX_POINTS_X 16
opt_set FANMUX0_PIN 53
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 \
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 \

3
platformio.ini

@ -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/spindle_laser.cpp> -<src/gcode/control/M3-M5.cpp>
-<src/feature/tmc_util.cpp> -<src/module/stepper/trinamic.cpp>
-<src/feature/tramming.cpp>
-<src/feature/twibus.cpp>
-<src/feature/z_stepper_align.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_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>
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_LEVELING = src_filter=+<src/gcode/bedlevel/M420.cpp>
DELTA_AUTO_CALIBRATION = src_filter=+<src/gcode/calibrate/G33.cpp>

Loading…
Cancel
Save