diff --git a/Marlin/Configuration_adv.h b/Marlin/Configuration_adv.h index f3f7a4c255..35e7363423 100644 --- a/Marlin/Configuration_adv.h +++ b/Marlin/Configuration_adv.h @@ -4052,6 +4052,7 @@ #define MAX7219_DEBUG_PROFILE 6 // Display the fraction of CPU time spent in profiled code on this LED matrix // row. By default idle() is profiled so this shows how "idle" the processor is. // See class CodeProfiler. + //#define MAX7219_DEBUG_MULTISTEPPING 6 // Show multistepping 1 to 128 on this LED matrix row. #endif /** diff --git a/Marlin/src/feature/max7219.cpp b/Marlin/src/feature/max7219.cpp index 83d161d1fe..efc992f80f 100644 --- a/Marlin/src/feature/max7219.cpp +++ b/Marlin/src/feature/max7219.cpp @@ -44,6 +44,7 @@ #include "max7219.h" #include "../module/planner.h" +#include "../module/stepper.h" #include "../MarlinCore.h" #include "../HAL/shared/Delay.h" @@ -723,6 +724,19 @@ void Max7219::idle_tasks() { } #endif + #ifdef MAX7219_DEBUG_MULTISTEPPING + static uint8_t last_multistepping = 0; + const uint8_t multistepping = Stepper::steps_per_isr; + if (multistepping != last_multistepping) { + static uint8_t log2_old = 0; + uint8_t log2_new = 0; + for (uint8_t val = multistepping; val > 1; val >>= 1) log2_new++; + mark16(MAX7219_DEBUG_MULTISTEPPING, log2_old, log2_new, &row_change_mask); + last_multistepping = multistepping; + log2_old = log2_new; + } + #endif + // batch line updates suspended--; if (!suspended) diff --git a/Marlin/src/module/stepper.h b/Marlin/src/module/stepper.h index 3a3e45dccc..33f45b9ae1 100644 --- a/Marlin/src/module/stepper.h +++ b/Marlin/src/module/stepper.h @@ -459,6 +459,7 @@ constexpr ena_mask_t enable_overlap[] = { // Stepper class definition // class Stepper { + friend class Max7219; friend void stepperTask(void *); public: