Ver código fonte

Add "G29 S4" to fine tune Z level for Mesh Bed Leveling.

Also add mbl.z_offset to the EEPROM, bumping the version to V23.
Edward Patel 8 anos atrás
pai
commit
c606ed447a

+ 19
- 5
Marlin/Marlin_main.cpp Ver arquivo

@@ -2717,7 +2717,7 @@ inline void gcode_G28() {
2717 2717
 
2718 2718
 #if ENABLED(MESH_BED_LEVELING)
2719 2719
 
2720
-  enum MeshLevelingState { MeshReport, MeshStart, MeshNext, MeshSet };
2720
+  enum MeshLevelingState { MeshReport, MeshStart, MeshNext, MeshSet, MeshSetZOffset };
2721 2721
 
2722 2722
   /**
2723 2723
    * G29: Mesh-based Z probe, probes a grid and produces a
@@ -2729,21 +2729,22 @@ inline void gcode_G28() {
2729 2729
    *  S1              Start probing mesh points
2730 2730
    *  S2              Probe the next mesh point
2731 2731
    *  S3 Xn Yn Zn.nn  Manually modify a single point
2732
+   *  S4 Zn.nn        Set z offset. Positive away from bed, negative closer to bed.
2732 2733
    *
2733 2734
    * The S0 report the points as below
2734 2735
    *
2735
-   *  +----> X-axis
2736
+   *  +----> X-axis  1-n
2736 2737
    *  |
2737 2738
    *  |
2738
-   *  v Y-axis
2739
+   *  v Y-axis  1-n
2739 2740
    *
2740 2741
    */
2741 2742
   inline void gcode_G29() {
2742 2743
 
2743 2744
     static int probe_point = -1;
2744 2745
     MeshLevelingState state = code_seen('S') ? (MeshLevelingState)code_value_short() : MeshReport;
2745
-    if (state < 0 || state > 3) {
2746
-      SERIAL_PROTOCOLLNPGM("S out of range (0-3).");
2746
+    if (state < 0 || state > 4) {
2747
+      SERIAL_PROTOCOLLNPGM("S out of range (0-4).");
2747 2748
       return;
2748 2749
     }
2749 2750
 
@@ -2759,6 +2760,8 @@ inline void gcode_G28() {
2759 2760
           SERIAL_PROTOCOL(MESH_NUM_Y_POINTS);
2760 2761
           SERIAL_PROTOCOLPGM("\nZ search height: ");
2761 2762
           SERIAL_PROTOCOL(MESH_HOME_SEARCH_Z);
2763
+          SERIAL_PROTOCOLPGM("\nZ offset: ");
2764
+          SERIAL_PROTOCOL_F(mbl.z_offset, 5);
2762 2765
           SERIAL_PROTOCOLLNPGM("\nMeasured points:");
2763 2766
           for (int y = 0; y < MESH_NUM_Y_POINTS; y++) {
2764 2767
             for (int x = 0; x < MESH_NUM_X_POINTS; x++) {
@@ -2849,6 +2852,17 @@ inline void gcode_G28() {
2849 2852
           return;
2850 2853
         }
2851 2854
         mbl.z_values[iy][ix] = z;
2855
+        break;
2856
+
2857
+      case MeshSetZOffset:
2858
+        if (code_seen('Z')) {
2859
+          z = code_value();
2860
+        } 
2861
+        else {
2862
+          SERIAL_PROTOCOLPGM("Z not entered.\n");
2863
+          return;
2864
+        }
2865
+        mbl.z_offset = z;
2852 2866
 
2853 2867
     } // switch(state)
2854 2868
   }

+ 47
- 40
Marlin/configuration_store.cpp Ver arquivo

@@ -36,10 +36,10 @@
36 36
  *
37 37
  */
38 38
 
39
-#define EEPROM_VERSION "V22"
39
+#define EEPROM_VERSION "V23"
40 40
 
41 41
 /**
42
- * V21 EEPROM Layout:
42
+ * V23 EEPROM Layout:
43 43
  *
44 44
  *  100  Version (char x4)
45 45
  *
@@ -59,62 +59,65 @@
59 59
  *
60 60
  * Mesh bed leveling:
61 61
  *  200  M420 S    active (bool)
62
- *  201            mesh_num_x (uint8 as set in firmware)
63
- *  202            mesh_num_y (uint8 as set in firmware)
64
- *  203  M421 XYZ  z_values[][] (float x9, by default)
65
- *  239  M851      zprobe_zoffset (float)
62
+ *  201            z_offset (float) (added in V23)
63
+ *  205            mesh_num_x (uint8 as set in firmware)
64
+ *  206            mesh_num_y (uint8 as set in firmware)
65
+ *  207  M421 XYZ  z_values[][] (float x9, by default)
66
+ *
67
+ * AUTO BED LEVELING
68
+ *  243  M851      zprobe_zoffset (float)
66 69
  *
67 70
  * DELTA:
68
- *  243  M666 XYZ  endstop_adj (float x3)
69
- *  255  M665 R    delta_radius (float)
70
- *  259  M665 L    delta_diagonal_rod (float)
71
- *  263  M665 S    delta_segments_per_second (float)
72
- *  267  M665 A    delta_diagonal_rod_trim_tower_1 (float)
73
- *  271  M665 B    delta_diagonal_rod_trim_tower_2 (float)
74
- *  275  M665 C    delta_diagonal_rod_trim_tower_3 (float)
71
+ *  247  M666 XYZ  endstop_adj (float x3)
72
+ *  259  M665 R    delta_radius (float)
73
+ *  263  M665 L    delta_diagonal_rod (float)
74
+ *  267  M665 S    delta_segments_per_second (float)
75
+ *  271  M665 A    delta_diagonal_rod_trim_tower_1 (float)
76
+ *  275  M665 B    delta_diagonal_rod_trim_tower_2 (float)
77
+ *  279  M665 C    delta_diagonal_rod_trim_tower_3 (float)
75 78
  *
76 79
  * Z_DUAL_ENDSTOPS:
77
- *  279  M666 Z    z_endstop_adj (float)
80
+ *  283  M666 Z    z_endstop_adj (float)
78 81
  *
79 82
  * ULTIPANEL:
80
- *  283  M145 S0 H plaPreheatHotendTemp (int)
81
- *  285  M145 S0 B plaPreheatHPBTemp (int)
82
- *  287  M145 S0 F plaPreheatFanSpeed (int)
83
- *  289  M145 S1 H absPreheatHotendTemp (int)
84
- *  291  M145 S1 B absPreheatHPBTemp (int)
85
- *  293  M145 S1 F absPreheatFanSpeed (int)
83
+ *  287  M145 S0 H plaPreheatHotendTemp (int)
84
+ *  289  M145 S0 B plaPreheatHPBTemp (int)
85
+ *  291  M145 S0 F plaPreheatFanSpeed (int)
86
+ *  293  M145 S1 H absPreheatHotendTemp (int)
87
+ *  295  M145 S1 B absPreheatHPBTemp (int)
88
+ *  297  M145 S1 F absPreheatFanSpeed (int)
86 89
  *
87 90
  * PIDTEMP:
88
- *  295  M301 E0 PIDC  Kp[0], Ki[0], Kd[0], Kc[0] (float x4)
89
- *  311  M301 E1 PIDC  Kp[1], Ki[1], Kd[1], Kc[1] (float x4)
90
- *  327  M301 E2 PIDC  Kp[2], Ki[2], Kd[2], Kc[2] (float x4)
91
- *  343  M301 E3 PIDC  Kp[3], Ki[3], Kd[3], Kc[3] (float x4)
92
- *  359  M301 L        lpq_len (int)
91
+ *  299  M301 E0 PIDC  Kp[0], Ki[0], Kd[0], Kc[0] (float x4)
92
+ *  315  M301 E1 PIDC  Kp[1], Ki[1], Kd[1], Kc[1] (float x4)
93
+ *  331  M301 E2 PIDC  Kp[2], Ki[2], Kd[2], Kc[2] (float x4)
94
+ *  347  M301 E3 PIDC  Kp[3], Ki[3], Kd[3], Kc[3] (float x4)
95
+ *  363  M301 L        lpq_len (int)
93 96
  *
94 97
  * PIDTEMPBED:
95
- *  361  M304 PID  bedKp, bedKi, bedKd (float x3)
98
+ *  365  M304 PID  bedKp, bedKi, bedKd (float x3)
96 99
  *
97 100
  * DOGLCD:
98
- *  373  M250 C    lcd_contrast (int)
101
+ *  377  M250 C    lcd_contrast (int)
99 102
  *
100 103
  * SCARA:
101
- *  375  M365 XYZ  axis_scaling (float x3)
104
+ *  379  M365 XYZ  axis_scaling (float x3)
102 105
  *
103 106
  * FWRETRACT:
104
- *  387  M209 S    autoretract_enabled (bool)
105
- *  388  M207 S    retract_length (float)
106
- *  392  M207 W    retract_length_swap (float)
107
- *  396  M207 F    retract_feedrate (float)
108
- *  400  M207 Z    retract_zlift (float)
109
- *  404  M208 S    retract_recover_length (float)
110
- *  408  M208 W    retract_recover_length_swap (float)
111
- *  412  M208 F    retract_recover_feedrate (float)
107
+ *  391  M209 S    autoretract_enabled (bool)
108
+ *  392  M207 S    retract_length (float)
109
+ *  396  M207 W    retract_length_swap (float)
110
+ *  400  M207 F    retract_feedrate (float)
111
+ *  404  M207 Z    retract_zlift (float)
112
+ *  408  M208 S    retract_recover_length (float)
113
+ *  412  M208 W    retract_recover_length_swap (float)
114
+ *  416  M208 F    retract_recover_feedrate (float)
112 115
  *
113 116
  * Volumetric Extrusion:
114
- *  416  M200 D    volumetric_enabled (bool)
115
- *  417  M200 T D  filament_size (float x4) (T0..3)
117
+ *  420  M200 D    volumetric_enabled (bool)
118
+ *  421  M200 T D  filament_size (float x4) (T0..3)
116 119
  *
117
- *  433  This Slot is Available!
120
+ *  437  This Slot is Available!
118 121
  *
119 122
  */
120 123
 #include "Marlin.h"
@@ -192,15 +195,17 @@ void Config_StoreSettings()  {
192 195
     mesh_num_x = MESH_NUM_X_POINTS;
193 196
     mesh_num_y = MESH_NUM_Y_POINTS;
194 197
     EEPROM_WRITE_VAR(i, mbl.active);
198
+    EEPROM_WRITE_VAR(i, mbl.z_offset);
195 199
     EEPROM_WRITE_VAR(i, mesh_num_x);
196 200
     EEPROM_WRITE_VAR(i, mesh_num_y);
197 201
     EEPROM_WRITE_VAR(i, mbl.z_values);
198 202
   #else
199 203
     uint8_t dummy_uint8 = 0;
204
+    dummy = 0.0f;
200 205
     EEPROM_WRITE_VAR(i, dummy_uint8);
206
+    EEPROM_WRITE_VAR(i, dummy);
201 207
     EEPROM_WRITE_VAR(i, mesh_num_x);
202 208
     EEPROM_WRITE_VAR(i, mesh_num_y);
203
-    dummy = 0.0f;
204 209
     for (uint8_t q = 0; q < mesh_num_x * mesh_num_y; q++) EEPROM_WRITE_VAR(i, dummy);
205 210
   #endif // MESH_BED_LEVELING
206 211
 
@@ -366,10 +371,12 @@ void Config_RetrieveSettings() {
366 371
 
367 372
     uint8_t dummy_uint8 = 0, mesh_num_x = 0, mesh_num_y = 0;
368 373
     EEPROM_READ_VAR(i, dummy_uint8);
374
+    EEPROM_READ_VAR(i, dummy);
369 375
     EEPROM_READ_VAR(i, mesh_num_x);
370 376
     EEPROM_READ_VAR(i, mesh_num_y);
371 377
     #if ENABLED(MESH_BED_LEVELING)
372 378
       mbl.active = dummy_uint8;
379
+      mbl.z_offset = dummy;
373 380
       if (mesh_num_x == MESH_NUM_X_POINTS && mesh_num_y == MESH_NUM_Y_POINTS) {
374 381
         EEPROM_READ_VAR(i, mbl.z_values);
375 382
       } else {

+ 3
- 0
Marlin/language_en.h Ver arquivo

@@ -169,6 +169,9 @@
169 169
 #ifndef MSG_SPEED
170 170
   #define MSG_SPEED                           "Speed"
171 171
 #endif
172
+#ifndef MSG_BED_Z
173
+  #define MSG_BED_Z                           "Bed Z"
174
+#endif
172 175
 #ifndef MSG_NOZZLE
173 176
   #define MSG_NOZZLE                          "Nozzle"
174 177
 #endif

+ 1
- 0
Marlin/mesh_bed_leveling.cpp Ver arquivo

@@ -30,6 +30,7 @@
30 30
 
31 31
   void mesh_bed_leveling::reset() {
32 32
     active = 0;
33
+    z_offset = 0;
33 34
     for (int y = 0; y < MESH_NUM_Y_POINTS; y++)
34 35
       for (int x = 0; x < MESH_NUM_X_POINTS; x++)
35 36
         z_values[y][x] = 0;

+ 2
- 1
Marlin/mesh_bed_leveling.h Ver arquivo

@@ -30,6 +30,7 @@
30 30
   class mesh_bed_leveling {
31 31
   public:
32 32
     uint8_t active;
33
+    float z_offset;
33 34
     float z_values[MESH_NUM_Y_POINTS][MESH_NUM_X_POINTS];
34 35
 
35 36
     mesh_bed_leveling();
@@ -70,7 +71,7 @@
70 71
       float z0 = calc_z0(y0,
71 72
                          get_y(y_index), z1,
72 73
                          get_y(y_index + 1), z2);
73
-      return z0;
74
+      return z0 + z_offset;
74 75
     }
75 76
   };
76 77
 

+ 9
- 0
Marlin/ultralcd.cpp Ver arquivo

@@ -599,6 +599,11 @@ static void lcd_tune_menu() {
599 599
   //
600 600
   MENU_ITEM_EDIT(int3, MSG_SPEED, &feedrate_multiplier, 10, 999);
601 601
 
602
+  // Manual bed leveling, Bed Z:
603
+  #if ENABLED(MANUAL_BED_LEVELING)
604
+    MENU_ITEM_EDIT(float43, MSG_BED_Z, &mbl.z_offset, -1, 1);
605
+  #endif
606
+
602 607
   //
603 608
   // Nozzle:
604 609
   // Nozzle [1-4]:
@@ -1333,6 +1338,10 @@ static void lcd_control_motion_menu() {
1333 1338
   #if ENABLED(AUTO_BED_LEVELING_FEATURE)
1334 1339
     MENU_ITEM_EDIT(float32, MSG_ZPROBE_ZOFFSET, &zprobe_zoffset, Z_PROBE_OFFSET_RANGE_MIN, Z_PROBE_OFFSET_RANGE_MAX);
1335 1340
   #endif
1341
+  // Manual bed leveling, Bed Z:
1342
+  #if ENABLED(MANUAL_BED_LEVELING)
1343
+    MENU_ITEM_EDIT(float43, MSG_BED_Z, &mbl.z_offset, -1, 1);
1344
+  #endif
1336 1345
   MENU_ITEM_EDIT(float5, MSG_ACC, &acceleration, 10, 99000);
1337 1346
   MENU_ITEM_EDIT(float3, MSG_VXY_JERK, &max_xy_jerk, 1, 990);
1338 1347
   #if ENABLED(DELTA)

Carregando…
Cancelar
Salvar