Skip to content

Commit d1d2948

Browse files
committed
style tweak
1 parent ae934bf commit d1d2948

File tree

3 files changed

+25
-33
lines changed

3 files changed

+25
-33
lines changed

Marlin/Configuration_adv.h

+11-11
Original file line numberDiff line numberDiff line change
@@ -4042,17 +4042,17 @@
40424042
* Sample debug features
40434043
* If you add more debug displays, be careful to avoid conflicts!
40444044
*/
4045-
#define MAX7219_DEBUG_PRINTER_ALIVE // Blink corner LED of 8x8 matrix to show that the firmware is functioning
4046-
#define MAX7219_DEBUG_PLANNER_HEAD 2 // Show the planner queue head position on this and the next LED matrix row
4047-
#define MAX7219_DEBUG_PLANNER_TAIL 4 // Show the planner queue tail position on this and the next LED matrix row
4048-
4049-
#define MAX7219_DEBUG_PLANNER_QUEUE 0 // Show the current planner queue depth on this and the next LED matrix row
4050-
// If you experience stuttering, reboots, etc. this option can reveal how
4051-
// tweaks made to the configuration are affecting the printer in real-time.
4052-
#define MAX7219_DEBUG_PROFILE 6 // Display the fraction of CPU time spent in profiled code on this LED matrix
4053-
// row. By default idle() is profiled so this shows how "idle" the processor is.
4054-
// See class CodeProfiler.
4055-
//#define MAX7219_DEBUG_MULTISTEPPING 6// Show multistepping 1 to 128 on this LED matrix row.
4045+
#define MAX7219_DEBUG_PRINTER_ALIVE // Blink corner LED of 8x8 matrix to show that the firmware is functioning
4046+
#define MAX7219_DEBUG_PLANNER_HEAD 2 // Show the planner queue head position on this and the next LED matrix row
4047+
#define MAX7219_DEBUG_PLANNER_TAIL 4 // Show the planner queue tail position on this and the next LED matrix row
4048+
4049+
#define MAX7219_DEBUG_PLANNER_QUEUE 0 // Show the current planner queue depth on this and the next LED matrix row
4050+
// If you experience stuttering, reboots, etc. this option can reveal how
4051+
// tweaks made to the configuration are affecting the printer in real-time.
4052+
#define MAX7219_DEBUG_PROFILE 6 // Display the fraction of CPU time spent in profiled code on this LED matrix
4053+
// row. By default idle() is profiled so this shows how "idle" the processor is.
4054+
// See class CodeProfiler.
4055+
//#define MAX7219_DEBUG_MULTISTEPPING 6 // Show multistepping 1 to 128 on this LED matrix row.
40564056
#endif
40574057

