From b3fd03198af688bbd7b3d74500c441007bcf890d Mon Sep 17 00:00:00 2001 From: Dan Royer Date: Mon, 20 Sep 2021 13:42:33 -0700 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20Polargraph=20/=20Makelangelo=20kine?= =?UTF-8?q?matics=20(#22790)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/Configuration.h | 7 + Marlin/src/MarlinCore.cpp | 2 + Marlin/src/core/language.h | 7 +- .../src/feature/bedlevel/ubl/ubl_motion.cpp | 2 + Marlin/src/gcode/calibrate/M665.cpp | 25 ++- Marlin/src/gcode/control/M280.cpp | 36 +++- Marlin/src/gcode/control/M282.cpp | 2 +- Marlin/src/gcode/gcode.cpp | 4 +- Marlin/src/gcode/gcode.h | 1 + Marlin/src/inc/Conditionals_LCD.h | 2 +- Marlin/src/inc/SanityCheck.h | 4 +- Marlin/src/lcd/menu/menu_advanced.cpp | 6 +- Marlin/src/module/motion.cpp | 2 +- Marlin/src/module/motion.h | 8 + Marlin/src/module/planner.cpp | 4 +- Marlin/src/module/planner.h | 2 + Marlin/src/module/polargraph.cpp | 47 +++++ Marlin/src/module/polargraph.h | 33 ++++ Marlin/src/module/settings.cpp | 171 ++++++++++-------- Marlin/src/pins/ramps/pins_RUMBA.h | 27 ++- buildroot/tests/mega1280 | 1 + buildroot/tests/mega2560 | 10 +- ini/features.ini | 1 + platformio.ini | 4 +- 24 files changed, 304 insertions(+), 104 deletions(-) create mode 100644 Marlin/src/module/polargraph.cpp create mode 100644 Marlin/src/module/polargraph.h diff --git a/Marlin/Configuration.h b/Marlin/Configuration.h index 13dc6a2b2c..7afb86dac7 100644 --- a/Marlin/Configuration.h +++ b/Marlin/Configuration.h @@ -761,6 +761,13 @@ // Enable for a belt style printer with endless "Z" motion //#define BELTPRINTER +// Enable for Polargraph Kinematics +//#define POLARGRAPH +#if ENABLED(POLARGRAPH) + #define POLARGRAPH_MAX_BELT_LEN 1035.0 + #define POLAR_SEGMENTS_PER_SECOND 5 +#endif + //=========================================================================== //============================== Endstop Settings =========================== //=========================================================================== diff --git a/Marlin/src/MarlinCore.cpp b/Marlin/src/MarlinCore.cpp index 147853eaf9..280c619ad2 100644 --- a/Marlin/src/MarlinCore.cpp +++ b/Marlin/src/MarlinCore.cpp @@ -168,6 +168,8 @@ #if ENABLED(DELTA) #include "module/delta.h" +#elif ENABLED(POLARGRAPH) + #include "module/polargraph.h" #elif IS_SCARA #include "module/scara.h" #endif diff --git a/Marlin/src/core/language.h b/Marlin/src/core/language.h index 6c034d6b13..03bffb8bd9 100644 --- a/Marlin/src/core/language.h +++ b/Marlin/src/core/language.h @@ -264,9 +264,10 @@ // Settings Report Strings #define STR_Z_AUTO_ALIGN "Z Auto-Align" #define STR_BACKLASH_COMPENSATION "Backlash compensation" -#define STR_DELTA_SETTINGS "Delta settings (L R H S XYZ ABC)" -#define STR_SCARA_SETTINGS "SCARA settings" -#define STR_SCARA_S "S" +#define STR_S_SEG_PER_SEC "S" +#define STR_DELTA_SETTINGS "Delta (L R H S XYZ ABC)" +#define STR_SCARA_SETTINGS "SCARA" +#define STR_POLARGRAPH_SETTINGS "Polargraph" #define STR_SCARA_P_T_Z "P T Z" #define STR_ENDSTOP_ADJUSTMENT "Endstop adjustment" #define STR_SKEW_FACTOR "Skew Factor" diff --git a/Marlin/src/feature/bedlevel/ubl/ubl_motion.cpp b/Marlin/src/feature/bedlevel/ubl/ubl_motion.cpp index be5f6fee12..f7e98c9fa7 100644 --- a/Marlin/src/feature/bedlevel/ubl/ubl_motion.cpp +++ b/Marlin/src/feature/bedlevel/ubl/ubl_motion.cpp @@ -324,6 +324,8 @@ #define DELTA_SEGMENT_MIN_LENGTH 0.25 // SCARA minimum segment size is 0.25mm #elif ENABLED(DELTA) #define DELTA_SEGMENT_MIN_LENGTH 0.10 // mm (still subject to DELTA_SEGMENTS_PER_SECOND) + #elif ENABLED(POLARGRAPH) + #define DELTA_SEGMENT_MIN_LENGTH 0.10 // mm (still subject to DELTA_SEGMENTS_PER_SECOND) #else // CARTESIAN #ifdef LEVELED_SEGMENT_LENGTH #define DELTA_SEGMENT_MIN_LENGTH LEVELED_SEGMENT_LENGTH diff --git a/Marlin/src/gcode/calibrate/M665.cpp b/Marlin/src/gcode/calibrate/M665.cpp index 09b5ec8d4e..11de1ce434 100644 --- a/Marlin/src/gcode/calibrate/M665.cpp +++ b/Marlin/src/gcode/calibrate/M665.cpp @@ -132,7 +132,7 @@ } void GcodeSuite::M665_report(const bool forReplay/*=true*/) { - report_heading_etc(forReplay, PSTR(STR_SCARA_SETTINGS " (" STR_SCARA_S TERN_(HAS_SCARA_OFFSET, " " STR_SCARA_P_T_Z) ")")); + report_heading_etc(forReplay, PSTR(STR_SCARA_SETTINGS " (" STR_S_SEG_PER_SEC TERN_(HAS_SCARA_OFFSET, " " STR_SCARA_P_T_Z) ")")); SERIAL_ECHOLNPGM_P( PSTR(" M665 S"), segments_per_second #if HAS_SCARA_OFFSET @@ -143,6 +143,29 @@ ); } +#elif ENABLED(POLARGRAPH) + + #include "../../module/polargraph.h" + + /** + * M665: Set POLARGRAPH settings + * + * Parameters: + * + * S[segments-per-second] - Segments-per-second + */ + void GcodeSuite::M665() { + if (parser.seenval('S')) + segments_per_second = parser.value_float(); + else + M665_report(); + } + + void GcodeSuite::M665_report(const bool forReplay/*=true*/) { + report_heading_etc(forReplay, PSTR(STR_POLARGRAPH_SETTINGS " (" STR_S_SEG_PER_SEC ")")); + SERIAL_ECHOLNPGM(" M665 S", segments_per_second); + } + #endif #endif // IS_KINEMATIC diff --git a/Marlin/src/gcode/control/M280.cpp b/Marlin/src/gcode/control/M280.cpp index f285adf47f..2a8e73eafb 100644 --- a/Marlin/src/gcode/control/M280.cpp +++ b/Marlin/src/gcode/control/M280.cpp @@ -26,22 +26,44 @@ #include "../gcode.h" #include "../../module/servo.h" +#include "../../module/planner.h" /** - * M280: Get or set servo position. P [S] + * M280: Get or set servo position. + * P - Servo index + * S - Angle to set, omit to read current angle, or use -1 to detach + * + * With POLARGRAPH: + * T - Duration of servo move */ void GcodeSuite::M280() { - if (!parser.seen('P')) return; + if (!parser.seenval('P')) return; + + TERN_(POLARGRAPH, planner.synchronize()); const int servo_index = parser.value_int(); if (WITHIN(servo_index, 0, NUM_SERVOS - 1)) { - if (parser.seen('S')) { - const int a = parser.value_int(); - if (a == -1) - DETACH_SERVO(servo_index); + if (parser.seenval('S')) { + const int anew = parser.value_int(); + if (anew >= 0) { + #if ENABLED(POLARGRAPH) + if (parser.seen('T')) { // (ms) Total duration of servo move + const int16_t t = constrain(parser.value_int(), 0, 10000); + const int aold = servo[servo_index].read(); + millis_t now = millis(); + const millis_t start = now, end = start + t; + while (PENDING(now, end)) { + safe_delay(50); + now = _MIN(millis(), end); + MOVE_SERVO(servo_index, LROUND(aold + (anew - aold) * (float(now - start) / t))); + } + } + #endif // POLARGRAPH + MOVE_SERVO(servo_index, anew); + } else - MOVE_SERVO(servo_index, a); + DETACH_SERVO(servo_index); } else SERIAL_ECHO_MSG(" Servo ", servo_index, ": ", servo[servo_index].read()); diff --git a/Marlin/src/gcode/control/M282.cpp b/Marlin/src/gcode/control/M282.cpp index 5fe2e6e328..e6f5ce7dcc 100644 --- a/Marlin/src/gcode/control/M282.cpp +++ b/Marlin/src/gcode/control/M282.cpp @@ -32,7 +32,7 @@ */ void GcodeSuite::M282() { - if (!parser.seen('P')) return; + if (!parser.seenval('P')) return; const int servo_index = parser.value_int(); if (WITHIN(servo_index, 0, NUM_SERVOS - 1)) diff --git a/Marlin/src/gcode/gcode.cpp b/Marlin/src/gcode/gcode.cpp index 4e7c3df78d..0fc6db07d6 100644 --- a/Marlin/src/gcode/gcode.cpp +++ b/Marlin/src/gcode/gcode.cpp @@ -885,8 +885,8 @@ void GcodeSuite::process_parsed_command(const bool no_ok/*=false*/) { case 605: M605(); break; // M605: Set Dual X Carriage movement mode #endif - #if ENABLED(DELTA) - case 665: M665(); break; // M665: Set delta configurations + #if IS_KINEMATIC + case 665: M665(); break; // M665: Set Delta/SCARA parameters #endif #if ENABLED(DELTA) || HAS_EXTRA_ENDSTOPS diff --git a/Marlin/src/gcode/gcode.h b/Marlin/src/gcode/gcode.h index aa38b7de4a..b10f0bf06a 100644 --- a/Marlin/src/gcode/gcode.h +++ b/Marlin/src/gcode/gcode.h @@ -244,6 +244,7 @@ * M603 - Configure filament change: "M603 T U L". (Requires ADVANCED_PAUSE_FEATURE) * M605 - Set Dual X-Carriage movement mode: "M605 S [X] [R]". (Requires DUAL_X_CARRIAGE) * M665 - Set delta configurations: "M665 H L R S B X Y Z (Requires DELTA) + * Set SCARA configurations: "M665 S P T Z (Requires MORGAN_SCARA or MP_SCARA) * M666 - Set/get offsets for delta (Requires DELTA) or dual endstops. (Requires [XYZ]_DUAL_ENDSTOPS) * M672 - Set/Reset Duet Smart Effector's sensitivity. (Requires DUET_SMART_EFFECTOR and SMART_EFFECTOR_MOD_PIN) * M701 - Load filament (Requires FILAMENT_LOAD_UNLOAD_GCODES) diff --git a/Marlin/src/inc/Conditionals_LCD.h b/Marlin/src/inc/Conditionals_LCD.h index 1395be8a0a..381a0827e1 100644 --- a/Marlin/src/inc/Conditionals_LCD.h +++ b/Marlin/src/inc/Conditionals_LCD.h @@ -1075,7 +1075,7 @@ #if ANY(MORGAN_SCARA, MP_SCARA, AXEL_TPARA) #define IS_SCARA 1 #define IS_KINEMATIC 1 -#elif ENABLED(DELTA) +#elif EITHER(DELTA, POLARGRAPH) #define IS_KINEMATIC 1 #else #define IS_CARTESIAN 1 diff --git a/Marlin/src/inc/SanityCheck.h b/Marlin/src/inc/SanityCheck.h index 53b8783647..159284e84a 100644 --- a/Marlin/src/inc/SanityCheck.h +++ b/Marlin/src/inc/SanityCheck.h @@ -1340,8 +1340,8 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS /** * Servo deactivation depends on servo endstops, switching nozzle, or switching extruder */ -#if ENABLED(DEACTIVATE_SERVOS_AFTER_MOVE) && !HAS_Z_SERVO_PROBE && !defined(SWITCHING_NOZZLE_SERVO_NR) && !defined(SWITCHING_EXTRUDER_SERVO_NR) && !defined(SWITCHING_TOOLHEAD_SERVO_NR) - #error "Z_PROBE_SERVO_NR, switching nozzle, switching toolhead or switching extruder is required for DEACTIVATE_SERVOS_AFTER_MOVE." +#if ENABLED(DEACTIVATE_SERVOS_AFTER_MOVE) && NONE(HAS_Z_SERVO_PROBE, POLARGRAPH) && !defined(SWITCHING_NOZZLE_SERVO_NR) && !defined(SWITCHING_EXTRUDER_SERVO_NR) && !defined(SWITCHING_TOOLHEAD_SERVO_NR) + #error "Z_PROBE_SERVO_NR, switching nozzle, switching toolhead, switching extruder, or POLARGRAPH is required for DEACTIVATE_SERVOS_AFTER_MOVE." #endif /** diff --git a/Marlin/src/lcd/menu/menu_advanced.cpp b/Marlin/src/lcd/menu/menu_advanced.cpp index 8834ee6eac..cfb7e5fc70 100644 --- a/Marlin/src/lcd/menu/menu_advanced.cpp +++ b/Marlin/src/lcd/menu/menu_advanced.cpp @@ -466,9 +466,11 @@ void menu_backlash(); #ifdef MAX_JERK_EDIT_VALUES MAX_JERK_EDIT_VALUES #elif ENABLED(LIMITED_JERK_EDITING) - { (DEFAULT_XJERK) * 2, (DEFAULT_YJERK) * 2, (DEFAULT_ZJERK) * 2, (DEFAULT_EJERK) * 2 } + { LOGICAL_AXIS_LIST((DEFAULT_EJERK) * 2, + (DEFAULT_XJERK) * 2, (DEFAULT_YJERK) * 2, (DEFAULT_ZJERK) * 2, + (DEFAULT_IJERK) * 2, (DEFAULT_JJERK) * 2, (DEFAULT_KJERK) * 2) } #else - { 990, 990, 990, 990 } + { LOGICAL_AXIS_LIST(990, 990, 990, 990, 990, 990, 990) } #endif ; #define EDIT_JERK(N) EDIT_ITEM_FAST(float3, MSG_V##N##_JERK, &planner.max_jerk[_AXIS(N)], 1, max_jerk_edit[_AXIS(N)]) diff --git a/Marlin/src/module/motion.cpp b/Marlin/src/module/motion.cpp index cdd425c472..397c2ac1d0 100644 --- a/Marlin/src/module/motion.cpp +++ b/Marlin/src/module/motion.cpp @@ -489,7 +489,7 @@ void do_blocking_move_to(LINEAR_AXIS_ARGS(const float), const_feedRate_t fr_mm_s const feedRate_t z_feedrate = fr_mm_s ?: homing_feedrate(Z_AXIS); #endif - #if EITHER(DELTA, IS_SCARA) + #if IS_KINEMATIC if (!position_is_reachable(x, y)) return; destination = current_position; // sync destination at the start #endif diff --git a/Marlin/src/module/motion.h b/Marlin/src/module/motion.h index c41738a5ab..50df5675e6 100644 --- a/Marlin/src/module/motion.h +++ b/Marlin/src/module/motion.h @@ -504,6 +504,14 @@ void home_if_needed(const bool keeplev=false); return HYPOT2(rx, ry) <= sq(DELTA_PRINTABLE_RADIUS - inset + fslop); + #elif ENABLED(POLARGRAPH) + + const float x1 = rx - (X_MIN_POS), x2 = (X_MAX_POS) - rx, y = ry - (Y_MAX_POS), + a = HYPOT(x1, y), b = HYPOT(x2, y); + return a < (POLARGRAPH_MAX_BELT_LEN) + 1 + && b < (POLARGRAPH_MAX_BELT_LEN) + 1 + && (a + b) > _MIN(X_BED_SIZE, Y_BED_SIZE); + #elif ENABLED(AXEL_TPARA) const float R2 = HYPOT2(rx - TPARA_OFFSET_X, ry - TPARA_OFFSET_Y); diff --git a/Marlin/src/module/planner.cpp b/Marlin/src/module/planner.cpp index 3e030c84d2..04fabd2df7 100644 --- a/Marlin/src/module/planner.cpp +++ b/Marlin/src/module/planner.cpp @@ -3021,7 +3021,7 @@ bool Planner::buffer_line(const xyze_pos_t &cart, const_feedRate_t fr_mm_s, cons #else const feedRate_t feedrate = fr_mm_s; #endif - delta.e = machine.e; + TERN_(HAS_EXTRUDERS, delta.e = machine.e); if (buffer_segment(delta OPTARG(HAS_DIST_MM_ARG, cart_dist_mm), feedrate, extruder, mm)) { position_cart = cart; return true; @@ -3126,7 +3126,7 @@ void Planner::set_position_mm(const xyze_pos_t &xyze) { #if IS_KINEMATIC position_cart = xyze; inverse_kinematics(machine); - delta.e = machine.e; + TERN_(HAS_EXTRUDERS, delta.e = machine.e); set_machine_position_mm(delta); #else set_machine_position_mm(machine); diff --git a/Marlin/src/module/planner.h b/Marlin/src/module/planner.h index 5e3922c897..ea63f862e0 100644 --- a/Marlin/src/module/planner.h +++ b/Marlin/src/module/planner.h @@ -48,6 +48,8 @@ #if ENABLED(DELTA) #include "delta.h" +#elif ENABLED(POLARGRAPH) + #include "polargraph.h" #endif #if ABL_PLANAR diff --git a/Marlin/src/module/polargraph.cpp b/Marlin/src/module/polargraph.cpp new file mode 100644 index 0000000000..b7eeeee8af --- /dev/null +++ b/Marlin/src/module/polargraph.cpp @@ -0,0 +1,47 @@ +/** + * Marlin 3D Printer Firmware + * Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * + * Based on Sprinter and grbl. + * Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ + +/** + * polargraph.cpp + */ + +#include "../inc/MarlinConfig.h" + +#if ENABLED(POLARGRAPH) + +#include "polargraph.h" +#include "motion.h" + +// For homing: +#include "planner.h" +#include "endstops.h" +#include "../lcd/marlinui.h" +#include "../MarlinCore.h" + +float segments_per_second; // Initialized by settings.load() + +void inverse_kinematics(const xyz_pos_t &raw) { + const float x1 = raw.x - (X_MIN_POS), x2 = (X_MAX_POS) - raw.x, y = raw.y - (Y_MAX_POS); + delta.set(HYPOT(x1, y), HYPOT(x2, y), raw.z); +} + +#endif // POLARGRAPH diff --git a/Marlin/src/module/polargraph.h b/Marlin/src/module/polargraph.h new file mode 100644 index 0000000000..0406034253 --- /dev/null +++ b/Marlin/src/module/polargraph.h @@ -0,0 +1,33 @@ +/** + * Marlin 3D Printer Firmware + * Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * + * Based on Sprinter and grbl. + * Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ +#pragma once + +/** + * polargraph.h - Polargraph-specific functions + */ + +#include "../core/types.h" +#include "../core/macros.h" + +extern float segments_per_second; + +void inverse_kinematics(const xyz_pos_t &raw); diff --git a/Marlin/src/module/settings.cpp b/Marlin/src/module/settings.cpp index 0a7a194a3b..7d73f2ec4b 100644 --- a/Marlin/src/module/settings.cpp +++ b/Marlin/src/module/settings.cpp @@ -36,7 +36,7 @@ */ // Change EEPROM version if the structure changes -#define EEPROM_VERSION "V84" +#define EEPROM_VERSION "V85" #define EEPROM_OFFSET 100 // Check the integrity of data offsets. @@ -279,17 +279,24 @@ typedef struct SettingsDataStruct { bool bltouch_last_written_mode; // - // DELTA / [XYZ]_DUAL_ENDSTOPS + // Kinematic Settings // - #if ENABLED(DELTA) - float delta_height; // M666 H - abc_float_t delta_endstop_adj; // M666 X Y Z - float delta_radius, // M665 R - delta_diagonal_rod, // M665 L - segments_per_second; // M665 S - abc_float_t delta_tower_angle_trim, // M665 X Y Z - delta_diagonal_rod_trim; // M665 A B C - #elif HAS_EXTRA_ENDSTOPS + #if IS_KINEMATIC + float segments_per_second; // M665 S + #if ENABLED(DELTA) + float delta_height; // M666 H + abc_float_t delta_endstop_adj; // M666 X Y Z + float delta_radius, // M665 R + delta_diagonal_rod; // M665 L + abc_float_t delta_tower_angle_trim, // M665 X Y Z + delta_diagonal_rod_trim; // M665 A B C + #endif + #endif + + // + // Extra Endstops offsets + // + #if HAS_EXTRA_ENDSTOPS float x2_endstop_adj, // M666 X y2_endstop_adj, // M666 Y z2_endstop_adj, // M666 (S2) Z @@ -857,45 +864,49 @@ void MarlinSettings::postprocess() { } // - // DELTA Geometry or Dual Endstops offsets + // Kinematic Settings // + #if IS_KINEMATIC { + EEPROM_WRITE(segments_per_second); #if ENABLED(DELTA) - _FIELD_TEST(delta_height); - EEPROM_WRITE(delta_height); // 1 float EEPROM_WRITE(delta_endstop_adj); // 3 floats EEPROM_WRITE(delta_radius); // 1 float EEPROM_WRITE(delta_diagonal_rod); // 1 float - EEPROM_WRITE(segments_per_second); // 1 float EEPROM_WRITE(delta_tower_angle_trim); // 3 floats EEPROM_WRITE(delta_diagonal_rod_trim); // 3 floats - - #elif HAS_EXTRA_ENDSTOPS - - _FIELD_TEST(x2_endstop_adj); - - // Write dual endstops in X, Y, Z order. Unused = 0.0 - dummyf = 0; - EEPROM_WRITE(TERN(X_DUAL_ENDSTOPS, endstops.x2_endstop_adj, dummyf)); // 1 float - EEPROM_WRITE(TERN(Y_DUAL_ENDSTOPS, endstops.y2_endstop_adj, dummyf)); // 1 float - EEPROM_WRITE(TERN(Z_MULTI_ENDSTOPS, endstops.z2_endstop_adj, dummyf)); // 1 float - - #if ENABLED(Z_MULTI_ENDSTOPS) && NUM_Z_STEPPER_DRIVERS >= 3 - EEPROM_WRITE(endstops.z3_endstop_adj); // 1 float - #else - EEPROM_WRITE(dummyf); - #endif - - #if ENABLED(Z_MULTI_ENDSTOPS) && NUM_Z_STEPPER_DRIVERS >= 4 - EEPROM_WRITE(endstops.z4_endstop_adj); // 1 float - #else - EEPROM_WRITE(dummyf); - #endif - #endif } + #endif + + // + // Extra Endstops offsets + // + #if HAS_EXTRA_ENDSTOPS + { + _FIELD_TEST(x2_endstop_adj); + + // Write dual endstops in X, Y, Z order. Unused = 0.0 + dummyf = 0; + EEPROM_WRITE(TERN(X_DUAL_ENDSTOPS, endstops.x2_endstop_adj, dummyf)); // 1 float + EEPROM_WRITE(TERN(Y_DUAL_ENDSTOPS, endstops.y2_endstop_adj, dummyf)); // 1 float + EEPROM_WRITE(TERN(Z_MULTI_ENDSTOPS, endstops.z2_endstop_adj, dummyf)); // 1 float + + #if ENABLED(Z_MULTI_ENDSTOPS) && NUM_Z_STEPPER_DRIVERS >= 3 + EEPROM_WRITE(endstops.z3_endstop_adj); // 1 float + #else + EEPROM_WRITE(dummyf); + #endif + + #if ENABLED(Z_MULTI_ENDSTOPS) && NUM_Z_STEPPER_DRIVERS >= 4 + EEPROM_WRITE(endstops.z4_endstop_adj); // 1 float + #else + EEPROM_WRITE(dummyf); + #endif + } + #endif #if ENABLED(Z_STEPPER_AUTO_ALIGN) EEPROM_WRITE(z_stepper_align.xy); @@ -1724,42 +1735,46 @@ void MarlinSettings::postprocess() { } // - // DELTA Geometry or Dual Endstops offsets + // Kinematic Segments-per-second // + #if IS_KINEMATIC { + EEPROM_READ(segments_per_second); #if ENABLED(DELTA) - _FIELD_TEST(delta_height); - EEPROM_READ(delta_height); // 1 float EEPROM_READ(delta_endstop_adj); // 3 floats EEPROM_READ(delta_radius); // 1 float EEPROM_READ(delta_diagonal_rod); // 1 float - EEPROM_READ(segments_per_second); // 1 float EEPROM_READ(delta_tower_angle_trim); // 3 floats EEPROM_READ(delta_diagonal_rod_trim); // 3 floats - - #elif HAS_EXTRA_ENDSTOPS - - _FIELD_TEST(x2_endstop_adj); - - EEPROM_READ(TERN(X_DUAL_ENDSTOPS, endstops.x2_endstop_adj, dummyf)); // 1 float - EEPROM_READ(TERN(Y_DUAL_ENDSTOPS, endstops.y2_endstop_adj, dummyf)); // 1 float - EEPROM_READ(TERN(Z_MULTI_ENDSTOPS, endstops.z2_endstop_adj, dummyf)); // 1 float - - #if ENABLED(Z_MULTI_ENDSTOPS) && NUM_Z_STEPPER_DRIVERS >= 3 - EEPROM_READ(endstops.z3_endstop_adj); // 1 float - #else - EEPROM_READ(dummyf); - #endif - #if ENABLED(Z_MULTI_ENDSTOPS) && NUM_Z_STEPPER_DRIVERS >= 4 - EEPROM_READ(endstops.z4_endstop_adj); // 1 float - #else - EEPROM_READ(dummyf); - #endif - #endif } + #endif + + // + // Extra Endstops offsets + // + #if HAS_EXTRA_ENDSTOPS + { + _FIELD_TEST(x2_endstop_adj); + + EEPROM_READ(TERN(X_DUAL_ENDSTOPS, endstops.x2_endstop_adj, dummyf)); // 1 float + EEPROM_READ(TERN(Y_DUAL_ENDSTOPS, endstops.y2_endstop_adj, dummyf)); // 1 float + EEPROM_READ(TERN(Z_MULTI_ENDSTOPS, endstops.z2_endstop_adj, dummyf)); // 1 float + + #if ENABLED(Z_MULTI_ENDSTOPS) && NUM_Z_STEPPER_DRIVERS >= 3 + EEPROM_READ(endstops.z3_endstop_adj); // 1 float + #else + EEPROM_READ(dummyf); + #endif + #if ENABLED(Z_MULTI_ENDSTOPS) && NUM_Z_STEPPER_DRIVERS >= 4 + EEPROM_READ(endstops.z4_endstop_adj); // 1 float + #else + EEPROM_READ(dummyf); + #endif + } + #endif #if ENABLED(Z_STEPPER_AUTO_ALIGN) EEPROM_READ(z_stepper_align.xy); @@ -2721,20 +2736,30 @@ void MarlinSettings::reset() { //#endif // - // Endstop Adjustments + // Kinematic settings // - #if ENABLED(DELTA) - const abc_float_t adj = DELTA_ENDSTOP_ADJ, dta = DELTA_TOWER_ANGLE_TRIM, ddr = DELTA_DIAGONAL_ROD_TRIM_TOWER; - delta_height = DELTA_HEIGHT; - delta_endstop_adj = adj; - delta_radius = DELTA_RADIUS; - delta_diagonal_rod = DELTA_DIAGONAL_ROD; - segments_per_second = DELTA_SEGMENTS_PER_SECOND; - delta_tower_angle_trim = dta; - delta_diagonal_rod_trim = ddr; + #if IS_KINEMATIC + segments_per_second = ( + TERN_(DELTA, DELTA_SEGMENTS_PER_SECOND) + TERN_(IS_SCARA, SCARA_SEGMENTS_PER_SECOND) + TERN_(POLARGRAPH, POLAR_SEGMENTS_PER_SECOND) + ); + #if ENABLED(DELTA) + const abc_float_t adj = DELTA_ENDSTOP_ADJ, dta = DELTA_TOWER_ANGLE_TRIM, ddr = DELTA_DIAGONAL_ROD_TRIM_TOWER; + delta_height = DELTA_HEIGHT; + delta_endstop_adj = adj; + delta_radius = DELTA_RADIUS; + delta_diagonal_rod = DELTA_DIAGONAL_ROD; + delta_tower_angle_trim = dta; + delta_diagonal_rod_trim = ddr; + #endif #endif + // + // Endstop Adjustments + // + #if ENABLED(X_DUAL_ENDSTOPS) #ifndef X2_ENDSTOP_ADJUSTMENT #define X2_ENDSTOP_ADJUSTMENT 0 @@ -3137,7 +3162,7 @@ void MarlinSettings::reset() { TERN_(EDITABLE_SERVO_ANGLES, gcode.M281_report(forReplay)); // - // Delta / SCARA Kinematics + // Kinematic Settings // TERN_(IS_KINEMATIC, gcode.M665_report(forReplay)); diff --git a/Marlin/src/pins/ramps/pins_RUMBA.h b/Marlin/src/pins/ramps/pins_RUMBA.h index 942afafd7a..d8e2dd0971 100644 --- a/Marlin/src/pins/ramps/pins_RUMBA.h +++ b/Marlin/src/pins/ramps/pins_RUMBA.h @@ -47,12 +47,27 @@ // // Limit Switches // -#define X_MIN_PIN 37 -#define X_MAX_PIN 36 -#define Y_MIN_PIN 35 -#define Y_MAX_PIN 34 -#define Z_MIN_PIN 33 -#define Z_MAX_PIN 32 +#ifndef X_MIN_PIN + #define X_MIN_PIN 37 +#endif +#ifndef X_MIN_PIN + #define X_MIN_PIN 37 +#endif +#ifndef X_MAX_PIN + #define X_MAX_PIN 36 +#endif +#ifndef Y_MIN_PIN + #define Y_MIN_PIN 35 +#endif +#ifndef Y_MAX_PIN + #define Y_MAX_PIN 34 +#endif +#ifndef Z_MIN_PIN + #define Z_MIN_PIN 33 +#endif +#ifndef Z_MAX_PIN + #define Z_MAX_PIN 32 +#endif // // Z Probe (when not Z_MIN_PIN) diff --git a/buildroot/tests/mega1280 b/buildroot/tests/mega1280 index d8cefbaf81..cae747017f 100755 --- a/buildroot/tests/mega1280 +++ b/buildroot/tests/mega1280 @@ -46,6 +46,7 @@ exec_test $1 $2 "RAMPS | DELTA | RRD LCD | DELTA_AUTO_CALIBRATION | DELTA_CALIBR # # Delta Config (generic) + ABL bilinear + BLTOUCH +# use_example_configs delta/generic opt_set LCD_LANGUAGE cz \ Z_MIN_PROBE_ENDSTOP_INVERTING false \ diff --git a/buildroot/tests/mega2560 b/buildroot/tests/mega2560 index 7d28a00d92..bf3290b9d0 100755 --- a/buildroot/tests/mega2560 +++ b/buildroot/tests/mega2560 @@ -182,7 +182,7 @@ opt_set MOTHERBOARD BOARD_RAMPS_14_EFB EXTRUDERS 0 LCD_LANGUAGE en TEMP_SENSOR_C opt_enable REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER SDSUPPORT EEPROM_SETTINGS EEPROM_BOOT_SILENT EEPROM_AUTO_INIT \ LASER_FEATURE AIR_EVACUATION AIR_EVACUATION_PIN AIR_ASSIST AIR_ASSIST_PIN LASER_COOLANT_FLOW_METER MEATPACK_ON_SERIAL_PORT_1 -exec_test $1 $2 "REPRAP MEGA2560 RAMPS | Laser Feature | Air Evacuation | Air Assist | Cooler | Flowmeter | 12864 LCD | meatpack | SERIAL_PORT_2 " "$3" +exec_test $1 $2 "MEGA2560 RAMPS | Laser Feature | Air Evacuation | Air Assist | Cooler | Flowmeter | 12864 LCD | meatpack | SERIAL_PORT_2 " "$3" # # Test Laser features with 44780 LCD @@ -197,7 +197,7 @@ opt_set MOTHERBOARD BOARD_RAMPS_14_EFB EXTRUDERS 0 LCD_LANGUAGE en TEMP_SENSOR_C opt_enable REPRAP_DISCOUNT_SMART_CONTROLLER SDSUPPORT EEPROM_SETTINGS EEPROM_BOOT_SILENT EEPROM_AUTO_INIT \ LASER_FEATURE AIR_EVACUATION AIR_EVACUATION_PIN AIR_ASSIST AIR_ASSIST_PIN LASER_COOLANT_FLOW_METER I2C_AMMETER -exec_test $1 $2 "REPRAP MEGA2560 RAMPS | Laser Feature | Air Evacuation | Air Assist | Cooler | Flowmeter | 44780 LCD " "$3" +exec_test $1 $2 "MEGA2560 RAMPS | Laser Feature | Air Evacuation | Air Assist | Cooler | Flowmeter | 44780 LCD " "$3" # # Test redundant temperature sensors + MAX TC @@ -210,6 +210,12 @@ opt_set MOTHERBOARD BOARD_RAMPS_14_EFB EXTRUDERS 1 \ exec_test $1 $2 "MEGA2560 RAMPS | Redundant temperature sensor | 2x MAX6675" "$3" +# +# Polargraph Config +# +use_example_configs Polargraph +exec_test $1 $2 "RUMBA | POLARGRAPH | RRD LCD" "$3" + # # Language files test with REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER # diff --git a/ini/features.ini b/ini/features.ini index 949c55c06e..f54b645f85 100644 --- a/ini/features.ini +++ b/ini/features.ini @@ -219,6 +219,7 @@ NEED_LSF = src_filter=+ + NOZZLE_CLEAN_FEATURE = src_filter=+ + DELTA = src_filter=+ + +POLARGRAPH = src_filter=+ BEZIER_CURVE_SUPPORT = src_filter=+ + PRINTCOUNTER = src_filter=+ HAS_BED_PROBE = src_filter=+ + + + diff --git a/platformio.ini b/platformio.ini index bd2a4ed21f..106e454d10 100644 --- a/platformio.ini +++ b/platformio.ini @@ -158,6 +158,7 @@ default_src_filter = + - - + - - - + - - - - @@ -239,9 +240,10 @@ default_src_filter = + - - + - - - - + - - - - - - + - - - - - -