Skip to content

Commit 75da355

Browse files
committed
🔧 Update CLASSIC_JERK conditionals
1 parent 8bce9de commit 75da355

File tree

21 files changed

+83
-93
lines changed

21 files changed

+83
-93
lines changed

Marlin/src/gcode/calibrate/G28.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@
155155
planner.settings.max_acceleration_mm_per_s2[X_AXIS] = 100;
156156
planner.settings.max_acceleration_mm_per_s2[Y_AXIS] = 100;
157157
TERN_(DELTA, planner.settings.max_acceleration_mm_per_s2[Z_AXIS] = 100);
158-
#if HAS_CLASSIC_JERK
158+
#if ENABLED(CLASSIC_JERK)
159159
motion_state.jerk_state = planner.max_jerk;
160160
planner.max_jerk.set(0, 0 OPTARG(DELTA, 0));
161161
#endif
@@ -167,7 +167,7 @@
167167
planner.settings.max_acceleration_mm_per_s2[X_AXIS] = motion_state.acceleration.x;
168168
planner.settings.max_acceleration_mm_per_s2[Y_AXIS] = motion_state.acceleration.y;
169169
TERN_(DELTA, planner.settings.max_acceleration_mm_per_s2[Z_AXIS] = motion_state.acceleration.z);
170-
TERN_(HAS_CLASSIC_JERK, planner.max_jerk = motion_state.jerk_state);
170+
TERN_(CLASSIC_JERK, planner.max_jerk = motion_state.jerk_state);
171171
planner.refresh_acceleration_rates();
172172
}
173173

