Browse Source

Merge pull request #6848 from thinkyhead/bf_scara_M665

Add M665 for SCARA
Scott Lahteine 8 years ago
parent
commit
735405b2a4

+ 6
- 0
Marlin/Conditionals_post.h View File

788
     #define MAX_PROBE_X ( DELTA_PRINTABLE_RADIUS)
788
     #define MAX_PROBE_X ( DELTA_PRINTABLE_RADIUS)
789
     #define MIN_PROBE_Y (-DELTA_PRINTABLE_RADIUS)
789
     #define MIN_PROBE_Y (-DELTA_PRINTABLE_RADIUS)
790
     #define MAX_PROBE_Y ( DELTA_PRINTABLE_RADIUS)
790
     #define MAX_PROBE_Y ( DELTA_PRINTABLE_RADIUS)
791
+  #elif IS_SCARA
792
+    #define SCARA_PRINTABLE_RADIUS (SCARA_LINKAGE_1 + SCARA_LINKAGE_2)
793
+    #define MIN_PROBE_X (-SCARA_PRINTABLE_RADIUS)
794
+    #define MAX_PROBE_X ( SCARA_PRINTABLE_RADIUS)
795
+    #define MIN_PROBE_Y (-SCARA_PRINTABLE_RADIUS)
796
+    #define MAX_PROBE_Y ( SCARA_PRINTABLE_RADIUS)
791
   #else
797
   #else
792
     // Boundaries for probing based on set limits
798
     // Boundaries for probing based on set limits
793
     #define MIN_PROBE_X (max(X_MIN_POS, X_MIN_POS + X_PROBE_OFFSET_FROM_EXTRUDER))
799
     #define MIN_PROBE_X (max(X_MIN_POS, X_MIN_POS + X_PROBE_OFFSET_FROM_EXTRUDER))

+ 48
- 2
Marlin/Marlin_main.cpp View File

7678
 
7678
 
