浏览代码

Assisted Tramming improvements (#20298)

qwewer0 4 年前
父节点
当前提交
e685950d97
没有帐户链接到提交者的电子邮件

+ 2
- 2
Marlin/Configuration_adv.h 查看文件

813
   #define RESTORE_LEVELING_AFTER_G35    // Enable to restore leveling setup after operation
813
   #define RESTORE_LEVELING_AFTER_G35    // Enable to restore leveling setup after operation
814
   //#define REPORT_TRAMMING_MM          // Report Z deviation (mm) for each point relative to the first
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
   //#define ASSISTED_TRAMMING_WAIT_POSITION { X_CENTER, Y_CENTER, 30 } // Move the nozzle out of the way for adjustment
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 查看文件

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 查看文件

19
  * along with this program.  If not, see <https://www.gnu.org/licenses/>.
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
 #include "../module/probe.h"
25
 #include "../module/probe.h"
25
 
26
 
26
 #if !WITHIN(TRAMMING_SCREW_THREAD, 30, 51) || TRAMMING_SCREW_THREAD % 10 > 1
27
 #if !WITHIN(TRAMMING_SCREW_THREAD, 30, 51) || TRAMMING_SCREW_THREAD % 10 > 1
62
 #undef _NR_TRAM_NAMES
63
 #undef _NR_TRAM_NAMES
63
 
64
 
64
 extern PGM_P const tramming_point_name[];
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 查看文件

40
 // Define tramming point names.
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
  * G35: Read bed corners to help adjust bed screws
46
  * G35: Read bed corners to help adjust bed screws
178
   // the probe deployed if it was successful.
158
   // the probe deployed if it was successful.
179
   probe.stow();
159
   probe.stow();
180
 
160
 
161
+  move_to_tramming_wait_pos();
162
+
181
   // After this operation the Z position needs correction
163
   // After this operation the Z position needs correction
182
   set_axis_never_homed(Z_AXIS);
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
 #endif // ASSISTED_TRAMMING
167
 #endif // ASSISTED_TRAMMING

+ 2
- 0
Marlin/src/inc/SanityCheck.h 查看文件

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

+ 0
- 2
Marlin/src/lcd/menu/menu_motion.cpp 查看文件

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

+ 4
- 11
Marlin/src/lcd/menu/menu_tramming.cpp 查看文件

42
 float z_measured[G35_PROBE_COUNT] = { 0 };
42
 float z_measured[G35_PROBE_COUNT] = { 0 };
43
 static uint8_t tram_index = 0;
43
 static uint8_t tram_index = 0;
44
 
44
 
45
-bool probe_single_point() {
45
+static bool probe_single_point() {
46
   do_blocking_move_to_z(TERN(BLTOUCH, Z_CLEARANCE_DEPLOY_PROBE, Z_CLEARANCE_BETWEEN_PROBES));
46
   do_blocking_move_to_z(TERN(BLTOUCH, Z_CLEARANCE_DEPLOY_PROBE, Z_CLEARANCE_BETWEEN_PROBES));
47
   // Stow after each point with BLTouch "HIGH SPEED" mode for push-pin safety
47
   // Stow after each point with BLTouch "HIGH SPEED" mode for push-pin safety
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);
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
   DEBUG_ECHOLNPAIR("probe_single_point: ", z_probed_height, "mm");
49
   DEBUG_ECHOLNPAIR("probe_single_point: ", z_probed_height, "mm");
50
   z_measured[tram_index] = z_probed_height;
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
   return !isnan(z_probed_height);
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
   tram_index = point;
57
   tram_index = point;
64
   DEBUG_ECHOLNPAIR("Screen: single probe screen Arg:", point);
58
   DEBUG_ECHOLNPAIR("Screen: single probe screen Arg:", point);
65
   START_MENU();
59
   START_MENU();
70
   END_MENU();
64
   END_MENU();
71
 }
65
 }
72
 
66
 