Marlin/src/gcode/config/M200-M205.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,7 @@ void GcodeSuite::M205() {
297297
if (parser.seenval('S')) planner.settings.min_feedrate_mm_s = parser.value_linear_units();
298298
if (parser.seenval('T')) planner.settings.min_travel_feedrate_mm_s = parser.value_linear_units();
299299
#if HAS_JUNCTION_DEVIATION
300-
#if HAS_CLASSIC_JERK && AXIS_COLLISION('J')
300+
#if ENABLED(CLASSIC_JERK) && AXIS_COLLISION('J')
301301
#error "Can't set_max_jerk for 'J' axis because 'J' is used for Junction Deviation."
302302
#endif
303303
if (parser.seenval('J')) {
@@ -310,7 +310,7 @@ void GcodeSuite::M205() {
310310
SERIAL_ERROR_MSG("?J out of range (0.01 to 0.3)");
311311
}
312312
#endif
313-
#if HAS_CLASSIC_JERK
313+
#if ENABLED(CLASSIC_JERK)
314314
bool seenZ = false;
315315
LOGICAL_AXIS_CODE(
316316
if (parser.seenval('E')) planner.set_max_jerk(E_AXIS, parser.value_linear_units()),
@@ -328,14 +328,14 @@ void GcodeSuite::M205() {
328328
if (seenZ && planner.max_jerk.z <= 0.1f)
329329
SERIAL_ECHOLNPGM("WARNING! Low Z Jerk may lead to unwanted pauses.");
330330
#endif
331-
#endif // HAS_CLASSIC_JERK
331+
#endif // CLASSIC_JERK
332332
}
333333

334334
void GcodeSuite::M205_report(const bool forReplay/*=true*/) {
335335
report_heading_etc(forReplay, F(
336336
"Advanced (" M205_MIN_SEG_TIME_STR "<min_segment_time_us> S<min_feedrate> T<min_travel_feedrate>"
337337
TERN_(HAS_JUNCTION_DEVIATION, " J<junc_dev>")
338-
#if HAS_CLASSIC_JERK
338+
#if ENABLED(CLASSIC_JERK)
339339
NUM_AXIS_GANG(
340340
" X<max_jerk>", " Y<max_jerk>", " Z<max_jerk>",
341341
" " STR_I "<max_jerk>", " " STR_J "<max_jerk>", " " STR_K "<max_jerk>",
@@ -352,7 +352,7 @@ void GcodeSuite::M205_report(const bool forReplay/*=true*/) {
352352
#if HAS_JUNCTION_DEVIATION
353353
, PSTR(" J"), LINEAR_UNIT(planner.junction_deviation_mm)
354354
#endif
355-
#if HAS_CLASSIC_JERK && NUM_AXES
355+
#if ENABLED(CLASSIC_JERK) && NUM_AXES
356356
, LIST_N(DOUBLE(NUM_AXES),
357357
SP_X_STR, LINEAR_UNIT(planner.max_jerk.x),
358358
SP_Y_STR, LINEAR_UNIT(planner.max_jerk.y),

Marlin/src/gcode/config/M92.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ void GcodeSuite::M92() {
5555
const float value = parser.value_per_axis_units((AxisEnum)(E_AXIS_N(target_extruder)));
5656
if (value < 20) {
5757
float factor = planner.settings.axis_steps_per_mm[E_AXIS_N(target_extruder)] / value; // increase e constants if M92 E14 is given for netfab.
58-
#if HAS_CLASSIC_JERK && HAS_CLASSIC_E_JERK
58+
#if ALL(CLASSIC_JERK, HAS_CLASSIC_E_JERK)
5959
planner.max_jerk.e *= factor;
6060
#endif
6161
planner.settings.max_feedrate_mm_s[E_AXIS_N(target_extruder)] *= factor;

Marlin/src/gcode/host/M360.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ void GcodeSuite::M360() {
9191
//
9292
// XYZ Axis Jerk
9393
//
94-
#if HAS_CLASSIC_JERK
94+
#if ENABLED(CLASSIC_JERK)
9595
if (planner.max_jerk.x == planner.max_jerk.y)
9696
config_line(F("XY"), planner.max_jerk.x, FPSTR(JERK_STR));
9797
else {
@@ -182,7 +182,7 @@ void GcodeSuite::M360() {
182182
config_line(F("NumExtruder"), EXTRUDERS);
183183
#if HAS_EXTRUDERS
184184
EXTRUDER_LOOP() {
185-
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)));
185+
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)));
186186
config_line_e(e, F("MaxSpeed"), planner.settings.max_feedrate_mm_s[E_AXIS_N(e)]);
187187
config_line_e(e, F("Acceleration"), planner.settings.max_acceleration_mm_per_s2[E_AXIS_N(e)]);
188188
config_line_e(e, F("Diameter"), TERN(NO_VOLUMETRICS, DEFAULT_NOMINAL_FILAMENT_DIA, planner.filament_size[e]));

Marlin/src/inc/Conditionals_LCD.h

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1615,20 +1615,6 @@
16151615
#undef DELTA_HOME_TO_SAFE_ZONE
16161616
#endif
16171617

1618-
// This flag indicates some kind of jerk storage is needed
1619-
#if ANY(CLASSIC_JERK, IS_KINEMATIC)
1620-
#define HAS_CLASSIC_JERK 1
1621-
#endif
1622-
1623-
#if DISABLED(CLASSIC_JERK)
1624-
#define HAS_JUNCTION_DEVIATION 1
1625-
#endif
1626-
1627-
// E jerk exists with JD disabled (of course) but also when Linear Advance is disabled on Delta/SCARA
1628-
#if HAS_EXTRUDERS && (ENABLED(CLASSIC_JERK) || (IS_KINEMATIC && DISABLED(LIN_ADVANCE)))
1629-
#define HAS_CLASSIC_E_JERK 1
1630-
#endif
1631-
16321618
//
16331619
// Serial Port Info
16341620
//

Marlin/src/inc/Conditionals_adv.h

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -302,6 +302,21 @@
302302
#endif
303303
#endif
304304

305+
// Use Junction Deviation for motion if Jerk is disabled
306+
#if DISABLED(CLASSIC_JERK)
307+
#define HAS_JUNCTION_DEVIATION 1
308+
#endif
309+
310+
// E jerk exists with JD disabled (of course) but also when Linear Advance is disabled on Delta/SCARA
311+
#if HAS_EXTRUDERS && (ENABLED(CLASSIC_JERK) || (IS_KINEMATIC && DISABLED(LIN_ADVANCE)))
312+
#define HAS_CLASSIC_E_JERK 1
313+
#endif
314+
315+
// Linear advance uses Jerk since E is an isolated axis
316+
#if ALL(HAS_JUNCTION_DEVIATION, LIN_ADVANCE)
317+
#define HAS_LINEAR_E_JERK 1
318+
#endif
319+
305320
/**
306321
* Temperature Sensors; define what sensor(s) we have.
307322
*/

Marlin/src/inc/Conditionals_post.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,6 @@
3737
#define ADC_VREF_MV HAL_ADC_VREF_MV
3838
#endif
3939

40-
// Linear advance uses Jerk since E is an isolated axis
41-
#if ALL(HAS_JUNCTION_DEVIATION, LIN_ADVANCE)
42-
#define HAS_LINEAR_E_JERK 1
43-
#endif
44-
4540
// Determine which type of 'EEPROM' is in use
4641
#if ENABLED(EEPROM_SETTINGS)
4742
// EEPROM type may be defined by compile flags, configs, HALs, or pins

Marlin/src/inc/SanityCheck.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1225,7 +1225,7 @@ static_assert(COUNT(arm) == LOGICAL_AXES, "AXIS_RELATIVE_MODES must contain " _L
12251225
* Junction deviation is incompatible with kinematic systems.
12261226
*/
12271227
#if HAS_JUNCTION_DEVIATION && IS_KINEMATIC
1228-
#error "CLASSIC_JERK is required for DELTA, SCARA, and POLAR."
1228+
#error "CLASSIC_JERK is required for the kinematics of DELTA, SCARA, POLAR, etc."
12291229
#endif
12301230

12311231
/**
@@ -1583,7 +1583,7 @@ static_assert(COUNT(arm) == LOGICAL_AXES, "AXIS_RELATIVE_MODES must contain " _L
15831583
#error "Only enable RESTORE_LEVELING_AFTER_G28 or ENABLE_LEVELING_AFTER_G28, but not both."
15841584
#endif
15851585

1586-
#if HAS_MESH && HAS_CLASSIC_JERK
1586+
#if ALL(HAS_MESH, CLASSIC_JERK)
15871587
static_assert(DEFAULT_ZJERK > 0.1, "Low DEFAULT_ZJERK values are incompatible with mesh-based leveling.");
15881588
#endif
15891589
#if HAS_MESH && DGUS_LCD_UI_IA_CREALITY && GRID_MAX_POINTS > 25

Marlin/src/lcd/e3v2/common/limits.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ constexpr xyze_float_t min_acceleration_edit_values = LOGICAL_AXIS_ARRAY_1(MIN_A
6767
#define MIN_JERK_EDIT_VALUE 0.1
6868
#define DEFAULT_MAX_JERK_MULTIPLIER 2
6969

70-
#if HAS_CLASSIC_JERK
70+
#if ENABLED(CLASSIC_JERK)
7171
constexpr xyze_float_t min_jerk_edit_values = LOGICAL_AXIS_ARRAY_1(MIN_JERK_EDIT_VALUE),
7272
default_jerk = LOGICAL_AXIS_ARRAY(
7373
DEFAULT_EJERK,

Marlin/src/lcd/e3v2/creality/dwin.cpp

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -460,7 +460,7 @@ void drawBackFirst(const bool is_sel=true) {
460460

461461
#define MOTION_CASE_RATE 1
462462
#define MOTION_CASE_ACCEL 2
463-
#define MOTION_CASE_JERK (MOTION_CASE_ACCEL + ENABLED(HAS_CLASSIC_JERK))
463+
#define MOTION_CASE_JERK (MOTION_CASE_ACCEL + ENABLED(CLASSIC_JERK))
464464
#define MOTION_CASE_STEPS (MOTION_CASE_JERK + 1)
465465
#define MOTION_CASE_TOTAL MOTION_CASE_STEPS
466466

@@ -1004,7 +1004,7 @@ void drawMotionMenu() {
10041004
itemAreaCopy(173, 133, 228, 147, MOTION_CASE_RATE); // Max speed
10051005
itemAreaCopy(173, 133, 200, 147, MOTION_CASE_ACCEL); // Max...
10061006
itemAreaCopy(28, 149, 69, 161, MOTION_CASE_ACCEL, 30, 1); // ...Acceleration
1007-
#if HAS_CLASSIC_JERK
1007+
#if ENABLED(CLASSIC_JERK)
10081008
itemAreaCopy(173, 133, 200, 147, MOTION_CASE_JERK); // Max...
10091009
itemAreaCopy(1, 180, 28, 192, MOTION_CASE_JERK, 30, 1); // ...
10101010
itemAreaCopy(202, 133, 228, 147, MOTION_CASE_JERK, 57); // ...Jerk
@@ -1020,14 +1020,14 @@ void drawMotionMenu() {
10201020
#ifdef USE_STRING_TITLES
10211021
dwinDrawLabel(MOTION_CASE_RATE, F("Feedrate")); // "Feedrate"
10221022
dwinDrawLabel(MOTION_CASE_ACCEL, GET_TEXT_F(MSG_ACCELERATION)); // "Acceleration"
1023-
#if HAS_CLASSIC_JERK
1023+
#if ENABLED(CLASSIC_JERK)
10241024
dwinDrawLabel(MOTION_CASE_JERK, GET_TEXT_F(MSG_JERK)); // "Jerk"
10251025
#endif
10261026
dwinDrawLabel(MOTION_CASE_STEPS, GET_TEXT_F(MSG_STEPS_PER_MM)); // "Steps/mm"
10271027
#else
10281028
say_max_en(MOTION_CASE_RATE); say_speed_en(30, MOTION_CASE_RATE); // "Max Speed"
10291029
say_max_accel_en(MOTION_CASE_ACCEL); // "Max Acceleration"
1030-
#if HAS_CLASSIC_JERK
1030+
#if ENABLED(CLASSIC_JERK)
10311031
say_max_en(MOTION_CASE_JERK); say_jerk_en(MOTION_CASE_JERK); // "Max Jerk"
10321032
#endif
10331033
say_steps_per_mm_en(MOTION_CASE_STEPS); // "Steps-per-mm"
@@ -1041,7 +1041,7 @@ void drawMotionMenu() {
10411041
#define _MOTION_ICON(N) drawMenuLine(++i, ICON_MaxSpeed + (N) - 1)
10421042
_MOTION_ICON(MOTION_CASE_RATE); drawMoreIcon(i);
10431043
_MOTION_ICON(MOTION_CASE_ACCEL); drawMoreIcon(i);
1044-
#if HAS_CLASSIC_JERK
1044+
#if ENABLED(CLASSIC_JERK)
10451045
_MOTION_ICON(MOTION_CASE_JERK); drawMoreIcon(i);
10461046
#endif
10471047
_MOTION_ICON(MOTION_CASE_STEPS); drawMoreIcon(i);
@@ -1597,7 +1597,7 @@ void hmiMaxAccelerationXYZE() {
15971597
drawEditInteger4(select_acc.now, hmiValues.maxAcceleration, true);
15981598
}
15991599

1600-
#if HAS_CLASSIC_JERK
1600+
#if ENABLED(CLASSIC_JERK)
16011601

16021602
void hmiMaxJerkXYZE() {
16031603
EncoderState encoder_diffState = encoderReceiveAnalyze();
@@ -1617,7 +1617,7 @@ void hmiMaxAccelerationXYZE() {
16171617
drawEditFloat3(select_jerk.now, hmiValues.maxJerkScaled, true);
16181618
}
16191619

1620-
#endif // HAS_CLASSIC_JERK
1620+
#endif // CLASSIC_JERK
16211621

16221622
void hmiStepXYZE() {
16231623
EncoderState encoder_diffState = encoderReceiveAnalyze();
@@ -3349,7 +3349,7 @@ void drawMaxAccelMenu() {
33493349
#endif
33503350
}
33513351

3352-
#if HAS_CLASSIC_JERK
3352+
#if ENABLED(CLASSIC_JERK)
33533353
void drawMaxJerkMenu() {
33543354
clearMainWindow();
33553355

@@ -3489,7 +3489,7 @@ void hmiMotion() {
34893489
select_acc.reset();
34903490
drawMaxAccelMenu();
34913491
break;
3492-
#if HAS_CLASSIC_JERK
3492+
#if ENABLED(CLASSIC_JERK)
34933493
case MOTION_CASE_JERK:
34943494
checkkey = ID_MaxJerk;
34953495
select_jerk.reset();
@@ -3996,7 +3996,7 @@ void hmiMaxAcceleration() {
39963996
dwinUpdateLCD();
39973997
}
39983998

3999-
#if HAS_CLASSIC_JERK
3999+
#if ENABLED(CLASSIC_JERK)
40004000
// Max Jerk
40014001
void hmiMaxJerk() {
40024002
EncoderState encoder_diffState = get_encoder_state();
@@ -4025,7 +4025,7 @@ void hmiMaxAcceleration() {
40254025
}
40264026
dwinUpdateLCD();
40274027
}
4028-
#endif // HAS_CLASSIC_JERK
4028+
#endif // CLASSIC_JERK
40294029

40304030
// Step
40314031
void hmiStep() {
@@ -4251,7 +4251,7 @@ void dwinHandleScreen() {
42514251
#endif
42524252
case ID_MaxSpeed: hmiMaxSpeed(); break;
42534253
case ID_MaxAcceleration: hmiMaxAcceleration(); break;
4254-
#if HAS_CLASSIC_JERK
4254+
#if ENABLED(CLASSIC_JERK)
42554255
case ID_MaxJerk: hmiMaxJerk(); break;
42564256
#endif
42574257
case ID_Step: hmiStep(); break;
@@ -4274,7 +4274,7 @@ void dwinHandleScreen() {
42744274
case ID_PrintSpeed: hmiPrintSpeed(); break;
42754275
case ID_MaxSpeedValue: hmiMaxFeedspeedXYZE(); break;
42764276
case ID_MaxAccelerationValue: hmiMaxAccelerationXYZE(); break;
4277-
#if HAS_CLASSIC_JERK
4277+
#if ENABLED(CLASSIC_JERK)
42784278
case ID_MaxJerkValue: hmiMaxJerkXYZE(); break;
42794279
#endif
42804280
case ID_StepValue: hmiStepXYZE(); break;

0 commit comments

Comments
 (0)