7679
   /**
7679
   /**
7680
    * M206: Set Additional Homing Offset (X Y Z). SCARA aliases T=X, P=Y
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
   inline void gcode_M206() {
7686
   inline void gcode_M206() {
7683
     LOOP_XYZ(i)
7687
     LOOP_XYZ(i)
7757
     LOOP_XYZ(i) endstop_adj[i] -= z_temp;
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
 #elif ENABLED(Z_DUAL_ENDSTOPS) // !DELTA && ENABLED(Z_DUAL_ENDSTOPS)
7802
 #elif ENABLED(Z_DUAL_ENDSTOPS) // !DELTA && ENABLED(Z_DUAL_ENDSTOPS)
7761
 
7803
 
7762
   /**
7804
   /**
11193
     if (!position_is_reachable_xy(ltarget[X_AXIS], ltarget[Y_AXIS])) return true;
11235
     if (!position_is_reachable_xy(ltarget[X_AXIS], ltarget[Y_AXIS])) return true;
11194
 
11236
 
11195
     // Get the cartesian distances moved in XYZE
11237
     // Get the cartesian distances moved in XYZE
11196
-    float difference[XYZE];
11197
-    LOOP_XYZE(i) difference[i] = ltarget[i] - current_position[i];
11238
+    const float difference[XYZE] = {
11239
+      ltarget[X_AXIS] - current_position[X_AXIS],
11240
+      ltarget[Y_AXIS] - current_position[Y_AXIS],
11241
+      ltarget[Z_AXIS] - current_position[Z_AXIS],
11242
+      ltarget[E_AXIS] - current_position[E_AXIS]
11243
+    };
11198
 
11244
 
11199
     // Get the linear distance in XYZ
11245
     // Get the linear distance in XYZ
11200
     float cartesian_mm = sqrt(sq(difference[X_AXIS]) + sq(difference[Y_AXIS]) + sq(difference[Z_AXIS]));
11246
     float cartesian_mm = sqrt(sq(difference[X_AXIS]) + sq(difference[Y_AXIS]) + sq(difference[Z_AXIS]));

+ 1
- 1
Marlin/configuration_store.cpp View File

1461
     #endif
1461
     #endif
1462
     SERIAL_EOL;
1462
     SERIAL_EOL;
1463
     #if ENABLED(DISTINCT_E_FACTORS)
1463
     #if ENABLED(DISTINCT_E_FACTORS)
1464
-      SERIAL_ECHO_START;
1464
+      CONFIG_ECHO_START;
1465
       for (uint8_t i = 0; i < E_STEPPERS; i++) {
1465
       for (uint8_t i = 0; i < E_STEPPERS; i++) {
1466
         SERIAL_ECHOPAIR("  M201 T", (int)i);
1466
         SERIAL_ECHOPAIR("  M201 T", (int)i);
1467
         SERIAL_ECHOLNPAIR(" E", VOLUMETRIC_UNIT(planner.max_acceleration_mm_per_s2[E_AXIS + i]));
1467
         SERIAL_ECHOLNPAIR(" E", VOLUMETRIC_UNIT(planner.max_acceleration_mm_per_s2[E_AXIS + i]));

+ 21
- 18
Marlin/pins_MEGATRONICS_3.h View File

143
 #define BTN_ENC            33
143
 #define BTN_ENC            33
144
 
144
 
145
 #if ENABLED(REPRAPWORLD_GRAPHICAL_LCD)
145
 #if ENABLED(REPRAPWORLD_GRAPHICAL_LCD)
146
+
146
   #define LCD_PINS_RS      56 // CS chip select / SS chip slave select
147
   #define LCD_PINS_RS      56 // CS chip select / SS chip slave select
147
   #define LCD_PINS_ENABLE  51 // SID (MOSI)
148
   #define LCD_PINS_ENABLE  51 // SID (MOSI)
148
   #define LCD_PINS_D4      52 // SCK (CLK) clock
149
   #define LCD_PINS_D4      52 // SCK (CLK) clock
149
   #define SD_DETECT_PIN    35
150
   #define SD_DETECT_PIN    35
151
+
150
 #else
152
 #else
153
+
151
   #define LCD_PINS_RS      32
154
   #define LCD_PINS_RS      32
152
   #define LCD_PINS_ENABLE  31
155
   #define LCD_PINS_ENABLE  31
153
   #define LCD_PINS_D4      14
156
   #define LCD_PINS_D4      14
171
 //
174
 //
172
 // M3/M4/M5 - Spindle/Laser Control
175
 // M3/M4/M5 - Spindle/Laser Control
173
 //
176
 //
174
-#if DISABLED(REPRAPWORLD_KEYPAD)     // try to use the keypad connector first
175
-  #define SPINDLE_LASER_PWM_PIN         44  // MUST BE HARDWARE PWM
176
-  #define SPINDLE_LASER_ENABLE_PIN      43  // Pin should have a pullup!
177
-  #define SPINDLE_DIR_PIN               42
177
+#if DISABLED(REPRAPWORLD_KEYPAD)       // try to use the keypad connector first
178
+  #define SPINDLE_LASER_PWM_PIN    44  // MUST BE HARDWARE PWM
179
+  #define SPINDLE_LASER_ENABLE_PIN 43  // Pin should have a pullup!
180
+  #define SPINDLE_DIR_PIN          42
178
 #elif EXTRUDERS <= 2
181
 #elif EXTRUDERS <= 2
179
-  // try to hijack the last extruder so that we can get the PWM signal off the Y breakout
180
-  // move all the Y signals to the E2 extruder socket - makes dual Y steppers harder
181
-  #undef Y_ENABLE_PIN
182
-  #undef Y_STEP_PIN
183
-  #undef Y_DIR_PIN
184
-  #undef E2_STEP_PIN
185
-  #undef E2_ENABLE_PIN
186
-  #undef E2_DIR_PIN
187
-  #define Y_ENABLE_PIN          23
188
-  #define Y_STEP_PIN            22
189
-  #define Y_DIR_PIN             60
190
-  #define SPINDLE_LASER_PWM_PIN          4  // MUST BE HARDWARE PWM
191
-  #define SPINDLE_LASER_ENABLE_PIN      17  // Pin should have a pullup!
192
-  #define SPINDLE_DIR_PIN                5
182
+  // Hijack the last extruder so that we can get the PWM signal off the Y breakout
183
+  // Move Y to the E2 plug. This makes dual Y steppers harder
184
+  #undef Y_ENABLE_PIN  //  4
185
+  #undef Y_STEP_PIN    //  5
186
+  #undef Y_DIR_PIN     // 17
187
+  #undef E2_ENABLE_PIN // 23
188
+  #undef E2_STEP_PIN   // 22
189
+  #undef E2_DIR_PIN    // 60
190
+  #define Y_ENABLE_PIN             23
191
+  #define Y_STEP_PIN               22
192
+  #define Y_DIR_PIN                60
193
+  #define SPINDLE_LASER_PWM_PIN     4  // MUST BE HARDWARE PWM
194
+  #define SPINDLE_LASER_ENABLE_PIN 17  // Pin should have a pullup!
195
+  #define SPINDLE_DIR_PIN           5
193
 #endif
196
 #endif

+ 1
- 1
Marlin/pins_RAMPS.h View File

375
 //
375
 //
376
 // M3/M4/M5 - Spindle/Laser Control
376
 // M3/M4/M5 - Spindle/Laser Control
377
 //
377
 //
378
-#if ENABLED(SPINDLE_LASER_ENABLE) && !PIN_EXISTS(SPINDLE_LASER_ENABLE_PIN)
378
+#if ENABLED(SPINDLE_LASER_ENABLE) && !PIN_EXISTS(SPINDLE_LASER_ENABLE)
379
   #if !defined(NUM_SERVOS) || NUM_SERVOS == 0 // try to use servo connector first
379
   #if !defined(NUM_SERVOS) || NUM_SERVOS == 0 // try to use servo connector first
380
     #define SPINDLE_LASER_ENABLE_PIN  4  // Pin should have a pullup/pulldown!
380
     #define SPINDLE_LASER_ENABLE_PIN  4  // Pin should have a pullup/pulldown!
381
     #define SPINDLE_LASER_PWM_PIN     6  // MUST BE HARDWARE PWM
381
     #define SPINDLE_LASER_PWM_PIN     6  // MUST BE HARDWARE PWM

Loading…
Cancel
Save