HAS_TRINAMIC => HAS_TRINAMIC_CONFIG

This commit is contained in:
Scott Lahteine 2020-03-02 12:03:43 -06:00
parent 736521a3f1
commit b1a50d54e2
31 changed files with 65 additions and 65 deletions

View File

@ -2015,7 +2015,7 @@
* TMCStepper library is required to use TMC stepper drivers.
* https://github.com/teemuatlut/TMCStepper
*/
#if HAS_TRINAMIC
#if HAS_TRINAMIC_CONFIG
#define HOLD_MULTIPLIER 0.5 // Scales down the holding current from run current
#define INTERPOLATE true // Interpolate X/Y/Z_MICROSTEPS to 256
@ -2345,7 +2345,7 @@
*/
#define TMC_ADV() { }
#endif // HAS_TRINAMIC
#endif // HAS_TRINAMIC_CONFIG
// @section L64XX

View File

@ -56,7 +56,7 @@
/**
* The Trinamic library includes SoftwareSerial.h, leading to a compile error.
*/
#if HAS_TRINAMIC && ENABLED(ENDSTOP_INTERRUPTS_FEATURE)
#if HAS_TRINAMIC_CONFIG && ENABLED(ENDSTOP_INTERRUPTS_FEATURE)
#error "TMCStepper includes SoftwareSerial.h which is incompatible with ENDSTOP_INTERRUPTS_FEATURE. Disable ENDSTOP_INTERRUPTS_FEATURE to continue."
#endif

View File

