From 73b0349898fa7e905ce1195d7ae35a6e52a45d6e Mon Sep 17 00:00:00 2001 From: Robert Pelnar Date: Fri, 23 Feb 2018 16:31:24 +0100 Subject: [PATCH] fix - Z movement speed in selftest conditional translation for linearity correction and variable resolution --- Firmware/Configuration_prusa.h | 4 ++++ Firmware/Marlin_main.cpp | 9 +++++++++ Firmware/tmc2130.cpp | 3 +++ Firmware/ultralcd.cpp | 2 +- 4 files changed, 17 insertions(+), 1 deletion(-) diff --git a/Firmware/Configuration_prusa.h b/Firmware/Configuration_prusa.h index 42f63c96..4538b226 100644 --- a/Firmware/Configuration_prusa.h +++ b/Firmware/Configuration_prusa.h @@ -136,6 +136,10 @@ const bool Z_MIN_ENDSTOP_INVERTING = false; // set to true to invert the logic o #endif /* DEBUG_BUILD */ //#define EXPERIMENTAL_FEATURES +//#define TMC2130_LINEARITY_CORRECTION +//#define TMC2130_VARIABLE_RESOLUTION + + /*------------------------------------ TMC2130 default settings diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index 536c8031..0f562e18 100644 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -1033,6 +1033,7 @@ void setup() MYSERIAL.println("CrashDetect DISABLED"); } +#ifdef TMC2130_LINEARITY_CORRECTION tmc2130_wave_fac[X_AXIS] = eeprom_read_byte((uint8_t*)EEPROM_TMC2130_WAVE_X_FAC); tmc2130_wave_fac[Y_AXIS] = eeprom_read_byte((uint8_t*)EEPROM_TMC2130_WAVE_Y_FAC); tmc2130_wave_fac[Z_AXIS] = eeprom_read_byte((uint8_t*)EEPROM_TMC2130_WAVE_Z_FAC); @@ -1041,7 +1042,9 @@ void setup() if (tmc2130_wave_fac[Y_AXIS] == 0xff) tmc2130_wave_fac[Y_AXIS] = 0; if (tmc2130_wave_fac[Z_AXIS] == 0xff) tmc2130_wave_fac[Z_AXIS] = 0; if (tmc2130_wave_fac[E_AXIS] == 0xff) tmc2130_wave_fac[E_AXIS] = 0; +#endif //TMC2130_LINEARITY_CORRECTION +#ifdef TMC2130_VARIABLE_RESOLUTION tmc2130_mres[X_AXIS] = eeprom_read_byte((uint8_t*)EEPROM_TMC2130_X_MRES); tmc2130_mres[Y_AXIS] = eeprom_read_byte((uint8_t*)EEPROM_TMC2130_Y_MRES); tmc2130_mres[Z_AXIS] = eeprom_read_byte((uint8_t*)EEPROM_TMC2130_Z_MRES); @@ -1054,6 +1057,12 @@ void setup() eeprom_update_byte((uint8_t*)EEPROM_TMC2130_Y_MRES, tmc2130_mres[Y_AXIS]); eeprom_update_byte((uint8_t*)EEPROM_TMC2130_Z_MRES, tmc2130_mres[Z_AXIS]); eeprom_update_byte((uint8_t*)EEPROM_TMC2130_E_MRES, tmc2130_mres[E_AXIS]); +#else //TMC2130_VARIABLE_RESOLUTION + tmc2130_mres[X_AXIS] = tmc2130_usteps2mres(TMC2130_USTEPS_XY); + tmc2130_mres[Y_AXIS] = tmc2130_usteps2mres(TMC2130_USTEPS_XY); + tmc2130_mres[Z_AXIS] = tmc2130_usteps2mres(TMC2130_USTEPS_Z); + tmc2130_mres[E_AXIS] = tmc2130_usteps2mres(TMC2130_USTEPS_E); +#endif //TMC2130_VARIABLE_RESOLUTION #endif //TMC2130 diff --git a/Firmware/tmc2130.cpp b/Firmware/tmc2130.cpp index cb6c5252..109712bd 100644 --- a/Firmware/tmc2130.cpp +++ b/Firmware/tmc2130.cpp @@ -185,10 +185,13 @@ void tmc2130_init() tmc2130_sg_cnt[2] = 0; tmc2130_sg_cnt[3] = 0; +#ifdef TMC2130_LINEARITY_CORRECTION tmc2130_set_wave(X_AXIS, 247, tmc2130_wave_fac[X_AXIS]); tmc2130_set_wave(Y_AXIS, 247, tmc2130_wave_fac[Y_AXIS]); tmc2130_set_wave(Z_AXIS, 247, tmc2130_wave_fac[Z_AXIS]); tmc2130_set_wave(E_AXIS, 247, tmc2130_wave_fac[E_AXIS]); +#endif //TMC2130_LINEARITY_CORRECTION + } uint8_t tmc2130_sample_diag() diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index 86af480b..8de9e2eb 100644 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -5938,7 +5938,7 @@ static bool lcd_selftest() _result = lcd_selfcheck_axis(2, Z_MAX_POS); if (eeprom_read_byte((uint8_t*)EEPROM_WIZARD_ACTIVE) != 1) { enquecommand_P(PSTR("G28 W")); - enquecommand_P(PSTR("G1 Z15")); + enquecommand_P(PSTR("G1 Z15 F1000")); } }