Skip to content

Commit

Permalink
✨ MAX7219_DEBUG_MULTISTEPPING
Browse files Browse the repository at this point in the history
Co-Authored-By: tombrazier <68918209+tombrazier@users.noreply.github.com>
  • Loading branch information
thinkyhead and tombrazier committed Mar 12, 2023
1 parent f9d3939 commit 4fdb0fb
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 0 deletions.
1 change: 1 addition & 0 deletions Marlin/Configuration_adv.h
Original file line number Diff line number Diff line change
Expand Up @@ -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

/**
Expand Down
14 changes: 14 additions & 0 deletions Marlin/src/feature/max7219.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
#include "max7219.h"

#include "../module/planner.h"
#include "../module/stepper.h"
#include "../MarlinCore.h"
#include "../HAL/shared/Delay.h"

Expand Down Expand Up @@ -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)
Expand Down
1 change: 1 addition & 0 deletions Marlin/src/module/stepper.h
Original file line number Diff line number Diff line change
Expand Up @@ -459,6 +459,7 @@ constexpr ena_mask_t enable_overlap[] = {
// Stepper class definition
//
class Stepper {
friend class Max7219;
friend void stepperTask(void *);

public:
Expand Down

0 comments on commit 4fdb0fb

Please sign in to comment.