Skip to content

Commit

Permalink
🩹 Fix M502 init of default motion
Browse files Browse the repository at this point in the history
Fix regression from #25035
  • Loading branch information
thinkyhead committed Dec 12, 2022
1 parent 7884ce0 commit 6d87daf
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
2 changes: 2 additions & 0 deletions Marlin/src/module/settings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,8 @@ typedef struct { bool NUM_AXIS_LIST(X:1, Y:1, Z:1, I:1, J:1, K:1, U:1, V:1,

// Defaults for reset / fill in on load
static const uint32_t _DMA[] PROGMEM = DEFAULT_MAX_ACCELERATION;
static const float _DASU[] PROGMEM = DEFAULT_AXIS_STEPS_PER_UNIT;
static const feedRate_t _DMF[] PROGMEM = DEFAULT_MAX_FEEDRATE;

/**
* Current EEPROM Layout
Expand Down
11 changes: 5 additions & 6 deletions Marlin/src/module/stepper.h
Original file line number Diff line number Diff line change
Expand Up @@ -326,22 +326,21 @@ constexpr ena_mask_t enable_overlap[] = {
#endif
};

constexpr float _DASU[] = DEFAULT_AXIS_STEPS_PER_UNIT;
constexpr feedRate_t _DMF[] = DEFAULT_MAX_FEEDRATE;

//static_assert(!any_enable_overlap(), "There is some overlap.");

#if HAS_SHAPING

#ifdef SHAPING_MAX_STEPRATE
constexpr float max_step_rate = SHAPING_MAX_STEPRATE;
#else
constexpr float max_shaped_rate = TERN0(INPUT_SHAPING_X, _DMF[X_AXIS] * _DASU[X_AXIS]) +
TERN0(INPUT_SHAPING_Y, _DMF[Y_AXIS] * _DASU[Y_AXIS]);
constexpr float _ISDASU[] = DEFAULT_AXIS_STEPS_PER_UNIT;
constexpr feedRate_t _ISDMF[] = DEFAULT_MAX_FEEDRATE;
constexpr float max_shaped_rate = TERN0(INPUT_SHAPING_X, _ISDMF[X_AXIS] * _ISDASU[X_AXIS]) +
TERN0(INPUT_SHAPING_Y, _ISDMF[Y_AXIS] * _ISDASU[Y_AXIS]);
#if defined(__AVR__) || !defined(ADAPTIVE_STEP_SMOOTHING)
// MIN_STEP_ISR_FREQUENCY is known at compile time on AVRs and any reduction in SRAM is welcome
template<int INDEX=DISTINCT_AXES> constexpr float max_isr_rate() {
return _MAX(_DMF[INDEX - 1] * _DASU[INDEX - 1], max_isr_rate<INDEX - 1>());
return _MAX(_ISDMF[INDEX - 1] * _ISDASU[INDEX - 1], max_isr_rate<INDEX - 1>());
}
template<> constexpr float max_isr_rate<0>() {
return TERN0(ADAPTIVE_STEP_SMOOTHING, MIN_STEP_ISR_FREQUENCY);
Expand Down

0 comments on commit 6d87daf

Please sign in to comment.