Browse Source

Fix warnings in stepper.cpp (#16364)

Jason Smith 4 years ago
parent
commit
9ff2d34bf8
1 changed files with 18 additions and 11 deletions
  1. 18
    11
      Marlin/src/module/stepper.cpp

+ 18
- 11
Marlin/src/module/stepper.cpp View File

@@ -1405,6 +1405,9 @@ void Stepper::isr() {
1405 1405
   ENABLE_ISRS();
1406 1406
 }
1407 1407
 
1408
+#define ISR_PULSE_CONTROL (MINIMUM_STEPPER_PULSE || MAXIMUM_STEPPER_RATE)
1409
+#define ISR_MULTI_STEPS (ISR_PULSE_CONTROL && DISABLED(I2S_STEPPER_STREAM))
1410
+
1408 1411
 /**
1409 1412
  * This phase of the ISR should ONLY create the pulses for the steppers.
1410 1413
  * This prevents jitter caused by the interval between the start of the
@@ -1435,9 +1438,11 @@ void Stepper::stepper_pulse_phase_isr() {
1435 1438
   step_events_completed += events_to_do;
1436 1439
 
1437 1440
   // Take multiple steps per interrupt (For high speed moves)
1438
-  bool firstStep = true;
1441
+  #if ISR_MULTI_STEPS
1442
+    bool firstStep = true;
1443
+    hal_timer_t end_tick_count = 0;
1444
+  #endif
1439 1445
   xyze_bool_t step_needed{0};
1440
-  hal_timer_t end_tick_count = 0;
1441 1446
 
1442 1447
   do {
1443 1448
     #define _APPLY_STEP(AXIS) AXIS ##_APPLY_STEP
@@ -1494,7 +1499,7 @@ void Stepper::stepper_pulse_phase_isr() {
1494 1499
       PULSE_PREP(E);
1495 1500
     #endif
1496 1501
 
1497
-    #if (MINIMUM_STEPPER_PULSE || MAXIMUM_STEPPER_RATE) && DISABLED(I2S_STEPPER_STREAM)
1502
+    #if ISR_MULTI_STEPS
1498 1503
       if (firstStep)
1499 1504
         firstStep = false;
1500 1505
       else
@@ -1525,7 +1530,7 @@ void Stepper::stepper_pulse_phase_isr() {
1525 1530
     #endif
1526 1531
 
1527 1532
     // TODO: need to deal with MINIMUM_STEPPER_PULSE over i2s
1528
-    #if (MINIMUM_STEPPER_PULSE || MAXIMUM_STEPPER_RATE) && DISABLED(I2S_STEPPER_STREAM)
1533
+    #if ISR_MULTI_STEPS
1529 1534
       START_HIGH_PULSE();
1530 1535
       AWAIT_HIGH_PULSE();
1531 1536
     #endif
@@ -1558,7 +1563,7 @@ void Stepper::stepper_pulse_phase_isr() {
1558 1563
       #endif  // !MIXING_EXTRUDER
1559 1564
     #endif // !LIN_ADVANCE
1560 1565
 
1561
-    #if (MINIMUM_STEPPER_PULSE || MAXIMUM_STEPPER_RATE) && DISABLED(I2S_STEPPER_STREAM)
1566
+    #if ISR_MULTI_STEPS
1562 1567
       if (events_to_do) START_LOW_PULSE();
1563 1568
     #endif
1564 1569
 
@@ -1947,11 +1952,13 @@ uint32_t Stepper::stepper_block_phase_isr() {
1947 1952
     //const hal_timer_t added_step_ticks = hal_timer_t(ADDED_STEP_TICKS);
1948 1953
 
1949 1954
     // Step E stepper if we have steps
1950
-    bool firstStep = true;
1951
-    hal_timer_t end_tick_count = 0;
1955
+    #if ISR_MULTI_STEPS
1956
+      bool firstStep = true;
1957
+      hal_timer_t end_tick_count = 0;
1958
+    #endif
1952 1959
 
1953 1960
     while (LA_steps) {
1954
-      #if (MINIMUM_STEPPER_PULSE || MAXIMUM_STEPPER_RATE) && DISABLED(I2S_STEPPER_STREAM)
1961
+      #if ISR_MULTI_STEPS
1955 1962
         if (firstStep)
1956 1963
           firstStep = false;
1957 1964
         else
@@ -1966,13 +1973,13 @@ uint32_t Stepper::stepper_block_phase_isr() {
1966 1973
       #endif
1967 1974
 
1968 1975
       // Enforce a minimum duration for STEP pulse ON
1969
-      #if (MINIMUM_STEPPER_PULSE || MAXIMUM_STEPPER_RATE)
1976
+      #if ISR_PULSE_CONTROL
1970 1977
         START_HIGH_PULSE();
1971 1978
       #endif
1972 1979
 
1973 1980
       LA_steps < 0 ? ++LA_steps : --LA_steps;
1974 1981
 
1975
-      #if (MINIMUM_STEPPER_PULSE || MAXIMUM_STEPPER_RATE)
1982
+      #if ISR_PULSE_CONTROL
1976 1983
         AWAIT_HIGH_PULSE();
1977 1984
       #endif
1978 1985
 
@@ -1985,7 +1992,7 @@ uint32_t Stepper::stepper_block_phase_isr() {
1985 1992
 
1986 1993
       // For minimum pulse time wait before looping
1987 1994
       // Just wait for the requested pulse duration
1988
-      #if (MINIMUM_STEPPER_PULSE || MAXIMUM_STEPPER_RATE)
1995
+      #if ISR_PULSE_CONTROL
1989 1996
         if (LA_steps) START_LOW_PULSE();
1990 1997
       #endif
1991 1998
     } // LA_steps

Loading…
Cancel
Save