Merge pull request #6848 from thinkyhead/bf_scara_M665

Add M665 for SCARA
This commit is contained in:
Scott Lahteine 2017-05-24 20:51:51 -05:00 committed by GitHub
commit 735405b2a4
5 changed files with 77 additions and 22 deletions

View file

@ -788,6 +788,12 @@
#define MAX_PROBE_X ( DELTA_PRINTABLE_RADIUS) #define MAX_PROBE_X ( DELTA_PRINTABLE_RADIUS)
#define MIN_PROBE_Y (-DELTA_PRINTABLE_RADIUS) #define MIN_PROBE_Y (-DELTA_PRINTABLE_RADIUS)
#define MAX_PROBE_Y ( DELTA_PRINTABLE_RADIUS) #define MAX_PROBE_Y ( DELTA_PRINTABLE_RADIUS)
#elif IS_SCARA
#define SCARA_PRINTABLE_RADIUS (SCARA_LINKAGE_1 + SCARA_LINKAGE_2)
#define MIN_PROBE_X (-SCARA_PRINTABLE_RADIUS)
#define MAX_PROBE_X ( SCARA_PRINTABLE_RADIUS)
#define MIN_PROBE_Y (-SCARA_PRINTABLE_RADIUS)
#define MAX_PROBE_Y ( SCARA_PRINTABLE_RADIUS)
#else #else
// Boundaries for probing based on set limits // Boundaries for probing based on set limits
#define MIN_PROBE_X (max(X_MIN_POS, X_MIN_POS + X_PROBE_OFFSET_FROM_EXTRUDER)) #define MIN_PROBE_X (max(X_MIN_POS, X_MIN_POS + X_PROBE_OFFSET_FROM_EXTRUDER))

View file

