Browse Source

Assisted Tramming improvements (#20298)

qwewer0 3 years ago
parent
commit
e685950d97
No account linked to committer's email address

+ 2
- 2
Marlin/Configuration_adv.h View File

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

+ 63
- 0
Marlin/src/feature/tramming.cpp View File

@@ -0,0 +1,63 @@
1
+/**
2
+ * Marlin 3D Printer Firmware
3
+ * Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
4
+ *
5
+ * Based on Sprinter and grbl.
6
+ * Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
7
+ *
8
+ * This program is free software: you can redistribute it and/or modify
9
+ * it under the terms of the GNU General Public License as published by
10
+ * the Free Software Foundation, either version 3 of the License, or
11
+ * (at your option) any later version.
12
+ *
13
+ * This program is distributed in the hope that it will be useful,
14
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
+ * GNU General Public License for more details.
17
+ *
18
+ * You should have received a copy of the GNU General Public License
19
+ * along with this program.  If not, see <https://www.gnu.org/licenses/>.
20
+ *
21
+ */
22
+
23
+#include "../inc/MarlinConfigPre.h"
24
+
25
+#if ENABLED(ASSISTED_TRAMMING)
26
+
27
+#include "tramming.h"
28
+
29
+#define DEBUG_OUT ENABLED(DEBUG_LEVELING_FEATURE)
30
+#include "../core/debug_out.h"
31
+
32
+PGMSTR(point_name_1, TRAMMING_POINT_NAME_1);
33
+PGMSTR(point_name_2, TRAMMING_POINT_NAME_2);
34
+PGMSTR(point_name_3, TRAMMING_POINT_NAME_3);
35
+#ifdef TRAMMING_POINT_NAME_4
36
+  PGMSTR(point_name_4, TRAMMING_POINT_NAME_4);
37
+  #ifdef TRAMMING_POINT_NAME_5
38
+    PGMSTR(point_name_5, TRAMMING_POINT_NAME_5);
39
+  #endif
40
+#endif
41
+
42
+PGM_P const tramming_point_name[] PROGMEM = {
43
+  point_name_1, point_name_2, point_name_3
44
+  #ifdef TRAMMING_POINT_NAME_4
45
+    , point_name_4
46
+    #ifdef TRAMMING_POINT_NAME_5
47
+      , point_name_5
48
+    #endif
49
+  #endif
50
+};
51
+
52
+#ifdef ASSISTED_TRAMMING_WAIT_POSITION
53
+
54
+  // Move to the defined wait position
55
+  void move_to_tramming_wait_pos() {
56
+    constexpr xyz_pos_t wait_pos = ASSISTED_TRAMMING_WAIT_POSITION;
57
+    if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("Moving away");
58
+    do_blocking_move_to(wait_pos, XY_PROBE_FEEDRATE_MM_S);
59
+  }
60
+
61
+#endif
62
+
63
+#endif // ASSISTED_TRAMMING

+ 8
- 1
Marlin/src/feature/tramming.h View File

@@ -19,8 +19,9 @@
19 19
  * along with this program.  If not, see <https://www.gnu.org/licenses/>.
20 20
  *
21 21
  */
22
+#pragma once
22 23
 
23
-#include "../inc/MarlinConfigPre.h"
24
+#include "../inc/MarlinConfig.h"
24 25
 #include "../module/probe.h"
25 26
 
26 27
 #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
62 63
 #undef _NR_TRAM_NAMES
63 64
 
64 65
 extern PGM_P const tramming_point_name[];
66
+
67
+#ifdef ASSISTED_TRAMMING_WAIT_POSITION
68
+  void move_to_tramming_wait_pos();
69
+#else
70
+  inline void move_to_tramming_wait_pos() {}
71
+#endif

+ 3
- 24
Marlin/src/gcode/bedlevel/G35.cpp View File

@@ -40,27 +40,7 @@
40 40
 // Define tramming point names.
41 41
 //
42 42
 
43
-#include "../../feature/tramming.h" // Validate
44
-
45
-PGMSTR(point_name_1, TRAMMING_POINT_NAME_1);
46
-PGMSTR(point_name_2, TRAMMING_POINT_NAME_2);
47
-PGMSTR(point_name_3, TRAMMING_POINT_NAME_3);
48
-#ifdef TRAMMING_POINT_NAME_4
49
-  PGMSTR(point_name_4, TRAMMING_POINT_NAME_4);
50
-  #ifdef TRAMMING_POINT_NAME_5
51
-    PGMSTR(point_name_5, TRAMMING_POINT_NAME_5);
52
-  #endif
53
-#endif
54
-
55
-PGM_P const tramming_point_name[] PROGMEM = {
56
-  point_name_1, point_name_2, point_name_3
57
-  #ifdef TRAMMING_POINT_NAME_4
58
-    , point_name_4
59
-    #ifdef TRAMMING_POINT_NAME_5
60
-      , point_name_5
61
-    #endif
62
-  #endif
63
-};
43
+#include "../../feature/tramming.h"
64 44
 
65 45
 /**
66 46
  * G35: Read bed corners to help adjust bed screws
@@ -178,11 +158,10 @@ void GcodeSuite::G35() {
178 158
   // the probe deployed if it was successful.
179 159
   probe.stow();
180 160
 
161
+  move_to_tramming_wait_pos();
162
+
181 163
   // After this operation the Z position needs correction
182 164
   set_axis_never_homed(Z_AXIS);
183
-
184
-  // Home Z after the alignment procedure
185
-  process_subcommands_now_P(PSTR("G28Z"));
186 165
 }
187 166
 
188 167
 #endif // ASSISTED_TRAMMING

+ 2
- 0
Marlin/src/inc/SanityCheck.h View File

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

+ 0
- 2
Marlin/src/lcd/menu/menu_motion.cpp View File

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

+ 4
- 11
Marlin/src/lcd/menu/menu_tramming.cpp View File

@@ -42,24 +42,18 @@
42 42
 float z_measured[G35_PROBE_COUNT] = { 0 };
43 43
 static uint8_t tram_index = 0;
44 44
 
45
-bool probe_single_point() {
45
+static bool probe_single_point() {
46 46
   do_blocking_move_to_z(TERN(BLTOUCH, Z_CLEARANCE_DEPLOY_PROBE, Z_CLEARANCE_BETWEEN_PROBES));
47 47
   // Stow after each point with BLTouch "HIGH SPEED" mode for push-pin safety
48 48
   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);
49 49
   DEBUG_ECHOLNPAIR("probe_single_point: ", z_probed_height, "mm");
50 50
   z_measured[tram_index] = z_probed_height;
51
-
52
-  #ifdef ASSISTED_TRAMMING_WAIT_POSITION
53
-    // Move XY to safe position
54
-    if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("Moving away");
55
-    const xyz_pos_t wait_pos = ASSISTED_TRAMMING_WAIT_POSITION;
56
-    do_blocking_move_to(wait_pos, XY_PROBE_FEEDRATE_MM_S);
57
-  #endif
51
+  move_to_tramming_wait_pos();
58 52
 
59 53
   return !isnan(z_probed_height);
60 54
 }
61 55
 
62
-void _menu_single_probe(const uint8_t point) {
56
+static void _menu_single_probe(const uint8_t point) {
63 57
   tram_index = point;
64 58
   DEBUG_ECHOLNPAIR("Screen: single probe screen Arg:", point);
65 59
   START_MENU();
@@ -70,7 +64,7 @@ void _menu_single_probe(const uint8_t point) {
70 64
   END_MENU();
71 65
 }
72 66
 
73
-void tramming_wizard_menu() {
67
+static void tramming_wizard_menu() {
74 68
   DEBUG_ECHOLNPAIR("Screen: tramming_wizard_menu");
75 69
   START_MENU();
76 70
   STATIC_ITEM(MSG_SELECT_ORIGIN);
@@ -91,7 +85,6 @@ void goto_tramming_wizard() {
91 85
   DEBUG_ECHOLNPAIR("Screen: goto_tramming_wizard", 1);
92 86
   tram_index = 0;
93 87
   ui.defer_status_screen();
94
-  //probe_single_point(); // Probe first point to get differences
95 88
 
96 89
   // Inject G28, wait for homing to complete,
97 90
   set_all_unhomed();

+ 2
- 1
buildroot/tests/DUE-tests View File

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

+ 2
- 1
platformio.ini View File

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

Loading…
Cancel
Save