浏览代码

M420 support in MARLIN_DEV_MODE

Scott Lahteine 6 年前
父节点
当前提交
07a0822ebe
共有 1 个文件被更改,包括 25 次插入2 次删除
  1. 25
    2
      Marlin/src/gcode/bedlevel/M420.cpp

+ 25
- 2
Marlin/src/gcode/bedlevel/M420.cpp 查看文件

@@ -49,10 +49,33 @@
49 49
  * With mesh-based leveling only:
50 50
  *
51 51
  *   C         Center mesh on the mean of the lowest and highest
52
+ *
53
+ * With MARLIN_DEV_MODE:
54
+ *   S2        Create a simple random mesh and enable
52 55
  */
53 56
 void GcodeSuite::M420() {
54
-  const bool seen_S = parser.seen('S');
55
-  bool to_enable = seen_S ? parser.value_bool() : planner.leveling_active;
57
+  const bool seen_S = parser.seen('S'),
58
+             to_enable = seen_S ? parser.value_bool() : planner.leveling_active;
59
+
60
+  #if ENABLED(MARLIN_DEV_MODE)
61
+    if (parser.intval('S') == 2) {
62
+      #if ENABLED(AUTO_BED_LEVELING_BILINEAR)
63
+        bilinear_start[X_AXIS] = MIN_PROBE_X;
64
+        bilinear_start[Y_AXIS] = MIN_PROBE_Y;
65
+        bilinear_grid_spacing[X_AXIS] = (MAX_PROBE_X - (MIN_PROBE_X)) / (GRID_MAX_POINTS_X - 1);
66
+        bilinear_grid_spacing[Y_AXIS] = (MAX_PROBE_Y - (MIN_PROBE_Y)) / (GRID_MAX_POINTS_Y - 1);
67
+      #endif
68
+      for (uint8_t x = 0; x < GRID_MAX_POINTS_X; x++)
69
+        for (uint8_t y = 0; y < GRID_MAX_POINTS_Y; y++)
70
+          Z_VALUES(x, y) = 0.001 * random(-200, 200);
71
+      SERIAL_ECHOPGM("Simulated " STRINGIFY(GRID_MAX_POINTS_X) "x" STRINGIFY(GRID_MAX_POINTS_X) " mesh ");
72
+      SERIAL_ECHOPAIR(" (", MIN_PROBE_X);
73
+      SERIAL_CHAR(','); SERIAL_ECHO(MIN_PROBE_Y);
74
+      SERIAL_ECHOPAIR(")-(", MAX_PROBE_X);
75
+      SERIAL_CHAR(','); SERIAL_ECHO(MAX_PROBE_Y);
76
+      SERIAL_ECHOLNPGM(")");
77
+    }
78
+  #endif
56 79
 
57 80
   // If disabling leveling do it right away
58 81
   // (Don't disable for just M420 or M420 V)

正在加载...
取消
保存