From 55d66fb8971d9e5dbfb15e7ae5c952839b488f59 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Thu, 23 Apr 2020 20:49:11 -0500 Subject: [PATCH] Add HAS_JUNCTION_DEVIATION --- Marlin/Configuration.h | 2 +- Marlin/src/gcode/config/M200-M205.cpp | 4 ++-- Marlin/src/inc/Conditionals_LCD.h | 4 ++++ Marlin/src/inc/Conditionals_post.h | 2 +- Marlin/src/inc/SanityCheck.h | 4 ++-- .../screens/advanced_settings_menu.cpp | 4 ++-- .../screens/bio_advanced_settings.cpp | 4 ++-- .../screens/junction_deviation_screen.cpp | 2 +- .../lib/ftdi_eve_touch_ui/screens/screens.cpp | 2 +- .../extui/lib/ftdi_eve_touch_ui/screens/screens.h | 4 ++-- Marlin/src/lcd/extui/ui_api.cpp | 2 +- Marlin/src/lcd/extui/ui_api.h | 2 +- Marlin/src/lcd/menu/menu_advanced.cpp | 2 +- Marlin/src/module/configuration_store.cpp | 6 +++--- Marlin/src/module/planner.cpp | 14 +++++++------- Marlin/src/module/planner.h | 6 +++--- 16 files changed, 34 insertions(+), 30 deletions(-) diff --git a/Marlin/Configuration.h b/Marlin/Configuration.h index 2804d8ffef..998d5ebea4 100644 --- a/Marlin/Configuration.h +++ b/Marlin/Configuration.h @@ -800,7 +800,7 @@ * https://reprap.org/forum/read.php?1,739819 * http://blog.kyneticcnc.com/2018/10/computing-junction-deviation-for-marlin.html */ -#if DISABLED(CLASSIC_JERK) +#if HAS_JUNCTION_DEVIATION #define JUNCTION_DEVIATION_MM 0.013 // (mm) Distance from real junction edge #endif diff --git a/Marlin/src/gcode/config/M200-M205.cpp b/Marlin/src/gcode/config/M200-M205.cpp index 0ea4fd7c17..30e6f0f564 100644 --- a/Marlin/src/gcode/config/M200-M205.cpp +++ b/Marlin/src/gcode/config/M200-M205.cpp @@ -121,7 +121,7 @@ void GcodeSuite::M204() { * J = Junction Deviation (mm) (If not using CLASSIC_JERK) */ void GcodeSuite::M205() { - #if DISABLED(CLASSIC_JERK) + #if HAS_JUNCTION_DEVIATION #define J_PARAM "J" #else #define J_PARAM @@ -137,7 +137,7 @@ void GcodeSuite::M205() { if (parser.seen('B')) planner.settings.min_segment_time_us = parser.value_ulong(); if (parser.seen('S')) planner.settings.min_feedrate_mm_s = parser.value_linear_units(); if (parser.seen('T')) planner.settings.min_travel_feedrate_mm_s = parser.value_linear_units(); - #if DISABLED(CLASSIC_JERK) + #if HAS_JUNCTION_DEVIATION if (parser.seen('J')) { const float junc_dev = parser.value_linear_units(); if (WITHIN(junc_dev, 0.01f, 0.3f)) { diff --git a/Marlin/src/inc/Conditionals_LCD.h b/Marlin/src/inc/Conditionals_LCD.h index 626d353e38..92c264a66f 100644 --- a/Marlin/src/inc/Conditionals_LCD.h +++ b/Marlin/src/inc/Conditionals_LCD.h @@ -680,6 +680,10 @@ #define HAS_CLASSIC_JERK 1 #endif +#if DISABLED(CLASSIC_JERK) + #define HAS_JUNCTION_DEVIATION 1 +#endif + // E jerk exists with JD disabled (of course) but also when Linear Advance is disabled on Delta/SCARA #if ENABLED(CLASSIC_JERK) || (IS_KINEMATIC && DISABLED(LIN_ADVANCE)) #define HAS_CLASSIC_E_JERK 1 diff --git a/Marlin/src/inc/Conditionals_post.h b/Marlin/src/inc/Conditionals_post.h index 9269c76b7d..4cefe82008 100644 --- a/Marlin/src/inc/Conditionals_post.h +++ b/Marlin/src/inc/Conditionals_post.h @@ -31,7 +31,7 @@ #endif // Linear advance uses Jerk since E is an isolated axis -#if DISABLED(CLASSIC_JERK) && ENABLED(LIN_ADVANCE) +#if HAS_JUNCTION_DEVIATION && ENABLED(LIN_ADVANCE) #define HAS_LINEAR_E_JERK 1 #endif diff --git a/Marlin/src/inc/SanityCheck.h b/Marlin/src/inc/SanityCheck.h index d1024e44ce..840e54e124 100644 --- a/Marlin/src/inc/SanityCheck.h +++ b/Marlin/src/inc/SanityCheck.h @@ -355,7 +355,7 @@ #error "LEVEL_BED_CORNERS requires LEVEL_CORNERS_INSET_LFRB values. Please update your Configuration.h." #elif defined(BEZIER_JERK_CONTROL) #error "BEZIER_JERK_CONTROL is now S_CURVE_ACCELERATION. Please update your configuration." -#elif DISABLED(CLASSIC_JERK) && defined(JUNCTION_DEVIATION_FACTOR) +#elif HAS_JUNCTION_DEVIATION && defined(JUNCTION_DEVIATION_FACTOR) #error "JUNCTION_DEVIATION_FACTOR is now JUNCTION_DEVIATION_MM. Please update your configuration." #elif defined(JUNCTION_ACCELERATION_FACTOR) #error "JUNCTION_ACCELERATION_FACTOR is obsolete. Delete it from Configuration_adv.h." @@ -1137,7 +1137,7 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS /** * Junction deviation is incompatible with kinematic systems. */ -#if DISABLED(CLASSIC_JERK) && IS_KINEMATIC +#if HAS_JUNCTION_DEVIATION && IS_KINEMATIC #error "CLASSIC_JERK is required for DELTA and SCARA." #endif diff --git a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/advanced_settings_menu.cpp b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/advanced_settings_menu.cpp index e625325d44..41c76ad48d 100644 --- a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/advanced_settings_menu.cpp +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/advanced_settings_menu.cpp @@ -133,7 +133,7 @@ void AdvancedSettingsMenu::onRedraw(draw_mode_t what) { .tag(5) .button( VELOCITY_POS, GET_TEXT_F(MSG_VELOCITY)) .tag(6) .button( ACCELERATION_POS, GET_TEXT_F(MSG_ACCELERATION)) .tag(7) .button( JERK_POS, GET_TEXT_F( - #if DISABLED(CLASSIC_JERK) + #if HAS_JUNCTION_DEVIATION MSG_JUNCTION_DEVIATION #else MSG_JERK @@ -163,7 +163,7 @@ bool AdvancedSettingsMenu::onTouchEnd(uint8_t tag) { case 5: GOTO_SCREEN(MaxVelocityScreen); break; case 6: GOTO_SCREEN(DefaultAccelerationScreen); break; case 7: - #if DISABLED(CLASSIC_JERK) + #if HAS_JUNCTION_DEVIATION GOTO_SCREEN(JunctionDeviationScreen); #else GOTO_SCREEN(JerkScreen); diff --git a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/bio_advanced_settings.cpp b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/bio_advanced_settings.cpp index d2c5c6658c..ea6ba93c8b 100644 --- a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/bio_advanced_settings.cpp +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/bio_advanced_settings.cpp @@ -68,7 +68,7 @@ void AdvancedSettingsMenu::onRedraw(draw_mode_t what) { .tag(7) .button( BTN_POS(2,1), BTN_SIZE(1,1), GET_TEXT_F(MSG_STEPS_PER_MM)) .tag(8) .button( BTN_POS(2,2), BTN_SIZE(1,1), GET_TEXT_F(MSG_VELOCITY)) .tag(9) .button( BTN_POS(2,3), BTN_SIZE(1,1), GET_TEXT_F(MSG_ACCELERATION)) - #if DISABLED(CLASSIC_JERK) + #if HAS_JUNCTION_DEVIATION .tag(10) .button( BTN_POS(2,4), BTN_SIZE(1,1), GET_TEXT_F(MSG_JUNCTION_DEVIATION)) #else .tag(10) .button( BTN_POS(2,4), BTN_SIZE(1,1), GET_TEXT_F(MSG_JERK)) @@ -113,7 +113,7 @@ bool AdvancedSettingsMenu::onTouchEnd(uint8_t tag) { case 8: GOTO_SCREEN(MaxVelocityScreen); break; case 9: GOTO_SCREEN(DefaultAccelerationScreen); break; case 10: - #if DISABLED(CLASSIC_JERK) + #if HAS_JUNCTION_DEVIATION GOTO_SCREEN(JunctionDeviationScreen); #else GOTO_SCREEN(JerkScreen); diff --git a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/junction_deviation_screen.cpp b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/junction_deviation_screen.cpp index 034ac15c42..afc230987e 100644 --- a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/junction_deviation_screen.cpp +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/junction_deviation_screen.cpp @@ -22,7 +22,7 @@ #include "../config.h" -#if ENABLED(TOUCH_UI_FTDI_EVE) && DISABLED(CLASSIC_JERK) +#if ENABLED(TOUCH_UI_FTDI_EVE) && HAS_JUNCTION_DEVIATION #include "screens.h" diff --git a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/screens.cpp b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/screens.cpp index 53d9d7a5ba..72b4a8b1a5 100644 --- a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/screens.cpp +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/screens.cpp @@ -78,7 +78,7 @@ SCREEN_TABLE { DECL_SCREEN(MaxVelocityScreen), DECL_SCREEN(MaxAccelerationScreen), DECL_SCREEN(DefaultAccelerationScreen), -#if DISABLED(CLASSIC_JERK) +#if HAS_JUNCTION_DEVIATION DECL_SCREEN(JunctionDeviationScreen), #else DECL_SCREEN(JerkScreen), diff --git a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/screens.h b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/screens.h index c659f50fc1..87522870b9 100644 --- a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/screens.h +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/screens.h @@ -58,7 +58,7 @@ enum { #if HAS_MESH BED_MESH_SCREEN_CACHE, #endif -#if DISABLED(CLASSIC_JERK) +#if HAS_JUNCTION_DEVIATION JUNC_DEV_SCREEN_CACHE, #else JERK_SCREEN_CACHE, @@ -566,7 +566,7 @@ class DefaultAccelerationScreen : public BaseNumericAdjustmentScreen, public Cac static bool onTouchHeld(uint8_t tag); }; -#if DISABLED(CLASSIC_JERK) +#if HAS_JUNCTION_DEVIATION class JunctionDeviationScreen : public BaseNumericAdjustmentScreen, public CachedScreen { public: static void onRedraw(draw_mode_t); diff --git a/Marlin/src/lcd/extui/ui_api.cpp b/Marlin/src/lcd/extui/ui_api.cpp index dd5ddd3b66..1ae9edb7e3 100644 --- a/Marlin/src/lcd/extui/ui_api.cpp +++ b/Marlin/src/lcd/extui/ui_api.cpp @@ -631,7 +631,7 @@ namespace ExtUI { } #endif - #if DISABLED(CLASSIC_JERK) + #if HAS_JUNCTION_DEVIATION float getJunctionDeviation_mm() { return planner.junction_deviation_mm; diff --git a/Marlin/src/lcd/extui/ui_api.h b/Marlin/src/lcd/extui/ui_api.h index 3852686898..652f77198a 100644 --- a/Marlin/src/lcd/extui/ui_api.h +++ b/Marlin/src/lcd/extui/ui_api.h @@ -186,7 +186,7 @@ namespace ExtUI { void setLinearAdvance_mm_mm_s(const float, const extruder_t); #endif - #if DISABLED(CLASSIC_JERK) + #if HAS_JUNCTION_DEVIATION float getJunctionDeviation_mm(); void setJunctionDeviation_mm(const float); #else diff --git a/Marlin/src/lcd/menu/menu_advanced.cpp b/Marlin/src/lcd/menu/menu_advanced.cpp index 4f85976d7d..f6c8a2cdff 100644 --- a/Marlin/src/lcd/menu/menu_advanced.cpp +++ b/Marlin/src/lcd/menu/menu_advanced.cpp @@ -423,7 +423,7 @@ void menu_cancelobject(); START_MENU(); BACK_ITEM(MSG_ADVANCED_SETTINGS); - #if DISABLED(CLASSIC_JERK) + #if HAS_JUNCTION_DEVIATION #if ENABLED(LIN_ADVANCE) EDIT_ITEM(float43, MSG_JUNCTION_DEVIATION, &planner.junction_deviation_mm, 0.001f, 0.3f, planner.recalculate_max_e_jerk); #else diff --git a/Marlin/src/module/configuration_store.cpp b/Marlin/src/module/configuration_store.cpp index 84b8c75370..a919562d64 100644 --- a/Marlin/src/module/configuration_store.cpp +++ b/Marlin/src/module/configuration_store.cpp @@ -2393,7 +2393,7 @@ void MarlinSettings::reset() { TERN_(HAS_CLASSIC_E_JERK, planner.max_jerk.e = DEFAULT_EJERK;); #endif - #if DISABLED(CLASSIC_JERK) + #if HAS_JUNCTION_DEVIATION planner.junction_deviation_mm = float(JUNCTION_DEVIATION_MM); #endif @@ -2862,7 +2862,7 @@ void MarlinSettings::reset() { CONFIG_ECHO_HEADING( "Advanced: B S T" - #if DISABLED(CLASSIC_JERK) + #if HAS_JUNCTION_DEVIATION " J" #endif #if HAS_CLASSIC_JERK @@ -2875,7 +2875,7 @@ void MarlinSettings::reset() { PSTR(" M205 B"), LINEAR_UNIT(planner.settings.min_segment_time_us) , PSTR(" S"), LINEAR_UNIT(planner.settings.min_feedrate_mm_s) , SP_T_STR, LINEAR_UNIT(planner.settings.min_travel_feedrate_mm_s) - #if DISABLED(CLASSIC_JERK) + #if HAS_JUNCTION_DEVIATION , PSTR(" J"), LINEAR_UNIT(planner.junction_deviation_mm) #endif #if HAS_CLASSIC_JERK diff --git a/Marlin/src/module/planner.cpp b/Marlin/src/module/planner.cpp index c2a6365417..310e86f2e5 100644 --- a/Marlin/src/module/planner.cpp +++ b/Marlin/src/module/planner.cpp @@ -132,7 +132,7 @@ uint32_t Planner::max_acceleration_steps_per_s2[XYZE_N]; // (steps/s^2) Derived float Planner::steps_to_mm[XYZE_N]; // (mm) Millimeters per step -#if DISABLED(CLASSIC_JERK) +#if HAS_JUNCTION_DEVIATION float Planner::junction_deviation_mm; // (mm) M205 J #if ENABLED(LIN_ADVANCE) #if ENABLED(DISTINCT_E_FACTORS) @@ -2151,7 +2151,7 @@ bool Planner::_populate_block(block_t * const block, bool split_move, #if ENABLED(LIN_ADVANCE) - #if DISABLED(CLASSIC_JERK) + #if HAS_JUNCTION_DEVIATION #if ENABLED(DISTINCT_E_FACTORS) #define MAX_E_JERK max_e_jerk[extruder] #else @@ -2238,7 +2238,7 @@ bool Planner::_populate_block(block_t * const block, bool split_move, float vmax_junction_sqr; // Initial limit on the segment entry velocity (mm/s)^2 - #if DISABLED(CLASSIC_JERK) + #if HAS_JUNCTION_DEVIATION /** * Compute maximum allowable entry speed at junction by centripetal acceleration approximation. * Let a circle be tangent to both previous and current path line segments, where the junction @@ -2285,7 +2285,7 @@ bool Planner::_populate_block(block_t * const block, bool split_move, ; unit_vec *= inverse_millimeters; - #if IS_CORE && DISABLED(CLASSIC_JERK) + #if IS_CORE && HAS_JUNCTION_DEVIATION /** * On CoreXY the length of the vector [A,B] is SQRT(2) times the length of the head movement vector [X,Y]. * So taking Z and E into account, we cannot scale to a unit vector with "inverse_millimeters". @@ -2460,7 +2460,7 @@ bool Planner::_populate_block(block_t * const block, bool split_move, previous_safe_speed = safe_speed; - #if DISABLED(CLASSIC_JERK) + #if HAS_JUNCTION_DEVIATION vmax_junction_sqr = _MIN(vmax_junction_sqr, sq(vmax_junction)); #else vmax_junction_sqr = sq(vmax_junction); @@ -2649,7 +2649,7 @@ bool Planner::buffer_line(const float &rx, const float &ry, const float &rz, con #if IS_KINEMATIC - #if DISABLED(CLASSIC_JERK) + #if HAS_JUNCTION_DEVIATION const xyze_pos_t cart_dist_mm = { rx - position_cart.x, ry - position_cart.y, rz - position_cart.z, e - position_cart.e @@ -2675,7 +2675,7 @@ bool Planner::buffer_line(const float &rx, const float &ry, const float &rz, con const feedRate_t feedrate = fr_mm_s; #endif if (buffer_segment(delta.a, delta.b, delta.c, machine.e - #if DISABLED(CLASSIC_JERK) + #if HAS_JUNCTION_DEVIATION , cart_dist_mm #endif , feedrate, extruder, mm diff --git a/Marlin/src/module/planner.h b/Marlin/src/module/planner.h index 87a6e7c0a8..626e39c721 100644 --- a/Marlin/src/module/planner.h +++ b/Marlin/src/module/planner.h @@ -61,7 +61,7 @@ manual_feedrate_mm_s { _mf.x / 60.0f, _mf.y / 60.0f, _mf.z / 60.0f, _mf.e / 60.0f }; #endif -#if IS_KINEMATIC && DISABLED(CLASSIC_JERK) +#if IS_KINEMATIC && HAS_JUNCTION_DEVIATION #define HAS_DIST_MM_ARG 1 #endif @@ -304,7 +304,7 @@ class Planner { static uint32_t max_acceleration_steps_per_s2[XYZE_N]; // (steps/s^2) Derived from mm_per_s2 static float steps_to_mm[XYZE_N]; // Millimeters per step - #if DISABLED(CLASSIC_JERK) + #if HAS_JUNCTION_DEVIATION static float junction_deviation_mm; // (mm) M205 J #if ENABLED(LIN_ADVANCE) static float max_e_jerk // Calculated from junction_deviation_mm @@ -900,7 +900,7 @@ class Planner { static void recalculate(); - #if DISABLED(CLASSIC_JERK) + #if HAS_JUNCTION_DEVIATION FORCE_INLINE static void normalize_junction_vector(xyze_float_t &vector) { float magnitude_sq = 0;