Kaynağa Gözat

Use M665 to set SCARA angle offsets

Scott Lahteine 8 yıl önce
ebeveyn
işleme
361cbba113
1 değiştirilmiş dosya ile 42 ekleme ve 0 silme
  1. 42
    0
      Marlin/Marlin_main.cpp

+ 42
- 0
Marlin/Marlin_main.cpp Dosyayı Görüntüle

@@ -7678,6 +7678,10 @@ inline void gcode_M205() {
7678 7678
 
7679 7679
   /**
7680 7680
    * M206: Set Additional Homing Offset (X Y Z). SCARA aliases T=X, P=Y
7681
+   *
7682
+   * *** @thinkyhead: I recommend deprecating M206 for SCARA in favor of M665.
7683
+   * ***              M206 for SCARA will remain enabled in 1.1.x for compatibility.
7684
+   * ***              In the next 1.2 release, it will simply be disabled by default.
7681 7685
    */
7682 7686
   inline void gcode_M206() {
7683 7687
     LOOP_XYZ(i)
@@ -7757,6 +7761,44 @@ inline void gcode_M205() {
7757 7761
     LOOP_XYZ(i) endstop_adj[i] -= z_temp;
7758 7762
   }
7759 7763
 
7764
+#elif IS_SCARA
7765
+
7766
+  /**
7767
+   * M665: Set SCARA settings
7768
+   *
7769
+   * Parameters:
7770
+   *
7771
+   *   S[segments-per-second] - Segments-per-second
7772
+   *   P[theta-psi-offset]    - Theta-Psi offset, added to the shoulder (A/X) angle
7773
+   *   T[theta-offset]        - Theta     offset, added to the elbow    (B/Y) angle
7774
+   *
7775
+   *   A, P, and X are all aliases for the shoulder angle
7776
+   *   B, T, and Y are all aliases for the elbow angle
7777
+   */
7778
+  inline void gcode_M665() {
7779
+    if (parser.seen('S')) delta_segments_per_second = parser.value_float();
7780
+
7781
+    const bool hasA = parser.seen('A'), hasP = parser.seen('P'), hasX = parser.seen('X');
7782
+    const uint8_t sumAPX = hasA + hasP + hasX;
7783
+    if (sumAPX == 1)
7784
+      home_offset[A_AXIS] = parser.value_float();
7785
+    else if (sumAPX > 1) {
7786
+      SERIAL_ERROR_START;
7787
+      SERIAL_ERRORLNPGM("Only one of A, P, or X is allowed.");
7788
+      return;
7789
+    }
7790
+
7791
+    const bool hasB = parser.seen('B'), hasT = parser.seen('T'), hasY = parser.seen('Y');
7792
+    const uint8_t sumBTY = hasB + hasT + hasY;
7793
+    if (sumBTY == 1)
7794
+      home_offset[B_AXIS] = parser.value_float();
7795
+    else if (sumBTY > 1) {
7796
+      SERIAL_ERROR_START;
7797
+      SERIAL_ERRORLNPGM("Only one of B, T, or Y is allowed.");
7798
+      return;
7799
+    }
7800
+  }
7801
+
7760 7802
 #elif ENABLED(Z_DUAL_ENDSTOPS) // !DELTA && ENABLED(Z_DUAL_ENDSTOPS)
7761 7803
 
7762 7804
   /**

Loading…
İptal
Kaydet