73
-void tramming_wizard_menu() {
67
+static void tramming_wizard_menu() {
74
   DEBUG_ECHOLNPAIR("Screen: tramming_wizard_menu");
68
   DEBUG_ECHOLNPAIR("Screen: tramming_wizard_menu");
75
   START_MENU();
69
   START_MENU();
76
   STATIC_ITEM(MSG_SELECT_ORIGIN);
70
   STATIC_ITEM(MSG_SELECT_ORIGIN);
91
   DEBUG_ECHOLNPAIR("Screen: goto_tramming_wizard", 1);
85
   DEBUG_ECHOLNPAIR("Screen: goto_tramming_wizard", 1);
92
   tram_index = 0;
86
   tram_index = 0;
93
   ui.defer_status_screen();
87
   ui.defer_status_screen();
94
-  //probe_single_point(); // Probe first point to get differences
95
 
88
 
96
   // Inject G28, wait for homing to complete,
89
   // Inject G28, wait for homing to complete,
97
   set_all_unhomed();
90
   set_all_unhomed();

+ 2
- 1
buildroot/tests/DUE-tests 查看文件

14
 opt_set GRID_MAX_POINTS_X 16
14
 opt_set GRID_MAX_POINTS_X 16
15
 opt_set FANMUX0_PIN 53
15
 opt_set FANMUX0_PIN 53
16
 opt_enable S_CURVE_ACCELERATION EEPROM_SETTINGS GCODE_MACROS \
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
            EEPROM_SETTINGS SDSUPPORT BINARY_FILE_TRANSFER \
19
            EEPROM_SETTINGS SDSUPPORT BINARY_FILE_TRANSFER \
19
            BLINKM PCA9533 PCA9632 RGB_LED RGB_LED_R_PIN RGB_LED_G_PIN RGB_LED_B_PIN LED_CONTROL_MENU \
20
            BLINKM PCA9533 PCA9632 RGB_LED RGB_LED_R_PIN RGB_LED_G_PIN RGB_LED_B_PIN LED_CONTROL_MENU \
20
            NEOPIXEL_LED CASE_LIGHT_ENABLE CASE_LIGHT_USE_NEOPIXEL CASE_LIGHT_MENU \
21
            NEOPIXEL_LED CASE_LIGHT_ENABLE CASE_LIGHT_USE_NEOPIXEL CASE_LIGHT_MENU \

+ 2
- 1
platformio.ini 查看文件

106
   -<src/feature/solenoid.cpp> -<src/gcode/control/M380_M381.cpp>
106
   -<src/feature/solenoid.cpp> -<src/gcode/control/M380_M381.cpp>
107
   -<src/feature/spindle_laser.cpp> -<src/gcode/control/M3-M5.cpp>
107
   -<src/feature/spindle_laser.cpp> -<src/gcode/control/M3-M5.cpp>
108
   -<src/feature/tmc_util.cpp> -<src/module/stepper/trinamic.cpp>
108
   -<src/feature/tmc_util.cpp> -<src/module/stepper/trinamic.cpp>
109
+  -<src/feature/tramming.cpp>
109
   -<src/feature/twibus.cpp>
110
   -<src/feature/twibus.cpp>
110
   -<src/feature/z_stepper_align.cpp>
111
   -<src/feature/z_stepper_align.cpp>
111
   -<src/gcode/bedlevel/G26.cpp>
112
   -<src/gcode/bedlevel/G26.cpp>
323
 Z_MULTI_ENDSTOPS        = src_filter=+<src/gcode/calibrate/G34_M422.cpp>
324
 Z_MULTI_ENDSTOPS        = src_filter=+<src/gcode/calibrate/G34_M422.cpp>
324
 Z_STEPPER_AUTO_ALIGN    = src_filter=+<src/feature/z_stepper_align.cpp> +<src/gcode/calibrate/G34_M422.cpp>
325
 Z_STEPPER_AUTO_ALIGN    = src_filter=+<src/feature/z_stepper_align.cpp> +<src/gcode/calibrate/G34_M422.cpp>
325
 G26_MESH_VALIDATION     = src_filter=+<src/gcode/bedlevel/G26.cpp>
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
 HAS_MESH                = src_filter=+<src/gcode/bedlevel/G42.cpp>
328
 HAS_MESH                = src_filter=+<src/gcode/bedlevel/G42.cpp>
328
 HAS_LEVELING            = src_filter=+<src/gcode/bedlevel/M420.cpp>
329
 HAS_LEVELING            = src_filter=+<src/gcode/bedlevel/M420.cpp>
329
 DELTA_AUTO_CALIBRATION  = src_filter=+<src/gcode/calibrate/G33.cpp>
330
 DELTA_AUTO_CALIBRATION  = src_filter=+<src/gcode/calibrate/G33.cpp>

正在加载...
取消
保存