浏览代码

Init CS pins before loading settings (#9566)

teemuatlut 7 年前
父节点
当前提交
5990266724
共有 3 个文件被更改,包括 50 次插入0 次删除
  1. 7
    0
      Marlin/src/Marlin.cpp
  2. 39
    0
      Marlin/src/feature/tmc_util.cpp
  3. 4
    0
      Marlin/src/feature/tmc_util.h

+ 7
- 0
Marlin/src/Marlin.cpp 查看文件

689
   SERIAL_PROTOCOLLNPGM("start");
689
   SERIAL_PROTOCOLLNPGM("start");
690
   SERIAL_ECHO_START();
690
   SERIAL_ECHO_START();
691
 
691
 
692
+  #if ENABLED(HAVE_TMC2130)
693
+    tmc_init_cs_pins();
694
+  #endif
695
+  #if ENABLED(HAVE_TMC2208)
696
+    tmc2208_serial_begin();
697
+  #endif
698
+
692
   // Check startup - does nothing if bootloader sets MCUSR to 0
699
   // Check startup - does nothing if bootloader sets MCUSR to 0
693
   byte mcu = HAL_get_reset_source();
700
   byte mcu = HAL_get_reset_source();
694
   if (mcu &  1) SERIAL_ECHOLNPGM(MSG_POWERUP);
701
   if (mcu &  1) SERIAL_ECHOLNPGM(MSG_POWERUP);

+ 39
- 0
Marlin/src/feature/tmc_util.cpp 查看文件

582
 
582
 
583
 #endif // SENSORLESS_HOMING
583
 #endif // SENSORLESS_HOMING
584
 
584
 
585
+#if ENABLED(HAVE_TMC2130)
586
+  #define SET_CS_PIN(st) OUT_WRITE(st##_CS_PIN, HIGH)
587
+  void tmc_init_cs_pins() {
588
+    #if ENABLED(X_IS_TMC2130)
589
+      SET_CS_PIN(X);
590
+    #endif
591
+    #if ENABLED(Y_IS_TMC2130)
592
+      SET_CS_PIN(Y);
593
+    #endif
594
+    #if ENABLED(Z_IS_TMC2130)
595
+      SET_CS_PIN(Z);
596
+    #endif
597
+    #if ENABLED(X2_IS_TMC2130)
598
+      SET_CS_PIN(X2);
599
+    #endif
600
+    #if ENABLED(Y2_IS_TMC2130)
601
+      SET_CS_PIN(Y2);
602
+    #endif
603
+    #if ENABLED(Z2_IS_TMC2130)
604
+      SET_CS_PIN(Z2);
605
+    #endif
606
+    #if ENABLED(E0_IS_TMC2130)
607
+      SET_CS_PIN(E0);
608
+    #endif
609
+    #if ENABLED(E1_IS_TMC2130)
610
+      SET_CS_PIN(E1);
611
+    #endif
612
+    #if ENABLED(E2_IS_TMC2130)
613
+      SET_CS_PIN(E2);
614
+    #endif
615
+    #if ENABLED(E3_IS_TMC2130)
616
+      SET_CS_PIN(E3);
617
+    #endif
618
+    #if ENABLED(E4_IS_TMC2130)
619
+      SET_CS_PIN(E4);
620
+    #endif
621
+  }
622
+#endif // HAVE_TMC2130
623
+
585
 #endif // HAS_TRINAMIC
624
 #endif // HAS_TRINAMIC

+ 4
- 0
Marlin/src/feature/tmc_util.h 查看文件

100
   void tmc_sensorless_homing(TMC2130Stepper &st, bool enable=true);
100
   void tmc_sensorless_homing(TMC2130Stepper &st, bool enable=true);
101
 #endif
101
 #endif
102
 
102
 
103
+#if ENABLED(HAVE_TMC2130)
104
+  void tmc_init_cs_pins();
105
+#endif
106
+
103
 #endif // _TMC_UTIL_H_
107
 #endif // _TMC_UTIL_H_

正在加载...
取消
保存