From af81cb4cbbe58f4f93aa19751137a1d41705d2ce Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Wed, 24 May 2017 16:56:36 -0500 Subject: [PATCH 1/5] Patch for M503 output --- Marlin/configuration_store.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Marlin/configuration_store.cpp b/Marlin/configuration_store.cpp index f23ee7770..2d2a22579 100644 --- a/Marlin/configuration_store.cpp +++ b/Marlin/configuration_store.cpp @@ -1461,7 +1461,7 @@ void MarlinSettings::reset() { #endif SERIAL_EOL; #if ENABLED(DISTINCT_E_FACTORS) - SERIAL_ECHO_START; + CONFIG_ECHO_START; for (uint8_t i = 0; i < E_STEPPERS; i++) { SERIAL_ECHOPAIR(" M201 T", (int)i); SERIAL_ECHOLNPAIR(" E", VOLUMETRIC_UNIT(planner.max_acceleration_mm_per_s2[E_AXIS + i])); From 1f52c9f5df9849d35c622e98884794a55166cd92 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Fri, 19 May 2017 14:06:06 -0500 Subject: [PATCH 2/5] Neater Megatronics 3 pins --- Marlin/pins_MEGATRONICS_3.h | 39 ++++++++++++++++++++----------------- 1 file changed, 21 insertions(+), 18 deletions(-) diff --git a/Marlin/pins_MEGATRONICS_3.h b/Marlin/pins_MEGATRONICS_3.h index aa6c40374..5e4ca4b58 100644 --- a/Marlin/pins_MEGATRONICS_3.h +++ b/Marlin/pins_MEGATRONICS_3.h @@ -143,11 +143,14 @@ #define BTN_ENC 33 #if ENABLED(REPRAPWORLD_GRAPHICAL_LCD) + #define LCD_PINS_RS 56 // CS chip select / SS chip slave select #define LCD_PINS_ENABLE 51 // SID (MOSI) #define LCD_PINS_D4 52 // SCK (CLK) clock #define SD_DETECT_PIN 35 + #else + #define LCD_PINS_RS 32 #define LCD_PINS_ENABLE 31 #define LCD_PINS_D4 14 @@ -171,23 +174,23 @@ // // M3/M4/M5 - Spindle/Laser Control // -#if DISABLED(REPRAPWORLD_KEYPAD) // try to use the keypad connector first - #define SPINDLE_LASER_PWM_PIN 44 // MUST BE HARDWARE PWM - #define SPINDLE_LASER_ENABLE_PIN 43 // Pin should have a pullup! - #define SPINDLE_DIR_PIN 42 +#if DISABLED(REPRAPWORLD_KEYPAD) // try to use the keypad connector first + #define SPINDLE_LASER_PWM_PIN 44 // MUST BE HARDWARE PWM + #define SPINDLE_LASER_ENABLE_PIN 43 // Pin should have a pullup! + #define SPINDLE_DIR_PIN 42 #elif EXTRUDERS <= 2 - // try to 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 - #undef Y_ENABLE_PIN - #undef Y_STEP_PIN - #undef Y_DIR_PIN - #undef E2_STEP_PIN - #undef E2_ENABLE_PIN - #undef E2_DIR_PIN - #define Y_ENABLE_PIN 23 - #define Y_STEP_PIN 22 - #define Y_DIR_PIN 60 - #define SPINDLE_LASER_PWM_PIN 4 // MUST BE HARDWARE PWM - #define SPINDLE_LASER_ENABLE_PIN 17 // Pin should have a pullup! - #define SPINDLE_DIR_PIN 5 + // Hijack the last extruder so that we can get the PWM signal off the Y breakout + // Move Y to the E2 plug. This makes dual Y steppers harder + #undef Y_ENABLE_PIN // 4 + #undef Y_STEP_PIN // 5 + #undef Y_DIR_PIN // 17 + #undef E2_ENABLE_PIN // 23 + #undef E2_STEP_PIN // 22 + #undef E2_DIR_PIN // 60 + #define Y_ENABLE_PIN 23 + #define Y_STEP_PIN 22 + #define Y_DIR_PIN 60 + #define SPINDLE_LASER_PWM_PIN 4 // MUST BE HARDWARE PWM + #define SPINDLE_LASER_ENABLE_PIN 17 // Pin should have a pullup! + #define SPINDLE_DIR_PIN 5 #endif From 5cbe0244c592c848229a3711b995344504f6a8a2 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Fri, 19 May 2017 13:48:16 -0500 Subject: [PATCH 3/5] Fixes for spindle/laser and SCARA probe bounds --- Marlin/Conditionals_post.h | 6 ++++++ Marlin/pins_RAMPS.h | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/Marlin/Conditionals_post.h b/Marlin/Conditionals_post.h index a4ae28ff3..9fcd944ac 100644 --- a/Marlin/Conditionals_post.h +++ b/Marlin/Conditionals_post.h @@ -788,6 +788,12 @@ #define MAX_PROBE_X ( DELTA_PRINTABLE_RADIUS) #define MIN_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 // Boundaries for probing based on set limits #define MIN_PROBE_X (max(X_MIN_POS, X_MIN_POS + X_PROBE_OFFSET_FROM_EXTRUDER)) diff --git a/Marlin/pins_RAMPS.h b/Marlin/pins_RAMPS.h index 9bd1a252c..d1502e7d9 100644 --- a/Marlin/pins_RAMPS.h +++ b/Marlin/pins_RAMPS.h @@ -375,7 +375,7 @@ // // 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 #define SPINDLE_LASER_ENABLE_PIN 4 // Pin should have a pullup/pulldown! #define SPINDLE_LASER_PWM_PIN 6 // MUST BE HARDWARE PWM From 5ed63a5724be36e066104a5c17c3bc6b3563797b Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Thu, 27 Apr 2017 10:36:15 -0500 Subject: [PATCH 4/5] Apply const in prepare_kinematic_move_to --- Marlin/Marlin_main.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Marlin/Marlin_main.cpp b/Marlin/Marlin_main.cpp index 6547cc152..f24929f67 100644 --- a/Marlin/Marlin_main.cpp +++ b/Marlin/Marlin_main.cpp @@ -11193,8 +11193,12 @@ void set_current_from_steppers_for_axis(const AxisEnum axis) { if (!position_is_reachable_xy(ltarget[X_AXIS], ltarget[Y_AXIS])) return true; // Get the cartesian distances moved in XYZE - float difference[XYZE]; - LOOP_XYZE(i) difference[i] = ltarget[i] - current_position[i]; + const float difference[XYZE] = { + 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 float cartesian_mm = sqrt(sq(difference[X_AXIS]) + sq(difference[Y_AXIS]) + sq(difference[Z_AXIS])); From 361cbba11373a497c8e6b6fc121f6786a056b839 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Wed, 24 May 2017 17:19:02 -0500 Subject: [PATCH 5/5] Use M665 to set SCARA angle offsets --- Marlin/Marlin_main.cpp | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/Marlin/Marlin_main.cpp b/Marlin/Marlin_main.cpp index f24929f67..a5c42c5f6 100644 --- a/Marlin/Marlin_main.cpp +++ b/Marlin/Marlin_main.cpp @@ -7678,6 +7678,10 @@ inline void gcode_M205() { /** * 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() { LOOP_XYZ(i) @@ -7757,6 +7761,44 @@ inline void gcode_M205() { 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) /**