Преглед на файлове

Fix warnings in stepper.cpp (#16364)

Jason Smith преди 4 години
родител
ревизия
9ff2d34bf8
променени са 1 файла, в които са добавени 18 реда и са изтрити 11 реда
  1. 18
    11
      Marlin/src/module/stepper.cpp

+ 18
- 11
Marlin/src/module/stepper.cpp Целия файл

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

Loading…
Отказ
Запис