소스 검색

Fix stepper use before init. Add Ultimaker2+ Extended clone config (#13284)

Vasily Evseenko 6 년 전
부모
커밋
71773b128d

+ 2103
- 0
Marlin/src/config/examples/AliExpress/UM2pExt/Configuration.h
파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
파일 보기


+ 2263
- 0
Marlin/src/config/examples/AliExpress/UM2pExt/Configuration_adv.h
파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
파일 보기


+ 1
- 1
Marlin/src/module/configuration_store.cpp 파일 보기

@@ -2265,7 +2265,7 @@ void MarlinSettings::reset() {
2265 2265
   //
2266 2266
 
2267 2267
   #if HAS_MOTOR_CURRENT_PWM
2268
-    uint32_t tmp_motor_current_setting[3] = PWM_MOTOR_CURRENT;
2268
+    constexpr uint32_t tmp_motor_current_setting[3] = PWM_MOTOR_CURRENT;
2269 2269
     for (uint8_t q = 3; q--;)
2270 2270
       stepper.digipot_current(q, (stepper.motor_current_setting[q] = tmp_motor_current_setting[q]));
2271 2271
   #endif

+ 10
- 0
Marlin/src/module/stepper.cpp 파일 보기

@@ -81,6 +81,10 @@
81 81
 
82 82
 Stepper stepper; // Singleton
83 83
 
84
+#if HAS_MOTOR_CURRENT_PWM
85
+  bool Stepper::initialized; // = false
86
+#endif
87
+
84 88
 #ifdef __AVR__
85 89
   #include "speed_lookuptable.h"
86 90
 #endif
@@ -2161,6 +2165,9 @@ void Stepper::init() {
2161 2165
     | (INVERT_Z_DIR ? _BV(Z_AXIS) : 0);
2162 2166
 
2163 2167
   set_directions();
2168
+  #if HAS_MOTOR_CURRENT_PWM
2169
+    initialized = true;
2170
+  #endif
2164 2171
 }
2165 2172
 
2166 2173
 /**
@@ -2466,6 +2473,7 @@ void Stepper::report_positions() {
2466 2473
 #if HAS_MOTOR_CURRENT_PWM
2467 2474
 
2468 2475
   void Stepper::refresh_motor_power() {
2476
+    if (!initialized) return;
2469 2477
     LOOP_L_N(i, COUNT(motor_current_setting)) {
2470 2478
       switch (i) {
2471 2479
         #if PIN_EXISTS(MOTOR_CURRENT_PWM_XY) || PIN_EXISTS(MOTOR_CURRENT_PWM_X) || PIN_EXISTS(MOTOR_CURRENT_PWM_Y)
@@ -2498,6 +2506,8 @@ void Stepper::report_positions() {
2498 2506
 
2499 2507
       #elif HAS_MOTOR_CURRENT_PWM
2500 2508
 
2509
+        if (!initialized) return;
2510
+
2501 2511
         if (WITHIN(driver, 0, COUNT(motor_current_setting) - 1))
2502 2512
           motor_current_setting[driver] = current; // update motor_current_setting
2503 2513
 

+ 1
- 0
Marlin/src/module/stepper.h 파일 보기

@@ -239,6 +239,7 @@ class Stepper {
239 239
         #define PWM_MOTOR_CURRENT DEFAULT_PWM_MOTOR_CURRENT
240 240
       #endif
241 241
       static uint32_t motor_current_setting[3];
242
+      static bool initialized;
242 243
     #endif
243 244
 
244 245
   private:

+ 2
- 0
Marlin/src/pins/pins_ULTIMAIN_2.h 파일 보기

@@ -97,6 +97,8 @@
97 97
   #define FAN_PIN           7
98 98
 #endif
99 99
 
100
+#define ORIG_E0_AUTO_FAN_PIN 77
101
+
100 102
 //
101 103
 // Misc. Functions
102 104
 //

Loading…
취소
저장