소스 검색

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
  * With mesh-based leveling only:
49
  * With mesh-based leveling only:
50
  *
50
  *
51
  *   C         Center mesh on the mean of the lowest and highest
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
 void GcodeSuite::M420() {
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
   // If disabling leveling do it right away
80
   // If disabling leveling do it right away
58
   // (Don't disable for just M420 or M420 V)
81
   // (Don't disable for just M420 or M420 V)

Loading…
취소
저장