Browse Source

Mesh bed leveling: Added G29 S3 + finer steps in manual probing.

* Use "G29 S3 Xn Yn Zn.nn" to modify bad probed point manually
* Changed manual Z steps from 0.05 to 0.025 and made brought it to Configuration.h
Edward Patel 10 years ago
parent
commit
6b91b7b411
3 changed files with 52 additions and 10 deletions
  1. 4
    0
      Marlin/Configuration.h
  2. 46
    8
      Marlin/Marlin_main.cpp
  3. 2
    2
      Marlin/ultralcd.cpp

+ 4
- 0
Marlin/Configuration.h View File

@@ -387,6 +387,10 @@ const bool Z_MAX_ENDSTOP_INVERTING = false; // set to true to invert the logic o
387 387
 // #define MANUAL_BED_LEVELING  // Add display menu option for bed leveling
388 388
 // #define MESH_BED_LEVELING    // Enable mesh bed leveling
389 389
 
390
+#if defined(MANUAL_BED_LEVELING)
391
+  #define MBL_Z_STEP 0.025
392
+#endif  // MANUAL_BED_LEVELING
393
+
390 394
 #if defined(MESH_BED_LEVELING)
391 395
   #define MESH_MIN_X 10
392 396
   #define MESH_MAX_X (X_MAX_POS - MESH_MIN_X)

+ 46
- 8
Marlin/Marlin_main.cpp View File

@@ -2038,10 +2038,18 @@ inline void gcode_G28() {
2038 2038
    *
2039 2039
    * Parameters With MESH_BED_LEVELING:
2040 2040
    *
2041
-   *  S0 Produce a mesh report
2042
-   *  S1 Start probing mesh points
2043
-   *  S2 Probe the next mesh point
2041
+   *  S0              Produce a mesh report
2042
+   *  S1              Start probing mesh points
2043
+   *  S2              Probe the next mesh point
2044
+   *  S3 Xn Yn Zn.nn  Manually modify a single point
2044 2045
    *
2046
+   * The S0 report the points as below
2047
+   *
2048
+   *  +----> X-axis
2049
+   *  |
2050
+   *  |
2051
+   *  v Y-axis
2052
+   *  
2045 2053
    */
2046 2054
   inline void gcode_G29() {
2047 2055
 
@@ -2052,13 +2060,13 @@ inline void gcode_G28() {
2052 2060
     int state = 0;
2053 2061
     if (code_seen('S') || code_seen('s')) {
2054 2062
       state = code_value_long();
2055
-      if (state < 0 || state > 2) {
2056
-        SERIAL_PROTOCOLPGM("S out of range (0-2).\n");
2063
+      if (state < 0 || state > 3) {
2064
+        SERIAL_PROTOCOLPGM("S out of range (0-3).\n");
2057 2065
         return;
2058 2066
       }
2059 2067
     }
2060 2068
 
2061
-    if (state == 0) { // Dump mesh_bed_leveling
2069
+    if (state == 0) { // Produce a mesh report
2062 2070
       if (mbl.active) {
2063 2071
         SERIAL_PROTOCOLPGM("Num X,Y: ");
2064 2072
         SERIAL_PROTOCOL(MESH_NUM_X_POINTS);
@@ -2078,14 +2086,14 @@ inline void gcode_G28() {
2078 2086
         SERIAL_PROTOCOLPGM("Mesh bed leveling not active.\n");
2079 2087
       }
2080 2088
 
2081
-    } else if (state == 1) { // Begin probing mesh points
2089
+    } else if (state == 1) { // Start probing mesh points
2082 2090
 
2083 2091
       mbl.reset();
2084 2092
       probe_point = 0;
2085 2093
       enquecommands_P(PSTR("G28"));
2086 2094
       enquecommands_P(PSTR("G29 S2"));
2087 2095
 
2088
-    } else if (state == 2) { // Goto next point
2096
+    } else if (state == 2) { // Probe the next mesh point
2089 2097
 
2090 2098
       if (probe_point < 0) {
2091 2099
         SERIAL_PROTOCOLPGM("Start mesh probing with \"G29 S1\" first.\n");
@@ -2119,6 +2127,36 @@ inline void gcode_G28() {
2119 2127
       plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], homing_feedrate[X_AXIS]/60, active_extruder);
2120 2128
       st_synchronize();
2121 2129
       probe_point++;
2130
+    } else if (state == 3) { // Manually modify a single point
2131
+      int ix, iy;
2132
+      float z;
2133
+      if (code_seen('X') || code_seen('x')) {
2134
+        ix = code_value_long()-1;
2135
+        if (ix < 0 || ix >= MESH_NUM_X_POINTS) {
2136
+          SERIAL_PROTOCOLPGM("X out of range (1-" STRINGIFY(MESH_NUM_X_POINTS) ").\n");
2137
+          return;
2138
+        }
2139
+      } else {
2140
+          SERIAL_PROTOCOLPGM("X not entered.\n");
2141
+          return;
2142
+      }
2143
+      if (code_seen('Y') || code_seen('y')) {
2144
+        iy = code_value_long()-1;
2145
+        if (iy < 0 || iy >= MESH_NUM_Y_POINTS) {
2146
+          SERIAL_PROTOCOLPGM("Y out of range (1-" STRINGIFY(MESH_NUM_Y_POINTS) ").\n");
2147
+          return;
2148
+        }
2149
+      } else {
2150
+          SERIAL_PROTOCOLPGM("Y not entered.\n");
2151
+          return;
2152
+      }
2153
+      if (code_seen('Z') || code_seen('z')) {
2154
+        z = code_value();
2155
+      } else {
2156
+          SERIAL_PROTOCOLPGM("Z not entered.\n");
2157
+          return;
2158
+      }
2159
+      mbl.z_values[iy][ix] = z;
2122 2160
     }
2123 2161
   }
2124 2162
 

+ 2
- 2
Marlin/ultralcd.cpp View File

@@ -1795,14 +1795,14 @@ static void _lcd_level_bed()
1795 1795
 {
1796 1796
   if (encoderPosition != 0) {
1797 1797
     refresh_cmd_timeout();
1798
-    current_position[Z_AXIS] += float((int)encoderPosition) * 0.05;
1798
+    current_position[Z_AXIS] += float((int)encoderPosition) * MBL_Z_STEP;
1799 1799
     if (min_software_endstops && current_position[Z_AXIS] < Z_MIN_POS) current_position[Z_AXIS] = Z_MIN_POS;
1800 1800
     if (max_software_endstops && current_position[Z_AXIS] > Z_MAX_POS) current_position[Z_AXIS] = Z_MAX_POS;
1801 1801
     encoderPosition = 0;
1802 1802
     plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], manual_feedrate[Z_AXIS]/60, active_extruder);
1803 1803
     lcdDrawUpdate = 1;
1804 1804
   }
1805
-  if (lcdDrawUpdate) lcd_implementation_drawedit(PSTR("Z"), ftostr32(current_position[Z_AXIS]));
1805
+  if (lcdDrawUpdate) lcd_implementation_drawedit(PSTR("Z"), ftostr43(current_position[Z_AXIS]));
1806 1806
   static bool debounce_click = false;
1807 1807
   if (LCD_CLICKED) {
1808 1808
     if (!debounce_click) {

Loading…
Cancel
Save