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

Skip unnecessary (costly) SW Stepper Enable (#20218)

Co-authored-by: Jason Smith <jason.inet@gmail.com>
Co-authored-by: Scott Lahteine <github@thinkyhead.com>
Orel преди 4 години
родител
ревизия
8db72d027e
No account linked to committer's email address
променени са 4 файла, в които са добавени 25 реда и са изтрити 10 реда
  1. 5
    0
      Marlin/src/module/stepper/indirection.cpp
  2. 18
    8
      Marlin/src/module/stepper/indirection.h
  3. 1
    1
      buildroot/tests/NUCLEO_F767ZI-tests
  4. 1
    1
      buildroot/tests/esp32-tests

+ 5
- 0
Marlin/src/module/stepper/indirection.cpp Целия файл

@@ -43,3 +43,8 @@ void reset_stepper_drivers() {
43 43
   TERN_(HAS_L64XX, L64xxManager.init_to_defaults());
44 44
   TERN_(HAS_TRINAMIC_CONFIG, reset_trinamic_drivers());
45 45
 }
46
+
47
+#if ENABLED(SOFTWARE_DRIVER_ENABLE)
48
+  // Flags to optimize XYZ Enabled state
49
+  xyz_bool_t axis_sw_enabled; // = { false, false, false }
50
+#endif

+ 18
- 8
Marlin/src/module/stepper/indirection.h Целия файл

@@ -843,22 +843,32 @@ void reset_stepper_drivers();    // Called by settings.load / settings.reset
843 843
 //
844 844
 // Axis steppers enable / disable macros
845 845
 //
846
-#define FORGET_AXIS(A) TERN(HOME_AFTER_DEACTIVATE, set_axis_never_homed(A), CBI(axis_known_position, A))
847
-
848
-#define  ENABLE_AXIS_X() do{ ENABLE_STEPPER_X(); ENABLE_STEPPER_X2(); }while(0)
849
-#define DISABLE_AXIS_X() do{ DISABLE_STEPPER_X(); DISABLE_STEPPER_X2(); FORGET_AXIS(X_AXIS); }while(0)
846
+#if ENABLED(SOFTWARE_DRIVER_ENABLE)
847
+  // Avoid expensive calls to enable / disable steppers
848
+  extern xyz_bool_t axis_sw_enabled;
849
+  #define SHOULD_ENABLE(N)  !axis_sw_enabled.N
850
+  #define SHOULD_DISABLE(N)  axis_sw_enabled.N
851
+  #define AFTER_CHANGE(N,TF) axis_sw_enabled.N = TF
852
+#else
853
+  #define SHOULD_ENABLE(N)   true
854
+  #define SHOULD_DISABLE(N)  true
855
+  #define AFTER_CHANGE(N,TF) NOOP
856
+#endif
850 857
 
851
-#define  ENABLE_AXIS_Y() do{ ENABLE_STEPPER_Y(); ENABLE_STEPPER_Y2(); }while(0)
852
-#define DISABLE_AXIS_Y() do{ DISABLE_STEPPER_Y(); DISABLE_STEPPER_Y2(); FORGET_AXIS(Y_AXIS); }while(0)
858
+#define  ENABLE_AXIS_X() if (SHOULD_ENABLE(x))  {  ENABLE_STEPPER_X();  ENABLE_STEPPER_X2(); AFTER_CHANGE(x, true); }
859
+#define DISABLE_AXIS_X() if (SHOULD_DISABLE(x)) { DISABLE_STEPPER_X(); DISABLE_STEPPER_X2(); AFTER_CHANGE(x, false); FORGET_AXIS(X_AXIS); }
860
+#define  ENABLE_AXIS_Y() if (SHOULD_ENABLE(y))  {  ENABLE_STEPPER_Y();  ENABLE_STEPPER_Y2(); AFTER_CHANGE(y, true); }
861
+#define DISABLE_AXIS_Y() if (SHOULD_DISABLE(y)) { DISABLE_STEPPER_Y(); DISABLE_STEPPER_Y2(); AFTER_CHANGE(y, false); FORGET_AXIS(Y_AXIS); }
862
+#define  ENABLE_AXIS_Z() if (SHOULD_ENABLE(z))  {  ENABLE_STEPPER_Z();  ENABLE_STEPPER_Z2();  ENABLE_STEPPER_Z3(); AFTER_CHANGE(z, true); }
863
+#define DISABLE_AXIS_Z() if (SHOULD_DISABLE(z)) { DISABLE_STEPPER_Z(); DISABLE_STEPPER_Z2(); DISABLE_STEPPER_Z3(); AFTER_CHANGE(z, false); FORGET_AXIS(Z_AXIS); Z_RESET(); }
853 864
 
854
-#define  ENABLE_AXIS_Z() do{ ENABLE_STEPPER_Z();  ENABLE_STEPPER_Z2();  ENABLE_STEPPER_Z3();  ENABLE_STEPPER_Z4(); }while(0)
865
+#define FORGET_AXIS(A) TERN(HOME_AFTER_DEACTIVATE, set_axis_never_homed(A), CBI(axis_known_position, A))
855 866
 
856 867
 #ifdef Z_AFTER_DEACTIVATE
857 868
   #define Z_RESET() do{ current_position.z = Z_AFTER_DEACTIVATE; sync_plan_position(); }while(0)
858 869
 #else
859 870
   #define Z_RESET()
860 871
 #endif
861
-#define DISABLE_AXIS_Z() do{ DISABLE_STEPPER_Z(); DISABLE_STEPPER_Z2(); DISABLE_STEPPER_Z3(); DISABLE_STEPPER_Z4(); FORGET_AXIS(Z_AXIS); Z_RESET(); }while(0)
862 872
 
863 873
 //
864 874
 // Extruder steppers enable / disable macros

+ 1
- 1
buildroot/tests/NUCLEO_F767ZI-tests Целия файл

@@ -12,7 +12,7 @@ set -e
12 12
 restore_configs
13 13
 opt_set MOTHERBOARD BOARD_NUCLEO_F767ZI
14 14
 opt_set SERIAL_PORT -1
15
-opt_enable BLTOUCH Z_SAFE_HOMING SPEAKER
15
+opt_enable BLTOUCH Z_SAFE_HOMING SPEAKER SOFTWARE_DRIVER_ENABLE
16 16
 opt_set X_DRIVER_TYPE TMC2209
17 17
 opt_set Y_DRIVER_TYPE TMC2208
18 18
 exec_test $1 $2 "Mixed timer usage" "$3"

+ 1
- 1
buildroot/tests/esp32-tests Целия файл

@@ -34,7 +34,7 @@ opt_set X_SLAVE_ADDRESS 0
34 34
 opt_set Y_SLAVE_ADDRESS 1
35 35
 opt_set Z_SLAVE_ADDRESS 2
36 36
 opt_set E0_SLAVE_ADDRESS 3
37
-opt_enable HOTEND_IDLE_TIMEOUT
37
+opt_enable HOTEND_IDLE_TIMEOUT SOFTWARE_DRIVER_ENABLE
38 38
 exec_test $1 $2 "ESP32, TMC HW Serial, Hotend Idle" "$3"
39 39
 
40 40
 # cleanup

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