From e5801b75f89254d088b423499719b5ccbc48cb0d Mon Sep 17 00:00:00 2001 From: teemuatlut Date: Mon, 21 Jan 2019 07:54:57 +0200 Subject: [PATCH] Fix TMC-related compile issues. (#12971) - `STEALTHOP_[XYZE]` configuration options now set the default state. --- Marlin/src/feature/tmc_util.cpp | 8 ++------ Marlin/src/feature/tmc_util.h | 9 +++------ Marlin/src/lcd/menu/menu_tmc.cpp | 4 ++-- 3 files changed, 7 insertions(+), 14 deletions(-) diff --git a/Marlin/src/feature/tmc_util.cpp b/Marlin/src/feature/tmc_util.cpp index 8c21575a73..cba1d7e329 100644 --- a/Marlin/src/feature/tmc_util.cpp +++ b/Marlin/src/feature/tmc_util.cpp @@ -838,18 +838,14 @@ bool stealthchop_was_enabled = st.en_pwm_mode(); st.TCOOLTHRS(0xFFFFF); - #if STEALTHCHOP_ENABLED - st.en_pwm_mode(false); - #endif + st.en_pwm_mode(false); st.diag1_stall(true); return stealthchop_was_enabled; } void tmc_disable_stallguard(TMC2130Stepper &st, const bool restore_stealth) { st.TCOOLTHRS(0); - #if STEALTHCHOP_ENABLED - st.en_pwm_mode(restore_stealth); - #endif + st.en_pwm_mode(restore_stealth); st.diag1_stall(false); } bool tmc_enable_stallguard(TMC2660Stepper) { diff --git a/Marlin/src/feature/tmc_util.h b/Marlin/src/feature/tmc_util.h index 6b5ca8daa5..aa0962a2a2 100644 --- a/Marlin/src/feature/tmc_util.h +++ b/Marlin/src/feature/tmc_util.h @@ -82,7 +82,7 @@ class TMCStorage { } struct { - #if STEALTHCHOP_ENABLED + #if HAS_STEALTHCHOP bool stealthChop_enabled = false; #endif #if ENABLED(HYBRID_THRESHOLD) @@ -113,7 +113,7 @@ class TMCMarlin : public TMC, public TMCStorage { TMC::rms_current(mA, mult); } - #if STEALTHCHOP_ENABLED + #if HAS_STEALTHCHOP inline void refresh_stepping_mode() { this->en_pwm_mode(this->stored.stealthChop_enabled); } inline bool get_stealthChop_status() { return this->en_pwm_mode(); } #endif @@ -158,7 +158,7 @@ class TMCMarlin : public TMC2208Stepper, TMC2208Stepper::rms_current(mA, mult); } - #if STEALTHCHOP_ENABLED + #if HAS_STEALTHCHOP inline void refresh_stepping_mode() { en_spreadCycle(!this->stored.stealthChop_enabled); } inline bool get_stealthChop_status() { return !this->en_spreadCycle(); } #endif @@ -169,9 +169,6 @@ class TMCMarlin : public TMC2208Stepper, #if ENABLED(HYBRID_THRESHOLD) this->stored.hybrid_thrs = _tmc_thrs(this->microsteps(), this->TPWMTHRS(), planner.settings.axis_steps_per_mm[spmm_id]); #endif - #if STEALTHCHOP_ENABLED - this->stored.stealthChop_enabled = !this->en_spreadCycle(); - #endif } inline void refresh_stepper_current() { rms_current(this->val_mA); } diff --git a/Marlin/src/lcd/menu/menu_tmc.cpp b/Marlin/src/lcd/menu/menu_tmc.cpp index 269e65ba57..fa2e2c4c86 100644 --- a/Marlin/src/lcd/menu/menu_tmc.cpp +++ b/Marlin/src/lcd/menu/menu_tmc.cpp @@ -241,7 +241,7 @@ void menu_tmc_current() { #endif -#if STEALTHCHOP_ENABLED +#if HAS_STEALTHCHOP #define TMC_EDIT_STEP_MODE(ST) MENU_ITEM_EDIT_CALLBACK(bool, MSG_##ST, &stepper##ST.stored.stealthChop_enabled, refresh_stepping_mode_##ST) @@ -343,7 +343,7 @@ void menu_tmc() { #if ENABLED(SENSORLESS_HOMING) MENU_ITEM(submenu, MSG_TMC_HOMING_THRS, menu_tmc_homing_thrs); #endif - #if STEALTHCHOP_ENABLED + #if HAS_STEALTHCHOP MENU_ITEM(submenu, MSG_TMC_STEPPING_MODE, menu_tmc_step_mode); #endif END_MENU();