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
 // #define MANUAL_BED_LEVELING  // Add display menu option for bed leveling
387
 // #define MANUAL_BED_LEVELING  // Add display menu option for bed leveling
388
 // #define MESH_BED_LEVELING    // Enable mesh bed leveling
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
 #if defined(MESH_BED_LEVELING)
394
 #if defined(MESH_BED_LEVELING)
391
   #define MESH_MIN_X 10
395
   #define MESH_MIN_X 10
392
   #define MESH_MAX_X (X_MAX_POS - MESH_MIN_X)
396
   #define MESH_MAX_X (X_MAX_POS - MESH_MIN_X)

+ 46
- 8
Marlin/Marlin_main.cpp View File

2038
    *
2038
    *
2039
    * Parameters With MESH_BED_LEVELING:
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
   inline void gcode_G29() {
2054
   inline void gcode_G29() {
2047
 
2055
 
2052
     int state = 0;
2060
     int state = 0;
2053
     if (code_seen('S') || code_seen('s')) {
2061
     if (code_seen('S') || code_seen('s')) {
2054
       state = code_value_long();
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
         return;
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
       if (mbl.active) {
2070
       if (mbl.active) {
2063
         SERIAL_PROTOCOLPGM("Num X,Y: ");
2071
         SERIAL_PROTOCOLPGM("Num X,Y: ");
2064
         SERIAL_PROTOCOL(MESH_NUM_X_POINTS);
2072
         SERIAL_PROTOCOL(MESH_NUM_X_POINTS);
2078
         SERIAL_PROTOCOLPGM("Mesh bed leveling not active.\n");
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
       mbl.reset();
2091
       mbl.reset();
2084
       probe_point = 0;
2092
       probe_point = 0;
2085
       enquecommands_P(PSTR("G28"));
2093
       enquecommands_P(PSTR("G28"));
2086
       enquecommands_P(PSTR("G29 S2"));
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
       if (probe_point < 0) {
2098
       if (probe_point < 0) {
2091
         SERIAL_PROTOCOLPGM("Start mesh probing with \"G29 S1\" first.\n");
2099
         SERIAL_PROTOCOLPGM("Start mesh probing with \"G29 S1\" first.\n");
2119
       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);
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
       st_synchronize();
2128
       st_synchronize();
2121
       probe_point++;
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
 {
1795
 {
1796
   if (encoderPosition != 0) {
1796
   if (encoderPosition != 0) {
1797
     refresh_cmd_timeout();
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
     if (min_software_endstops && current_position[Z_AXIS] < Z_MIN_POS) current_position[Z_AXIS] = Z_MIN_POS;
1799
     if (min_software_endstops && current_position[Z_AXIS] < Z_MIN_POS) current_position[Z_AXIS] = Z_MIN_POS;
1800
     if (max_software_endstops && current_position[Z_AXIS] > Z_MAX_POS) current_position[Z_AXIS] = Z_MAX_POS;
1800
     if (max_software_endstops && current_position[Z_AXIS] > Z_MAX_POS) current_position[Z_AXIS] = Z_MAX_POS;
1801
     encoderPosition = 0;
1801
     encoderPosition = 0;
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);
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
     lcdDrawUpdate = 1;
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
   static bool debounce_click = false;
1806
   static bool debounce_click = false;
1807
   if (LCD_CLICKED) {
1807
   if (LCD_CLICKED) {
1808
     if (!debounce_click) {
1808
     if (!debounce_click) {

Loading…
Cancel
Save