Merge pull request #4037 from gudnimg/optimisation-tmc2130-stuff

Optimisation: Disable M351 when using TMC2130 and code related to it
This commit is contained in:
Alex Voinea 2023-04-13 10:54:08 +02:00 committed by GitHub
commit 193bce7f20
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 12 additions and 9 deletions

View File

@ -8378,6 +8378,7 @@ Sigma_Exit:
}
break;
#ifndef TMC2130
/*!
### M351 - Toggle Microstep Pins <a href="https://reprap.org/wiki/G-code#M351:_Toggle_MS1_MS2_pins_directly">M351: Toggle MS1 MS2 pins directly</a>
Toggle MS1 MS2 pins directly.
@ -8411,6 +8412,7 @@ Sigma_Exit:
#endif
}
break;
#endif // !TMC2130
/*!
### M701 - Load filament to extruder <a href="https://reprap.org/wiki/G-code#M701:_Load_filament">M701: Load filament</a>

View File

@ -1073,10 +1073,10 @@ void st_init()
{
#ifdef TMC2130
tmc2130_init(TMCInitParams(false, FarmOrUserECool()));
#endif //TMC2130
#else
st_current_init(); //Initialize Digipot Motor Current
microstep_init(); //Initialize Microstepping Pins
#endif //TMC2130
//Initialize Dir Pins
#if defined(X_DIR_PIN) && X_DIR_PIN > -1
@ -1513,6 +1513,7 @@ void digitalPotWrite(int address, int value) // From Arduino DigitalPotControl e
}
#endif
#ifndef TMC2130
void st_current_init() //Initialize Digipot Motor Current
{
#ifdef MOTOR_CURRENT_PWM_XY_PIN
@ -1542,8 +1543,6 @@ void st_current_init() //Initialize Digipot Motor Current
#endif
}
#ifdef MOTOR_CURRENT_PWM_XY_PIN
void st_current_set(uint8_t driver, int current)
{
@ -1577,9 +1576,6 @@ void microstep_init()
#endif
}
#ifndef TMC2130
void microstep_ms(uint8_t driver, int8_t ms1, int8_t ms2)
{
if(ms1 > -1) switch(driver)
@ -1637,4 +1633,4 @@ void microstep_readings()
SERIAL_PROTOCOLLN( READ(E1_MS2_PIN));
#endif
}
#endif //TMC2130
#endif //!TMC2130

View File

@ -76,12 +76,15 @@ void quickStop();
#if defined(DIGIPOTSS_PIN) && DIGIPOTSS_PIN > -1
void digitalPotWrite(int address, int value);
#endif //defined(DIGIPOTSS_PIN) && DIGIPOTSS_PIN > -1
#ifndef TMC2130
void microstep_ms(uint8_t driver, int8_t ms1, int8_t ms2);
void microstep_mode(uint8_t driver, uint8_t stepping);
void st_current_init();
void st_current_set(uint8_t driver, int current);
void microstep_init();
void microstep_readings();
#endif //!TMC2130
#ifdef BABYSTEPPING
void babystep(const uint8_t axis,const bool direction); // perform a short step with a single stepper motor, outside of any convention

View File

@ -3454,8 +3454,10 @@ static void lcd_silent_mode_set() {
// Be safe than sorry, reset the stepper timer before re-enabling interrupts.
st_reset_timer();
sei();
#else
st_current_init();
#endif //TMC2130
st_current_init();
#ifdef TMC2130
if (lcd_crash_detect_enabled() && (SilentModeMenu != SILENT_MODE_NORMAL))
menu_submenu(lcd_crash_mode_info2);