Skip to content

Commit 4fdb0fb

Browse files
✨ MAX7219_DEBUG_MULTISTEPPING
Co-Authored-By: tombrazier <[email protected]>
1 parent f9d3939 commit 4fdb0fb

File tree

3 files changed

+16
-0
lines changed

3 files changed

+16
-0
lines changed

Marlin/Configuration_adv.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4052,6 +4052,7 @@
40524052
#define MAX7219_DEBUG_PROFILE 6 // Display the fraction of CPU time spent in profiled code on this LED matrix
40534053
// row. By default idle() is profiled so this shows how "idle" the processor is.
40544054
// See class CodeProfiler.
4055+
//#define MAX7219_DEBUG_MULTISTEPPING 6 // Show multistepping 1 to 128 on this LED matrix row.
40554056
#endif
40564057

40574058
/**

Marlin/src/feature/max7219.cpp

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444
#include "max7219.h"
4545

4646
#include "../module/planner.h"
47+
#include "../module/stepper.h"
4748
#include "../MarlinCore.h"
4849
#include "../HAL/shared/Delay.h"
4950

@@ -723,6 +724,19 @@ void Max7219::idle_tasks() {
723724
}
724725
#endif
725726

727+
#ifdef MAX7219_DEBUG_MULTISTEPPING
728+
static uint8_t last_multistepping = 0;
729+
const uint8_t multistepping = Stepper::steps_per_isr;
730+
if (multistepping != last_multistepping) {
731+
static uint8_t log2_old = 0;
732+
uint8_t log2_new = 0;
733+
for (uint8_t val = multistepping; val > 1; val >>= 1) log2_new++;
734+
mark16(MAX7219_DEBUG_MULTISTEPPING, log2_old, log2_new, &row_change_mask);
735+
last_multistepping = multistepping;
736+
log2_old = log2_new;
737+
}
738+
#endif
739+
726740
// batch line updates
727741
suspended--;
728742
if (!suspended)

Marlin/src/module/stepper.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -459,6 +459,7 @@ constexpr ena_mask_t enable_overlap[] = {
459459
// Stepper class definition
460460
//
461461
class Stepper {
462+
friend class Max7219;
462463
friend void stepperTask(void *);
463464

464465
public:

0 commit comments

Comments
 (0)