소스 검색

Tramming Wizard submenu option (#20000)

Co-authored-by: Scott Lahteine <thinkyhead@users.noreply.github.com>
Speaka 4 년 전
부모
커밋
6954772ece
No account linked to committer's email address

+ 3
- 1
Marlin/Configuration_adv.h 파일 보기

@@ -808,7 +808,9 @@
808 808
 
809 809
   #define RESTORE_LEVELING_AFTER_G35    // Enable to restore leveling setup after operation
810 810
   //#define REPORT_TRAMMING_MM          // Report Z deviation (mm) for each point relative to the first
811
-  //#define ASSISTED_TRAMMING_MENU_ITEM // Add a menu item for Assisted Tramming
811
+
812
+  //#define ASSISTED_TRAMMING_MENU_ITEM // Add a menu item to run G35 Assisted Tramming (MarlinUI)
813
+  //#define ASSISTED_TRAMMING_WIZARD    // Make the menu item open a Tramming Wizard sub-menu
812 814
 
813 815
   /**
814 816
    * Screw thread:

+ 59
- 0
Marlin/src/feature/tramming.h 파일 보기

@@ -0,0 +1,59 @@
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 !WITHIN(TRAMMING_SCREW_THREAD, 30, 51) || TRAMMING_SCREW_THREAD % 10 > 1
26
+  #error "TRAMMING_SCREW_THREAD must be equal to 30, 31, 40, 41, 50, or 51."
27
+#endif
28
+
29
+constexpr xy_pos_t screws_tilt_adjust_pos[] = TRAMMING_POINT_XY;
30
+
31
+#define G35_PROBE_COUNT COUNT(screws_tilt_adjust_pos)
32
+static_assert(G35_PROBE_COUNT >= 3, "TRAMMING_POINT_XY requires at least 3 XY positions.");
33
+
34
+extern const char point_name_1[], point_name_2[], point_name_3[]
35
+  #ifdef TRAMMING_POINT_NAME_4
36
+    , point_name_4[]
37
+    #ifdef TRAMMING_POINT_NAME_5
38
+      , point_name_5[]
39
+    #endif
40
+  #endif
41
+;
42
+
43
+#define _NR_TRAM_NAMES 2
44
+#ifdef TRAMMING_POINT_NAME_3
45
+  #undef _NR_TRAM_NAMES
46
+  #define _NR_TRAM_NAMES 3
47
+  #ifdef TRAMMING_POINT_NAME_4
48
+    #undef _NR_TRAM_NAMES
49
+    #define _NR_TRAM_NAMES 4
50
+    #ifdef TRAMMING_POINT_NAME_5
51
+      #undef _NR_TRAM_NAMES
52
+      #define _NR_TRAM_NAMES 5
53
+    #endif
54
+  #endif
55
+#endif
56
+static_assert(_NR_TRAM_NAMES >= G35_PROBE_COUNT, "Define enough TRAMMING_POINT_NAME_s for all TRAMMING_POINT_XY entries.");
57
+#undef _NR_TRAM_NAMES
58
+
59
+extern PGM_P const tramming_point_name[];

+ 11
- 15
Marlin/src/gcode/bedlevel/G35.cpp 파일 보기

@@ -36,19 +36,23 @@
36 36
 #define DEBUG_OUT ENABLED(DEBUG_LEVELING_FEATURE)
37 37
 #include "../../core/debug_out.h"
38 38
 
39
-constexpr xy_pos_t screws_tilt_adjust_pos[] = TRAMMING_POINT_XY;
39
+//
40
+// Define tramming point names.
41
+//
40 42
 
41
-static PGMSTR(point_name_1, TRAMMING_POINT_NAME_1);
42
-static PGMSTR(point_name_2, TRAMMING_POINT_NAME_2);
43
-static PGMSTR(point_name_3, TRAMMING_POINT_NAME_3);
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);
44 48
 #ifdef TRAMMING_POINT_NAME_4
45
-  static PGMSTR(point_name_4, TRAMMING_POINT_NAME_4);
49
+  PGMSTR(point_name_4, TRAMMING_POINT_NAME_4);
46 50
   #ifdef TRAMMING_POINT_NAME_5
47
-    static PGMSTR(point_name_5, TRAMMING_POINT_NAME_5);
51
+    PGMSTR(point_name_5, TRAMMING_POINT_NAME_5);
48 52
   #endif
49 53
 #endif
50 54
 
51
-static PGM_P const tramming_point_name[] PROGMEM = {
55
+PGM_P const tramming_point_name[] PROGMEM = {
52 56
   point_name_1, point_name_2, point_name_3
53 57
   #ifdef TRAMMING_POINT_NAME_4
54 58
     , point_name_4
@@ -58,14 +62,6 @@ static PGM_P const tramming_point_name[] PROGMEM = {
58 62
   #endif
59 63
 };
60 64
 
61
-#define G35_PROBE_COUNT COUNT(screws_tilt_adjust_pos)
62
-
63
-#if !WITHIN(TRAMMING_SCREW_THREAD, 30, 51) || TRAMMING_SCREW_THREAD % 10 > 1
64
-  #error "TRAMMING_SCREW_THREAD must be equal to 30, 31, 40, 41, 50, or 51."
65
-#endif
66
-
67
-static_assert(G35_PROBE_COUNT > 2, "TRAMMING_POINT_XY requires at least 3 XY positions.");
68
-
69 65
 /**
70 66
  * G35: Read bed corners to help adjust bed screws
71 67
  *

+ 5
- 1
Marlin/src/lcd/language/language_en.h 파일 보기

@@ -73,7 +73,6 @@ namespace Language_en {
73 73
   PROGMEM Language_Str MSG_AUTO_HOME_Y                     = _UxGT("Home Y");
74 74
   PROGMEM Language_Str MSG_AUTO_HOME_Z                     = _UxGT("Home Z");
75 75
   PROGMEM Language_Str MSG_AUTO_Z_ALIGN                    = _UxGT("Auto Z-Align");
76
-  PROGMEM Language_Str MSG_ASSISTED_TRAMMING               = _UxGT("Assisted Tramming");
77 76
   PROGMEM Language_Str MSG_ITERATION                       = _UxGT("G34 Iteration: %i");
78 77
   PROGMEM Language_Str MSG_DECREASING_ACCURACY             = _UxGT("Accuracy Decreasing!");
79 78
   PROGMEM Language_Str MSG_ACCURACY_ACHIEVED               = _UxGT("Accuracy Achieved");
@@ -85,6 +84,10 @@ namespace Language_en {
85 84
   PROGMEM Language_Str MSG_SET_HOME_OFFSETS                = _UxGT("Set Home Offsets");
86 85
   PROGMEM Language_Str MSG_HOME_OFFSETS_APPLIED            = _UxGT("Offsets Applied");
87 86
   PROGMEM Language_Str MSG_SET_ORIGIN                      = _UxGT("Set Origin");
87
+  PROGMEM Language_Str MSG_ASSISTED_TRAMMING               = _UxGT("Assisted Tramming");
88
+  PROGMEM Language_Str MSG_TRAMMING_WIZARD                 = _UxGT("Tramming Wizard");
89
+  PROGMEM Language_Str MSG_SELECT_ORIGIN                   = _UxGT("Select Origin");
90
+  PROGMEM Language_Str MSG_LAST_VALUE_SP                   = _UxGT("Last value ");
88 91
   #if PREHEAT_COUNT
89 92
     PROGMEM Language_Str MSG_PREHEAT_1                     = _UxGT("Preheat ") PREHEAT_1_LABEL;
90 93
     PROGMEM Language_Str MSG_PREHEAT_1_H                   = _UxGT("Preheat ") PREHEAT_1_LABEL " ~";
@@ -666,6 +669,7 @@ namespace Language_en {
666 669
   PROGMEM Language_Str MSG_REHEATING                       = _UxGT("Reheating...");
667 670
 
668 671
   PROGMEM Language_Str MSG_PROBE_WIZARD                    = _UxGT("Z Probe Wizard");
672
+
669 673
   PROGMEM Language_Str MSG_SOUND                           = _UxGT("Sound");
670 674
 }
671 675
 

+ 7
- 1
Marlin/src/lcd/menu/menu_motion.cpp 파일 보기

@@ -305,6 +305,10 @@ void menu_move() {
305 305
   void menu_bed_leveling();
306 306
 #endif
307 307
 
308
+#if ENABLED(ASSISTED_TRAMMING_WIZARD)
309
+  void goto_tramming_wizard();
310
+#endif
311
+
308 312
 void menu_motion() {
309 313
   START_MENU();
310 314
 
@@ -346,7 +350,9 @@ void menu_motion() {
346 350
   //
347 351
   // Assisted Bed Tramming
348 352
   //
349
-  #if ENABLED(ASSISTED_TRAMMING_MENU_ITEM)
353
+  #if ENABLED(ASSISTED_TRAMMING_WIZARD)
354
+    SUBMENU(MSG_TRAMMING_WIZARD, goto_tramming_wizard);
355
+  #elif ENABLED(ASSISTED_TRAMMING_MENU_ITEM)
350 356
     GCODES_ITEM(MSG_ASSISTED_TRAMMING, PSTR("G35"));
351 357
   #endif
352 358
 

+ 93
- 0
Marlin/src/lcd/menu/menu_tramming.cpp 파일 보기

@@ -0,0 +1,93 @@
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 <http://www.gnu.org/licenses/>.
20
+ *
21
+ */
22
+
23
+//
24
+// Bed Tramming Wizard
25
+//
26
+
27
+#include "../../inc/MarlinConfigPre.h"
28
+
29
+#if BOTH(HAS_LCD_MENU, ASSISTED_TRAMMING_WIZARD)
30
+
31
+#include "menu_item.h"
32
+
33
+#include "../../feature/tramming.h"
34
+
35
+#include "../../module/motion.h"
36
+#include "../../module/probe.h"
37
+#include "../../gcode/queue.h"
38
+
39
+//#define DEBUG_OUT 1
40
+#include "../../core/debug_out.h"
41
+
42
+float z_measured[G35_PROBE_COUNT] = { 0 };
43
+static uint8_t tram_index = 0;
44
+
45
+bool probe_single_point() {
46
+  const float z_probed_height = probe.probe_at_point(screws_tilt_adjust_pos[tram_index], PROBE_PT_RAISE, 0, true);
47
+  DEBUG_ECHOLNPAIR("probe_single_point: ", z_probed_height, "mm");
48
+  z_measured[tram_index] = z_probed_height;
49
+  return !isnan(z_probed_height);
50
+}
51
+
52
+void _menu_single_probe(const uint8_t point) {
53
+  tram_index = point;
54
+  DEBUG_ECHOLNPAIR("Screen: single probe screen Arg:", point);
55
+  START_MENU();
56
+  STATIC_ITEM(MSG_LEVEL_CORNERS, SS_LEFT);
57
+  STATIC_ITEM(MSG_LAST_VALUE_SP, SS_LEFT, ftostr42_52(z_measured[0] - z_measured[point])); // Print diff
58
+  ACTION_ITEM(MSG_UBL_BC_INSERT2, []{ if (probe_single_point()) ui.refresh(); });
59
+  ACTION_ITEM(MSG_BUTTON_DONE, []{ ui.goto_previous_screen_no_defer(); }); // Back
60
+  END_MENU();
61
+}
62
+
63
+void tramming_wizard_menu() {
64
+  DEBUG_ECHOLNPAIR("Screen: tramming_wizard_menu");
65
+  START_MENU();
66
+  STATIC_ITEM(MSG_SELECT_ORIGIN);
67
+
68
+  // Draw a menu item for each tramming point
69
+  LOOP_L_N(i, G35_PROBE_COUNT)
70
+    SUBMENU_N_P(i, (char*)pgm_read_ptr(&tramming_point_name[i]), []{ _menu_single_probe(MenuItemBase::itemIndex); });
71
+
72
+  ACTION_ITEM(MSG_BUTTON_DONE, []{ ui.goto_previous_screen_no_defer(); });
73
+  END_MENU();
74
+}
75
+
76
+// Init the wizard and enter the submenu
77
+void goto_tramming_wizard() {
78
+  DEBUG_ECHOLNPAIR("Screen: goto_tramming_wizard", 1);
79
+  tram_index = 0;
80
+  ui.defer_status_screen();
81
+  //probe_single_point(); // Probe first point to get differences
82
+
83
+  // Inject G28, wait for homing to complete,
84
+  set_all_unhomed();
85
+  queue.inject_P(G28_STR);
86
+  ui.goto_screen([]{
87
+    _lcd_draw_homing();
88
+    if (all_axes_homed())
89
+      ui.goto_screen(tramming_wizard_menu);
90
+  });
91
+}
92
+
93
+#endif // HAS_LCD_MENU && ASSISTED_TRAMMING_WIZARD

+ 3
- 0
buildroot/share/PlatformIO/scripts/common-dependencies.h 파일 보기

@@ -111,6 +111,9 @@
111 111
   #if ENABLED(TOUCH_SCREEN_CALIBRATION)
112 112
     #define HAS_MENU_TOUCH_SCREEN
113 113
   #endif
114
+  #if ENABLED(ASSISTED_TRAMMING_WIZARD)
115
+    #define HAS_MENU_TRAMMING
116
+  #endif
114 117
   #if ENABLED(AUTO_BED_LEVELING_UBL)
115 118
     #define HAS_MENU_UBL
116 119
   #endif

+ 1
- 1
buildroot/tests/DUE-tests 파일 보기

@@ -14,7 +14,7 @@ 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 \
17
+           FIX_MOUNTED_PROBE Z_SAFE_HOMING CODEPENDENT_XY_HOMING ASSISTED_TRAMMING ASSISTED_TRAMMING_WIZARD \
18 18
            EEPROM_SETTINGS SDSUPPORT BINARY_FILE_TRANSFER \
19 19
            BLINKM PCA9533 PCA9632 RGB_LED RGB_LED_R_PIN RGB_LED_G_PIN RGB_LED_B_PIN LED_CONTROL_MENU \
20 20
            NEOPIXEL_LED CASE_LIGHT_ENABLE CASE_LIGHT_USE_NEOPIXEL CASE_LIGHT_MENU \

+ 2
- 0
platformio.ini 파일 보기

@@ -48,6 +48,7 @@ default_src_filter = +<src/*> -<src/config> -<src/HAL> +<src/HAL/shared>
48 48
   -<src/lcd/menu/menu_temperature.cpp>
49 49
   -<src/lcd/menu/menu_tmc.cpp>
50 50
   -<src/lcd/menu/menu_touch_screen.cpp>
51
+  -<src/lcd/menu/menu_tramming.cpp>
51 52
   -<src/lcd/menu/menu_ubl.cpp>
52 53
   -<src/lcd/extui/lib/mks_ui>
53 54
   -<src/lcd/extui/lib/dgus> -<src/lcd/extui/dgus_lcd.cpp>
@@ -259,6 +260,7 @@ HAS_MENU_CUTTER         = src_filter=+<src/lcd/menu/menu_spindle_laser.cpp>
259 260
 HAS_MENU_TEMPERATURE    = src_filter=+<src/lcd/menu/menu_temperature.cpp>
260 261
 HAS_MENU_TMC            = src_filter=+<src/lcd/menu/menu_tmc.cpp>
261 262
 HAS_MENU_TOUCH_SCREEN   = src_filter=+<src/lcd/menu/menu_touch_screen.cpp>
263
+HAS_MENU_TRAMMING       = src_filter=+<src/lcd/menu/menu_tramming.cpp>
262 264
 HAS_MENU_UBL            = src_filter=+<src/lcd/menu/menu_ubl.cpp>
263 265
 ANYCUBIC_LCD_CHIRON     = src_filter=+<src/lcd/extui/anycubic_chiron_lcd.cpp> +<src/lcd/extui/lib/anycubic_chiron>
264 266
 ANYCUBIC_LCD_I3MEGA     = src_filter=+<src/lcd/extui/anycubic_i3mega_lcd.cpp> +<src/lcd/extui/lib/anycubic_i3mega>

Loading…
취소
저장