Consolidate smart stepper driver initialization

This commit is contained in:
Scott Lahteine 2018-03-18 18:33:56 -05:00
parent 72776f647b
commit a03502080e
5 changed files with 180 additions and 119 deletions

View file

@ -8278,19 +8278,14 @@ inline void gcode_M140() {
OUT_WRITE(SUICIDE_PIN, HIGH);
#endif
#if ENABLED(HAVE_TMC2130)
delay(100);
tmc2130_init(); // Settings only stick when the driver has power
#if DISABLED(AUTO_POWER_CONTROL)
delay(100); // Wait for power to settle
restore_stepper_drivers();
#endif
#if ENABLED(ULTIPANEL)
LCD_MESSAGEPGM(WELCOME_MSG);
#endif
#if ENABLED(HAVE_TMC2208)
delay(100);
tmc2208_init();
#endif
}
#endif // HAS_POWER_SWITCH
@ -13667,6 +13662,7 @@ void setup() {
SERIAL_PROTOCOLLNPGM("start");
SERIAL_ECHO_START();
// Prepare communication for TMC drivers
#if ENABLED(HAVE_TMC2130)
tmc_init_cs_pins();
#endif
@ -13722,8 +13718,9 @@ void setup() {
print_job_timer.init(); // Initial setup of print job timer
stepper.init(); // Initialize stepper, this enables interrupts!
servo_init();
stepper.init(); // Initialize stepper, this enables interrupts!
servo_init(); // Initialize all servos, stow servo probe
#if HAS_PHOTOGRAPH
OUT_WRITE(PHOTOGRAPH_PIN, LOW);