@ -7678,6 +7678,10 @@ inline void gcode_M205() {
/** /**
* M206: Set Additional Homing Offset (X Y Z). SCARA aliases T=X, P=Y * M206: Set Additional Homing Offset (X Y Z). SCARA aliases T=X, P=Y
*
* *** @thinkyhead: I recommend deprecating M206 for SCARA in favor of M665.
* *** M206 for SCARA will remain enabled in 1.1.x for compatibility.
* *** In the next 1.2 release, it will simply be disabled by default.
*/ */
inline void gcode_M206() { inline void gcode_M206() {
LOOP_XYZ(i) LOOP_XYZ(i)
@ -7757,6 +7761,44 @@ inline void gcode_M205() {
LOOP_XYZ(i) endstop_adj[i] -= z_temp; LOOP_XYZ(i) endstop_adj[i] -= z_temp;
} }
#elif IS_SCARA
/**
* M665: Set SCARA settings
*
* Parameters:
*
* S[segments-per-second] - Segments-per-second
* P[theta-psi-offset] - Theta-Psi offset, added to the shoulder (A/X) angle
* T[theta-offset] - Theta offset, added to the elbow (B/Y) angle
*
* A, P, and X are all aliases for the shoulder angle
* B, T, and Y are all aliases for the elbow angle
*/
inline void gcode_M665() {
if (parser.seen('S')) delta_segments_per_second = parser.value_float();
const bool hasA = parser.seen('A'), hasP = parser.seen('P'), hasX = parser.seen('X');
const uint8_t sumAPX = hasA + hasP + hasX;
if (sumAPX == 1)
home_offset[A_AXIS] = parser.value_float();
else if (sumAPX > 1) {
SERIAL_ERROR_START;
SERIAL_ERRORLNPGM("Only one of A, P, or X is allowed.");
return;
}
const bool hasB = parser.seen('B'), hasT = parser.seen('T'), hasY = parser.seen('Y');
const uint8_t sumBTY = hasB + hasT + hasY;
if (sumBTY == 1)
home_offset[B_AXIS] = parser.value_float();
else if (sumBTY > 1) {
SERIAL_ERROR_START;
SERIAL_ERRORLNPGM("Only one of B, T, or Y is allowed.");
return;
}
}
#elif ENABLED(Z_DUAL_ENDSTOPS) // !DELTA && ENABLED(Z_DUAL_ENDSTOPS) #elif ENABLED(Z_DUAL_ENDSTOPS) // !DELTA && ENABLED(Z_DUAL_ENDSTOPS)
/** /**
@ -11193,8 +11235,12 @@ void set_current_from_steppers_for_axis(const AxisEnum axis) {
if (!position_is_reachable_xy(ltarget[X_AXIS], ltarget[Y_AXIS])) return true; if (!position_is_reachable_xy(ltarget[X_AXIS], ltarget[Y_AXIS])) return true;
// Get the cartesian distances moved in XYZE // Get the cartesian distances moved in XYZE
float difference[XYZE]; const float difference[XYZE] = {
LOOP_XYZE(i) difference[i] = ltarget[i] - current_position[i]; ltarget[X_AXIS] - current_position[X_AXIS],
ltarget[Y_AXIS] - current_position[Y_AXIS],
ltarget[Z_AXIS] - current_position[Z_AXIS],
ltarget[E_AXIS] - current_position[E_AXIS]
};
// Get the linear distance in XYZ // Get the linear distance in XYZ
float cartesian_mm = sqrt(sq(difference[X_AXIS]) + sq(difference[Y_AXIS]) + sq(difference[Z_AXIS])); float cartesian_mm = sqrt(sq(difference[X_AXIS]) + sq(difference[Y_AXIS]) + sq(difference[Z_AXIS]));

View file

@ -1461,7 +1461,7 @@ void MarlinSettings::reset() {
#endif #endif
SERIAL_EOL; SERIAL_EOL;
#if ENABLED(DISTINCT_E_FACTORS) #if ENABLED(DISTINCT_E_FACTORS)
SERIAL_ECHO_START; CONFIG_ECHO_START;
for (uint8_t i = 0; i < E_STEPPERS; i++) { for (uint8_t i = 0; i < E_STEPPERS; i++) {
SERIAL_ECHOPAIR(" M201 T", (int)i); SERIAL_ECHOPAIR(" M201 T", (int)i);
SERIAL_ECHOLNPAIR(" E", VOLUMETRIC_UNIT(planner.max_acceleration_mm_per_s2[E_AXIS + i])); SERIAL_ECHOLNPAIR(" E", VOLUMETRIC_UNIT(planner.max_acceleration_mm_per_s2[E_AXIS + i]));

View file

@ -143,11 +143,14 @@
#define BTN_ENC 33 #define BTN_ENC 33
#if ENABLED(REPRAPWORLD_GRAPHICAL_LCD) #if ENABLED(REPRAPWORLD_GRAPHICAL_LCD)
#define LCD_PINS_RS 56 // CS chip select / SS chip slave select #define LCD_PINS_RS 56 // CS chip select / SS chip slave select
#define LCD_PINS_ENABLE 51 // SID (MOSI) #define LCD_PINS_ENABLE 51 // SID (MOSI)
#define LCD_PINS_D4 52 // SCK (CLK) clock #define LCD_PINS_D4 52 // SCK (CLK) clock
#define SD_DETECT_PIN 35 #define SD_DETECT_PIN 35
#else #else
#define LCD_PINS_RS 32 #define LCD_PINS_RS 32
#define LCD_PINS_ENABLE 31 #define LCD_PINS_ENABLE 31
#define LCD_PINS_D4 14 #define LCD_PINS_D4 14
@ -171,23 +174,23 @@
// //
// M3/M4/M5 - Spindle/Laser Control // M3/M4/M5 - Spindle/Laser Control
// //
#if DISABLED(REPRAPWORLD_KEYPAD) // try to use the keypad connector first #if DISABLED(REPRAPWORLD_KEYPAD) // try to use the keypad connector first
#define SPINDLE_LASER_PWM_PIN 44 // MUST BE HARDWARE PWM #define SPINDLE_LASER_PWM_PIN 44 // MUST BE HARDWARE PWM
#define SPINDLE_LASER_ENABLE_PIN 43 // Pin should have a pullup! #define SPINDLE_LASER_ENABLE_PIN 43 // Pin should have a pullup!
#define SPINDLE_DIR_PIN 42 #define SPINDLE_DIR_PIN 42
#elif EXTRUDERS <= 2 #elif EXTRUDERS <= 2
// try to hijack the last extruder so that we can get the PWM signal off the Y breakout // Hijack the last extruder so that we can get the PWM signal off the Y breakout
// move all the Y signals to the E2 extruder socket - makes dual Y steppers harder // Move Y to the E2 plug. This makes dual Y steppers harder
#undef Y_ENABLE_PIN #undef Y_ENABLE_PIN // 4
#undef Y_STEP_PIN #undef Y_STEP_PIN // 5
#undef Y_DIR_PIN #undef Y_DIR_PIN // 17
#undef E2_STEP_PIN #undef E2_ENABLE_PIN // 23
#undef E2_ENABLE_PIN #undef E2_STEP_PIN // 22
#undef E2_DIR_PIN #undef E2_DIR_PIN // 60
#define Y_ENABLE_PIN 23 #define Y_ENABLE_PIN 23
#define Y_STEP_PIN 22 #define Y_STEP_PIN 22
#define Y_DIR_PIN 60 #define Y_DIR_PIN 60
#define SPINDLE_LASER_PWM_PIN 4 // MUST BE HARDWARE PWM #define SPINDLE_LASER_PWM_PIN 4 // MUST BE HARDWARE PWM
#define SPINDLE_LASER_ENABLE_PIN 17 // Pin should have a pullup! #define SPINDLE_LASER_ENABLE_PIN 17 // Pin should have a pullup!
#define SPINDLE_DIR_PIN 5 #define SPINDLE_DIR_PIN 5
#endif #endif

View file

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