Marlin
Marlin copied to clipboard
Fix JD / HAS_LINEAR_E_JERK
Description
Here is the issue
When DISABLED(CLASSIC_JERK) and if ENABLED(LIN_ADVANCE), naturally you will have HAS_JUNCTION_DEVIATION and HAS_LINEAR_E_JERK, like so:
In Conditionals-4-adv.h
#if ALL(HAS_JUNCTION_DEVIATION, LIN_ADVANCE)
#define HAS_LINEAR_E_JERK 1
#endif
Except that it doesn't make sense in the following files.
In module/planner.h (and .cpp likewise)
#if HAS_JUNCTION_DEVIATION
static float junction_deviation_mm; // (mm) M205 J
#if HAS_LINEAR_E_JERK
static float max_e_jerk[DISTINCT_E]; // Calculated from junction_deviation_mm
#endif
#else // 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
static TERN(HAS_LINEAR_E_JERK, xyz_pos_t, xyze_pos_t) max_jerk; will never use this TERN as intended.
(and similarly where CLASSIC_JERK is enabled, this code will never be utilized)
In module/settings.cpp
#if ENABLED(CLASSIC_JERK)
EEPROM_READ(planner.max_jerk);
#if HAS_LINEAR_E_JERK
EEPROM_READ(dummyf);
#endif
#else
for (uint8_t q = LOGICAL_AXES; q--;) EEPROM_READ(dummyf);
#endif
// and also where HAS_LINEAR_E_JERK uses EEPROM_WRITE()
So what this PR aims fix any issues associated with JD enabled.
Apparently this causes "Warning:EEPROM Corrupt" message.
Requirements
- Disable
CLASSIC_JERK - Enable
LIN_ADVANCE
Benefits
- Fixes confusing code that seems to go back and forth like it doesn't know where to go
- Stops any EEPROM warnings