40584058
/**

Marlin/src/feature/max7219.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -731,11 +731,11 @@ void Max7219::idle_tasks() {
731731

732732
#ifdef MAX7219_DEBUG_MULTISTEPPING
733733
static uint8_t last_multistepping = 0;
734-
uint8_t multistepping = Stepper::steps_per_isr;
735-
if (last_multistepping != multistepping) {
734+
const uint8_t multistepping = Stepper::steps_per_isr;
735+
if (multistepping != last_multistepping) {
736736
static uint8_t log2_old = 0;
737737
uint8_t log2_new = 0;
738-
for (uint8_t val = multistepping; val > 1; val >>= 1, log2_new++);
738+
for (uint8_t val = multistepping; val > 1; val >>= 1) log2_new++;
739739
mark16(MAX7219_DEBUG_MULTISTEPPING, log2_old, log2_new, &row_change_mask);
740740
last_multistepping = multistepping;
741741
log2_old = log2_new;

Marlin/src/module/stepper.cpp

+11-19
Original file line numberDiff line numberDiff line change
@@ -1761,7 +1761,7 @@ void Stepper::pulse_phase_isr() {
17611761
}while(0)
17621762

17631763
#define PAGE_PULSE_PREP(AXIS) do{ \
1764-
step_needed.set(_AXIS(AXIS), \
1764+
step_needed.set(_AXIS(AXIS), \
17651765
pgm_read_byte(&segment_table[page_step_state.sd[_AXIS(AXIS)]][page_step_state.segment_steps & 0x7])); \
17661766
}while(0)
17671767

@@ -1802,7 +1802,7 @@ void Stepper::pulse_phase_isr() {
18021802
page_step_state.bd[_AXIS(AXIS)] += VALUE;
18031803

18041804
#define PAGE_PULSE_PREP(AXIS) do{ \
1805-
step_needed.set(_AXIS(AXIS), \
1805+
step_needed.set(_AXIS(AXIS), \
18061806
pgm_read_byte(&segment_table[page_step_state.sd[_AXIS(AXIS)]][page_step_state.segment_steps & 0x3])); \
18071807
}while(0)
18081808

@@ -1890,7 +1890,7 @@ void Stepper::pulse_phase_isr() {
18901890
PULSE_PREP(E);
18911891

18921892
#if ENABLED(LIN_ADVANCE)
1893-
if (step_needed.e && la_active) {
1893+
if (la_active && step_needed.e) {
18941894
// don't actually step here, but do subtract movements steps
18951895
// from the linear advance step count
18961896
step_needed.e = false;
@@ -2070,17 +2070,9 @@ void Stepper::pulse_phase_isr() {
20702070
// Get the timer interval and the number of loops to perform per tick
20712071
hal_timer_t Stepper::calc_timer_interval(uint32_t step_rate, uint8_t loops) {
20722072
#if DISABLED(DISABLE_MULTI_STEPPING)
2073-
if (loops >= 16) {
2074-
step_rate >>= 4;
2075-
loops >>= 4;
2076-
}
2077-
if (loops >= 4) {
2078-
step_rate >>= 2;
2079-
loops >>= 2;
2080-
}
2081-
if (loops >= 2) {
2082-
step_rate >>= 1;
2083-
}
2073+
if (loops >= 16) { step_rate >>= 4; loops >>= 4; }
2074+
if (loops >= 4) { step_rate >>= 2; loops >>= 2; }
2075+
if (loops >= 2) { step_rate >>= 1; }
20842076
#else
20852077
NOMORE(step_rate, uint32_t(MAX_STEP_ISR_FREQUENCY_1X));
20862078
#endif
@@ -2110,7 +2102,7 @@ hal_timer_t Stepper::calc_timer_interval(uint32_t step_rate, uint8_t loops) {
21102102
}
21112103
else {
21122104
step_rate = 0;
2113-
uintptr_t table_address = (uintptr_t)&speed_lookuptable_slow[0][0];
2105+
const uintptr_t table_address = (uintptr_t)&speed_lookuptable_slow[0][0];
21142106
return uint16_t(pgm_read_word(table_address));
21152107
}
21162108
}
@@ -2591,7 +2583,7 @@ hal_timer_t Stepper::block_phase_isr() {
25912583
if (stepper_extruder != last_moved_extruder) la_advance_steps = 0;
25922584
#endif
25932585
if (la_active) {
2594-
// apply LA scaling and discount the effect of frequency scaling
2586+
// Apply LA scaling and discount the effect of frequency scaling
25952587
la_dividend = (advance_dividend.e << current_block->la_scaling) << oversampling_factor;
25962588
}
25972589
#endif
@@ -2671,8 +2663,8 @@ hal_timer_t Stepper::block_phase_isr() {
26712663
// the acceleration and speed values calculated in block_phase_isr().
26722664
// This helps keep LA in sync with, for example, S_CURVE_ACCELERATION.
26732665
la_delta_error += la_dividend;
2674-
const bool step_needed = la_delta_error >= 0;
2675-
if (step_needed) {
2666+
const bool e_step_needed = la_delta_error >= 0;
2667+
if (e_step_needed) {
26762668
count_position.e += count_direction.e;
26772669
la_advance_steps += count_direction.e;
26782670
la_delta_error -= advance_divisor;
@@ -2683,7 +2675,7 @@ hal_timer_t Stepper::block_phase_isr() {
26832675

26842676
TERN_(I2S_STEPPER_STREAM, i2s_push_sample());
26852677

2686-
if (step_needed) {
2678+
if (e_step_needed) {
26872679
// Enforce a minimum duration for STEP pulse ON
26882680
#if ISR_PULSE_CONTROL
26892681
USING_TIMED_PULSE();

0 commit comments

Comments
 (0)