Browse Source

🎨 MKS hardware test followup (#22395)

Co-authored-by: Scott Lahteine <thinkyhead@users.noreply.github.com>
Malderin 3 years ago
parent
commit
a90968b0ce
No account linked to committer's email address

+ 72
- 68
Marlin/src/lcd/extui/mks_ui/mks_hardware.cpp View File

@@ -127,77 +127,81 @@
127 127
     delay(100);
128 128
   }
129 129
 
130
-  void mks_gpio_test() {
131
-    init_test_gpio();
132
-
133
-    test_gpio_readlevel_L();
134
-    test_gpio_readlevel_H();
135
-    test_gpio_readlevel_L();
136
-    if (pw_det_sta && pw_off_sta && mt_det_sta
137
-      #if PIN_EXISTS(MT_DET_2)
138
-        && mt_det2_sta
139
-      #endif
140
-      #if ENABLED(MKS_HARDWARE_TEST_ONLY_E0)
141
-        && (READ(PA1) == LOW)
142
-        && (READ(PA3) == LOW)
143
-        && (READ(PC2) == LOW)
144
-        && (READ(PD8) == LOW)
145
-        && (READ(PE5) == LOW)
146
-        && (READ(PE6) == LOW)
147
-        && (READ(PE7) == LOW)
148
-      #endif
149
-    )
150
-      disp_det_ok();
151
-    else
152
-      disp_det_error();
153
-
154
-    if (endstopx1_sta && endstopy1_sta && endstopz1_sta && endstopz2_sta)
155
-      disp_Limit_ok();
156
-    else
157
-      disp_Limit_error();
158
-  }
159
-
160
-  void mks_hardware_test() {
161
-    if (millis() % 2000 < 1000) {
162
-      WRITE(X_DIR_PIN, LOW);
163
-      WRITE(Y_DIR_PIN, LOW);
164
-      WRITE(Z_DIR_PIN, LOW);
165
-      WRITE(E0_DIR_PIN, LOW);
166
-      #if DISABLED(MKS_HARDWARE_TEST_ONLY_E0)
167
-        WRITE(E1_DIR_PIN, LOW);
168
-      #endif
169
-      thermalManager.fan_speed[0] = 255;
170
-      #if DISABLED(MKS_HARDWARE_TEST_ONLY_E0)
171
-        WRITE(HEATER_1_PIN, HIGH); // HE1
172
-      #endif
173
-      WRITE(HEATER_0_PIN, HIGH); // HE0
174
-      WRITE(HEATER_BED_PIN, HIGH); // HOT-BED
175
-    }
176
-    else {
177
-      WRITE(X_DIR_PIN, HIGH);
178
-      WRITE(Y_DIR_PIN, HIGH);
179
-      WRITE(Z_DIR_PIN, HIGH);
180
-      WRITE(E0_DIR_PIN, HIGH);
181
-      #if DISABLED(MKS_HARDWARE_TEST_ONLY_E0)
182
-        WRITE(E1_DIR_PIN, HIGH);
183
-      #endif
184
-      thermalManager.fan_speed[0] = 0;
185
-      #if DISABLED(MKS_HARDWARE_TEST_ONLY_E0)
186
-        WRITE(HEATER_1_PIN, LOW); // HE1
187
-      #endif
188
-      WRITE(HEATER_0_PIN, LOW); // HE0
189
-      WRITE(HEATER_BED_PIN, LOW); // HOT-BED
130
+  #if ENABLED(SDSUPPORT)
131
+
132
+    void mks_gpio_test() {
133
+      init_test_gpio();
134
+
135
+      test_gpio_readlevel_L();
136
+      test_gpio_readlevel_H();
137
+      test_gpio_readlevel_L();
138
+      if (pw_det_sta && pw_off_sta && mt_det_sta
139
+        #if PIN_EXISTS(MT_DET_2)
140
+          && mt_det2_sta
141
+        #endif
142
+        #if ENABLED(MKS_HARDWARE_TEST_ONLY_E0)
143
+          && (READ(PA1) == LOW)
144
+          && (READ(PA3) == LOW)
145
+          && (READ(PC2) == LOW)
146
+          && (READ(PD8) == LOW)
147
+          && (READ(PE5) == LOW)
148
+          && (READ(PE6) == LOW)
149
+          && (READ(PE7) == LOW)
150
+        #endif
151
+      )
152
+        disp_det_ok();
153
+      else
154
+        disp_det_error();
155
+
156
+      if (endstopx1_sta && endstopy1_sta && endstopz1_sta && endstopz2_sta)
157
+        disp_Limit_ok();
158
+      else
159
+        disp_Limit_error();
190 160
     }
191 161
 
192
-    if (endstopx1_sta && endstopx2_sta && endstopy1_sta && endstopy2_sta && endstopz1_sta && endstopz2_sta) {
193
-      // nothing here
194
-    }
195
-    else {
162
+    void mks_hardware_test() {
163
+      if (millis() % 2000 < 1000) {
164
+        WRITE(X_DIR_PIN, LOW);
165
+        WRITE(Y_DIR_PIN, LOW);
166
+        WRITE(Z_DIR_PIN, LOW);
167
+        WRITE(E0_DIR_PIN, LOW);
168
+        #if DISABLED(MKS_HARDWARE_TEST_ONLY_E0)
169
+          WRITE(E1_DIR_PIN, LOW);
170
+        #endif
171
+        thermalManager.fan_speed[0] = 255;
172
+        #if DISABLED(MKS_HARDWARE_TEST_ONLY_E0)
173
+          WRITE(HEATER_1_PIN, HIGH); // HE1
174
+        #endif
175
+        WRITE(HEATER_0_PIN, HIGH); // HE0
176
+        WRITE(HEATER_BED_PIN, HIGH); // HOT-BED
177
+      }
178
+      else {
179
+        WRITE(X_DIR_PIN, HIGH);
180
+        WRITE(Y_DIR_PIN, HIGH);
181
+        WRITE(Z_DIR_PIN, HIGH);
182
+        WRITE(E0_DIR_PIN, HIGH);
183
+        #if DISABLED(MKS_HARDWARE_TEST_ONLY_E0)
184
+          WRITE(E1_DIR_PIN, HIGH);
185
+        #endif
186
+        thermalManager.fan_speed[0] = 0;
187
+        #if DISABLED(MKS_HARDWARE_TEST_ONLY_E0)
188
+          WRITE(HEATER_1_PIN, LOW); // HE1
189
+        #endif
190
+        WRITE(HEATER_0_PIN, LOW); // HE0
191
+        WRITE(HEATER_BED_PIN, LOW); // HOT-BED
192
+      }
193
+
194
+      if (endstopx1_sta && endstopx2_sta && endstopy1_sta && endstopy2_sta && endstopz1_sta && endstopz2_sta) {
195
+        // nothing here
196
+      }
197
+      else {
198
+      }
199
+
200
+      if (disp_state == PRINT_READY_UI)
201
+        mks_disp_test();
196 202
     }
197 203
 
198
-    if (disp_state == PRINT_READY_UI)
199
-      mks_disp_test();
200
-  }
204
+  #endif
201 205
 
202 206
 #endif // MKS_TEST
203 207
 
@@ -613,7 +617,7 @@ void disp_assets_update_progress(const char *msg) {
613 617
   disp_string(100, 165, buf, 0xFFFF, 0x0000);
614 618
 }
615 619
 
616
-#if ENABLED(SDSUPPORT)
620
+#if BOTH(MKS_TEST, SDSUPPORT)
617 621
   uint8_t mks_test_flag = 0;
618 622
   const char *MKSTestPath = "MKS_TEST";
619 623
   void mks_test_get() {

+ 3
- 6
Marlin/src/lcd/extui/mks_ui/mks_hardware.h View File

@@ -26,17 +26,14 @@
26 26
 #include <lvgl.h>
27 27
 
28 28
 // Functions for MKS_TEST
29
-#if ENABLED(MKS_TEST)
30
-  void mks_gpio_test();
29
+#if BOTH(MKS_TEST, SDSUPPORT)
31 30
   void mks_hardware_test();
32 31
   void mks_test_get();
32
+  void mks_gpio_test();
33
+  extern uint8_t mks_test_flag;
33 34
 #endif
34 35
 
35 36
 // String display and assets
36 37
 void disp_string(uint16_t x, uint16_t y, const char * string, uint16_t charColor, uint16_t bkColor);
37 38
 void disp_assets_update();
38 39
 void disp_assets_update_progress(const char *msg);
39
-
40
-#if ENABLED(SDSUPPORT)
41
-  extern uint8_t mks_test_flag;
42
-#endif

+ 1
- 1
Marlin/src/lcd/extui/mks_ui/tft_lvgl_configuration.cpp View File

@@ -139,7 +139,7 @@ void tft_lvgl_init() {
139 139
   #if ENABLED(SDSUPPORT)
140 140
     UpdateAssets();
141 141
     watchdog_refresh();   // LVGL init takes time
142
-    mks_test_get();
142
+    TERN_(MKS_TEST, mks_test_get());
143 143
   #endif
144 144
 
145 145
   touch.Init();

Loading…
Cancel
Save