1
0
mirror of https://github.com/MarlinFirmware/Marlin.git synced 2024-11-29 23:07:42 +00:00

🩹 Fix Input Shaping max_isr_rate with Distinct E factors (#26167)

This commit is contained in:
tombrazier 2023-10-27 22:10:02 +01:00 committed by GitHub
parent f82d0109e4
commit aa0671fb32
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -139,14 +139,15 @@ constexpr ena_mask_t enable_overlap[] = {
#ifdef SHAPING_MAX_STEPRATE
constexpr float max_step_rate = SHAPING_MAX_STEPRATE;
#else
#define ISALIM(I, ARR) _MIN(I, COUNT(ARR) - 1)
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(_ISDMF[INDEX - 1] * _ISDASU[INDEX - 1], max_isr_rate<INDEX - 1>());
template<unsigned int INDEX=DISTINCT_AXES> constexpr float max_isr_rate() {
return _MAX(_ISDMF[ISALIM(INDEX - 1, _ISDMF)] * _ISDASU[ISALIM(INDEX - 1, _ISDASU)], max_isr_rate<INDEX - 1>());
}
template<> constexpr float max_isr_rate<0>() {
return TERN0(ADAPTIVE_STEP_SMOOTHING, MIN_STEP_ISR_FREQUENCY);