From 75da3555ee0910f3d572f4b8176afecdc941524b Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Thu, 14 Dec 2023 10:03:11 -0600 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=A7=20Update=20CLASSIC=5FJERK=20condit?= =?UTF-8?q?ionals?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/gcode/calibrate/G28.cpp | 4 +-- Marlin/src/gcode/config/M200-M205.cpp | 10 +++---- Marlin/src/gcode/config/M92.cpp | 2 +- Marlin/src/gcode/host/M360.cpp | 4 +-- Marlin/src/inc/Conditionals_LCD.h | 14 ---------- Marlin/src/inc/Conditionals_adv.h | 15 +++++++++++ Marlin/src/inc/Conditionals_post.h | 5 ---- Marlin/src/inc/SanityCheck.h | 4 +-- Marlin/src/lcd/e3v2/common/limits.h | 2 +- Marlin/src/lcd/e3v2/creality/dwin.cpp | 26 +++++++++---------- Marlin/src/lcd/e3v2/jyersui/dwin.cpp | 10 +++---- Marlin/src/lcd/e3v2/proui/dwin.cpp | 14 +++++----- Marlin/src/lcd/e3v2/proui/dwin.h | 2 +- .../lcd/extui/mks_ui/draw_jerk_settings.cpp | 4 +-- .../extui/mks_ui/draw_machine_settings.cpp | 4 +-- .../src/lcd/extui/mks_ui/draw_number_key.cpp | 16 ++++++------ Marlin/src/lcd/extui/mks_ui/draw_ui.cpp | 4 +-- Marlin/src/lcd/menu/menu_advanced.cpp | 12 +++------ Marlin/src/module/planner.cpp | 12 ++++----- Marlin/src/module/planner.h | 6 ++--- Marlin/src/module/settings.cpp | 6 ++--- 21 files changed, 83 insertions(+), 93 deletions(-) diff --git a/Marlin/src/gcode/calibrate/G28.cpp b/Marlin/src/gcode/calibrate/G28.cpp index dbdbdc5aff..98d0a40148 100644 --- a/Marlin/src/gcode/calibrate/G28.cpp +++ b/Marlin/src/gcode/calibrate/G28.cpp @@ -155,7 +155,7 @@ planner.settings.max_acceleration_mm_per_s2[X_AXIS] = 100; planner.settings.max_acceleration_mm_per_s2[Y_AXIS] = 100; TERN_(DELTA, planner.settings.max_acceleration_mm_per_s2[Z_AXIS] = 100); - #if HAS_CLASSIC_JERK + #if ENABLED(CLASSIC_JERK) motion_state.jerk_state = planner.max_jerk; planner.max_jerk.set(0, 0 OPTARG(DELTA, 0)); #endif @@ -167,7 +167,7 @@ planner.settings.max_acceleration_mm_per_s2[X_AXIS] = motion_state.acceleration.x; planner.settings.max_acceleration_mm_per_s2[Y_AXIS] = motion_state.acceleration.y; TERN_(DELTA, planner.settings.max_acceleration_mm_per_s2[Z_AXIS] = motion_state.acceleration.z); - TERN_(HAS_CLASSIC_JERK, planner.max_jerk = motion_state.jerk_state); + TERN_(CLASSIC_JERK, planner.max_jerk = motion_state.jerk_state); planner.refresh_acceleration_rates(); } diff --git a/Marlin/src/gcode/config/M200-M205.cpp b/Marlin/src/gcode/config/M200-M205.cpp index 06fbef631e..7cdf4026b8 100644 --- a/Marlin/src/gcode/config/M200-M205.cpp +++ b/Marlin/src/gcode/config/M200-M205.cpp @@ -297,7 +297,7 @@ void GcodeSuite::M205() { if (parser.seenval('S')) planner.settings.min_feedrate_mm_s = parser.value_linear_units(); if (parser.seenval('T')) planner.settings.min_travel_feedrate_mm_s = parser.value_linear_units(); #if HAS_JUNCTION_DEVIATION - #if HAS_CLASSIC_JERK && AXIS_COLLISION('J') + #if ENABLED(CLASSIC_JERK) && AXIS_COLLISION('J') #error "Can't set_max_jerk for 'J' axis because 'J' is used for Junction Deviation." #endif if (parser.seenval('J')) { @@ -310,7 +310,7 @@ void GcodeSuite::M205() { SERIAL_ERROR_MSG("?J out of range (0.01 to 0.3)"); } #endif - #if HAS_CLASSIC_JERK + #if ENABLED(CLASSIC_JERK) bool seenZ = false; LOGICAL_AXIS_CODE( if (parser.seenval('E')) planner.set_max_jerk(E_AXIS, parser.value_linear_units()), @@ -328,14 +328,14 @@ void GcodeSuite::M205() { if (seenZ && planner.max_jerk.z <= 0.1f) SERIAL_ECHOLNPGM("WARNING! Low Z Jerk may lead to unwanted pauses."); #endif - #endif // HAS_CLASSIC_JERK + #endif // CLASSIC_JERK } void GcodeSuite::M205_report(const bool forReplay/*=true*/) { report_heading_etc(forReplay, F( "Advanced (" M205_MIN_SEG_TIME_STR " S T" TERN_(HAS_JUNCTION_DEVIATION, " J") - #if HAS_CLASSIC_JERK + #if ENABLED(CLASSIC_JERK) NUM_AXIS_GANG( " X", " Y", " Z", " " STR_I "", " " STR_J "", " " STR_K "", @@ -352,7 +352,7 @@ void GcodeSuite::M205_report(const bool forReplay/*=true*/) { #if HAS_JUNCTION_DEVIATION , PSTR(" J"), LINEAR_UNIT(planner.junction_deviation_mm) #endif - #if HAS_CLASSIC_JERK && NUM_AXES + #if ENABLED(CLASSIC_JERK) && NUM_AXES , LIST_N(DOUBLE(NUM_AXES), SP_X_STR, LINEAR_UNIT(planner.max_jerk.x), SP_Y_STR, LINEAR_UNIT(planner.max_jerk.y), diff --git a/Marlin/src/gcode/config/M92.cpp b/Marlin/src/gcode/config/M92.cpp index 67f55e2232..01b32118c8 100644 --- a/Marlin/src/gcode/config/M92.cpp +++ b/Marlin/src/gcode/config/M92.cpp @@ -55,7 +55,7 @@ void GcodeSuite::M92() { const float value = parser.value_per_axis_units((AxisEnum)(E_AXIS_N(target_extruder))); if (value < 20) { float factor = planner.settings.axis_steps_per_mm[E_AXIS_N(target_extruder)] / value; // increase e constants if M92 E14 is given for netfab. - #if HAS_CLASSIC_JERK && HAS_CLASSIC_E_JERK + #if ALL(CLASSIC_JERK, HAS_CLASSIC_E_JERK) planner.max_jerk.e *= factor; #endif planner.settings.max_feedrate_mm_s[E_AXIS_N(target_extruder)] *= factor; diff --git a/Marlin/src/gcode/host/M360.cpp b/Marlin/src/gcode/host/M360.cpp index 9649e99e17..87aad88952 100644 --- a/Marlin/src/gcode/host/M360.cpp +++ b/Marlin/src/gcode/host/M360.cpp @@ -91,7 +91,7 @@ void GcodeSuite::M360() { // // XYZ Axis Jerk // - #if HAS_CLASSIC_JERK + #if ENABLED(CLASSIC_JERK) if (planner.max_jerk.x == planner.max_jerk.y) config_line(F("XY"), planner.max_jerk.x, FPSTR(JERK_STR)); else { @@ -182,7 +182,7 @@ void GcodeSuite::M360() { config_line(F("NumExtruder"), EXTRUDERS); #if HAS_EXTRUDERS EXTRUDER_LOOP() { - config_line_e(e, JERK_STR, TERN(HAS_LINEAR_E_JERK, planner.max_e_jerk[E_INDEX_N(e)], TERN(HAS_CLASSIC_JERK, planner.max_jerk.e, DEFAULT_EJERK))); + config_line_e(e, JERK_STR, TERN(HAS_LINEAR_E_JERK, planner.max_e_jerk[E_INDEX_N(e)], TERN(CLASSIC_JERK, planner.max_jerk.e, DEFAULT_EJERK))); config_line_e(e, F("MaxSpeed"), planner.settings.max_feedrate_mm_s[E_AXIS_N(e)]); config_line_e(e, F("Acceleration"), planner.settings.max_acceleration_mm_per_s2[E_AXIS_N(e)]); config_line_e(e, F("Diameter"), TERN(NO_VOLUMETRICS, DEFAULT_NOMINAL_FILAMENT_DIA, planner.filament_size[e])); diff --git a/Marlin/src/inc/Conditionals_LCD.h b/Marlin/src/inc/Conditionals_LCD.h index 955b8fd960..37d56d4f1e 100644 --- a/Marlin/src/inc/Conditionals_LCD.h +++ b/Marlin/src/inc/Conditionals_LCD.h @@ -1615,20 +1615,6 @@ #undef DELTA_HOME_TO_SAFE_ZONE #endif -// This flag indicates some kind of jerk storage is needed -#if ANY(CLASSIC_JERK, IS_KINEMATIC) - #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 HAS_EXTRUDERS && (ENABLED(CLASSIC_JERK) || (IS_KINEMATIC && DISABLED(LIN_ADVANCE))) - #define HAS_CLASSIC_E_JERK 1 -#endif - // // Serial Port Info // diff --git a/Marlin/src/inc/Conditionals_adv.h b/Marlin/src/inc/Conditionals_adv.h index 755b251b18..f62714df4b 100644 --- a/Marlin/src/inc/Conditionals_adv.h +++ b/Marlin/src/inc/Conditionals_adv.h @@ -302,6 +302,21 @@ #endif #endif +// Use Junction Deviation for motion if Jerk is disabled +#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 HAS_EXTRUDERS && (ENABLED(CLASSIC_JERK) || (IS_KINEMATIC && DISABLED(LIN_ADVANCE))) + #define HAS_CLASSIC_E_JERK 1 +#endif + +// Linear advance uses Jerk since E is an isolated axis +#if ALL(HAS_JUNCTION_DEVIATION, LIN_ADVANCE) + #define HAS_LINEAR_E_JERK 1 +#endif + /** * Temperature Sensors; define what sensor(s) we have. */ diff --git a/Marlin/src/inc/Conditionals_post.h b/Marlin/src/inc/Conditionals_post.h index 09e020dab8..85b3a22cbf 100644 --- a/Marlin/src/inc/Conditionals_post.h +++ b/Marlin/src/inc/Conditionals_post.h @@ -37,11 +37,6 @@ #define ADC_VREF_MV HAL_ADC_VREF_MV #endif -// Linear advance uses Jerk since E is an isolated axis -#if ALL(HAS_JUNCTION_DEVIATION, LIN_ADVANCE) - #define HAS_LINEAR_E_JERK 1 -#endif - // Determine which type of 'EEPROM' is in use #if ENABLED(EEPROM_SETTINGS) // EEPROM type may be defined by compile flags, configs, HALs, or pins diff --git a/Marlin/src/inc/SanityCheck.h b/Marlin/src/inc/SanityCheck.h index 2e1149e668..1471d2d13c 100644 --- a/Marlin/src/inc/SanityCheck.h +++ b/Marlin/src/inc/SanityCheck.h @@ -1225,7 +1225,7 @@ static_assert(COUNT(arm) == LOGICAL_AXES, "AXIS_RELATIVE_MODES must contain " _L * Junction deviation is incompatible with kinematic systems. */ #if HAS_JUNCTION_DEVIATION && IS_KINEMATIC - #error "CLASSIC_JERK is required for DELTA, SCARA, and POLAR." + #error "CLASSIC_JERK is required for the kinematics of DELTA, SCARA, POLAR, etc." #endif /** @@ -1583,7 +1583,7 @@ static_assert(COUNT(arm) == LOGICAL_AXES, "AXIS_RELATIVE_MODES must contain " _L #error "Only enable RESTORE_LEVELING_AFTER_G28 or ENABLE_LEVELING_AFTER_G28, but not both." #endif -#if HAS_MESH && HAS_CLASSIC_JERK +#if ALL(HAS_MESH, CLASSIC_JERK) static_assert(DEFAULT_ZJERK > 0.1, "Low DEFAULT_ZJERK values are incompatible with mesh-based leveling."); #endif #if HAS_MESH && DGUS_LCD_UI_IA_CREALITY && GRID_MAX_POINTS > 25 diff --git a/Marlin/src/lcd/e3v2/common/limits.h b/Marlin/src/lcd/e3v2/common/limits.h index da75d9c982..5debc3ffdb 100644 --- a/Marlin/src/lcd/e3v2/common/limits.h +++ b/Marlin/src/lcd/e3v2/common/limits.h @@ -67,7 +67,7 @@ constexpr xyze_float_t min_acceleration_edit_values = LOGICAL_AXIS_ARRAY_1(MIN_A #define MIN_JERK_EDIT_VALUE 0.1 #define DEFAULT_MAX_JERK_MULTIPLIER 2 -#if HAS_CLASSIC_JERK +#if ENABLED(CLASSIC_JERK) constexpr xyze_float_t min_jerk_edit_values = LOGICAL_AXIS_ARRAY_1(MIN_JERK_EDIT_VALUE), default_jerk = LOGICAL_AXIS_ARRAY( DEFAULT_EJERK, diff --git a/Marlin/src/lcd/e3v2/creality/dwin.cpp b/Marlin/src/lcd/e3v2/creality/dwin.cpp index 2743901891..c1e7a358c0 100644 --- a/Marlin/src/lcd/e3v2/creality/dwin.cpp +++ b/Marlin/src/lcd/e3v2/creality/dwin.cpp @@ -460,7 +460,7 @@ void drawBackFirst(const bool is_sel=true) { #define MOTION_CASE_RATE 1 #define MOTION_CASE_ACCEL 2 -#define MOTION_CASE_JERK (MOTION_CASE_ACCEL + ENABLED(HAS_CLASSIC_JERK)) +#define MOTION_CASE_JERK (MOTION_CASE_ACCEL + ENABLED(CLASSIC_JERK)) #define MOTION_CASE_STEPS (MOTION_CASE_JERK + 1) #define MOTION_CASE_TOTAL MOTION_CASE_STEPS @@ -1004,7 +1004,7 @@ void drawMotionMenu() { itemAreaCopy(173, 133, 228, 147, MOTION_CASE_RATE); // Max speed itemAreaCopy(173, 133, 200, 147, MOTION_CASE_ACCEL); // Max... itemAreaCopy(28, 149, 69, 161, MOTION_CASE_ACCEL, 30, 1); // ...Acceleration - #if HAS_CLASSIC_JERK + #if ENABLED(CLASSIC_JERK) itemAreaCopy(173, 133, 200, 147, MOTION_CASE_JERK); // Max... itemAreaCopy(1, 180, 28, 192, MOTION_CASE_JERK, 30, 1); // ... itemAreaCopy(202, 133, 228, 147, MOTION_CASE_JERK, 57); // ...Jerk @@ -1020,14 +1020,14 @@ void drawMotionMenu() { #ifdef USE_STRING_TITLES dwinDrawLabel(MOTION_CASE_RATE, F("Feedrate")); // "Feedrate" dwinDrawLabel(MOTION_CASE_ACCEL, GET_TEXT_F(MSG_ACCELERATION)); // "Acceleration" - #if HAS_CLASSIC_JERK + #if ENABLED(CLASSIC_JERK) dwinDrawLabel(MOTION_CASE_JERK, GET_TEXT_F(MSG_JERK)); // "Jerk" #endif dwinDrawLabel(MOTION_CASE_STEPS, GET_TEXT_F(MSG_STEPS_PER_MM)); // "Steps/mm" #else say_max_en(MOTION_CASE_RATE); say_speed_en(30, MOTION_CASE_RATE); // "Max Speed" say_max_accel_en(MOTION_CASE_ACCEL); // "Max Acceleration" - #if HAS_CLASSIC_JERK + #if ENABLED(CLASSIC_JERK) say_max_en(MOTION_CASE_JERK); say_jerk_en(MOTION_CASE_JERK); // "Max Jerk" #endif say_steps_per_mm_en(MOTION_CASE_STEPS); // "Steps-per-mm" @@ -1041,7 +1041,7 @@ void drawMotionMenu() { #define _MOTION_ICON(N) drawMenuLine(++i, ICON_MaxSpeed + (N) - 1) _MOTION_ICON(MOTION_CASE_RATE); drawMoreIcon(i); _MOTION_ICON(MOTION_CASE_ACCEL); drawMoreIcon(i); - #if HAS_CLASSIC_JERK + #if ENABLED(CLASSIC_JERK) _MOTION_ICON(MOTION_CASE_JERK); drawMoreIcon(i); #endif _MOTION_ICON(MOTION_CASE_STEPS); drawMoreIcon(i); @@ -1597,7 +1597,7 @@ void hmiMaxAccelerationXYZE() { drawEditInteger4(select_acc.now, hmiValues.maxAcceleration, true); } -#if HAS_CLASSIC_JERK +#if ENABLED(CLASSIC_JERK) void hmiMaxJerkXYZE() { EncoderState encoder_diffState = encoderReceiveAnalyze(); @@ -1617,7 +1617,7 @@ void hmiMaxAccelerationXYZE() { drawEditFloat3(select_jerk.now, hmiValues.maxJerkScaled, true); } -#endif // HAS_CLASSIC_JERK +#endif // CLASSIC_JERK void hmiStepXYZE() { EncoderState encoder_diffState = encoderReceiveAnalyze(); @@ -3349,7 +3349,7 @@ void drawMaxAccelMenu() { #endif } -#if HAS_CLASSIC_JERK +#if ENABLED(CLASSIC_JERK) void drawMaxJerkMenu() { clearMainWindow(); @@ -3489,7 +3489,7 @@ void hmiMotion() { select_acc.reset(); drawMaxAccelMenu(); break; - #if HAS_CLASSIC_JERK + #if ENABLED(CLASSIC_JERK) case MOTION_CASE_JERK: checkkey = ID_MaxJerk; select_jerk.reset(); @@ -3996,7 +3996,7 @@ void hmiMaxAcceleration() { dwinUpdateLCD(); } -#if HAS_CLASSIC_JERK +#if ENABLED(CLASSIC_JERK) // Max Jerk void hmiMaxJerk() { EncoderState encoder_diffState = get_encoder_state(); @@ -4025,7 +4025,7 @@ void hmiMaxAcceleration() { } dwinUpdateLCD(); } -#endif // HAS_CLASSIC_JERK +#endif // CLASSIC_JERK // Step void hmiStep() { @@ -4251,7 +4251,7 @@ void dwinHandleScreen() { #endif case ID_MaxSpeed: hmiMaxSpeed(); break; case ID_MaxAcceleration: hmiMaxAcceleration(); break; - #if HAS_CLASSIC_JERK + #if ENABLED(CLASSIC_JERK) case ID_MaxJerk: hmiMaxJerk(); break; #endif case ID_Step: hmiStep(); break; @@ -4274,7 +4274,7 @@ void dwinHandleScreen() { case ID_PrintSpeed: hmiPrintSpeed(); break; case ID_MaxSpeedValue: hmiMaxFeedspeedXYZE(); break; case ID_MaxAccelerationValue: hmiMaxAccelerationXYZE(); break; - #if HAS_CLASSIC_JERK + #if ENABLED(CLASSIC_JERK) case ID_MaxJerkValue: hmiMaxJerkXYZE(); break; #endif case ID_StepValue: hmiStepXYZE(); break; diff --git a/Marlin/src/lcd/e3v2/jyersui/dwin.cpp b/Marlin/src/lcd/e3v2/jyersui/dwin.cpp index be8605e3bb..1cb2a2efed 100644 --- a/Marlin/src/lcd/e3v2/jyersui/dwin.cpp +++ b/Marlin/src/lcd/e3v2/jyersui/dwin.cpp @@ -2333,7 +2333,7 @@ void JyersDWIN::menuItemHandler(const uint8_t menu, const uint8_t item, bool dra #define MOTION_HOMEOFFSETS (MOTION_BACK + 1) #define MOTION_SPEED (MOTION_HOMEOFFSETS + 1) #define MOTION_ACCEL (MOTION_SPEED + 1) - #define MOTION_JERK (MOTION_ACCEL + ENABLED(HAS_CLASSIC_JERK)) + #define MOTION_JERK (MOTION_ACCEL + ENABLED(CLASSIC_JERK)) #define MOTION_STEPS (MOTION_JERK + 1) #define MOTION_FLOW (MOTION_STEPS + ENABLED(HAS_HOTEND)) #define MOTION_LA (MOTION_FLOW + ENABLED(LIN_ADVANCE)) @@ -2364,7 +2364,7 @@ void JyersDWIN::menuItemHandler(const uint8_t menu, const uint8_t item, bool dra else drawMenu(ID_MaxAcceleration); break; - #if HAS_CLASSIC_JERK + #if ENABLED(CLASSIC_JERK) case MOTION_JERK: if (draw) drawMenuItem(row, ICON_MaxJerk, GET_TEXT_F(MSG_JERK), nullptr, true); @@ -2553,7 +2553,7 @@ void JyersDWIN::menuItemHandler(const uint8_t menu, const uint8_t item, bool dra #endif } break; - #if HAS_CLASSIC_JERK + #if ENABLED(CLASSIC_JERK) case ID_MaxJerk: #define JERK_BACK 0 @@ -4170,7 +4170,7 @@ FSTR_P JyersDWIN::getMenuTitle(const uint8_t menu) { case ID_HomeOffsets: return GET_TEXT_F(MSG_SET_HOME_OFFSETS); case ID_MaxSpeed: return GET_TEXT_F(MSG_MAX_SPEED); case ID_MaxAcceleration: return F("Max Acceleration"); - #if HAS_CLASSIC_JERK + #if ENABLED(CLASSIC_JERK) case ID_MaxJerk: return F("Max Jerk"); #endif case ID_Steps: return GET_TEXT_F(MSG_STEPS_PER_MM); @@ -4247,7 +4247,7 @@ uint8_t JyersDWIN::getMenuSize(const uint8_t menu) { case ID_HomeOffsets: return HOMEOFFSETS_TOTAL; case ID_MaxSpeed: return SPEED_TOTAL; case ID_MaxAcceleration: return ACCEL_TOTAL; - #if HAS_CLASSIC_JERK + #if ENABLED(CLASSIC_JERK) case ID_MaxJerk: return JERK_TOTAL; #endif case ID_Steps: return STEPS_TOTAL; diff --git a/Marlin/src/lcd/e3v2/proui/dwin.cpp b/Marlin/src/lcd/e3v2/proui/dwin.cpp index 7c68c60f81..8d54e0c582 100644 --- a/Marlin/src/lcd/e3v2/proui/dwin.cpp +++ b/Marlin/src/lcd/e3v2/proui/dwin.cpp @@ -236,7 +236,7 @@ Menu *filamentMenu = nullptr; Menu *temperatureMenu = nullptr; Menu *maxSpeedMenu = nullptr; Menu *maxAccelMenu = nullptr; -#if HAS_CLASSIC_JERK +#if ENABLED(CLASSIC_JERK) Menu *maxJerkMenu = nullptr; #endif Menu *stepsMenu = nullptr; @@ -2545,7 +2545,7 @@ void applyMaxAccel() { planner.set_max_acceleration(hmiValue.axis, menuData.valu void setMaxAccelE() { hmiValue.axis = E_AXIS; setIntOnClick(min_acceleration_edit_values.e, max_acceleration_edit_values.e, planner.settings.max_acceleration_mm_per_s2[E_AXIS], applyMaxAccel); } #endif -#if HAS_CLASSIC_JERK +#if ENABLED(CLASSIC_JERK) void applyMaxJerk() { planner.set_max_jerk(hmiValue.axis, menuData.value / MINUNITMULT); } #if HAS_X_AXIS void setMaxJerkX() { hmiValue.axis = X_AXIS, setFloatOnClick(min_jerk_edit_values.x, max_jerk_edit_values.x, UNITFDIGITS, planner.max_jerk.x, applyMaxJerk); } @@ -2880,7 +2880,7 @@ void onDrawAcc(MenuItem* menuitem, int8_t line) { } #endif -#if HAS_CLASSIC_JERK +#if ENABLED(CLASSIC_JERK) void onDrawJerk(MenuItem* menuitem, int8_t line) { if (hmiIsChinese()) { @@ -2941,7 +2941,7 @@ void onDrawAcc(MenuItem* menuitem, int8_t line) { #endif -#endif // HAS_CLASSIC_JERK +#endif // CLASSIC_JERK #if HAS_X_AXIS void onDrawStepsX(MenuItem* menuitem, int8_t line) { @@ -3451,7 +3451,7 @@ void drawMotionMenu() { BACK_ITEM(drawControlMenu); MENU_ITEM(ICON_MaxSpeed, MSG_SPEED, onDrawSpeed, drawMaxSpeedMenu); MENU_ITEM(ICON_MaxAccelerated, MSG_ACCELERATION, onDrawAcc, drawMaxAccelMenu); - #if HAS_CLASSIC_JERK + #if ENABLED(CLASSIC_JERK) MENU_ITEM(ICON_MaxJerk, MSG_JERK, onDrawJerk, drawMaxJerkMenu); #elif HAS_JUNCTION_DEVIATION EDIT_ITEM(ICON_JDmm, MSG_JUNCTION_DEVIATION, onDrawPFloat3Menu, setJDmm, &planner.junction_deviation_mm); @@ -3616,7 +3616,7 @@ void drawMaxAccelMenu() { updateMenu(maxAccelMenu); } -#if HAS_CLASSIC_JERK +#if ENABLED(CLASSIC_JERK) void drawMaxJerkMenu() { checkkey = ID_Menu; @@ -3638,7 +3638,7 @@ void drawMaxAccelMenu() { updateMenu(maxJerkMenu); } -#endif // HAS_CLASSIC_JERK +#endif // CLASSIC_JERK void drawStepsMenu() { checkkey = ID_Menu; diff --git a/Marlin/src/lcd/e3v2/proui/dwin.h b/Marlin/src/lcd/e3v2/proui/dwin.h index cf4f9e2643..8706a18fac 100644 --- a/Marlin/src/lcd/e3v2/proui/dwin.h +++ b/Marlin/src/lcd/e3v2/proui/dwin.h @@ -341,7 +341,7 @@ void drawFilamentManMenu(); void drawTemperatureMenu(); void drawMaxSpeedMenu(); void drawMaxAccelMenu(); -#if HAS_CLASSIC_JERK +#if ENABLED(CLASSIC_JERK) void drawMaxJerkMenu(); #endif void drawStepsMenu(); diff --git a/Marlin/src/lcd/extui/mks_ui/draw_jerk_settings.cpp b/Marlin/src/lcd/extui/mks_ui/draw_jerk_settings.cpp index 5b22103e8f..474f06939f 100644 --- a/Marlin/src/lcd/extui/mks_ui/draw_jerk_settings.cpp +++ b/Marlin/src/lcd/extui/mks_ui/draw_jerk_settings.cpp @@ -22,7 +22,7 @@ #include "../../../inc/MarlinConfigPre.h" -#if ALL(HAS_TFT_LVGL_UI, HAS_CLASSIC_JERK) +#if ALL(HAS_TFT_LVGL_UI, CLASSIC_JERK) #include "draw_ui.h" #include @@ -96,4 +96,4 @@ void lv_clear_jerk_settings() { lv_obj_del(scr); } -#endif // HAS_TFT_LVGL_UI && HAS_CLASSIC_JERK +#endif // HAS_TFT_LVGL_UI && CLASSIC_JERK diff --git a/Marlin/src/lcd/extui/mks_ui/draw_machine_settings.cpp b/Marlin/src/lcd/extui/mks_ui/draw_machine_settings.cpp index c81002e3e0..f696978369 100644 --- a/Marlin/src/lcd/extui/mks_ui/draw_machine_settings.cpp +++ b/Marlin/src/lcd/extui/mks_ui/draw_machine_settings.cpp @@ -46,7 +46,7 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) { case ID_MACHINE_RETURN: draw_return_ui(); break; case ID_MACHINE_ACCELERATION: lv_draw_acceleration_settings(); break; case ID_MACHINE_FEEDRATE: lv_draw_max_feedrate_settings(); break; - #if HAS_CLASSIC_JERK + #if ENABLED(CLASSIC_JERK) case ID_MACHINE_JERK: lv_draw_jerk_settings(); break; #endif } @@ -58,7 +58,7 @@ void lv_draw_machine_settings() { lv_screen_menu_item(scr, machine_menu.AccelerationConf, PARA_UI_POS_X, y, event_handler, ID_MACHINE_ACCELERATION, 0); y += PARA_UI_POS_Y; lv_screen_menu_item(scr, machine_menu.MaxFeedRateConf, PARA_UI_POS_X, y, event_handler, ID_MACHINE_FEEDRATE, 1); - #if HAS_CLASSIC_JERK + #if ENABLED(CLASSIC_JERK) y += PARA_UI_POS_Y; lv_screen_menu_item(scr, machine_menu.JerkConf, PARA_UI_POS_X, y, event_handler, ID_MACHINE_JERK, 2); #endif diff --git a/Marlin/src/lcd/extui/mks_ui/draw_number_key.cpp b/Marlin/src/lcd/extui/mks_ui/draw_number_key.cpp index 9bb93e3333..c39678ed0f 100644 --- a/Marlin/src/lcd/extui/mks_ui/draw_number_key.cpp +++ b/Marlin/src/lcd/extui/mks_ui/draw_number_key.cpp @@ -118,22 +118,22 @@ static void disp_key_value() { break; case XJerk: - #if HAS_CLASSIC_JERK + #if ENABLED(CLASSIC_JERK) dtostrf(planner.max_jerk.x, 1, 1, public_buf_m); #endif break; case YJerk: - #if HAS_CLASSIC_JERK + #if ENABLED(CLASSIC_JERK) dtostrf(planner.max_jerk.y, 1, 1, public_buf_m); #endif break; case ZJerk: - #if HAS_CLASSIC_JERK + #if ENABLED(CLASSIC_JERK) dtostrf(planner.max_jerk.z, 1, 1, public_buf_m); #endif break; case EJerk: - #if HAS_CLASSIC_JERK + #if ENABLED(CLASSIC_JERK) dtostrf(planner.max_jerk.e, 1, 1, public_buf_m); #endif break; @@ -307,10 +307,10 @@ static void set_value_confirm() { case ZMaxFeedRate: planner.settings.max_feedrate_mm_s[Z_AXIS] = atof(key_value); break; case E0MaxFeedRate: planner.settings.max_feedrate_mm_s[E_AXIS] = atof(key_value); break; case E1MaxFeedRate: planner.settings.max_feedrate_mm_s[E_AXIS_N(1)] = atof(key_value); break; - case XJerk: TERN_(HAS_CLASSIC_JERK, planner.max_jerk.x = atof(key_value)); break; - case YJerk: TERN_(HAS_CLASSIC_JERK, planner.max_jerk.y = atof(key_value)); break; - case ZJerk: TERN_(HAS_CLASSIC_JERK, planner.max_jerk.z = atof(key_value)); break; - case EJerk: TERN_(HAS_CLASSIC_JERK, planner.max_jerk.e = atof(key_value)); break; + case XJerk: TERN_(CLASSIC_JERK, planner.max_jerk.x = atof(key_value)); break; + case YJerk: TERN_(CLASSIC_JERK, planner.max_jerk.y = atof(key_value)); break; + case ZJerk: TERN_(CLASSIC_JERK, planner.max_jerk.z = atof(key_value)); break; + case EJerk: TERN_(CLASSIC_JERK, planner.max_jerk.e = atof(key_value)); break; case Xstep: planner.settings.axis_steps_per_mm[X_AXIS] = atof(key_value); planner.refresh_positioning(); break; case Ystep: planner.settings.axis_steps_per_mm[Y_AXIS] = atof(key_value); planner.refresh_positioning(); break; case Zstep: planner.settings.axis_steps_per_mm[Z_AXIS] = atof(key_value); planner.refresh_positioning(); break; diff --git a/Marlin/src/lcd/extui/mks_ui/draw_ui.cpp b/Marlin/src/lcd/extui/mks_ui/draw_ui.cpp index 5d44090a77..13dbb5dee5 100644 --- a/Marlin/src/lcd/extui/mks_ui/draw_ui.cpp +++ b/Marlin/src/lcd/extui/mks_ui/draw_ui.cpp @@ -951,7 +951,7 @@ void clear_cur_ui() { case MAXFEEDRATE_UI: lv_clear_max_feedrate_settings(); break; case STEPS_UI: lv_clear_step_settings(); break; case ACCELERATION_UI: lv_clear_acceleration_settings(); break; - case JERK_UI: TERN_(HAS_CLASSIC_JERK, lv_clear_jerk_settings()); break; + case JERK_UI: TERN_(CLASSIC_JERK, lv_clear_jerk_settings()); break; case MOTORDIR_UI: break; case HOMESPEED_UI: break; case NOZZLE_CONFIG_UI: break; @@ -1061,7 +1061,7 @@ void draw_return_ui() { case MAXFEEDRATE_UI: lv_draw_max_feedrate_settings(); break; case STEPS_UI: lv_draw_step_settings(); break; case ACCELERATION_UI: lv_draw_acceleration_settings(); break; - #if HAS_CLASSIC_JERK + #if ENABLED(CLASSIC_JERK) case JERK_UI: lv_draw_jerk_settings(); break; #endif case MOTORDIR_UI: break; diff --git a/Marlin/src/lcd/menu/menu_advanced.cpp b/Marlin/src/lcd/menu/menu_advanced.cpp index 51fb55c9a4..95d965bdf9 100644 --- a/Marlin/src/lcd/menu/menu_advanced.cpp +++ b/Marlin/src/lcd/menu/menu_advanced.cpp @@ -587,18 +587,12 @@ void menu_backlash(); #endif - #if HAS_CLASSIC_JERK + #if ENABLED(CLASSIC_JERK) void menu_advanced_jerk() { START_MENU(); BACK_ITEM(MSG_ADVANCED_SETTINGS); - #if HAS_JUNCTION_DEVIATION - EDIT_ITEM(float43, MSG_JUNCTION_DEVIATION, &planner.junction_deviation_mm, 0.001f, TERN(LIN_ADVANCE, 0.3f, 0.5f) - OPTARG(LIN_ADVANCE, planner.recalculate_max_e_jerk) - ); - #endif - constexpr xyze_float_t max_jerk_edit = #ifdef MAX_JERK_EDIT_VALUES MAX_JERK_EDIT_VALUES @@ -711,12 +705,12 @@ void menu_advanced_settings() { if (!is_busy) SUBMENU(MSG_INPUT_SHAPING, menu_advanced_input_shaping); #endif - #if HAS_CLASSIC_JERK + #if ENABLED(CLASSIC_JERK) // M205 - Max Jerk SUBMENU(MSG_JERK, menu_advanced_jerk); #elif HAS_JUNCTION_DEVIATION EDIT_ITEM(float43, MSG_JUNCTION_DEVIATION, &planner.junction_deviation_mm, 0.001f, 0.3f - OPTARG(LIN_ADVANCE, planner.recalculate_max_e_jerk) + OPTARG(HAS_LINEAR_E_JERK, planner.recalculate_max_e_jerk) ); #endif diff --git a/Marlin/src/module/planner.cpp b/Marlin/src/module/planner.cpp index 70a1b105db..61dff55caf 100644 --- a/Marlin/src/module/planner.cpp +++ b/Marlin/src/module/planner.cpp @@ -155,7 +155,7 @@ float Planner::mm_per_step[DISTINCT_AXES]; // (mm) Millimeters per step #endif #endif -#if HAS_CLASSIC_JERK +#if ENABLED(CLASSIC_JERK) TERN(HAS_LINEAR_E_JERK, xyz_pos_t, xyze_pos_t) Planner::max_jerk; #endif @@ -1574,7 +1574,7 @@ void Planner::check_axes_activity() { saved_motion_state.acceleration.z = settings.max_acceleration_mm_per_s2[Z_AXIS]; settings.max_acceleration_mm_per_s2[Z_AXIS] = 100; #endif - #if HAS_CLASSIC_JERK + #if ENABLED(CLASSIC_JERK) saved_motion_state.jerk_state = max_jerk; max_jerk.set(0, 0 OPTARG(DELTA, 0)); #endif @@ -1583,7 +1583,7 @@ void Planner::check_axes_activity() { settings.max_acceleration_mm_per_s2[X_AXIS] = saved_motion_state.acceleration.x; settings.max_acceleration_mm_per_s2[Y_AXIS] = saved_motion_state.acceleration.y; TERN_(DELTA, settings.max_acceleration_mm_per_s2[Z_AXIS] = saved_motion_state.acceleration.z); - TERN_(HAS_CLASSIC_JERK, max_jerk = saved_motion_state.jerk_state); + TERN_(CLASSIC_JERK, max_jerk = saved_motion_state.jerk_state); } refresh_acceleration_rates(); } @@ -2766,7 +2766,7 @@ bool Planner::_populate_block( #endif - #if HAS_CLASSIC_JERK + #if ENABLED(CLASSIC_JERK) /** * Adapted from Průša MKS firmware @@ -2863,7 +2863,7 @@ bool Planner::_populate_block( vmax_junction_sqr = sq(vmax_junction); // Go up or down to the new speed #endif - #endif // Classic Jerk Limiting + #endif // CLASSIC_JERK // Max entry speed of this block equals the max exit speed of the previous block. block->max_entry_speed_sqr = vmax_junction_sqr; @@ -3398,7 +3398,7 @@ void Planner::set_max_feedrate(const AxisEnum axis, float inMaxFeedrateMMS) { settings.max_feedrate_mm_s[axis] = inMaxFeedrateMMS; } -#if HAS_CLASSIC_JERK +#if ENABLED(CLASSIC_JERK) /** * For the specified 'axis' set the Maximum Jerk (instant change) to the given value (mm/s) diff --git a/Marlin/src/module/planner.h b/Marlin/src/module/planner.h index 5c98307577..e746071de9 100644 --- a/Marlin/src/module/planner.h +++ b/Marlin/src/module/planner.h @@ -355,7 +355,7 @@ typedef struct { #if ENABLED(IMPROVE_HOMING_RELIABILITY) struct motion_state_t { TERN(DELTA, xyz_ulong_t, xy_ulong_t) acceleration; - #if HAS_CLASSIC_JERK + #if ENABLED(CLASSIC_JERK) TERN(DELTA, xyz_float_t, xy_float_t) jerk_state; #endif }; @@ -477,7 +477,7 @@ class Planner { #endif #endif - #if HAS_CLASSIC_JERK + #if ENABLED(CLASSIC_JERK) // (mm/s^2) M205 XYZ(E) - The largest speed change requiring no acceleration. static TERN(HAS_LINEAR_E_JERK, xyz_pos_t, xyze_pos_t) max_jerk; #endif @@ -602,7 +602,7 @@ class Planner { static void set_max_feedrate(const AxisEnum axis, float inMaxFeedrateMMS); // For an axis set the Maximum Jerk (instant change) in mm/s - #if HAS_CLASSIC_JERK + #if ENABLED(CLASSIC_JERK) static void set_max_jerk(const AxisEnum axis, float inMaxJerkMMS); #else static void set_max_jerk(const AxisEnum, const_float_t) {} diff --git a/Marlin/src/module/settings.cpp b/Marlin/src/module/settings.cpp index b99ae8ddcd..fa7beee94b 100644 --- a/Marlin/src/module/settings.cpp +++ b/Marlin/src/module/settings.cpp @@ -850,7 +850,7 @@ void MarlinSettings::postprocess() { { EEPROM_WRITE(planner.settings); - #if HAS_CLASSIC_JERK + #if ENABLED(CLASSIC_JERK) EEPROM_WRITE(planner.max_jerk); #if HAS_LINEAR_E_JERK dummyf = float(DEFAULT_EJERK); @@ -1880,7 +1880,7 @@ void MarlinSettings::postprocess() { EEPROM_READ(planner.settings.min_feedrate_mm_s); EEPROM_READ(planner.settings.min_travel_feedrate_mm_s); - #if HAS_CLASSIC_JERK + #if ENABLED(CLASSIC_JERK) EEPROM_READ(planner.max_jerk); #if HAS_LINEAR_E_JERK EEPROM_READ(dummyf); @@ -3094,7 +3094,7 @@ void MarlinSettings::reset() { planner.settings.min_feedrate_mm_s = feedRate_t(DEFAULT_MINIMUMFEEDRATE); planner.settings.min_travel_feedrate_mm_s = feedRate_t(DEFAULT_MINTRAVELFEEDRATE); - #if HAS_CLASSIC_JERK + #if ENABLED(CLASSIC_JERK) #if HAS_X_AXIS && !defined(DEFAULT_XJERK) #define DEFAULT_XJERK 0 #endif