@ -110,7 +110,7 @@
#include "feature/I2CPositionEncoder.h"
#endif
#if HAS_TRINAMIC && DISABLED(PSU_DEFAULT_OFF)
#if HAS_TRINAMIC_CONFIG && DISABLED(PSU_DEFAULT_OFF)
#include "feature/tmc_util.h"
#endif
@ -1162,7 +1162,7 @@ void setup() {
host_action_prompt_end();
#endif
#if HAS_TRINAMIC && DISABLED(PSU_DEFAULT_OFF)
#if HAS_TRINAMIC_CONFIG && DISABLED(PSU_DEFAULT_OFF)
test_tmc_connection(true, true, true, true);
#endif

View File

@ -90,7 +90,7 @@
// Test for supported TMC drivers that require advanced configuration
// Does not match standalone configurations
#define HAS_TRINAMIC ( HAS_DRIVER(TMC2130) \
#define HAS_TRINAMIC_CONFIG ( HAS_DRIVER(TMC2130) \
|| HAS_DRIVER(TMC2160) \
|| HAS_DRIVER(TMC2208) \
|| HAS_DRIVER(TMC2209) \

View File

@ -108,7 +108,7 @@ void Power::power_on() {
if (!powersupply_on) {
PSU_PIN_ON();
#if HAS_TRINAMIC
#if HAS_TRINAMIC_CONFIG
delay(PSU_POWERUP_DELAY); // Wait for power to settle
restore_stepper_drivers();
#endif

View File

@ -22,7 +22,7 @@
#include "../inc/MarlinConfig.h"
#if HAS_TRINAMIC
#if HAS_TRINAMIC_CONFIG
#include "tmc_util.h"
#include "../MarlinCore.h"
@ -954,7 +954,7 @@
static void tmc_get_ic_registers(TMC2208Stepper, const TMC_get_registers_enum) { SERIAL_CHAR('\t'); }
#endif
#if HAS_TRINAMIC
#if HAS_TRINAMIC_CONFIG
template<class TMC>
static void tmc_get_registers(TMC &st, const TMC_get_registers_enum i) {
switch (i) {
@ -1257,4 +1257,4 @@ void test_tmc_connection(const bool test_x, const bool test_y, const bool test_z
if (axis_connection) ui.set_status_P(GET_TEXT(MSG_ERROR_TMC));
}
#endif // HAS_TRINAMIC
#endif // HAS_TRINAMIC_CONFIG

View File

@ -24,7 +24,7 @@
#include "../inc/MarlinConfig.h"
#include "../lcd/ultralcd.h"
#if HAS_TRINAMIC
#if HAS_TRINAMIC_CONFIG
#include <TMCStepper.h>
#include "../module/planner.h"
@ -400,4 +400,4 @@ void test_tmc_connection(const bool test_x, const bool test_y, const bool test_z
void tmc_init_cs_pins();
#endif
#endif // HAS_TRINAMIC
#endif // HAS_TRINAMIC_CONFIG

View File

@ -44,7 +44,7 @@
// Could be moved to a feature, but this is all the data
bool powersupply_on;
#if HAS_TRINAMIC
#if HAS_TRINAMIC_CONFIG
#include "../../feature/tmc_util.h"
#endif

View File

@ -22,7 +22,7 @@
#include "../../../inc/MarlinConfig.h"
#if HAS_TRINAMIC
#if HAS_TRINAMIC_CONFIG
#include "../../gcode.h"
#include "../../../feature/tmc_util.h"
@ -53,4 +53,4 @@ void GcodeSuite::M122() {
test_tmc_connection(print_axis.x, print_axis.y, print_axis.z, print_axis.e);
}
#endif // HAS_TRINAMIC
#endif // HAS_TRINAMIC_CONFIG

View File

@ -22,7 +22,7 @@
#include "../../../inc/MarlinConfig.h"
#if HAS_TRINAMIC
#if HAS_TRINAMIC_CONFIG
#include "../../gcode.h"
#include "../../../feature/tmc_util.h"
@ -170,4 +170,4 @@ void GcodeSuite::M906() {
}
}
#endif // HAS_TRINAMIC
#endif // HAS_TRINAMIC_CONFIG

View File

@ -22,7 +22,7 @@
#include "../../../inc/MarlinConfig.h"
#if HAS_TRINAMIC
#if HAS_TRINAMIC_CONFIG
#include "../../gcode.h"
#include "../../../feature/tmc_util.h"
@ -426,4 +426,4 @@
}
#endif // USE_SENSORLESS
#endif // HAS_TRINAMIC
#endif // HAS_TRINAMIC_CONFIG

View File

@ -785,7 +785,7 @@ void GcodeSuite::process_parsed_command(const bool no_ok/*=false*/) {
#endif
#endif
#if HAS_TRINAMIC
#if HAS_TRINAMIC_CONFIG
case 122: M122(); break; // M122: Report driver configuration and status
case 906: M906(); break; // M906: Set motor current in milliamps using axis codes X, Y, Z, E
#if HAS_STEALTHCHOP

View File

@ -912,7 +912,7 @@ private:
static void M900();
#endif
#if HAS_TRINAMIC
#if HAS_TRINAMIC_CONFIG
static void M122();
static void M906();
#if HAS_STEALTHCHOP

View File

@ -196,7 +196,7 @@
#define MINIMUM_STEPPER_POST_DIR_DELAY 400
#elif HAS_DRIVER(A4988)
#define MINIMUM_STEPPER_POST_DIR_DELAY 200
#elif HAS_TRINAMIC || HAS_TRINAMIC_STANDALONE
#elif HAS_TRINAMIC_CONFIG || HAS_TRINAMIC_STANDALONE
#define MINIMUM_STEPPER_POST_DIR_DELAY 20
#else
#define MINIMUM_STEPPER_POST_DIR_DELAY 0 // Expect at least 10µS since one Stepper ISR must transpire
@ -216,7 +216,7 @@
#define MINIMUM_STEPPER_PULSE 2
#elif HAS_DRIVER(A4988) || HAS_DRIVER(A5984)
#define MINIMUM_STEPPER_PULSE 1
#elif HAS_TRINAMIC || HAS_TRINAMIC_STANDALONE
#elif HAS_TRINAMIC_CONFIG || HAS_TRINAMIC_STANDALONE
#define MINIMUM_STEPPER_PULSE 0
#elif HAS_DRIVER(LV8729)
#define MINIMUM_STEPPER_PULSE 0
@ -236,7 +236,7 @@
#define MAXIMUM_STEPPER_RATE 500000
#elif HAS_DRIVER(LV8729)
#define MAXIMUM_STEPPER_RATE 1000000
#elif HAS_TRINAMIC || HAS_TRINAMIC_STANDALONE
#elif HAS_TRINAMIC_CONFIG || HAS_TRINAMIC_STANDALONE
#define MAXIMUM_STEPPER_RATE 5000000
#else
#define MAXIMUM_STEPPER_RATE 250000

View File

@ -1290,7 +1290,7 @@
#define HAS_SOLENOID_7 (PIN_EXISTS(SOL7))
// Trinamic Stepper Drivers
#if HAS_TRINAMIC
#if HAS_TRINAMIC_CONFIG
#define STEALTHCHOP_ENABLED ANY(STEALTHCHOP_XY, STEALTHCHOP_Z, STEALTHCHOP_E)
#define USE_SENSORLESS EITHER(SENSORLESS_HOMING, SENSORLESS_PROBING)
// Disable Z axis sensorless homing if a probe is used to home the Z axis

View File

@ -58,13 +58,13 @@ void AdvancedSettingsMenu::onRedraw(draw_mode_t what) {
.tag(16).button( BTN_POS(1,6), BTN_SIZE(1,1), GET_TEXT_F(MSG_CASE_LIGHT))
.tag(3) .button( BTN_POS(2,1), BTN_SIZE(1,1), GET_TEXT_F(MSG_STEPS_PER_MM))
.enabled(
#if HAS_TRINAMIC
#if HAS_TRINAMIC_CONFIG
1
#endif
)
.tag(13).button( BTN_POS(1,4), BTN_SIZE(1,1), GET_TEXT_F(MSG_TMC_CURRENT))
.enabled(
#if HAS_TRINAMIC
#if HAS_TRINAMIC_CONFIG
1
#endif
)
@ -120,13 +120,13 @@ void AdvancedSettingsMenu::onRedraw(draw_mode_t what) {
.enabled(1)
.tag(3) .button( BTN_POS(2,1), BTN_SIZE(1,1), GET_TEXT_F(MSG_STEPS_PER_MM))
.enabled(
#if HAS_TRINAMIC
#if HAS_TRINAMIC_CONFIG
1
#endif
)
.tag(13).button( BTN_POS(3,1), BTN_SIZE(1,1), GET_TEXT_F(MSG_TMC_CURRENT))
.enabled(
#if HAS_TRINAMIC
#if HAS_TRINAMIC_CONFIG
1
#endif
)
@ -189,7 +189,7 @@ bool AdvancedSettingsMenu::onTouchEnd(uint8_t tag) {
case 11: GOTO_SCREEN(FilamentMenu); break;
#endif
case 12: GOTO_SCREEN(EndstopStatesScreen); break;
#if HAS_TRINAMIC
#if HAS_TRINAMIC_CONFIG
case 13: GOTO_SCREEN(StepperCurrentScreen); break;
case 14: GOTO_SCREEN(StepperBumpSensitivityScreen); break;
#endif

View File

@ -45,13 +45,13 @@ void AdvancedSettingsMenu::onRedraw(draw_mode_t what) {
.tag(2) .button( BTN_POS(1,1), BTN_SIZE(1,1), GET_TEXT_F(MSG_DISPLAY_MENU))
.enabled(
#if HAS_TRINAMIC
#if HAS_TRINAMIC_CONFIG
1
#endif
)
.tag(3) .button( BTN_POS(1,2), BTN_SIZE(1,1), GET_TEXT_F(MSG_TMC_CURRENT))
.enabled(
#if HAS_TRINAMIC
#if HAS_TRINAMIC_CONFIG
1
#endif
)
@ -100,7 +100,7 @@ bool AdvancedSettingsMenu::onTouchEnd(uint8_t tag) {
switch (tag) {
case 1: SaveSettingsDialogBox::promptToSaveSettings(); break;
case 2: GOTO_SCREEN(DisplayTuningScreen); break;
#if HAS_TRINAMIC
#if HAS_TRINAMIC_CONFIG
case 3: GOTO_SCREEN(StepperCurrentScreen); break;
case 4: GOTO_SCREEN(StepperBumpSensitivityScreen); break;
#endif

View File

@ -58,7 +58,7 @@ SCREEN_TABLE {
#endif
DECL_SCREEN(MoveAxisScreen),
DECL_SCREEN(StepsScreen),
#if HAS_TRINAMIC
#if HAS_TRINAMIC_CONFIG
DECL_SCREEN(StepperCurrentScreen),
DECL_SCREEN(StepperBumpSensitivityScreen),
#endif

View File

@ -455,7 +455,7 @@ class StepsScreen : public BaseNumericAdjustmentScreen, public CachedScreen<STEP
static bool onTouchHeld(uint8_t tag);
};
#if HAS_TRINAMIC
#if HAS_TRINAMIC_CONFIG
class StepperCurrentScreen : public BaseNumericAdjustmentScreen, public CachedScreen<STEPPER_CURRENT_SCREEN_CACHE> {
public:
static void onRedraw(draw_mode_t);

View File

@ -22,7 +22,7 @@
#include "../config.h"
#if ENABLED(TOUCH_UI_FTDI_EVE) && HAS_TRINAMIC
#if ENABLED(TOUCH_UI_FTDI_EVE) && HAS_TRINAMIC_CONFIG
#include "screens.h"
@ -74,4 +74,4 @@ bool StepperBumpSensitivityScreen::onTouchHeld(uint8_t tag) {
return true;
}
#endif // TOUCH_UI_FTDI_EVE && HAS_TRINAMIC
#endif // TOUCH_UI_FTDI_EVE && HAS_TRINAMIC_CONFIG

View File

@ -22,7 +22,7 @@
#include "../config.h"
#if ENABLED(TOUCH_UI_FTDI_EVE) && HAS_TRINAMIC
#if ENABLED(TOUCH_UI_FTDI_EVE) && HAS_TRINAMIC_CONFIG
#include "screens.h"

View File

@ -75,7 +75,7 @@
#define IFSD(A,B) (B)
#endif
#if HAS_TRINAMIC
#if HAS_TRINAMIC_CONFIG
#include "../../feature/tmc_util.h"
#include "../../module/stepper/indirection.h"
#endif
@ -445,7 +445,7 @@ namespace ExtUI {
void setSoftEndstopState(const bool value) { soft_endstops_enabled = value; }
#endif
#if HAS_TRINAMIC
#if HAS_TRINAMIC_CONFIG
float getAxisCurrent_mA(const axis_t axis) {
switch (axis) {
#if AXIS_IS_TMC(X)

View File

@ -97,7 +97,7 @@ namespace ExtUI {
void setSoftEndstopState(const bool);
#endif
#if HAS_TRINAMIC
#if HAS_TRINAMIC_CONFIG
float getAxisCurrent_mA(const axis_t);
float getAxisCurrent_mA(const extruder_t);
void setAxisCurrent_mA(const float, const axis_t);

View File

@ -544,7 +544,7 @@ void menu_advanced_settings() {
SUBMENU(MSG_DRIVE_STRENGTH, menu_pwm);
#endif
#if HAS_TRINAMIC
#if HAS_TRINAMIC_CONFIG
SUBMENU(MSG_TMC_DRIVERS, menu_tmc);
#endif

View File

@ -26,7 +26,7 @@
#include "../../inc/MarlinConfigPre.h"
#if HAS_TRINAMIC && HAS_LCD_MENU
#if HAS_TRINAMIC_CONFIG && HAS_LCD_MENU
#include "menu.h"
#include "../../module/stepper/indirection.h"
@ -249,4 +249,4 @@ void menu_tmc() {
END_MENU();
}
#endif // HAS_TRINAMIC
#endif // HAS_TRINAMIC_CONFIG

View File

@ -103,7 +103,7 @@ MarlinUI ui;
#include "../feature/bedlevel/bedlevel.h"
#endif
#if HAS_TRINAMIC
#if HAS_TRINAMIC_CONFIG
#include "../feature/tmc_util.h"
#endif

View File

@ -113,7 +113,7 @@
#include "../feature/bltouch.h"
#endif
#if HAS_TRINAMIC
#if HAS_TRINAMIC_CONFIG
#include "stepper/indirection.h"
#include "../feature/tmc_util.h"
#endif
@ -313,7 +313,7 @@ typedef struct SettingsDataStruct {
float planner_filament_size[EXTRUDERS]; // M200 T D planner.filament_size[]
//
// HAS_TRINAMIC
// HAS_TRINAMIC_CONFIG
//
tmc_stepper_current_t tmc_stepper_current; // M906 X Y Z X2 Y2 Z2 Z3 Z4 E0 E1 E2 E3 E4 E5
tmc_hybrid_threshold_t tmc_hybrid_threshold; // M913 X Y Z X2 Y2 Z2 Z3 Z4 E0 E1 E2 E3 E4 E5
@ -985,7 +985,7 @@ void MarlinSettings::postprocess() {
tmc_stepper_current_t tmc_stepper_current = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
#if HAS_TRINAMIC
#if HAS_TRINAMIC_CONFIG
#if AXIS_IS_TMC(X)
tmc_stepper_current.X = stepperX.getMilliamps();
#endif
@ -1862,7 +1862,7 @@ void MarlinSettings::postprocess() {
tmc_stepper_current_t currents;
EEPROM_READ(currents);
#if HAS_TRINAMIC
#if HAS_TRINAMIC_CONFIG
#define SET_CURR(Q) stepper##Q.rms_current(currents.Q ? currents.Q : Q##_CURRENT)
if (!validating) {
@ -2034,7 +2034,7 @@ void MarlinSettings::postprocess() {
tmc_stealth_enabled_t tmc_stealth_enabled;
EEPROM_READ(tmc_stealth_enabled);
#if HAS_TRINAMIC
#if HAS_TRINAMIC_CONFIG
#define SET_STEPPING_MODE(ST) stepper##ST.stored.stealthChop_enabled = tmc_stealth_enabled.ST; stepper##ST.refresh_stepping_mode();
if (!validating) {
@ -2788,7 +2788,7 @@ void MarlinSettings::reset() {
#define CONFIG_ECHO_MSG(STR) do{ CONFIG_ECHO_START(); SERIAL_ECHOLNPGM(STR); }while(0)
#define CONFIG_ECHO_HEADING(STR) config_heading(forReplay, PSTR(STR))
#if HAS_TRINAMIC
#if HAS_TRINAMIC_CONFIG
inline void say_M906(const bool forReplay) { CONFIG_ECHO_START(); SERIAL_ECHOPGM(" M906"); }
#if HAS_STEALTHCHOP
void say_M569(const bool forReplay, const char * const etc=nullptr, const bool newLine = false) {
@ -3298,7 +3298,7 @@ void MarlinSettings::reset() {
#endif
#endif
#if HAS_TRINAMIC
#if HAS_TRINAMIC_CONFIG
/**
* TMC stepper driver current
@ -3599,7 +3599,7 @@ void MarlinSettings::reset() {
#endif // HAS_STEALTHCHOP
#endif // HAS_TRINAMIC
#endif // HAS_TRINAMIC_CONFIG
/**
* Linear Advance

View File

@ -33,7 +33,7 @@
#include "indirection.h"
void restore_stepper_drivers() {
#if HAS_TRINAMIC
#if HAS_TRINAMIC_CONFIG
restore_trinamic_drivers();
#endif
}
@ -47,7 +47,7 @@ void reset_stepper_drivers() {
L64xxManager.init_to_defaults();
#endif
#if HAS_TRINAMIC
#if HAS_TRINAMIC_CONFIG
reset_trinamic_drivers();
#endif
}

View File

@ -40,7 +40,7 @@
#include "TMC26X.h"
#endif
#if HAS_TRINAMIC
#if HAS_TRINAMIC_CONFIG
#include "trinamic.h"
#endif

View File

@ -27,7 +27,7 @@
#include "../../inc/MarlinConfig.h"
#if HAS_TRINAMIC
#if HAS_TRINAMIC_CONFIG
#include "trinamic.h"
#include "../stepper.h"
@ -818,4 +818,4 @@ void reset_trinamic_drivers() {
stepper.set_directions();
}
#endif // HAS_TRINAMIC
#endif // HAS_TRINAMIC_CONFIG

View File

@ -103,7 +103,7 @@
// Trinamic driver support
#if HAS_TRINAMIC
#if HAS_TRINAMIC_CONFIG
// Using TMC devices in intelligent mode requires extra connections to each device. Unfortunately
// the SKR does not have many free pins (especially if a display is in use). The SPI-based devices
// will require 3 connections (clock, mosi, miso), plus a chip select line (CS) for each driver.