Pārlūkot izejas kodu

Fix TMC-related compile issues. (#12971)

- `STEALTHOP_[XYZE]` configuration options now set the default state.
teemuatlut 6 gadus atpakaļ
vecāks
revīzija
e5801b75f8

+ 2
- 6
Marlin/src/feature/tmc_util.cpp Parādīt failu

838
     bool stealthchop_was_enabled = st.en_pwm_mode();
838
     bool stealthchop_was_enabled = st.en_pwm_mode();
839
 
839
 
840
     st.TCOOLTHRS(0xFFFFF);
840
     st.TCOOLTHRS(0xFFFFF);
841
-    #if STEALTHCHOP_ENABLED
842
-      st.en_pwm_mode(false);
843
-    #endif
841
+    st.en_pwm_mode(false);
844
     st.diag1_stall(true);
842
     st.diag1_stall(true);
845
 
843
 
846
     return stealthchop_was_enabled;
844
     return stealthchop_was_enabled;
847
   }
845
   }
848
   void tmc_disable_stallguard(TMC2130Stepper &st, const bool restore_stealth) {
846
   void tmc_disable_stallguard(TMC2130Stepper &st, const bool restore_stealth) {
849
     st.TCOOLTHRS(0);
847
     st.TCOOLTHRS(0);
850
-    #if STEALTHCHOP_ENABLED
851
-      st.en_pwm_mode(restore_stealth);
852
-    #endif
848
+    st.en_pwm_mode(restore_stealth);
853
     st.diag1_stall(false);
849
     st.diag1_stall(false);
854
   }
850
   }
855
   bool tmc_enable_stallguard(TMC2660Stepper) {
851
   bool tmc_enable_stallguard(TMC2660Stepper) {

+ 3
- 6
Marlin/src/feature/tmc_util.h Parādīt failu

82
     }
82
     }
83
 
83
 
84
     struct {
84
     struct {
85
-      #if STEALTHCHOP_ENABLED
85
+      #if HAS_STEALTHCHOP
86
         bool stealthChop_enabled = false;
86
         bool stealthChop_enabled = false;
87
       #endif
87
       #endif
88
       #if ENABLED(HYBRID_THRESHOLD)
88
       #if ENABLED(HYBRID_THRESHOLD)
113
       TMC::rms_current(mA, mult);
113
       TMC::rms_current(mA, mult);
114
     }
114
     }
115
 
115
 
116
-    #if STEALTHCHOP_ENABLED
116
+    #if HAS_STEALTHCHOP
117
       inline void refresh_stepping_mode() { this->en_pwm_mode(this->stored.stealthChop_enabled); }
117
       inline void refresh_stepping_mode() { this->en_pwm_mode(this->stored.stealthChop_enabled); }
118
       inline bool get_stealthChop_status() { return this->en_pwm_mode(); }
118
       inline bool get_stealthChop_status() { return this->en_pwm_mode(); }
119
     #endif
119
     #endif
158
       TMC2208Stepper::rms_current(mA, mult);
158
       TMC2208Stepper::rms_current(mA, mult);
159
     }
159
     }
160
 
160
 
161
-    #if STEALTHCHOP_ENABLED
161
+    #if HAS_STEALTHCHOP
162
       inline void refresh_stepping_mode() { en_spreadCycle(!this->stored.stealthChop_enabled); }
162
       inline void refresh_stepping_mode() { en_spreadCycle(!this->stored.stealthChop_enabled); }
163
       inline bool get_stealthChop_status() { return !this->en_spreadCycle(); }
163
       inline bool get_stealthChop_status() { return !this->en_spreadCycle(); }
164
     #endif
164
     #endif
169
         #if ENABLED(HYBRID_THRESHOLD)
169
         #if ENABLED(HYBRID_THRESHOLD)
170
           this->stored.hybrid_thrs = _tmc_thrs(this->microsteps(), this->TPWMTHRS(), planner.settings.axis_steps_per_mm[spmm_id]);
170
           this->stored.hybrid_thrs = _tmc_thrs(this->microsteps(), this->TPWMTHRS(), planner.settings.axis_steps_per_mm[spmm_id]);
171
         #endif
171
         #endif
172
-        #if STEALTHCHOP_ENABLED
173
-          this->stored.stealthChop_enabled = !this->en_spreadCycle();
174
-        #endif
175
       }
172
       }
176
 
173
 
177
       inline void refresh_stepper_current() { rms_current(this->val_mA); }
174
       inline void refresh_stepper_current() { rms_current(this->val_mA); }

+ 2
- 2
Marlin/src/lcd/menu/menu_tmc.cpp Parādīt failu

241
 
241
 
242
 #endif
242
 #endif
243
 
243
 
244
-#if STEALTHCHOP_ENABLED
244
+#if HAS_STEALTHCHOP
245
 
245
 
246
   #define TMC_EDIT_STEP_MODE(ST) MENU_ITEM_EDIT_CALLBACK(bool, MSG_##ST, &stepper##ST.stored.stealthChop_enabled, refresh_stepping_mode_##ST)
246
   #define TMC_EDIT_STEP_MODE(ST) MENU_ITEM_EDIT_CALLBACK(bool, MSG_##ST, &stepper##ST.stored.stealthChop_enabled, refresh_stepping_mode_##ST)
247
 
247
 
343
   #if ENABLED(SENSORLESS_HOMING)
343
   #if ENABLED(SENSORLESS_HOMING)
344
     MENU_ITEM(submenu, MSG_TMC_HOMING_THRS, menu_tmc_homing_thrs);
344
     MENU_ITEM(submenu, MSG_TMC_HOMING_THRS, menu_tmc_homing_thrs);
345
   #endif
345
   #endif
346
-  #if STEALTHCHOP_ENABLED
346
+  #if HAS_STEALTHCHOP
347
     MENU_ITEM(submenu, MSG_TMC_STEPPING_MODE, menu_tmc_step_mode);
347
     MENU_ITEM(submenu, MSG_TMC_STEPPING_MODE, menu_tmc_step_mode);
348
   #endif
348
   #endif
349
   END_MENU();
349
   END_MENU();

Notiek ielāde…
Atcelt
Saglabāt