Browse Source

MKS WiFi for TFT_LVGL_UI (#20191)

MKS-Sean 3 years ago
parent
commit
35c1b330ec
No account linked to committer's email address
36 changed files with 1852 additions and 1108 deletions
  1. 4
    0
      Marlin/Configuration.h
  2. 205
    0
      Marlin/src/lcd/extui/lib/mks_ui/draw_cloud_bind.cpp
  3. 37
    0
      Marlin/src/lcd/extui/lib/mks_ui/draw_cloud_bind.h
  4. 24
    0
      Marlin/src/lcd/extui/lib/mks_ui/draw_dialog.cpp
  5. 2
    2
      Marlin/src/lcd/extui/lib/mks_ui/draw_home.cpp
  6. 2
    2
      Marlin/src/lcd/extui/lib/mks_ui/draw_keyboard.cpp
  7. 209
    0
      Marlin/src/lcd/extui/lib/mks_ui/draw_more.cpp
  8. 33
    0
      Marlin/src/lcd/extui/lib/mks_ui/draw_more.h
  9. 46
    56
      Marlin/src/lcd/extui/lib/mks_ui/draw_move_motor.cpp
  10. 98
    251
      Marlin/src/lcd/extui/lib/mks_ui/draw_ui.cpp
  11. 15
    3
      Marlin/src/lcd/extui/lib/mks_ui/draw_ui.h
  12. 29
    25
      Marlin/src/lcd/extui/lib/mks_ui/draw_wifi.cpp
  13. 4
    14
      Marlin/src/lcd/extui/lib/mks_ui/irq_overrid.cpp
  14. 34
    26
      Marlin/src/lcd/extui/lib/mks_ui/pic_manager.cpp
  15. 1
    1
      Marlin/src/lcd/extui/lib/mks_ui/pic_manager.h
  16. 5
    4
      Marlin/src/lcd/extui/lib/mks_ui/printer_operation.cpp
  17. 9
    0
      Marlin/src/lcd/extui/lib/mks_ui/tft_Language_en.h
  18. 8
    0
      Marlin/src/lcd/extui/lib/mks_ui/tft_Language_fr.h
  19. 8
    0
      Marlin/src/lcd/extui/lib/mks_ui/tft_Language_it.h
  20. 143
    34
      Marlin/src/lcd/extui/lib/mks_ui/tft_Language_ru.h
  21. 9
    0
      Marlin/src/lcd/extui/lib/mks_ui/tft_Language_s_cn.h
  22. 10
    0
      Marlin/src/lcd/extui/lib/mks_ui/tft_Language_sp.h
  23. 9
    0
      Marlin/src/lcd/extui/lib/mks_ui/tft_Language_t_cn.h
  24. 36
    26
      Marlin/src/lcd/extui/lib/mks_ui/tft_lvgl_configuration.cpp
  25. 5
    1
      Marlin/src/lcd/extui/lib/mks_ui/tft_lvgl_configuration.h
  26. 286
    12
      Marlin/src/lcd/extui/lib/mks_ui/tft_multi_language.cpp
  27. 19
    11
      Marlin/src/lcd/extui/lib/mks_ui/tft_multi_language.h
  28. 20
    1
      Marlin/src/lcd/extui/lib/mks_ui/wifiSerial.cpp
  29. 2
    1
      Marlin/src/lcd/extui/lib/mks_ui/wifiSerial.h
  30. 316
    293
      Marlin/src/lcd/extui/lib/mks_ui/wifi_module.cpp
  31. 3
    8
      Marlin/src/lcd/extui/lib/mks_ui/wifi_module.h
  32. 158
    278
      Marlin/src/lcd/extui/lib/mks_ui/wifi_upload.cpp
  33. 4
    3
      Marlin/src/lcd/extui/lib/mks_ui/wifi_upload.h
  34. 56
    54
      Marlin/src/libs/W25Qxx.cpp
  35. 2
    2
      Marlin/src/sd/SdBaseFile.cpp
  36. 1
    0
      platformio.ini

+ 4
- 0
Marlin/Configuration.h View File

2395
 //#define TFT_COLOR_UI
2395
 //#define TFT_COLOR_UI
2396
 //#define TFT_LVGL_UI
2396
 //#define TFT_LVGL_UI
2397
 
2397
 
2398
+#if ENABLED(TFT_LVGL_UI)
2399
+  //#define MKS_WIFI_MODULE  // MKS WiFi module
2400
+#endif
2401
+
2398
 /**
2402
 /**
2399
  * TFT Rotation. Set to one of the following values:
2403
  * TFT Rotation. Set to one of the following values:
2400
  *
2404
  *

+ 205
- 0
Marlin/src/lcd/extui/lib/mks_ui/draw_cloud_bind.cpp View File

1
+/**
2
+ * Marlin 3D Printer Firmware
3
+ * Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
4
+ *
5
+ * Based on Sprinter and grbl.
6
+ * Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
7
+ *
8
+ * This program is free software: you can redistribute it and/or modify
9
+ * it under the terms of the GNU General Public License as published by
10
+ * the Free Software Foundation, either version 3 of the License, or
11
+ * (at your option) any later version.
12
+ *
13
+ * This program is distributed in the hope that it will be useful,
14
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
+ * GNU General Public License for more details.
17
+ *
18
+ * You should have received a copy of the GNU General Public License
19
+ * along with this program.  If not, see <https://www.gnu.org/licenses/>.
20
+ *
21
+ */
22
+#include "../../../../inc/MarlinConfigPre.h"
23
+
24
+#if BOTH(HAS_TFT_LVGL_UI, MKS_WIFI_MODULE)
25
+
26
+#include "lv_conf.h"
27
+#include "draw_ui.h"
28
+
29
+#include "../../../../MarlinCore.h"
30
+#include "../../../../module/temperature.h"
31
+
32
+#include "QR_Encode.h"
33
+
34
+extern lv_group_t * g;
35
+static lv_obj_t * scr;
36
+static lv_obj_t *button_bind_or_not = NULL, *label_bind_or_not = NULL;
37
+static lv_obj_t *buttonReleaseBind = NULL, *label_ReleaseBind = NULL;
38
+static lv_obj_t * text_id;
39
+
40
+static uint8_t unbinding_flag = 0;
41
+static uint8_t id_mark        = 0;
42
+
43
+#define ID_CLOUD_BIND_RETURN  1
44
+#define ID_CLOUD_BIND_OR_NOT  2
45
+#define ID_CLOUD_RELEASE_BIND 3
46
+
47
+static void event_handler(lv_obj_t * obj, lv_event_t event) {
48
+  if (event != LV_EVENT_RELEASED) return;
49
+  switch (obj->mks_obj_id) {
50
+    case ID_CLOUD_BIND_RETURN:
51
+      clear_cur_ui();
52
+      draw_return_ui();
53
+      break;
54
+    case ID_CLOUD_RELEASE_BIND:
55
+      if (cloud_para.state == 0x12) {
56
+        clear_cur_ui();
57
+        lv_draw_dialog(DIALOG_TYPE_UNBIND);
58
+      }
59
+      break;
60
+  }
61
+}
62
+
63
+void lv_draw_cloud_bind(void) {
64
+  lv_obj_t *buttonBack = NULL, *label_Back = NULL;
65
+  scr = lv_screen_create(BIND_UI);
66
+
67
+  button_bind_or_not = lv_btn_create(scr, NULL);
68
+  lv_obj_set_pos(button_bind_or_not, TFT_WIDTH - 130, TFT_HEIGHT - 80 * 3);
69
+  lv_obj_set_size(button_bind_or_not, PARA_UI_VALUE_BTN_X_SIZE + 15, PARA_UI_VALUE_BTN_Y_SIZE + 15);
70
+  lv_obj_set_event_cb_mks(button_bind_or_not, event_handler, ID_CLOUD_BIND_OR_NOT, NULL, 0);
71
+  lv_btn_set_style(button_bind_or_not, LV_BTN_STYLE_REL, &style_para_value);
72
+  lv_btn_set_style(button_bind_or_not, LV_BTN_STYLE_PR, &style_para_value);
73
+  label_bind_or_not = lv_label_create_empty(button_bind_or_not);
74
+
75
+  buttonReleaseBind = lv_btn_create(scr, NULL);
76
+  lv_obj_set_pos(buttonReleaseBind, TFT_WIDTH - 130, TFT_HEIGHT - 80 * 2);
77
+  lv_obj_set_size(buttonReleaseBind, PARA_UI_VALUE_BTN_X_SIZE + 15, PARA_UI_VALUE_BTN_Y_SIZE + 15);
78
+  lv_obj_set_event_cb_mks(buttonReleaseBind, event_handler, ID_CLOUD_RELEASE_BIND, NULL, 0);
79
+  label_ReleaseBind = lv_label_create_empty(buttonReleaseBind);
80
+  lv_label_set_text(label_ReleaseBind, cloud_menu.unbind);
81
+  lv_obj_align(label_ReleaseBind, buttonReleaseBind, LV_ALIGN_CENTER, 0, 0);
82
+
83
+  buttonBack = lv_btn_create(scr, NULL);
84
+  lv_obj_set_pos(buttonBack, TFT_WIDTH - 130, TFT_HEIGHT - 80);
85
+  lv_obj_set_size(buttonBack, PARA_UI_VALUE_BTN_X_SIZE + 15, PARA_UI_VALUE_BTN_Y_SIZE + 15);
86
+  lv_obj_set_event_cb_mks(buttonBack, event_handler, ID_CLOUD_BIND_RETURN, NULL, 0);
87
+  lv_btn_set_style(buttonBack, LV_BTN_STYLE_REL, &style_para_back);
88
+  lv_btn_set_style(buttonBack, LV_BTN_STYLE_PR, &style_para_back);
89
+  label_Back = lv_label_create_empty(buttonBack);
90
+  lv_label_set_text(label_Back, common_menu.text_back);
91
+  lv_obj_align(label_Back, buttonBack, LV_ALIGN_CENTER, 0, 0);
92
+
93
+  #if BUTTONS_EXIST(EN1, EN2, ENC)
94
+    if (gCfgItems.encoder_enable) {
95
+      lv_group_add_obj(g, buttonReleaseBind);
96
+      lv_group_add_obj(g, buttonBack);
97
+    }
98
+  #endif
99
+
100
+  text_id = lv_label_create_empty(scr);
101
+  lv_obj_set_pos(text_id, 50, 60 + 200 + 20);
102
+  lv_obj_set_style(text_id, &tft_style_label_rel);
103
+  lv_label_set_text(text_id, (char *)cloud_para.id);
104
+
105
+  id_mark = 0;
106
+
107
+  disp_bind_state();
108
+}
109
+
110
+void disp_bind_state() {
111
+  if (cloud_para.state != 0x12)
112
+    unbinding_flag = 0;
113
+
114
+  if (unbinding_flag) {
115
+    lv_label_set_text(label_bind_or_not, cloud_menu.unbinding);
116
+    lv_obj_align(label_bind_or_not, button_bind_or_not, LV_ALIGN_CENTER, 0, 0);
117
+    lv_btn_set_style(buttonReleaseBind, LV_BTN_STYLE_REL, &style_para_value);
118
+    lv_btn_set_style(buttonReleaseBind, LV_BTN_STYLE_PR, &style_para_value);
119
+  }
120
+  else {
121
+    if (cloud_para.state == 0x10) {
122
+      lv_label_set_text(label_bind_or_not, cloud_menu.disconnected);
123
+      lv_obj_align(label_bind_or_not, button_bind_or_not, LV_ALIGN_CENTER, 0, 0);
124
+    }
125
+    else if (cloud_para.state == 0x11) {
126
+      lv_label_set_text(label_bind_or_not, cloud_menu.unbinded);
127
+      lv_obj_align(label_bind_or_not, button_bind_or_not, LV_ALIGN_CENTER, 0, 0);
128
+    }
129
+    else if (cloud_para.state == 0x12) {
130
+      lv_label_set_text(label_bind_or_not, cloud_menu.binded);
131
+      lv_obj_align(label_bind_or_not, button_bind_or_not, LV_ALIGN_CENTER, 0, 0);
132
+    }
133
+    else {
134
+      lv_label_set_text(label_bind_or_not, cloud_menu.disable);
135
+      lv_obj_align(label_bind_or_not, button_bind_or_not, LV_ALIGN_CENTER, 0, 0);
136
+    }
137
+  }
138
+
139
+  if (cloud_para.state == 0x12 && !unbinding_flag) {
140
+    lv_btn_set_style(buttonReleaseBind, LV_BTN_STYLE_REL, &style_para_back);
141
+    lv_btn_set_style(buttonReleaseBind, LV_BTN_STYLE_PR, &style_para_back);
142
+  }
143
+  else {
144
+    lv_btn_set_style(buttonReleaseBind, LV_BTN_STYLE_REL, &style_para_value);
145
+    lv_btn_set_style(buttonReleaseBind, LV_BTN_STYLE_PR, &style_para_value);
146
+  }
147
+}
148
+
149
+static char last_cloud_state = 0;
150
+void refresh_bind_ui() {
151
+  if ((last_cloud_state != cloud_para.state) || unbinding_flag) {
152
+    disp_bind_state();
153
+    last_cloud_state = cloud_para.state;
154
+  }
155
+  if (cloud_para.id[0]) {
156
+    if (!id_mark) {
157
+      display_qrcode((uint8_t *)cloud_para.id);
158
+      lv_label_set_text(text_id, (char *)cloud_para.id);
159
+    }
160
+  }
161
+  else
162
+    id_mark = 0;
163
+}
164
+
165
+void display_qrcode(uint8_t *qrcode_data) {
166
+  uint8_t i, j;
167
+  uint16_t x, y, p;
168
+
169
+  if (!id_mark) {
170
+    EncodeData((char *)qrcode_data);
171
+    id_mark = 1;
172
+  }
173
+
174
+  lv_fill_rect(10, QRCODE_Y, 300, QRCODE_Y + 300, LV_COLOR_WHITE);
175
+
176
+  if (m_nSymbleSize * 2 > QRCODE_WIDTH) return;
177
+
178
+  for (i = 0; i < 40; i++)
179
+    if ((m_nSymbleSize * i * 2) > QRCODE_WIDTH) break;
180
+
181
+  p = (i - 1) * 2;
182
+
183
+  x = QRCODE_X + 70;
184
+  y = QRCODE_Y + 70;
185
+
186
+  for (i = 0; i < m_nSymbleSize; i++)
187
+    for (j = 0; j < m_nSymbleSize; j++)
188
+      if (m_byModuleData[i][j] == 1)
189
+        lv_fill_rect(x + p * i, y + p * j, x + p * (i + 1) - 1, y + p * (j + 1) - 1, LV_COLOR_BACKGROUND);
190
+}
191
+
192
+void cloud_unbind() {
193
+  package_to_wifi(WIFI_CLOUD_UNBIND, (uint8_t *)0, 0);
194
+  unbinding_flag = 1;
195
+}
196
+
197
+void lv_clear_cloud_bind() {
198
+  #if BUTTONS_EXIST(EN1, EN2, ENC)
199
+    if (gCfgItems.encoder_enable)
200
+      lv_group_remove_all_objs(g);
201
+  #endif
202
+  lv_obj_del(scr);
203
+}
204
+
205
+#endif // HAS_TFT_LVGL_UI

+ 37
- 0
Marlin/src/lcd/extui/lib/mks_ui/draw_cloud_bind.h View File

1
+/**
2
+ * Marlin 3D Printer Firmware
3
+ * Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
4
+ *
5
+ * Based on Sprinter and grbl.
6
+ * Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
7
+ *
8
+ * This program is free software: you can redistribute it and/or modify
9
+ * it under the terms of the GNU General Public License as published by
10
+ * the Free Software Foundation, either version 3 of the License, or
11
+ * (at your option) any later version.
12
+ *
13
+ * This program is distributed in the hope that it will be useful,
14
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
+ * GNU General Public License for more details.
17
+ *
18
+ * You should have received a copy of the GNU General Public License
19
+ * along with this program.  If not, see <https://www.gnu.org/licenses/>.
20
+ *
21
+ */
22
+#pragma once
23
+
24
+#ifdef __cplusplus
25
+extern "C" { /* C-declarations for C++ */
26
+#endif
27
+
28
+extern void lv_draw_cloud_bind(void);
29
+extern void lv_clear_cloud_bind();
30
+extern void disp_bind_state();
31
+extern void refresh_bind_ui();
32
+extern void display_qrcode(uint8_t *qrcode_data);
33
+extern void cloud_unbind();
34
+
35
+#ifdef __cplusplus
36
+} /* C-declarations for C++ */
37
+#endif

+ 24
- 0
Marlin/src/lcd/extui/lib/mks_ui/draw_dialog.cpp View File

172
     clear_cur_ui();
172
     clear_cur_ui();
173
     draw_return_ui();
173
     draw_return_ui();
174
   }
174
   }
175
+  #if ENABLED(MKS_WIFI_MODULE)
176
+    else if (DIALOG_IS(TYPE_UNBIND)) {
177
+      cloud_unbind();
178
+      clear_cur_ui();
179
+      draw_return_ui();
180
+    }
181
+  #endif
182
+  else {
183
+    clear_cur_ui();
184
+    draw_return_ui();
185
+  }
175
 }
186
 }
176
 
187
 
177
 static void btn_cancel_event_cb(lv_obj_t *btn, lv_event_t event) {
188
 static void btn_cancel_event_cb(lv_obj_t *btn, lv_event_t event) {
246
         lv_label_set_text(labelOk, print_file_dialog_menu.confirm);
257
         lv_label_set_text(labelOk, print_file_dialog_menu.confirm);
247
       }
258
       }
248
     }
259
     }
260
+    else if (DIALOG_IS(TYPE_UPDATE_ESP_FIRMARE)) {
261
+      // nothing to do
262
+    }
249
   #endif
263
   #endif
250
   else if (DIALOG_IS(TYPE_FILAMENT_LOAD_HEAT, TYPE_FILAMENT_UNLOAD_HEAT)) {
264
   else if (DIALOG_IS(TYPE_FILAMENT_LOAD_HEAT, TYPE_FILAMENT_UNLOAD_HEAT)) {
251
     btnCancel = lv_button_btn_create(scr, BTN_OK_X+90, BTN_OK_Y, 100, 50, btn_cancel_event_cb);
265
     btnCancel = lv_button_btn_create(scr, BTN_OK_X+90, BTN_OK_Y, 100, 50, btn_cancel_event_cb);
412
         lv_obj_align(labelDialog, nullptr, LV_ALIGN_CENTER, 0, -20);
426
         lv_obj_align(labelDialog, nullptr, LV_ALIGN_CENTER, 0, -20);
413
       }
427
       }
414
     }
428
     }
429
+    else if (DIALOG_IS(TYPE_UPDATE_ESP_FIRMARE)) {
430
+      lv_label_set_text(labelDialog, DIALOG_UPDATE_WIFI_FIRMWARE_EN);
431
+      lv_obj_align(labelDialog, NULL, LV_ALIGN_CENTER, 0, -20);
432
+    }
415
   #endif // MKS_WIFI_MODULE
433
   #endif // MKS_WIFI_MODULE
416
   else if (DIALOG_IS(TYPE_FILAMENT_LOAD_HEAT)) {
434
   else if (DIALOG_IS(TYPE_FILAMENT_LOAD_HEAT)) {
417
     lv_label_set_text(labelDialog, filament_menu.filament_dialog_load_heat);
435
     lv_label_set_text(labelDialog, filament_menu.filament_dialog_load_heat);
445
     lv_label_set_text(labelDialog, filament_menu.filament_dialog_unloading);
463
     lv_label_set_text(labelDialog, filament_menu.filament_dialog_unloading);
446
     lv_obj_align(labelDialog, nullptr, LV_ALIGN_CENTER, 0, -70);
464
     lv_obj_align(labelDialog, nullptr, LV_ALIGN_CENTER, 0, -70);
447
   }
465
   }
466
+  #if ENABLED(MKS_WIFI_MODULE)
467
+    else if (DIALOG_IS(TYPE_UNBIND)) {
468
+      lv_label_set_text(labelDialog, common_menu.unbind_printer_tips);
469
+      lv_obj_align(labelDialog, NULL, LV_ALIGN_CENTER, 0, -70);
470
+    }
471
+  #endif
448
   #if HAS_ROTARY_ENCODER
472
   #if HAS_ROTARY_ENCODER
449
     if (gCfgItems.encoder_enable) {
473
     if (gCfgItems.encoder_enable) {
450
       if (btnOk) lv_group_add_obj(g, btnOk);
474
       if (btnOk) lv_group_add_obj(g, btnOk);

+ 2
- 2
Marlin/src/lcd/extui/lib/mks_ui/draw_home.cpp View File

66
       queue.inject_P(PSTR("M84 X Y"));
66
       queue.inject_P(PSTR("M84 X Y"));
67
       break;
67
       break;
68
     case ID_H_RETURN:
68
     case ID_H_RETURN:
69
-      lv_clear_home();
70
-      lv_draw_tool();
69
+      clear_cur_ui();
70
+      draw_return_ui();
71
       break;
71
       break;
72
   }
72
   }
73
 }
73
 }

+ 2
- 2
Marlin/src/lcd/extui/lib/mks_ui/draw_keyboard.cpp View File

55
     1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
55
     1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
56
     LV_KB_CTRL_BTN_FLAGS | 2, 2, 6, 2, LV_KB_CTRL_BTN_FLAGS | 2};
56
     LV_KB_CTRL_BTN_FLAGS | 2, 2, 6, 2, LV_KB_CTRL_BTN_FLAGS | 2};
57
 
57
 
58
-static const char * kb_map_spec[] = {"0", "1", "2", "3", "4" ,"5", "6", "7", "8", "9", LV_SYMBOL_BACKSPACE, "\n",
58
+static const char * kb_map_spec[] = {"0", "1", "2", "3", "4" ,"5", "6", "7", "8", "9", ".", LV_SYMBOL_BACKSPACE, "\n",
59
                                      "abc", "+", "-", "/", "*", "=", "%", "!", "?", "#", "<", ">", "\n",
59
                                      "abc", "+", "-", "/", "*", "=", "%", "!", "?", "#", "<", ">", "\n",
60
                                      "\\",  "@", "$", "(", ")", "{", "}", "[", "]", ";", "\"", "'", "\n",
60
                                      "\\",  "@", "$", "(", ")", "{", "}", "[", "]", ";", "\"", "'", "\n",
61
                                      LV_SYMBOL_CLOSE, LV_SYMBOL_LEFT, " ", LV_SYMBOL_RIGHT, LV_SYMBOL_OK, ""};
61
                                      LV_SYMBOL_CLOSE, LV_SYMBOL_LEFT, " ", LV_SYMBOL_RIGHT, LV_SYMBOL_OK, ""};
62
 
62
 
63
 static const lv_btnm_ctrl_t kb_ctrl_spec_map[] = {
63
 static const lv_btnm_ctrl_t kb_ctrl_spec_map[] = {
64
-    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, LV_KB_CTRL_BTN_FLAGS | 2,
64
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, LV_KB_CTRL_BTN_FLAGS | 2,
65
     LV_KB_CTRL_BTN_FLAGS | 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
65
     LV_KB_CTRL_BTN_FLAGS | 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
66
     1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
66
     1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
67
     LV_KB_CTRL_BTN_FLAGS | 2, 2, 6, 2, LV_KB_CTRL_BTN_FLAGS | 2};
67
     LV_KB_CTRL_BTN_FLAGS | 2, 2, 6, 2, LV_KB_CTRL_BTN_FLAGS | 2};

+ 209
- 0
Marlin/src/lcd/extui/lib/mks_ui/draw_more.cpp View File

1
+/**
2
+ * Marlin 3D Printer Firmware
3
+ * Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
4
+ *
5
+ * Based on Sprinter and grbl.
6
+ * Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
7
+ *
8
+ * This program is free software: you can redistribute it and/or modify
9
+ * it under the terms of the GNU General Public License as published by
10
+ * the Free Software Foundation, either version 3 of the License, or
11
+ * (at your option) any later version.
12
+ *
13
+ * This program is distributed in the hope that it will be useful,
14
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
+ * GNU General Public License for more details.
17
+ *
18
+ * You should have received a copy of the GNU General Public License
19
+ * along with this program.  If not, see <https://www.gnu.org/licenses/>.
20
+ *
21
+ */
22
+#include "../../../../inc/MarlinConfigPre.h"
23
+
24
+#if HAS_TFT_LVGL_UI
25
+
26
+#include "../../../../MarlinCore.h"
27
+#include "draw_ready_print.h"
28
+#include "draw_set.h"
29
+#include "lv_conf.h"
30
+#include "draw_ui.h"
31
+#include "../../../../gcode/queue.h"
32
+
33
+extern lv_group_t * g;
34
+static lv_obj_t * scr;
35
+
36
+#define ID_CUSTOM_1   1
37
+#define ID_CUSTOM_2   2
38
+#define ID_CUSTOM_3   3
39
+#define ID_CUSTOM_4   4
40
+#define ID_CUSTOM_5   5
41
+#define ID_CUSTOM_6   6
42
+#define ID_CUSTOM_7   7
43
+#define ID_M_RETURN   8
44
+
45
+static void event_handler(lv_obj_t * obj, lv_event_t event) {
46
+  if (event != LV_EVENT_RELEASED) return;
47
+  switch (obj->mks_obj_id) {
48
+    #if ENABLED(USER_CMD_1_ENABLE)
49
+      case ID_CUSTOM_1:
50
+        queue.inject_P(PSTR(USER_GCODE_1));
51
+        break;
52
+    #endif
53
+    #if ENABLED(USER_CMD_2_ENABLE)
54
+      case ID_CUSTOM_2:
55
+        queue.inject_P(PSTR(USER_GCODE_2));
56
+        break;
57
+    #endif
58
+    #if ENABLED(USER_CMD_3_ENABLE)
59
+      case ID_CUSTOM_3:
60
+        queue.inject_P(PSTR(USER_GCODE_3));
61
+        break;
62
+    #endif
63
+    #if ENABLED(USER_CMD_4_ENABLE)
64
+      case ID_CUSTOM_4:
65
+        queue.inject_P(PSTR(USER_GCODE_4));
66
+        break;
67
+    #endif
68
+    #if ENABLED(USER_CMD_5_ENABLE)
69
+      case ID_CUSTOM_5:
70
+        queue.inject_P(PSTR(USER_GCODE_5));
71
+        break;
72
+    #endif
73
+    #if ENABLED(USER_CMD_6_ENABLE)
74
+      case ID_CUSTOM_6:
75
+        queue.inject_P(PSTR(USER_GCODE_6));
76
+        break;
77
+    #endif
78
+    #if ENABLED(USER_CMD_7_ENABLE)
79
+      case ID_CUSTOM_7:
80
+        queue.inject_P(PSTR(USER_GCODE_7));
81
+        break;
82
+    #endif
83
+    case ID_M_RETURN:
84
+      lv_clear_more();
85
+      lv_draw_tool();
86
+      break;
87
+  }
88
+}
89
+
90
+void lv_draw_more(void) {
91
+  scr = lv_screen_create(MORE_UI);
92
+
93
+  const bool enc_ena = TERN0(HAS_ROTARY_ENCODER, gCfgItems.encoder_enable);
94
+
95
+  #if ENABLED(USER_CMD_1_ENABLE)
96
+    lv_obj_t *buttonCustom1 = lv_imgbtn_create(scr, "F:/bmp_custom1.bin", INTERVAL_V, titleHeight, event_handler, ID_CUSTOM_1);
97
+    if (enc_ena) lv_group_add_obj(g, buttonCustom1);
98
+    lv_obj_t *labelCustom1 = lv_label_create_empty(buttonCustom1);
99
+  #endif
100
+
101
+  #if ENABLED(USER_CMD_2_ENABLE)
102
+    lv_obj_t *buttonCustom2 = lv_imgbtn_create(scr, "F:/bmp_custom2.bin", BTN_X_PIXEL + INTERVAL_V * 2, titleHeight, event_handler, ID_CUSTOM_2);
103
+    if (enc_ena) lv_group_add_obj(g, buttonCustom2);
104
+    lv_obj_t *labelCustom2 = lv_label_create_empty(buttonCustom2);
105
+  #endif
106
+
107
+  #if ENABLED(USER_CMD_3_ENABLE)
108
+    lv_obj_t *buttonCustom3 = lv_imgbtn_create(scr, "F:/bmp_custom3.bin", BTN_X_PIXEL * 2 + INTERVAL_V * 3, titleHeight, event_handler, ID_CUSTOM_3);
109
+    if (enc_ena) lv_group_add_obj(g, buttonCustom3);
110
+    lv_obj_t *labelCustom3 = lv_label_create_empty(buttonCustom3);
111
+  #endif
112
+
113
+  #if ENABLED(USER_CMD_4_ENABLE)
114
+    lv_obj_t *buttonCustom4 = lv_imgbtn_create(scr, "F:/bmp_custom4.bin", BTN_X_PIXEL * 3 + INTERVAL_V * 4, titleHeight, event_handler, ID_CUSTOM_4);
115
+    if (enc_ena) lv_group_add_obj(g, buttonCustom4);
116
+    lv_obj_t *labelCustom4 = lv_label_create_empty(buttonCustom4);
117
+  #endif
118
+
119
+  #if ENABLED(USER_CMD_5_ENABLE)
120
+    lv_obj_t *buttonCustom5 = lv_imgbtn_create(scr, "F:/bmp_custom5.bin", INTERVAL_V, BTN_Y_PIXEL + INTERVAL_H + titleHeight, event_handler, ID_CUSTOM_5);
121
+    if (enc_ena) lv_group_add_obj(g, buttonCustom5);
122
+    lv_obj_t *labelCustom5 = lv_label_create_empty(buttonCustom5);
123
+  #endif
124
+
125
+  #if ENABLED(USER_CMD_6_ENABLE)
126
+    lv_obj_t *buttonCustom6 = lv_imgbtn_create(scr, "F:/bmp_custom6.bin", BTN_X_PIXEL + INTERVAL_V * 2, BTN_Y_PIXEL + INTERVAL_H + titleHeight, event_handler, ID_CUSTOM_6);
127
+    if (enc_ena) lv_group_add_obj(g, buttonCustom6);
128
+    lv_obj_t *labelCustom6 = lv_label_create_empty(buttonCustom6);
129
+  #endif
130
+
131
+  #if ENABLED(USER_CMD_7_ENABLE)
132
+    blv_obj_t *uttonCustom7 = lv_imgbtn_create(scr, "F:/bmp_custom7.bin", BTN_X_PIXEL * 2 + INTERVAL_V * 3, BTN_Y_PIXEL + INTERVAL_H + titleHeight, event_handler, ID_CUSTOM_7);
133
+    if (enc_ena) lv_group_add_obj(g, buttonCustom7);
134
+    lv_obj_t *labelCustom7 = lv_label_create_empty(buttonCustom7);
135
+  #endif
136
+
137
+  lv_obj_t *buttonBack = lv_imgbtn_create(scr, "F:/bmp_return.bin", BTN_X_PIXEL * 3 + INTERVAL_V * 4, BTN_Y_PIXEL + INTERVAL_H + titleHeight, event_handler, ID_M_RETURN);
138
+  if (enc_ena) lv_group_add_obj(g, buttonBack);
139
+  lv_obj_t *label_Back = lv_label_create_empty(buttonBack);
140
+
141
+  if (gCfgItems.multiple_language != 0) {
142
+    #if ENABLED(USER_CMD_1_ENABLE)
143
+      lv_label_set_text(labelCustom1, more_menu.custom1);
144
+      lv_obj_align(labelCustom1, buttonCustom1, LV_ALIGN_IN_BOTTOM_MID, 0, BUTTON_TEXT_Y_OFFSET);
145
+    #endif
146
+    #if ENABLED(USER_CMD_2_ENABLE)
147
+      lv_label_set_text(labelCustom2, more_menu.custom2);
148
+      lv_obj_align(labelCustom2, buttonCustom2, LV_ALIGN_IN_BOTTOM_MID, 0, BUTTON_TEXT_Y_OFFSET);
149
+    #endif
150
+    #if ENABLED(USER_CMD_3_ENABLE)
151
+      lv_label_set_text(labelCustom3, more_menu.custom3);
152
+      lv_obj_align(labelCustom3, buttonCustom3, LV_ALIGN_IN_BOTTOM_MID, 0, BUTTON_TEXT_Y_OFFSET);
153
+    #endif
154
+    #if ENABLED(USER_CMD_4_ENABLE)
155
+      lv_label_set_text(labelCustom4, more_menu.custom4);
156
+      lv_obj_align(labelCustom4, buttonCustom4, LV_ALIGN_IN_BOTTOM_MID, 0, BUTTON_TEXT_Y_OFFSET);
157
+    #endif
158
+    #if ENABLED(USER_CMD_5_ENABLE)
159
+      lv_label_set_text(labelCustom5, more_menu.custom5);
160
+      lv_obj_align(labelCustom5, buttonCustom5, LV_ALIGN_IN_BOTTOM_MID, 0, BUTTON_TEXT_Y_OFFSET);
161
+    #endif
162
+    #if ENABLED(USER_CMD_6_ENABLE)
163
+      lv_label_set_text(labelCustom6, more_menu.custom6);
164
+      lv_obj_align(labelCustom6, buttonCustom6, LV_ALIGN_IN_BOTTOM_MID, 0, BUTTON_TEXT_Y_OFFSET);
165
+    #endif
166
+    #if ENABLED(USER_CMD_7_ENABLE)
167
+      lv_label_set_text(labelCustom7, more_menu.custom7);
168
+      lv_obj_align(labelCustom7, buttonCustom7, LV_ALIGN_IN_BOTTOM_MID, 0, BUTTON_TEXT_Y_OFFSET);
169
+    #endif
170
+    lv_label_set_text(label_Back, common_menu.text_back);
171
+    lv_obj_align(label_Back, buttonBack, LV_ALIGN_IN_BOTTOM_MID, 0, BUTTON_TEXT_Y_OFFSET);
172
+  }
173
+
174
+  #if BUTTONS_EXIST(EN1, EN2, ENC)
175
+    if (enc_ena) {
176
+      #if ENABLED(USER_CMD_1_ENABLE)
177
+        lv_group_add_obj(g, buttonCustom1);
178
+      #endif
179
+      #if ENABLED(USER_CMD_2_ENABLE)
180
+        lv_group_add_obj(g, buttonCustom2);
181
+      #endif
182
+      #if ENABLED(USER_CMD_3_ENABLE)
183
+        lv_group_add_obj(g, buttonCustom3);
184
+      #endif
185
+      #if ENABLED(USER_CMD_4_ENABLE)
186
+        lv_group_add_obj(g, buttonCustom4);
187
+      #endif
188
+      #if ENABLED(USER_CMD_5_ENABLE)
189
+        lv_group_add_obj(g, buttonCustom5);
190
+      #endif
191
+      #if ENABLED(USER_CMD_6_ENABLE)
192
+        lv_group_add_obj(g, buttonCustom6);
193
+      #endif
194
+      #if ENABLED(USER_CMD_7_ENABLE)
195
+        lv_group_add_obj(g, buttonCustom7);
196
+      #endif
197
+      lv_group_add_obj(g, buttonBack);
198
+    }
199
+  #endif
200
+}
201
+
202
+void lv_clear_more() {
203
+  #if BUTTONS_EXIST(EN1, EN2, ENC)
204
+    if (gCfgItems.encoder_enable) lv_group_remove_all_objs(g);
205
+  #endif
206
+  lv_obj_del(scr);
207
+}
208
+
209
+#endif // HAS_TFT_LVGL_UI

+ 33
- 0
Marlin/src/lcd/extui/lib/mks_ui/draw_more.h View File

1
+/**
2
+ * Marlin 3D Printer Firmware
3
+ * Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
4
+ *
5
+ * Based on Sprinter and grbl.
6
+ * Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
7
+ *
8
+ * This program is free software: you can redistribute it and/or modify
9
+ * it under the terms of the GNU General Public License as published by
10
+ * the Free Software Foundation, either version 3 of the License, or
11
+ * (at your option) any later version.
12
+ *
13
+ * This program is distributed in the hope that it will be useful,
14
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
+ * GNU General Public License for more details.
17
+ *
18
+ * You should have received a copy of the GNU General Public License
19
+ * along with this program.  If not, see <https://www.gnu.org/licenses/>.
20
+ *
21
+ */
22
+#pragma once
23
+
24
+#ifdef __cplusplus
25
+extern "C" { /* C-declarations for C++ */
26
+#endif
27
+
28
+extern void lv_draw_more(void);
29
+extern void lv_clear_more();
30
+
31
+#ifdef __cplusplus
32
+} /* C-declarations for C++ */
33
+#endif

+ 46
- 56
Marlin/src/lcd/extui/lib/mks_ui/draw_move_motor.cpp View File

27
 #include <lv_conf.h>
27
 #include <lv_conf.h>
28
 
28
 
29
 #include "../../../../gcode/queue.h"
29
 #include "../../../../gcode/queue.h"
30
+#include "../../../../module/motion.h"
30
 #include "../../../../inc/MarlinConfig.h"
31
 #include "../../../../inc/MarlinConfig.h"
31
 
32
 
32
 extern lv_group_t *g;
33
 extern lv_group_t *g;
33
 static lv_obj_t *scr;
34
 static lv_obj_t *scr;
34
 
35
 
35
-static lv_obj_t *labelV, *buttonV;
36
+static lv_obj_t *labelV, *buttonV, *labelP;
37
+static lv_task_t *updatePosTask;
38
+static char cur_label = 'Z'; 
39
+static float cur_pos = 0;
40
+
41
+void disp_cur_pos();
36
 
42
 
37
 enum {
43
 enum {
38
   ID_M_X_P = 1,
44
   ID_M_X_P = 1,
47
 
53
 
48
 static void event_handler(lv_obj_t *obj, lv_event_t event) {
54
 static void event_handler(lv_obj_t *obj, lv_event_t event) {
49
   if (event != LV_EVENT_RELEASED) return;
55
   if (event != LV_EVENT_RELEASED) return;
56
+  if (queue.length <= (BUFSIZE - 3)) {
57
+    float dist = uiCfg.move_dist;
58
+    switch (obj->mks_obj_id) {
59
+      case ID_M_X_N: dist *= -1; case ID_M_X_P: cur_label = 'X'; break;
60
+      case ID_M_Y_N: dist *= -1; case ID_M_Y_P: cur_label = 'Y'; break;
61
+      case ID_M_Z_N: dist *= -1; case ID_M_Z_P: cur_label = 'Z'; break;
62
+    }
63
+    sprintf_P(public_buf_l, PSTR("G91\nG1 %c%3.1f F%d\nG90"), cur_label, dist, uiCfg.moveSpeed);
64
+    queue.inject(public_buf_l);
65
+  }
66
+
50
   switch (obj->mks_obj_id) {
67
   switch (obj->mks_obj_id) {
51
-    case ID_M_X_P:
52
-      if (queue.length <= (BUFSIZE - 3)) {
53
-        queue.enqueue_one_P(PSTR("G91"));
54
-        sprintf_P(public_buf_l, PSTR("G1 X%3.1f F%d"), uiCfg.move_dist, uiCfg.moveSpeed);
55
-        queue.enqueue_one_now(public_buf_l);
56
-        queue.enqueue_one_P(PSTR("G90"));
57
-      }
58
-      break;
59
-    case ID_M_X_N:
60
-      if (queue.length <= (BUFSIZE - 3)) {
61
-        queue.enqueue_now_P(PSTR("G91"));
62
-        sprintf_P(public_buf_l, PSTR("G1 X-%3.1f F%d"), uiCfg.move_dist, uiCfg.moveSpeed);
63
-        queue.enqueue_one_now(public_buf_l);
64
-        queue.enqueue_now_P(PSTR("G90"));
65
-      }
66
-      break;
67
-    case ID_M_Y_P:
68
-      if (queue.length <= (BUFSIZE - 3)) {
69
-        queue.enqueue_now_P(PSTR("G91"));
70
-        sprintf_P(public_buf_l, PSTR("G1 Y%3.1f F%d"), uiCfg.move_dist, uiCfg.moveSpeed);
71
-        queue.enqueue_one_now(public_buf_l);
72
-        queue.enqueue_now_P(PSTR("G90"));
73
-      }
74
-      break;
75
-    case ID_M_Y_N:
76
-      if (queue.length <= (BUFSIZE - 3)) {
77
-        queue.enqueue_now_P(PSTR("G91"));
78
-        sprintf_P(public_buf_l, PSTR("G1 Y-%3.1f F%d"), uiCfg.move_dist, uiCfg.moveSpeed);
79
-        queue.enqueue_one_now(public_buf_l);
80
-        queue.enqueue_now_P(PSTR("G90"));
81
-      }
82
-      break;
83
-    case ID_M_Z_P:
84
-      if (queue.length <= (BUFSIZE - 3)) {
85
-        queue.enqueue_now_P(PSTR("G91"));
86
-        sprintf_P(public_buf_l, PSTR("G1 Z%3.1f F%d"), uiCfg.move_dist, uiCfg.moveSpeed);
87
-        queue.enqueue_one_now(public_buf_l);
88
-        queue.enqueue_now_P(PSTR("G90"));
89
-      }
90
-      break;
91
-    case ID_M_Z_N:
92
-      if (queue.length <= (BUFSIZE - 3)) {
93
-        queue.enqueue_now_P(PSTR("G91"));
94
-        sprintf_P(public_buf_l, PSTR("G1 Z-%3.1f F%d"), uiCfg.move_dist, uiCfg.moveSpeed);
95
-        queue.enqueue_one_now(public_buf_l);
96
-        queue.enqueue_now_P(PSTR("G90"));
97
-      }
98
-      break;
99
     case ID_M_STEP:
68
     case ID_M_STEP:
100
       if (abs(10 * (int)uiCfg.move_dist) == 100)
69
       if (abs(10 * (int)uiCfg.move_dist) == 100)
101
         uiCfg.move_dist = 0.1;
70
         uiCfg.move_dist = 0.1;
102
       else
71
       else
103
-        uiCfg.move_dist *= (float)10;
72
+        uiCfg.move_dist *= 10.0f;
104
       disp_move_dist();
73
       disp_move_dist();
105
       break;
74
       break;
106
     case ID_M_RETURN:
75
     case ID_M_RETURN:
107
       clear_cur_ui();
76
       clear_cur_ui();
108
       draw_return_ui();
77
       draw_return_ui();
109
-      break;
78
+      return;
110
   }
79
   }
80
+  disp_cur_pos();
81
+}
82
+
83
+void refresh_pos(lv_task_t *) {
84
+  switch (cur_label) {
85
+    case 'X': cur_pos = current_position.x; break;
86
+    case 'Y': cur_pos = current_position.y; break;
87
+    case 'Z': cur_pos = current_position.z; break;
88
+    default: return;
89
+  }
90
+  disp_cur_pos();
111
 }
91
 }
112
 
92
 
113
 void lv_draw_move_motor(void) {
93
 void lv_draw_move_motor(void) {
124
   buttonV = lv_imgbtn_create(scr, nullptr, BTN_X_PIXEL * 3 + INTERVAL_V * 4, titleHeight, event_handler, ID_M_STEP);
104
   buttonV = lv_imgbtn_create(scr, nullptr, BTN_X_PIXEL * 3 + INTERVAL_V * 4, titleHeight, event_handler, ID_M_STEP);
125
   labelV = lv_label_create_empty(buttonV);
105
   labelV = lv_label_create_empty(buttonV);
126
   #if HAS_ROTARY_ENCODER
106
   #if HAS_ROTARY_ENCODER
127
-    if (gCfgItems.encoder_enable) {
128
-      lv_group_add_obj(g, buttonV);
129
-    }
107
+    if (gCfgItems.encoder_enable) lv_group_add_obj(g, buttonV);
130
   #endif
108
   #endif
131
 
109
 
132
   lv_big_button_create(scr, "F:/bmp_return.bin", common_menu.text_back, BTN_X_PIXEL * 3 + INTERVAL_V * 4, BTN_Y_PIXEL + INTERVAL_H + titleHeight, event_handler, ID_M_RETURN);
110
   lv_big_button_create(scr, "F:/bmp_return.bin", common_menu.text_back, BTN_X_PIXEL * 3 + INTERVAL_V * 4, BTN_Y_PIXEL + INTERVAL_H + titleHeight, event_handler, ID_M_RETURN);
133
 
111
 
112
+  // We need to patch the title to leave some space on the right for displaying the status
113
+  lv_obj_t * title = lv_obj_get_child_back(scr, NULL);
114
+  if (title != NULL) lv_obj_set_width(title, TFT_WIDTH - 101);
115
+  labelP = lv_label_create(scr, TFT_WIDTH - 100, TITLE_YPOS, "Z:0.0mm");
116
+  if (labelP != NULL)
117
+    updatePosTask = lv_task_create(refresh_pos, 300, LV_TASK_PRIO_LOWEST, 0);
118
+
134
   disp_move_dist();
119
   disp_move_dist();
120
+  disp_cur_pos();
135
 }
121
 }
136
 
122
 
137
-void disp_move_dist() {
138
-  // char buf[30] = {0};
123
+void disp_cur_pos() {
124
+  sprintf_P(public_buf_l, PSTR("%c:%3.1fmm"), cur_label, cur_pos);
125
+  if (labelP) lv_label_set_text(labelP, public_buf_l);
126
+}
139
 
127
 
128
+void disp_move_dist() {
140
   if ((int)(10 * uiCfg.move_dist) == 1)
129
   if ((int)(10 * uiCfg.move_dist) == 1)
141
     lv_imgbtn_set_src_both(buttonV, "F:/bmp_step_move0_1.bin");
130
     lv_imgbtn_set_src_both(buttonV, "F:/bmp_step_move0_1.bin");
142
   else if ((int)(10 * uiCfg.move_dist) == 10)
131
   else if ((int)(10 * uiCfg.move_dist) == 10)
164
   #if HAS_ROTARY_ENCODER
153
   #if HAS_ROTARY_ENCODER
165
     if (gCfgItems.encoder_enable) lv_group_remove_all_objs(g);
154
     if (gCfgItems.encoder_enable) lv_group_remove_all_objs(g);
166
   #endif
155
   #endif
156
+  lv_task_del(updatePosTask);
167
   lv_obj_del(scr);
157
   lv_obj_del(scr);
168
 }
158
 }
169
 
159
 

+ 98
- 251
Marlin/src/lcd/extui/lib/mks_ui/draw_ui.cpp View File

138
   gCfgItems.levelingPos[3][1] = Y_MAX_POS - 30;
138
   gCfgItems.levelingPos[3][1] = Y_MAX_POS - 30;
139
   gCfgItems.levelingPos[4][0] = X_BED_SIZE / 2;
139
   gCfgItems.levelingPos[4][0] = X_BED_SIZE / 2;
140
   gCfgItems.levelingPos[4][1] = Y_BED_SIZE / 2;
140
   gCfgItems.levelingPos[4][1] = Y_BED_SIZE / 2;
141
-  gCfgItems.cloud_enable  = true;
142
-  #if ENABLED(MKS_WIFI_MODULE)
143
-    gCfgItems.wifi_mode_sel = STA_MODEL;
144
-    gCfgItems.fileSysType   = FILE_SYS_SD;
145
-    gCfgItems.wifi_type     = ESP_WIFI;
146
-  #endif
141
+  gCfgItems.cloud_enable      = false;
142
+  gCfgItems.wifi_mode_sel = STA_MODEL;
143
+  gCfgItems.fileSysType   = FILE_SYS_SD;
144
+  gCfgItems.wifi_type     = ESP_WIFI;
147
   gCfgItems.filamentchange_load_length   = 200;
145
   gCfgItems.filamentchange_load_length   = 200;
148
   gCfgItems.filamentchange_load_speed    = 1000;
146
   gCfgItems.filamentchange_load_speed    = 1000;
149
   gCfgItems.filamentchange_unload_length = 200;
147
   gCfgItems.filamentchange_unload_length = 200;
449
 
447
 
450
 char *getDispText(int index) {
448
 char *getDispText(int index) {
451
 
449
 
450
+  ZERO(public_buf_l);
452
 
451
 
453
   switch (disp_state_stack._disp_state[index]) {
452
   switch (disp_state_stack._disp_state[index]) {
454
     case PRINT_READY_UI:
453
     case PRINT_READY_UI:
593
 
592
 
594
   if (strlen(public_buf_m) > MAX_TITLE_LEN) {
593
   if (strlen(public_buf_m) > MAX_TITLE_LEN) {
595
     ZERO(public_buf_m);
594
     ZERO(public_buf_m);
596
-    tmpText = getDispText(0);
595
+    tmpText = 0;
596
+    for (index = 0; index <= disp_state_stack._disp_index && (!tmpText || *tmpText == 0); index++)
597
+      tmpText = getDispText(index);
597
     if (*tmpText != 0) {
598
     if (*tmpText != 0) {
598
       titleText_cat(public_buf_m, sizeof(public_buf_m), tmpText);
599
       titleText_cat(public_buf_m, sizeof(public_buf_m), tmpText);
599
       titleText_cat(public_buf_m, sizeof(public_buf_m), (char *)">...>");
600
       titleText_cat(public_buf_m, sizeof(public_buf_m), (char *)">...>");
639
     #endif
640
     #endif
640
   }
641
   }
641
 
642
 
642
-  #if 1
643
-
644
-    void gcode_preview(char *path, int xpos_pixel, int ypos_pixel) {
645
-      #if ENABLED(SDSUPPORT)
646
-        //uint8_t ress;
647
-        //uint32_t write;
648
-        volatile uint32_t i, j;
649
-        volatile uint16_t *p_index;
650
-        //int res;
651
-        char *cur_name;
652
-
653
-        cur_name = strrchr(path, '/');
654
-        card.openFileRead(cur_name);
655
-
656
-        if (gPicturePreviewStart <= 0) {
657
-          while (1) {
658
-            uint32_t br  = card.read(public_buf, 400);
659
-            uint32_t* p1 = (uint32_t *)strstr((char *)public_buf, ";gimage:");
660
-            if (p1) {
661
-              gPicturePreviewStart += (uint32_t)p1 - (uint32_t)((uint32_t *)(&public_buf[0]));
662
-              break;
663
-            }
664
-            else {
665
-              gPicturePreviewStart += br;
666
-            }
667
-            if (br < 400) break;
668
-          }
669
-        }
670
-
671
-        card.setIndex((gPicturePreviewStart + To_pre_view) + size * row + 8);
672
-        SPI_TFT.setWindow(xpos_pixel, ypos_pixel + row, 200, 1);
643
+  void gcode_preview(char *path, int xpos_pixel, int ypos_pixel) {
644
+    #if ENABLED(SDSUPPORT)
645
+      volatile uint32_t i, j;
646
+      volatile uint16_t *p_index;
647
+      char *cur_name;
673
 
648
 
674
-        j = i = 0;
649
+      cur_name = strrchr(path, '/');
650
+      card.openFileRead(cur_name);
675
 
651
 
652
+      if (gPicturePreviewStart <= 0) {
676
         while (1) {
653
         while (1) {
677
-          card.read(public_buf, 400);
678
-          for (i = 0; i < 400;) {
679
-            bmp_public_buf[j] = ascii2dec_test((char*)&public_buf[i]) << 4 | ascii2dec_test((char*)&public_buf[i + 1]);
680
-            i                += 2;
681
-            j++;
682
-          }
683
-          if (j >= 400) break;
684
-        }
685
-        for (i = 0; i < 400; i += 2) {
686
-          p_index  = (uint16_t *)(&bmp_public_buf[i]);
687
-          if (*p_index == 0x0000) *p_index = LV_COLOR_BACKGROUND.full;
688
-        }
689
-        SPI_TFT.tftio.WriteSequence((uint16_t*)bmp_public_buf, 200);
690
-        #if HAS_BAK_VIEW_IN_FLASH
691
-          W25QXX.init(SPI_QUARTER_SPEED);
692
-          if (row < 20) W25QXX.SPI_FLASH_SectorErase(BAK_VIEW_ADDR_TFT35 + row * 4096);
693
-          W25QXX.SPI_FLASH_BufferWrite(bmp_public_buf, BAK_VIEW_ADDR_TFT35 + row * 400, 400);
694
-        #endif
695
-        row++;
696
-        if (row >= 200) {
697
-          size = 809;
698
-          row  = 0;
699
-
700
-          gcode_preview_over = false;
701
-          //flash_preview_begin = true;
702
-
703
-          card.closefile();
704
-
705
-          /*
706
-          if (gCurFileState.file_open_flag != 0xAA) {
707
-            reset_file_info();
708
-            res = f_open(file, curFileName, FA_OPEN_EXISTING | FA_READ);
709
-            if (res == FR_OK) {
710
-              f_lseek(file,PREVIEW_SIZE+To_pre_view);
711
-              gCurFileState.file_open_flag = 0xAA;
712
-              //bakup_file_path((uint8_t *)curFileName, strlen(curFileName));
713
-              srcfp = file;
714
-              mksReprint.mks_printer_state = MKS_WORKING;
715
-              once_flag = false;
716
-            }
717
-          }
718
-          */
719
-          char *cur_name;
720
-
721
-          cur_name = strrchr(list_file.file_name[sel_id], '/');
722
-
723
-          SdFile file;
724
-          SdFile *curDir;
725
-          card.endFilePrint();
726
-          const char * const fname = card.diveToFile(true, curDir, cur_name);
727
-          if (!fname) return;
728
-          if (file.open(curDir, fname, O_READ)) {
729
-            gCfgItems.curFilesize = file.fileSize();
730
-            file.close();
731
-            update_spi_flash();
654
+          uint32_t br  = card.read(public_buf, 400);
655
+          uint32_t* p1 = (uint32_t *)strstr((char *)public_buf, ";gimage:");
656
+          if (p1) {
657
+            gPicturePreviewStart += (uint32_t)p1 - (uint32_t)((uint32_t *)(&public_buf[0]));
658
+            break;
732
           }
659
           }
733
-
734
-          card.openFileRead(cur_name);
735
-          if (card.isFileOpen()) {
736
-            feedrate_percentage = 100;
737
-            //saved_feedrate_percentage = feedrate_percentage;
738
-            planner.flow_percentage[0] = 100;
739
-            planner.e_factor[0]        = planner.flow_percentage[0] * 0.01;
740
-            #if HAS_MULTI_EXTRUDER
741
-              planner.flow_percentage[1] = 100;
742
-              planner.e_factor[1]        = planner.flow_percentage[1] * 0.01;
743
-            #endif
744
-            card.startFileprint();
745
-            TERN_(POWER_LOSS_RECOVERY, recovery.prepare());
746
-            once_flag = false;
660
+          else {
661
+            gPicturePreviewStart += br;
747
           }
662
           }
748
-          return;
663
+          if (br < 400) break;
749
         }
664
         }
750
-        card.closefile();
751
-      #endif // SDSUPPORT
752
-    }
753
-
754
-  #else // if 1
755
-
756
-    void gcode_preview(char *path, int xpos_pixel, int ypos_pixel) {
757
-      #if ENABLED(SDSUPPORT)
758
-        //uint8_t ress;
759
-        //uint32_t write;
760
-        volatile uint32_t i, j;
761
-        volatile uint16_t *p_index;
762
-        //int res;
763
-        char *cur_name;
764
-        uint16_t Color;
765
-
766
-        cur_name = strrchr(path, '/');
767
-        card.openFileRead(cur_name);
768
-
769
-        card.setIndex((PREVIEW_LITTLE_PIC_SIZE + To_pre_view) + size * row + 8);
770
-        #if HAS_TFT_LVGL_UI_SPI
771
-          SPI_TFT.setWindow(xpos_pixel, ypos_pixel + row, 200, 1);
772
-        #else
773
-          LCD_setWindowArea(xpos_pixel, ypos_pixel + row, 200, 1);
774
-          LCD_WriteRAM_Prepare();
775
-        #endif
776
-
777
-        j = 0;
778
-        i = 0;
665
+      }
779
 
666
 
780
-        while (1) {
781
-          card.read(public_buf, 400);
782
-          for (i = 0; i < 400;) {
783
-            bmp_public_buf[j] = ascii2dec_test((char*)&public_buf[i]) << 4 | ascii2dec_test((char*)&public_buf[i + 1]);
784
-            i += 2;
785
-            j++;
786
-          }
667
+      card.setIndex(gPicturePreviewStart + size * row + 8);
668
+      SPI_TFT.setWindow(xpos_pixel, ypos_pixel + row, 200, 1);
787
 
669
 
788
-          //if (i > 800) break;
789
-          //#ifdef TFT70
790
-          //  if (j > 400) {
791
-          //    f_read(file, buff_pic, 1, &read);
792
-          //    break;
793
-          //  }
794
-          //#elif defined(TFT35)
795
-          if (j >= 400)
796
-            //f_read(file, buff_pic, 1, &read);
797
-            break;
798
-          //#endif
670
+      j = i = 0;
799
 
671
 
672
+      while (1) {
673
+        card.read(public_buf, 400);
674
+        for (i = 0; i < 400;) {
675
+          bmp_public_buf[j] = ascii2dec_test((char*)&public_buf[i]) << 4 | ascii2dec_test((char*)&public_buf[i + 1]);
676
+          i                += 2;
677
+          j++;
800
         }
678
         }
801
-        #if HAS_TFT_LVGL_UI_SPI
802
-          for (i = 0; i < 400;) {
803
-            p_index = (uint16_t *)(&bmp_public_buf[i]);
804
-
805
-            Color    = (*p_index >> 8);
806
-            *p_index = Color | ((*p_index & 0xFF) << 8);
807
-            i       += 2;
808
-            if (*p_index == 0x0000) *p_index = 0xC318;
809
-          }
810
-          TFT_CS_L;
811
-          TFT_DC_H;
812
-          SPI.dmaSend(bmp_public_buf, 400, true);
813
-          TFT_CS_H;
814
-
815
-        #else
816
-          for (i = 0; i < 400;) {
817
-            p_index = (uint16_t *)(&bmp_public_buf[i]);
818
-            if (*p_index == 0x0000) *p_index = 0x18C3;
819
-            LCD_IO_WriteData(*p_index);
820
-            i = i + 2;
821
-          }
822
-        #endif
679
+        if (j >= 400) break;
680
+      }
681
+      for (i = 0; i < 400; i += 2) {
682
+        p_index  = (uint16_t *)(&bmp_public_buf[i]);
683
+        if (*p_index == 0x0000) *p_index = LV_COLOR_BACKGROUND.full;
684
+      }
685
+      SPI_TFT.tftio.WriteSequence((uint16_t*)bmp_public_buf, 200);
686
+      #if HAS_BAK_VIEW_IN_FLASH
823
         W25QXX.init(SPI_QUARTER_SPEED);
687
         W25QXX.init(SPI_QUARTER_SPEED);
824
-        if (row < 20)
825
-          W25QXX.SPI_FLASH_SectorErase(BAK_VIEW_ADDR_TFT35 + row * 4096);
688
+        if (row < 20) W25QXX.SPI_FLASH_SectorErase(BAK_VIEW_ADDR_TFT35 + row * 4096);
826
         W25QXX.SPI_FLASH_BufferWrite(bmp_public_buf, BAK_VIEW_ADDR_TFT35 + row * 400, 400);
689
         W25QXX.SPI_FLASH_BufferWrite(bmp_public_buf, BAK_VIEW_ADDR_TFT35 + row * 400, 400);
827
-        row++;
828
-        if (row >= 200) {
829
-          size = 809;
830
-          row  = 0;
831
-
832
-          gcode_preview_over = false;
833
-          //flash_preview_begin = true;
834
-
835
-          card.closefile();
836
-
837
-          /*
838
-          if (gCurFileState.file_open_flag != 0xAA) {
839
-            reset_file_info();
840
-            res = f_open(file, curFileName, FA_OPEN_EXISTING | FA_READ);
841
-            if (res == FR_OK) {
842
-              f_lseek(file,PREVIEW_SIZE+To_pre_view);
843
-              gCurFileState.file_open_flag = 0xAA;
844
-              //bakup_file_path((uint8_t *)curFileName, strlen(curFileName));
845
-              srcfp = file;
846
-              mksReprint.mks_printer_state = MKS_WORKING;
847
-              once_flag = false;
848
-            }
849
-          }
850
-          */
851
-          char *cur_name;
852
-
853
-          cur_name = strrchr(list_file.file_name[sel_id], '/');
854
-
855
-          SdFile file;
856
-          SdFile *curDir;
857
-          card.endFilePrint();
858
-          const char * const fname = card.diveToFile(true, curDir, cur_name);
859
-          if (!fname) return;
860
-          if (file.open(curDir, fname, O_READ)) {
861
-            gCfgItems.curFilesize = file.fileSize();
862
-            file.close();
863
-            update_spi_flash();
864
-          }
690
+      #endif
691
+      row++;
692
+      if (row >= 200) {
693
+        size = 809;
694
+        row  = 0;
695
+
696
+        gcode_preview_over = false;
865
 
697
 
866
-          card.openFileRead(cur_name);
867
-          if (card.isFileOpen()) {
868
-            feedrate_percentage = 100;
869
-            //saved_feedrate_percentage = feedrate_percentage;
870
-            planner.flow_percentage[0] = 100;
871
-            planner.e_factor[0]        = planner.flow_percentage[0] * 0.01;
872
-            #if HAS_MULTI_EXTRUDER
873
-              planner.flow_percentage[1] = 100;
874
-              planner.e_factor[1]        = planner.flow_percentage[1] * 0.01;
875
-            #endif
876
-            card.startFileprint();
877
-            TERN_(POWER_LOSS_RECOVERY, recovery.prepare());
878
-            once_flag = false;
879
-          }
880
-          return;
881
-        }
882
         card.closefile();
698
         card.closefile();
883
-      #endif // SDSUPPORT
884
-    }
699
+        char *cur_name;
885
 
700
 
886
-  #endif // if 1
701
+        cur_name = strrchr(list_file.file_name[sel_id], '/');
702
+
703
+        SdFile file;
704
+        SdFile *curDir;
705
+        card.endFilePrint();
706
+        const char * const fname = card.diveToFile(true, curDir, cur_name);
707
+        if (!fname) return;
708
+        if (file.open(curDir, fname, O_READ)) {
709
+          gCfgItems.curFilesize = file.fileSize();
710
+          file.close();
711
+          update_spi_flash();
712
+        }
887
 
713
 
888
-  void Draw_default_preview(int xpos_pixel, int ypos_pixel, uint8_t sel) {
714
+        card.openFileRead(cur_name);
715
+        if (card.isFileOpen()) {
716
+          feedrate_percentage = 100;
717
+          planner.flow_percentage[0] = 100;
718
+          planner.e_factor[0]        = planner.flow_percentage[0] * 0.01;
719
+          #if HAS_MULTI_EXTRUDER
720
+            planner.flow_percentage[1] = 100;
721
+            planner.e_factor[1]        = planner.flow_percentage[1] * 0.01;
722
+          #endif
723
+          card.startFileprint();
724
+          TERN_(POWER_LOSS_RECOVERY, recovery.prepare());
725
+          once_flag = false;
726
+        }
727
+        return;
728
+      }
729
+      card.closefile();
730
+    #endif // SDSUPPORT
731
+  }
732
+
733
+  void draw_default_preview(int xpos_pixel, int ypos_pixel, uint8_t sel) {
889
     int index;
734
     int index;
890
     int y_off = 0;
735
     int y_off = 0;
891
     W25QXX.init(SPI_QUARTER_SPEED);
736
     W25QXX.init(SPI_QUARTER_SPEED);
914
     #if HAS_BAK_VIEW_IN_FLASH
759
     #if HAS_BAK_VIEW_IN_FLASH
915
       if (flash_preview_begin) {
760
       if (flash_preview_begin) {
916
         flash_preview_begin = false;
761
         flash_preview_begin = false;
917
-        Draw_default_preview(xpos_pixel, ypos_pixel, 1);
762
+        draw_default_preview(xpos_pixel, ypos_pixel, 1);
918
       }
763
       }
919
     #endif
764
     #endif
920
     #if HAS_GCODE_DEFAULT_VIEW_IN_FLASH
765
     #if HAS_GCODE_DEFAULT_VIEW_IN_FLASH
921
       if (default_preview_flg) {
766
       if (default_preview_flg) {
922
-        Draw_default_preview(xpos_pixel, ypos_pixel, 0);
767
+        draw_default_preview(xpos_pixel, ypos_pixel, 0);
923
         default_preview_flg = false;
768
         default_preview_flg = false;
924
       }
769
       }
925
     #endif
770
     #endif
1005
           temps_update_flag = false;
850
           temps_update_flag = false;
1006
         }
851
         }
1007
         break;
852
         break;
1008
-    #endif
1009
-
1010
-    case BIND_UI:
1011
-      /*refresh_bind_ui();*/
1012
-      break;
1013
 
853
 
854
+      case BIND_UI:
855
+        refresh_bind_ui();
856
+        break;
857
+    #endif
1014
     case FILAMENTCHANGE_UI:
858
     case FILAMENTCHANGE_UI:
1015
       if (temps_update_flag) {
859
       if (temps_update_flag) {
1016
         temps_update_flag = false;
860
         temps_update_flag = false;
1097
   last_disp_state = disp_state_stack._disp_state[disp_state_stack._disp_index];
941
   last_disp_state = disp_state_stack._disp_state[disp_state_stack._disp_index];
1098
 
942
 
1099
   switch (disp_state_stack._disp_state[disp_state_stack._disp_index]) {
943
   switch (disp_state_stack._disp_state[disp_state_stack._disp_index]) {
1100
-    case PRINT_READY_UI:
1101
-                                      lv_clear_ready_print(); break;
944
+    case PRINT_READY_UI:              lv_clear_ready_print(); break;
1102
     case PRINT_FILE_UI:               lv_clear_print_file(); break;
945
     case PRINT_FILE_UI:               lv_clear_print_file(); break;
1103
     case PRINTING_UI:                 lv_clear_printing(); break;
946
     case PRINTING_UI:                 lv_clear_printing(); break;
1104
     case MOVE_MOTOR_UI:               lv_clear_move_motor(); break;
947
     case MOVE_MOTOR_UI:               lv_clear_move_motor(); break;
1119
     #if ENABLED(MKS_WIFI_MODULE)
962
     #if ENABLED(MKS_WIFI_MODULE)
1120
       case WIFI_UI:                   lv_clear_wifi(); break;
963
       case WIFI_UI:                   lv_clear_wifi(); break;
1121
     #endif
964
     #endif
1122
-    case MORE_UI:                     /* Clear_more(); */ break;
965
+    case MORE_UI:                     lv_clear_more(); break;
1123
     case FILETRANSFER_UI:             break;
966
     case FILETRANSFER_UI:             break;
1124
     case DIALOG_UI:                   lv_clear_dialog(); break;
967
     case DIALOG_UI:                   lv_clear_dialog(); break;
1125
     case FILETRANSFERSTATE_UI:        break;
968
     case FILETRANSFERSTATE_UI:        break;
1126
     case PRINT_MORE_UI:               break;
969
     case PRINT_MORE_UI:               break;
1127
     case FILAMENTCHANGE_UI:           lv_clear_filament_change(); break;
970
     case FILAMENTCHANGE_UI:           lv_clear_filament_change(); break;
1128
     case LEVELING_UI:                 lv_clear_manualLevel(); break;
971
     case LEVELING_UI:                 lv_clear_manualLevel(); break;
1129
-    case BIND_UI:                     /* Clear_Bind(); */ break;
972
+    #if ENABLED(MKS_WIFI_MODULE)
973
+      case BIND_UI:                   lv_clear_cloud_bind(); break;
974
+    #endif
1130
     #if HAS_BED_PROBE
975
     #if HAS_BED_PROBE
1131
       case NOZZLE_PROBE_OFFSET_UI:    lv_clear_auto_level_offset_settings(); break;
976
       case NOZZLE_PROBE_OFFSET_UI:    lv_clear_auto_level_offset_settings(); break;
1132
     #endif
977
     #endif
1224
       #if ENABLED(MKS_WIFI_MODULE)
1069
       #if ENABLED(MKS_WIFI_MODULE)
1225
         case WIFI_UI:                   lv_draw_wifi(); break;
1070
         case WIFI_UI:                   lv_draw_wifi(); break;
1226
       #endif
1071
       #endif
1227
-      case PRINT_MORE_UI:               /* draw_printmore(); */ break;
1228
       case MORE_UI:                     break;
1072
       case MORE_UI:                     break;
1073
+      case PRINT_MORE_UI:               lv_draw_more(); break;
1229
       case FILAMENTCHANGE_UI:           lv_draw_filament_change(); break;
1074
       case FILAMENTCHANGE_UI:           lv_draw_filament_change(); break;
1230
       case LEVELING_UI:                 lv_draw_manualLevel(); break;
1075
       case LEVELING_UI:                 lv_draw_manualLevel(); break;
1231
-      case BIND_UI:                     /* draw_bind(); */ break;
1076
+      #if ENABLED(MKS_WIFI_MODULE)
1077
+        case BIND_UI:                   lv_draw_cloud_bind(); break;
1078
+      #endif
1232
       #if HAS_BED_PROBE
1079
       #if HAS_BED_PROBE
1233
         case NOZZLE_PROBE_OFFSET_UI:    lv_draw_auto_level_offset_settings(); break;
1080
         case NOZZLE_PROBE_OFFSET_UI:    lv_draw_auto_level_offset_settings(); break;
1234
       #endif
1081
       #endif

+ 15
- 3
Marlin/src/lcd/extui/lib/mks_ui/draw_ui.h View File

46
 #include "draw_preHeat.h"
46
 #include "draw_preHeat.h"
47
 #include "draw_extrusion.h"
47
 #include "draw_extrusion.h"
48
 #include "draw_home.h"
48
 #include "draw_home.h"
49
+#include "draw_more.h"
49
 #include "draw_move_motor.h"
50
 #include "draw_move_motor.h"
50
 #include "draw_fan.h"
51
 #include "draw_fan.h"
51
 #include "draw_about.h"
52
 #include "draw_about.h"
76
 #include "draw_keyboard.h"
77
 #include "draw_keyboard.h"
77
 #include "draw_encoder_settings.h"
78
 #include "draw_encoder_settings.h"
78
 
79
 
80
+#include "../../inc/MarlinConfigPre.h"
81
+
79
 #if ENABLED(MKS_WIFI_MODULE)
82
 #if ENABLED(MKS_WIFI_MODULE)
80
   #include "wifiSerial.h"
83
   #include "wifiSerial.h"
81
   #include "wifi_module.h"
84
   #include "wifi_module.h"
84
   #include "draw_wifi.h"
87
   #include "draw_wifi.h"
85
   #include "draw_wifi_list.h"
88
   #include "draw_wifi_list.h"
86
   #include "draw_wifi_tips.h"
89
   #include "draw_wifi_tips.h"
90
+  #include "draw_cloud_bind.h"
87
 #endif
91
 #endif
88
 
92
 
89
-#include "../../../../inc/MarlinConfigPre.h"
90
-#define FILE_SYS_USB  0
91
-#define FILE_SYS_SD 1
93
+#define ESP_WIFI          0x02
94
+#define AP_MODEL          0x01
95
+#define STA_MODEL         0x02
96
+
97
+#define FILE_SYS_USB      0
98
+#define FILE_SYS_SD       1
92
 
99
 
93
 #define TICK_CYCLE 1
100
 #define TICK_CYCLE 1
94
 
101
 
157
   #define PARA_UI_BACK_BTN_X_SIZE   70
164
   #define PARA_UI_BACK_BTN_X_SIZE   70
158
   #define PARA_UI_BACK_BTN_Y_SIZE   40
165
   #define PARA_UI_BACK_BTN_Y_SIZE   40
159
 
166
 
167
+  #define QRCODE_X                  20
168
+  #define QRCODE_Y                  40
169
+  #define QRCODE_WIDTH              160
170
+
160
 #else // ifdef TFT35
171
 #else // ifdef TFT35
161
 
172
 
162
   #define TFT_WIDTH     320
173
   #define TFT_WIDTH     320
237
   float desireSprayerTempBak;
248
   float desireSprayerTempBak;
238
   float current_x_position_bak;
249
   float current_x_position_bak;
239
   float current_y_position_bak;
250
   float current_y_position_bak;
251
+  float current_z_position_bak;
240
   float current_e_position_bak;
252
   float current_e_position_bak;
241
 } UI_CFG;
253
 } UI_CFG;
242
 
254
 

+ 29
- 25
Marlin/src/lcd/extui/lib/mks_ui/draw_wifi.cpp View File

41
 
41
 
42
 static void event_handler(lv_obj_t *obj, lv_event_t event) {
42
 static void event_handler(lv_obj_t *obj, lv_event_t event) {
43
   if (event != LV_EVENT_RELEASED) return;
43
   if (event != LV_EVENT_RELEASED) return;
44
+  clear_cur_ui();
44
   switch (obj->mks_obj_id) {
45
   switch (obj->mks_obj_id) {
45
     case ID_W_RETURN:
46
     case ID_W_RETURN:
46
-      clear_cur_ui();
47
       lv_draw_set();
47
       lv_draw_set();
48
       break;
48
       break;
49
     case ID_W_CLOUD:
49
     case ID_W_CLOUD:
50
-      //clear_cur_ui();
51
-      //draw_return_ui();
52
-      break;
53
-    case ID_W_RECONNECT:
54
-      clear_cur_ui();
55
-      lv_draw_wifi_list();
50
+      lv_draw_cloud_bind();
56
       break;
51
       break;
52
+    #if ENABLED(MKS_WIFI_MODULE)
53
+      case ID_W_RECONNECT: {
54
+        uint8_t cmd_wifi_list[] = { 0xA5, 0x07, 0x00, 0x00, 0xFC };
55
+        raw_send_to_wifi(cmd_wifi_list, COUNT(cmd_wifi_list));
56
+        lv_draw_wifi_list();
57
+      } break;
58
+    #endif
57
   }
59
   }
58
 }
60
 }
59
 
61
 
60
 void lv_draw_wifi(void) {
62
 void lv_draw_wifi(void) {
61
   scr = lv_screen_create(WIFI_UI);
63
   scr = lv_screen_create(WIFI_UI);
62
 
64
 
63
-  // Create an Image button
64
-  lv_obj_t *buttonBack = lv_imgbtn_create(scr, "F:/bmp_return.bin", BTN_X_PIXEL * 3 + INTERVAL_V * 4, BTN_Y_PIXEL + INTERVAL_H + titleHeight, event_handler, ID_W_RETURN);
65
-  #if HAS_ROTARY_ENCODER
66
-    if (gCfgItems.encoder_enable) lv_group_add_obj(g, buttonBack);
67
-  #endif
68
-  lv_obj_t *label_Back = lv_label_create_empty(buttonBack);
69
-
70
   lv_obj_t *buttonReconnect = nullptr, *label_Reconnect = nullptr;
65
   lv_obj_t *buttonReconnect = nullptr, *label_Reconnect = nullptr;
66
+  lv_obj_t *buttonCloud = nullptr, *label_Cloud = nullptr;
67
+
68
+  const bool enc_ena = TERN0(HAS_ROTARY_ENCODER, gCfgItems.encoder_enable);
71
 
69
 
72
   if (gCfgItems.wifi_mode_sel == STA_MODEL) {
70
   if (gCfgItems.wifi_mode_sel == STA_MODEL) {
73
 
71
 
74
-    buttonReconnect = lv_imgbtn_create(scr, nullptr);
72
+    if (gCfgItems.cloud_enable)
73
+      buttonCloud = lv_imgbtn_create(scr, "F:/bmp_cloud.bin", BTN_X_PIXEL+INTERVAL_V*2, BTN_Y_PIXEL + INTERVAL_H + titleHeight, event_handler, ID_W_CLOUD);
75
 
74
 
76
-    lv_obj_set_event_cb_mks(buttonReconnect, event_handler, ID_W_RECONNECT, "", 0);
77
-    lv_imgbtn_set_src_both(buttonReconnect, "F:/bmp_wifi.bin");
78
-    lv_imgbtn_use_label_style(buttonReconnect);
75
+    buttonReconnect = lv_imgbtn_create(scr, "F:/bmp_wifi.bin", BTN_X_PIXEL * 2 + INTERVAL_V * 3, BTN_Y_PIXEL + INTERVAL_H + titleHeight, event_handler, ID_W_RECONNECT);
79
 
76
 
80
     #if HAS_ROTARY_ENCODER
77
     #if HAS_ROTARY_ENCODER
81
-      if (gCfgItems.encoder_enable) lv_group_add_obj(g, buttonReconnect);
78
+      if (gCfgItems.cloud_enable) lv_group_add_obj(g, buttonCloud);
79
+      if (enc_ena) lv_group_add_obj(g, buttonReconnect);
82
     #endif
80
     #endif
83
 
81
 
84
-    lv_obj_set_pos(buttonReconnect, BTN_X_PIXEL * 2 + INTERVAL_V * 3, BTN_Y_PIXEL + INTERVAL_H + titleHeight);
85
-    lv_btn_set_layout(buttonReconnect, LV_LAYOUT_OFF);
86
-
87
     label_Reconnect = lv_label_create_empty(buttonReconnect);
82
     label_Reconnect = lv_label_create_empty(buttonReconnect);
83
+    if (gCfgItems.cloud_enable) label_Cloud = lv_label_create_empty(buttonCloud);
88
   }
84
   }
89
 
85
 
90
-  if (gCfgItems.multiple_language) {
91
-    lv_label_set_text(label_Back, common_menu.text_back);
92
-    lv_obj_align(label_Back, buttonBack, LV_ALIGN_IN_BOTTOM_MID, 0, BUTTON_TEXT_Y_OFFSET);
86
+  // Create an Image button
87
+  lv_obj_t *buttonBack = lv_imgbtn_create(scr, "F:/bmp_return.bin", BTN_X_PIXEL * 3 + INTERVAL_V * 4, BTN_Y_PIXEL + INTERVAL_H + titleHeight, event_handler, ID_W_RETURN);
88
+  if (enc_ena) lv_group_add_obj(g, buttonBack);
89
+  lv_obj_t *label_Back = lv_label_create_empty(buttonBack);
93
 
90
 
91
+  if (gCfgItems.multiple_language) {
94
     if (gCfgItems.wifi_mode_sel == STA_MODEL) {
92
     if (gCfgItems.wifi_mode_sel == STA_MODEL) {
93
+      if (gCfgItems.cloud_enable) {
94
+        lv_label_set_text(label_Cloud, wifi_menu.cloud);
95
+        lv_obj_align(label_Cloud, buttonCloud, LV_ALIGN_IN_BOTTOM_MID, 0, BUTTON_TEXT_Y_OFFSET);
96
+      }
95
       lv_label_set_text(label_Reconnect, wifi_menu.reconnect);
97
       lv_label_set_text(label_Reconnect, wifi_menu.reconnect);
96
       lv_obj_align(label_Reconnect, buttonReconnect, LV_ALIGN_IN_BOTTOM_MID, 0, BUTTON_TEXT_Y_OFFSET);
98
       lv_obj_align(label_Reconnect, buttonReconnect, LV_ALIGN_IN_BOTTOM_MID, 0, BUTTON_TEXT_Y_OFFSET);
97
     }
99
     }
100
+    lv_label_set_text(label_Back, common_menu.text_back);
101
+    lv_obj_align(label_Back, buttonBack, LV_ALIGN_IN_BOTTOM_MID, 0, BUTTON_TEXT_Y_OFFSET);
98
   }
102
   }
99
 
103
 
100
   wifi_ip_text = lv_label_create_empty(scr);
104
   wifi_ip_text = lv_label_create_empty(scr);

+ 4
- 14
Marlin/src/lcd/extui/lib/mks_ui/irq_overrid.cpp View File

46
 #define WIFI_IO1_RESET()  WRITE(WIFI_IO1_PIN, LOW);
46
 #define WIFI_IO1_RESET()  WRITE(WIFI_IO1_PIN, LOW);
47
 
47
 
48
 void __irq_usart1(void) {
48
 void __irq_usart1(void) {
49
-  WIFISERIAL.wifi_usart_irq(USART1_BASE);
50
-  if (wifi_link_state == WIFI_TRANS_FILE) {
51
-    if (WIFISERIAL.available() == (400)) WIFI_IO1_SET();
52
-    if (WIFISERIAL.wifi_rb_is_full()) {
53
-      if (esp_state == TRANSFER_IDLE) esp_state = TRANSFERING;
54
-      if (storeRcvData(UART_RX_BUFFER_SIZE)) {
55
-        if (wifiTransError.flag != 0x1) WIFI_IO1_RESET();
56
-      }
57
-      else {
58
-        WIFI_IO1_SET();
59
-        esp_state = TRANSFER_STORE;
60
-      }
61
-    }
62
-  }
49
+   if ((USART1_BASE->CR1 & USART_CR1_RXNEIE) && (USART1_BASE->SR & USART_SR_RXNE))
50
+     WRITE(WIFI_IO1_PIN, HIGH);
51
+
52
+   WIFISERIAL.wifi_usart_irq(USART1_BASE);
63
 }
53
 }
64
 
54
 
65
 #ifdef __cplusplus
55
 #ifdef __cplusplus

+ 34
- 26
Marlin/src/lcd/extui/lib/mks_ui/pic_manager.cpp View File

42
 #endif
42
 #endif
43
 
43
 
44
 static const char assets[][LONG_FILENAME_LENGTH] = {
44
 static const char assets[][LONG_FILENAME_LENGTH] = {
45
-  //homing screen
45
+  // Homing screen
46
   "bmp_zeroAll.bin",
46
   "bmp_zeroAll.bin",
47
   "bmp_zero.bin",
47
   "bmp_zero.bin",
48
   "bmp_zeroX.bin",
48
   "bmp_zeroX.bin",
50
   "bmp_zeroZ.bin",
50
   "bmp_zeroZ.bin",
51
   "bmp_manual_off.bin",
51
   "bmp_manual_off.bin",
52
 
52
 
53
-  //tool screen
53
+  // Tool screen
54
   "bmp_preHeat.bin",
54
   "bmp_preHeat.bin",
55
   "bmp_extruct.bin",
55
   "bmp_extruct.bin",
56
   "bmp_mov.bin",
56
   "bmp_mov.bin",
57
   "bmp_leveling.bin",
57
   "bmp_leveling.bin",
58
   "bmp_filamentchange.bin",
58
   "bmp_filamentchange.bin",
59
+  "bmp_more.bin",
59
 
60
 
60
-  //fan screen
61
+  // Fan screen
61
   "bmp_Add.bin",
62
   "bmp_Add.bin",
62
   "bmp_Dec.bin",
63
   "bmp_Dec.bin",
63
   "bmp_speed255.bin",
64
   "bmp_speed255.bin",
70
   "bmp_step5_degree.bin",
71
   "bmp_step5_degree.bin",
71
   "bmp_step10_degree.bin",
72
   "bmp_step10_degree.bin",
72
 
73
 
73
-  //extrusion screen
74
+  // Extrusion screen
74
   "bmp_in.bin",
75
   "bmp_in.bin",
75
   "bmp_out.bin",
76
   "bmp_out.bin",
76
   "bmp_extru1.bin",
77
   "bmp_extru1.bin",
84
   "bmp_step5_mm.bin",
85
   "bmp_step5_mm.bin",
85
   "bmp_step10_mm.bin",
86
   "bmp_step10_mm.bin",
86
 
87
 
87
-  //select file screen
88
+  // Select file screen
88
   "bmp_pageUp.bin",
89
   "bmp_pageUp.bin",
89
   "bmp_pageDown.bin",
90
   "bmp_pageDown.bin",
90
   "bmp_back.bin", //TODO: why two back buttons? Why not just one? (return / back)
91
   "bmp_back.bin", //TODO: why two back buttons? Why not just one? (return / back)
91
   "bmp_dir.bin",
92
   "bmp_dir.bin",
92
   "bmp_file.bin",
93
   "bmp_file.bin",
93
 
94
 
94
-  //move motor screen
95
-  //TODO: 6 equal icons, just in diffenct rotation... it may be optimized too
95
+  // Move motor screen
96
+  // TODO: 6 equal icons, just in diffenct rotation... it may be optimized too
96
   "bmp_xAdd.bin",
97
   "bmp_xAdd.bin",
97
   "bmp_xDec.bin",
98
   "bmp_xDec.bin",
98
   "bmp_yAdd.bin",
99
   "bmp_yAdd.bin",
103
   "bmp_step_move1.bin",
104
   "bmp_step_move1.bin",
104
   "bmp_step_move10.bin",
105
   "bmp_step_move10.bin",
105
 
106
 
106
-  //operation screen
107
+  // Operation screen
107
   "bmp_auto_off.bin",
108
   "bmp_auto_off.bin",
108
   "bmp_speed.bin",
109
   "bmp_speed.bin",
109
   "bmp_fan.bin",
110
   "bmp_fan.bin",
111
   "bmp_extrude_opr.bin",
112
   "bmp_extrude_opr.bin",
112
   "bmp_move_opr.bin",
113
   "bmp_move_opr.bin",
113
 
114
 
114
-  //change speed screen
115
+  // Change speed screen
115
   "bmp_step1_percent.bin",
116
   "bmp_step1_percent.bin",
116
   "bmp_step5_percent.bin",
117
   "bmp_step5_percent.bin",
117
   "bmp_step10_percent.bin",
118
   "bmp_step10_percent.bin",
120
   "bmp_mov_sel.bin",
121
   "bmp_mov_sel.bin",
121
   "bmp_speed_extruct.bin",
122
   "bmp_speed_extruct.bin",
122
 
123
 
123
-  //printing screen
124
+  // Printing screen
124
   "bmp_pause.bin",
125
   "bmp_pause.bin",
125
   "bmp_resume.bin",
126
   "bmp_resume.bin",
126
   "bmp_stop.bin",
127
   "bmp_stop.bin",
134
   "bmp_zpos_state.bin",
135
   "bmp_zpos_state.bin",
135
   "bmp_operate.bin",
136
   "bmp_operate.bin",
136
 
137
 
137
-  //manual leval screen (only if disabled auto level)
138
+  // Manual Level screen (only if auto level is disabled)
138
   #if DISABLED(AUTO_BED_LEVELING_BILINEAR)
139
   #if DISABLED(AUTO_BED_LEVELING_BILINEAR)
139
     "bmp_leveling1.bin",
140
     "bmp_leveling1.bin",
140
     "bmp_leveling2.bin",
141
     "bmp_leveling2.bin",
143
     "bmp_leveling5.bin",
144
     "bmp_leveling5.bin",
144
   #endif
145
   #endif
145
 
146
 
146
-  //lang select screen
147
+  // Language Select screen
147
   #if HAS_LANG_SELECT_SCREEN
148
   #if HAS_LANG_SELECT_SCREEN
148
     "bmp_language.bin",
149
     "bmp_language.bin",
149
     "bmp_simplified_cn.bin",
150
     "bmp_simplified_cn.bin",
162
     "bmp_italy_sel.bin",
163
     "bmp_italy_sel.bin",
163
   #endif // HAS_LANG_SELECT_SCREEN
164
   #endif // HAS_LANG_SELECT_SCREEN
164
 
165
 
165
-  // gcode preview
166
+  // G-code preview
166
   #if HAS_GCODE_DEFAULT_VIEW_IN_FLASH
167
   #if HAS_GCODE_DEFAULT_VIEW_IN_FLASH
167
     "bmp_preview.bin",
168
     "bmp_preview.bin",
168
   #endif
169
   #endif
171
     "bmp_logo.bin",
172
     "bmp_logo.bin",
172
   #endif
173
   #endif
173
 
174
 
174
-  // settings screen
175
+  // Settings screen
175
   "bmp_about.bin",
176
   "bmp_about.bin",
177
+  "bmp_eeprom_settings.bin",
178
+  "bmp_machine_para.bin",
179
+  "bmp_function1.bin",
176
 
180
 
177
-  //start screen
181
+  // Start screen
178
   "bmp_printing.bin",
182
   "bmp_printing.bin",
179
   "bmp_set.bin",
183
   "bmp_set.bin",
180
   "bmp_tool.bin",
184
   "bmp_tool.bin",
181
 
185
 
182
-  // settings screen
183
-  "bmp_eeprom_settings.bin",
184
-  "bmp_machine_para.bin",
185
-  "bmp_function1.bin",
186
-
187
-  // base icons
186
+  // Base icons
188
   "bmp_arrow.bin",
187
   "bmp_arrow.bin",
189
   "bmp_back70x40.bin",
188
   "bmp_back70x40.bin",
190
   "bmp_value_blank.bin",
189
   "bmp_value_blank.bin",
194
   "bmp_return.bin",
193
   "bmp_return.bin",
195
 
194
 
196
   #if ENABLED(MKS_WIFI_MODULE)
195
   #if ENABLED(MKS_WIFI_MODULE)
197
-    // wifi screen
196
+    // Wifi screen
198
     "bmp_wifi.bin",
197
     "bmp_wifi.bin",
198
+    "bmp_cloud.bin",
199
   #endif
199
   #endif
200
 
200
 
201
-  // babystep screen
201
+  // Babystep screen
202
   "bmp_baby_move0_01.bin",
202
   "bmp_baby_move0_01.bin",
203
   "bmp_baby_move0_05.bin",
203
   "bmp_baby_move0_05.bin",
204
-  "bmp_baby_move0_1.bin"
204
+  "bmp_baby_move0_1.bin",
205
+
206
+  // More screen
207
+  "bmp_custom1.bin",
208
+  "bmp_custom2.bin",
209
+  "bmp_custom3.bin",
210
+  "bmp_custom4.bin",
211
+  "bmp_custom5.bin",
212
+  "bmp_custom6.bin",
213
+  "bmp_custom7.bin"
205
 };
214
 };
206
 
215
 
207
 #if HAS_SPI_FLASH_FONT
216
 #if HAS_SPI_FLASH_FONT
235
     } while (PIC.name[j++] != '\0');
244
     } while (PIC.name[j++] != '\0');
236
 
245
 
237
     if ((strcasecmp((char*)Pname, (char*)PIC.name)) == 0) {
246
     if ((strcasecmp((char*)Pname, (char*)PIC.name)) == 0) {
238
-      if ((DeviceCode == 0x9488) || (DeviceCode == 0x5761))
247
+      if (DeviceCode == 0x9488 || DeviceCode == 0x5761)
239
         addr = PIC_DATA_ADDR_TFT35 + i * PER_PIC_MAX_SPACE_TFT35;
248
         addr = PIC_DATA_ADDR_TFT35 + i * PER_PIC_MAX_SPACE_TFT35;
240
       else
249
       else
241
         addr = PIC_DATA_ADDR_TFT32 + i * PER_PIC_MAX_SPACE_TFT32;
250
         addr = PIC_DATA_ADDR_TFT32 + i * PER_PIC_MAX_SPACE_TFT32;
242
       return addr;
251
       return addr;
243
     }
252
     }
244
   }
253
   }
245
-
246
   return addr;
254
   return addr;
247
 }
255
 }
248
 
256
 

+ 1
- 1
Marlin/src/lcd/extui/lib/mks_ui/pic_manager.h View File

120
 
120
 
121
 // SD card information first addr
121
 // SD card information first addr
122
 #define VAR_INF_ADDR                    0x000000
122
 #define VAR_INF_ADDR                    0x000000
123
-#define FLASH_INF_VALID_FLAG            0x20200831
123
+#define FLASH_INF_VALID_FLAG            0x20201118
124
 
124
 
125
 //Store some gcode commands, such as auto leveling commands
125
 //Store some gcode commands, such as auto leveling commands
126
 #define GCODE_COMMAND_ADDR              VAR_INF_ADDR + 3*1024
126
 #define GCODE_COMMAND_ADDR              VAR_INF_ADDR + 3*1024

+ 5
- 4
Marlin/src/lcd/extui/lib/mks_ui/printer_operation.cpp View File

32
 #include "../../../../sd/cardreader.h"
32
 #include "../../../../sd/cardreader.h"
33
 #include "../../../../inc/MarlinConfig.h"
33
 #include "../../../../inc/MarlinConfig.h"
34
 #include "../../../../MarlinCore.h"
34
 #include "../../../../MarlinCore.h"
35
+#include "../../../../gcode/queue.h"
35
 
36
 
36
 #if ENABLED(POWER_LOSS_RECOVERY)
37
 #if ENABLED(POWER_LOSS_RECOVERY)
37
   #include "../../../../feature/powerloss.h"
38
   #include "../../../../feature/powerloss.h"
55
         //save the positon
56
         //save the positon
56
         uiCfg.current_x_position_bak = current_position.x;
57
         uiCfg.current_x_position_bak = current_position.x;
57
         uiCfg.current_y_position_bak = current_position.y;
58
         uiCfg.current_y_position_bak = current_position.y;
59
+        uiCfg.current_z_position_bak = current_position.z;
58
 
60
 
59
         if (gCfgItems.pausePosZ != (float)-1) {
61
         if (gCfgItems.pausePosZ != (float)-1) {
60
           gcode.process_subcommands_now_P(PSTR("G91"));
62
           gcode.process_subcommands_now_P(PSTR("G91"));
87
         gcode.process_subcommands_now(public_buf_m);
89
         gcode.process_subcommands_now(public_buf_m);
88
       }
90
       }
89
       if (gCfgItems.pausePosZ != (float)-1) {
91
       if (gCfgItems.pausePosZ != (float)-1) {
90
-        gcode.process_subcommands_now_P(PSTR("G91"));
91
-        sprintf_P(public_buf_l, PSTR("G1 Z-%.1f"), gCfgItems.pausePosZ);
92
-        gcode.process_subcommands_now(public_buf_l);
93
-        gcode.process_subcommands_now_P(PSTR("G90"));
92
+        ZERO(public_buf_m);
93
+        sprintf_P(public_buf_m, PSTR("G1 Z%.1f"), uiCfg.current_z_position_bak);
94
+        gcode.process_subcommands_now(public_buf_m);
94
       }
95
       }
95
       gcode.process_subcommands_now_P(M24_STR);
96
       gcode.process_subcommands_now_P(M24_STR);
96
       uiCfg.print_state = WORKING;
97
       uiCfg.print_state = WORKING;

+ 9
- 0
Marlin/src/lcd/extui/lib/mks_ui/tft_Language_en.h View File

114
 #define PROBE_Z_SPEED_EN                "Probe Z-axis speed"
114
 #define PROBE_Z_SPEED_EN                "Probe Z-axis speed"
115
 #define ENABLE_EN                       "YES"
115
 #define ENABLE_EN                       "YES"
116
 #define DISABLE_EN                      "NO"
116
 #define DISABLE_EN                      "NO"
117
+#define LOCKED_EN                       "N/A"
117
 #define Z_MIN_EN                        "ZMin"
118
 #define Z_MIN_EN                        "ZMin"
118
 #define Z_MAX_EN                        "ZMax"
119
 #define Z_MAX_EN                        "ZMax"
119
 
120
 
725
 #define EEPROM_STORE_TIPS_EN  "Store settings to EEPROM?"
726
 #define EEPROM_STORE_TIPS_EN  "Store settings to EEPROM?"
726
 #define EEPROM_READ_TIPS_EN   "Read settings from EEPROM?"
727
 #define EEPROM_READ_TIPS_EN   "Read settings from EEPROM?"
727
 #define EEPROM_REVERT_TIPS_EN "Revert settings to factory defaults?"
728
 #define EEPROM_REVERT_TIPS_EN "Revert settings to factory defaults?"
729
+
730
+#define MORE_CUSTOM1_TEXT_EN  USER_DESC_1
731
+#define MORE_CUSTOM2_TEXT_EN  USER_DESC_2
732
+#define MORE_CUSTOM3_TEXT_EN  USER_DESC_3
733
+#define MORE_CUSTOM4_TEXT_EN  USER_DESC_4
734
+#define MORE_CUSTOM5_TEXT_EN  USER_DESC_5
735
+#define MORE_CUSTOM6_TEXT_EN  USER_DESC_6
736
+#define MORE_CUSTOM7_TEXT_EN  USER_DESC_7

+ 8
- 0
Marlin/src/lcd/extui/lib/mks_ui/tft_Language_fr.h View File

257
 #define EEPROM_STORE_TIPS_FR  "Stocker les paramètres dans l'EEPROM?"
257
 #define EEPROM_STORE_TIPS_FR  "Stocker les paramètres dans l'EEPROM?"
258
 #define EEPROM_READ_TIPS_FR   "Lire les paramètres de l'EEPROM?"
258
 #define EEPROM_READ_TIPS_FR   "Lire les paramètres de l'EEPROM?"
259
 #define EEPROM_REVERT_TIPS_FR "Rétablir les paramètres par défaut d'usine?"
259
 #define EEPROM_REVERT_TIPS_FR "Rétablir les paramètres par défaut d'usine?"
260
+
261
+#define MORE_CUSTOM1_TEXT_FR  USER_DESC_1
262
+#define MORE_CUSTOM2_TEXT_FR  USER_DESC_2
263
+#define MORE_CUSTOM3_TEXT_FR  USER_DESC_3
264
+#define MORE_CUSTOM4_TEXT_FR  USER_DESC_4
265
+#define MORE_CUSTOM5_TEXT_FR  USER_DESC_5
266
+#define MORE_CUSTOM6_TEXT_FR  USER_DESC_6
267
+#define MORE_CUSTOM7_TEXT_FR  USER_DESC_7

+ 8
- 0
Marlin/src/lcd/extui/lib/mks_ui/tft_Language_it.h View File

254
 #define EEPROM_STORE_TIPS_IT              "Memorizzare le impostazioni su EEPROM?"
254
 #define EEPROM_STORE_TIPS_IT              "Memorizzare le impostazioni su EEPROM?"
255
 #define EEPROM_READ_TIPS_IT               "Leggi le impostazioni dalla EEPROM?"
255
 #define EEPROM_READ_TIPS_IT               "Leggi le impostazioni dalla EEPROM?"
256
 #define EEPROM_REVERT_TIPS_IT             "Ripristinare le impostazioni predefinite?"
256
 #define EEPROM_REVERT_TIPS_IT             "Ripristinare le impostazioni predefinite?"
257
+
258
+#define MORE_CUSTOM1_TEXT_IT  USER_DESC_1
259
+#define MORE_CUSTOM2_TEXT_IT  USER_DESC_2
260
+#define MORE_CUSTOM3_TEXT_IT  USER_DESC_3
261
+#define MORE_CUSTOM4_TEXT_IT  USER_DESC_4
262
+#define MORE_CUSTOM5_TEXT_IT  USER_DESC_5
263
+#define MORE_CUSTOM6_TEXT_IT  USER_DESC_6
264
+#define MORE_CUSTOM7_TEXT_IT  USER_DESC_7

+ 143
- 34
Marlin/src/lcd/extui/lib/mks_ui/tft_Language_ru.h View File

29
 #define PRINT_TEXT_RU                   " печать"
29
 #define PRINT_TEXT_RU                   " печать"
30
 #define EXTRUDE_TEXT_RU                 "экструзия"
30
 #define EXTRUDE_TEXT_RU                 "экструзия"
31
 #define LEVELING_TEXT_RU                "уровень"
31
 #define LEVELING_TEXT_RU                "уровень"
32
-#define AUTO_LEVELING_TEXT_RU           "aвто"
32
+#define AUTO_LEVELING_TEXT_RU           "aвтоуровень"
33
 #define SET_TEXT_RU                     "настройки"
33
 #define SET_TEXT_RU                     "настройки"
34
 #define MORE_TEXT_RU                    "больше"
34
 #define MORE_TEXT_RU                    "больше"
35
 
35
 
46
 #define BACK_TEXT_RU                    "назад"
46
 #define BACK_TEXT_RU                    "назад"
47
 
47
 
48
 #define TOOL_PREHEAT_RU                 "нагрев"
48
 #define TOOL_PREHEAT_RU                 "нагрев"
49
-#define TOOL_EXTRUDE_RU                 "экструзия"
49
+#define TOOL_EXTRUDE_RU                 "экструдер"
50
 #define TOOL_MOVE_RU                    "движение"
50
 #define TOOL_MOVE_RU                    "движение"
51
 #define TOOL_HOME_RU                    "домой"
51
 #define TOOL_HOME_RU                    "домой"
52
 #define TOOL_LEVELING_RU                "уровень"
52
 #define TOOL_LEVELING_RU                "уровень"
53
-#define TOOL_AUTO_LEVELING_RU           "aвто"
53
+#define TOOL_AUTO_LEVELING_RU           "aвтоуровень"
54
 #define TOOL_FILAMENT_RU                "замена"
54
 #define TOOL_FILAMENT_RU                "замена"
55
 #define TOOL_MORE_RU                    "больше"
55
 #define TOOL_MORE_RU                    "больше"
56
 
56
 
57
-#define AXIS_X_ADD_TEXT_RU              "X+"
58
-#define AXIS_X_DEC_TEXT_RU              "X-"
59
-#define AXIS_Y_ADD_TEXT_RU              "Y+"
60
-#define AXIS_Y_DEC_TEXT_RU              "Y-"
61
-#define AXIS_Z_ADD_TEXT_RU              "Z+"
62
-#define AXIS_Z_DEC_TEXT_RU              "Z-"
63
-#define TEXT_01MM_RU                    "0.1mm"
64
-#define TEXT_1MM_RU                     "1mm"
65
-#define TEXT_10MM_RU                    "10mm"
57
+#define AXIS_X_ADD_TEXT_RU              "X +"
58
+#define AXIS_X_DEC_TEXT_RU              "X -"
59
+#define AXIS_Y_ADD_TEXT_RU              "Y +"
60
+#define AXIS_Y_DEC_TEXT_RU              "Y -"
61
+#define AXIS_Z_ADD_TEXT_RU              "Z +"
62
+#define AXIS_Z_DEC_TEXT_RU              "Z -"
63
+#define TEXT_01MM_RU                    "0.1 mm"
64
+#define TEXT_1MM_RU                     "1 mm"
65
+#define TEXT_10MM_RU                    "10 mm"
66
 
66
 
67
 #define HOME_X_TEXT_RU                  "X"
67
 #define HOME_X_TEXT_RU                  "X"
68
 #define HOME_Y_TEXT_RU                  "Y"
68
 #define HOME_Y_TEXT_RU                  "Y"
75
 
75
 
76
 #define EXTRUDER_IN_TEXT_RU             "втянуть"
76
 #define EXTRUDER_IN_TEXT_RU             "втянуть"
77
 #define EXTRUDER_OUT_TEXT_RU            "выдавить"
77
 #define EXTRUDER_OUT_TEXT_RU            "выдавить"
78
-#define EXTRUDE_1MM_TEXT_RU             "1mm"
79
-#define EXTRUDE_5MM_TEXT_RU             "5mm"
80
-#define EXTRUDE_10MM_TEXT_RU            "10mm"
78
+#define EXTRUDE_1MM_TEXT_RU             "1 mm"
79
+#define EXTRUDE_5MM_TEXT_RU             "5 mm"
80
+#define EXTRUDE_10MM_TEXT_RU            "10 mm"
81
 #define EXTRUDE_LOW_SPEED_TEXT_RU       "мин"
81
 #define EXTRUDE_LOW_SPEED_TEXT_RU       "мин"
82
 #define EXTRUDE_MEDIUM_SPEED_TEXT_RU    "сред"
82
 #define EXTRUDE_MEDIUM_SPEED_TEXT_RU    "сред"
83
 #define EXTRUDE_HIGH_SPEED_TEXT_RU      "выс"
83
 #define EXTRUDE_HIGH_SPEED_TEXT_RU      "выс"
84
 
84
 
85
-#define LEVELING_POINT1_TEXT_RU         "1точка"
86
-#define LEVELING_POINT2_TEXT_RU         "2точка"
87
-#define LEVELING_POINT3_TEXT_RU         "3точка"
88
-#define LEVELING_POINT4_TEXT_RU         "4точка"
89
-#define LEVELING_POINT5_TEXT_RU         "5точка"
85
+#define LEVELING_POINT1_TEXT_RU         "1 точка"
86
+#define LEVELING_POINT2_TEXT_RU         "2 точка"
87
+#define LEVELING_POINT3_TEXT_RU         "3 точка"
88
+#define LEVELING_POINT4_TEXT_RU         "4 точка"
89
+#define LEVELING_POINT5_TEXT_RU         "5 точка"
90
 
90
 
91
 #define FILESYS_TEXT_RU                 "система"
91
 #define FILESYS_TEXT_RU                 "система"
92
 #define WIFI_TEXT_RU                    "WiFi"
92
 #define WIFI_TEXT_RU                    "WiFi"
95
 #define BREAK_POINT_TEXT_RU             "продолжить"
95
 #define BREAK_POINT_TEXT_RU             "продолжить"
96
 #define FILAMENT_TEXT_RU                "замена"
96
 #define FILAMENT_TEXT_RU                "замена"
97
 #define LANGUAGE_TEXT_RU                "язык"
97
 #define LANGUAGE_TEXT_RU                "язык"
98
-#define MOTOR_OFF_TEXT_RU               "отклмотор"
98
+#define MOTOR_OFF_TEXT_RU               "откл. мотор"
99
 #define MOTOR_OFF_XY_TEXT_RU            "Off-XY"
99
 #define MOTOR_OFF_XY_TEXT_RU            "Off-XY"
100
 #define SHUTDOWN_TEXT_RU                "выключение"
100
 #define SHUTDOWN_TEXT_RU                "выключение"
101
 #define MACHINE_PARA_RU                 "конфиг"
101
 #define MACHINE_PARA_RU                 "конфиг"
102
-#define EEPROM_SETTINGS_RU              "Eeprom Set"
103
 
102
 
104
 #define U_DISK_TEXT_RU                  "U диск"
103
 #define U_DISK_TEXT_RU                  "U диск"
105
 #define SD_CARD_TEXT_RU                 "SD диск"
104
 #define SD_CARD_TEXT_RU                 "SD диск"
111
 #define WIFI_CONNECTED_TEXT_RU          "подключен"
110
 #define WIFI_CONNECTED_TEXT_RU          "подключен"
112
 #define WIFI_DISCONNECTED_TEXT_RU       "не подключен"
111
 #define WIFI_DISCONNECTED_TEXT_RU       "не подключен"
113
 #define WIFI_EXCEPTION_TEXT_RU          "исключение"
112
 #define WIFI_EXCEPTION_TEXT_RU          "исключение"
114
-#define WIFI_RECONNECT_TEXT_RU          "Reconnect"
113
+#define WIFI_RECONNECT_TEXT_RU          "выбор сети"
115
 #define CLOUD_TEXT_RU                   "облако"
114
 #define CLOUD_TEXT_RU                   "облако"
116
 #define CLOUD_BIND_RU                   "соединён"
115
 #define CLOUD_BIND_RU                   "соединён"
117
-#define CLOUD_UNBIND_RU                 "не соединён"
118
-#define CLOUD_UNBINDING_RU              "Unbinding"
119
-#define CLOUD_DISCONNECTED_RU           "Disconnected"
120
-#define CLOUD_UNBINDED_RU               "Unbinded"
121
-#define CLOUD_BINDED_RU                 "Binded"
116
+#define CLOUD_UNBIND_RU                 "отсоед."
117
+#define CLOUD_UNBINDING_RU              "отвязано"
118
+#define CLOUD_DISCONNECTED_RU           "отключено"
119
+#define CLOUD_UNBINDED_RU               "несвяз."
120
+#define CLOUD_BINDED_RU                 "связано"
122
 #define CLOUD_DISABLE_RU                "Disable"
121
 #define CLOUD_DISABLE_RU                "Disable"
123
 
122
 
124
 #define FAN_ADD_TEXT_RU                 "добавить"
123
 #define FAN_ADD_TEXT_RU                 "добавить"
169
 #define ABOUT_VERSION_TEXT_RU               "Firmware: "
168
 #define ABOUT_VERSION_TEXT_RU               "Firmware: "
170
 #define ABOUT_WIFI_TEXT_RU                  "WiFi: "
169
 #define ABOUT_WIFI_TEXT_RU                  "WiFi: "
171
 
170
 
172
-#define PRINTING_OPERATION_RU               "управление"
171
+#define PRINTING_OPERATION_RU               "опции"
173
 #define PRINTING_PAUSE_RU                   "пауза"
172
 #define PRINTING_PAUSE_RU                   "пауза"
174
 #define PRINTING_TEMP_RU                    "темп"
173
 #define PRINTING_TEMP_RU                    "темп"
175
 #define PRINTING_CHANGESPEED_RU             "скорости"
174
 #define PRINTING_CHANGESPEED_RU             "скорости"
176
-#define PRINTING_RESUME_RU                  "возобновить"
175
+#define PRINTING_RESUME_RU                  "возобн.   "
177
 #define PRINTING_STOP_RU                    "стоп"
176
 #define PRINTING_STOP_RU                    "стоп"
178
 #define PRINTING_MORE_RU                    "больше"
177
 #define PRINTING_MORE_RU                    "больше"
179
 #define PRINTING_EXTRUDER_RU                "экстр"
178
 #define PRINTING_EXTRUDER_RU                "экстр"
193
 #define TITLE_HOME_RU                       "Home"
192
 #define TITLE_HOME_RU                       "Home"
194
 #define TITLE_EXTRUDE_RU                    "экструзия"
193
 #define TITLE_EXTRUDE_RU                    "экструзия"
195
 #define TITLE_LEVELING_RU                   "уровень"
194
 #define TITLE_LEVELING_RU                   "уровень"
195
+#define TITLE_MLEVELING_RU                  "углы"
196
 #define TITLE_SET_RU                        "настройки"
196
 #define TITLE_SET_RU                        "настройки"
197
 #define TITLE_MORE_RU                       "больше"
197
 #define TITLE_MORE_RU                       "больше"
198
 #define TITLE_CHOOSEFILE_RU                 "файла"
198
 #define TITLE_CHOOSEFILE_RU                 "файла"
230
 #define DIALOG_CLOSE_MACHINE_RU             "Closing machine......"
230
 #define DIALOG_CLOSE_MACHINE_RU             "Closing machine......"
231
 #define DIALOG_UNBIND_PRINTER_RU            "Unbind the printer?"
231
 #define DIALOG_UNBIND_PRINTER_RU            "Unbind the printer?"
232
 #define DIALOG_FILAMENT_NO_PRESS_RU         "Filament detection switch is not pressed"
232
 #define DIALOG_FILAMENT_NO_PRESS_RU         "Filament detection switch is not pressed"
233
-#define DIALOG_PRINT_FINISH_RU              "Печать завершена!"
233
+#define DIALOG_PRINT_FINISH_RU              "печать завершена!"
234
 #define DIALOG_PRINT_TIME_RU                "Время печати: "
234
 #define DIALOG_PRINT_TIME_RU                "Время печати: "
235
 #define DIALOG_REPRINT_RU                   "Print again"
235
 #define DIALOG_REPRINT_RU                   "Print again"
236
 #define DIALOG_WIFI_ENABLE_TIPS_RU          "The wifi module is being configured,\nplease wait a moment....."
236
 #define DIALOG_WIFI_ENABLE_TIPS_RU          "The wifi module is being configured,\nplease wait a moment....."
253
 #define EEPROM_SETTINGS_READ_RU       "Чтение настроек из EEPROM"
253
 #define EEPROM_SETTINGS_READ_RU       "Чтение настроек из EEPROM"
254
 #define EEPROM_SETTINGS_REVERT_RU     "Bосстановить заводские настройки по умолчанию"
254
 #define EEPROM_SETTINGS_REVERT_RU     "Bосстановить заводские настройки по умолчанию"
255
 
255
 
256
-#define EEPROM_STORE_TIPS_RU          "Сохранить настройки в EEPROM?"
257
-#define EEPROM_READ_TIPS_RU           "Читать настройки из EEPROM?"
258
-#define EEPROM_REVERT_TIPS_RU         "Revert settings to factory defaults?"
256
+#define MORE_CUSTOM1_TEXT_RU  USER_DESC_1
257
+#define MORE_CUSTOM2_TEXT_RU  USER_DESC_2
258
+#define MORE_CUSTOM3_TEXT_RU  USER_DESC_3
259
+#define MORE_CUSTOM4_TEXT_RU  USER_DESC_4
260
+#define MORE_CUSTOM5_TEXT_RU  USER_DESC_5
261
+#define MORE_CUSTOM6_TEXT_RU  USER_DESC_6
262
+#define MORE_CUSTOM7_TEXT_RU  USER_DESC_7
263
+
264
+//Malderin translate
265
+//
266
+//
267
+#define EEPROM_STORE_TIPS_RU          "Cохранить настройки в EEPROM?"
268
+#define EEPROM_READ_TIPS_RU           "читать настройки из EEPROM?"
269
+#define EEPROM_REVERT_TIPS_RU         "Cбросить настройки к значениям по умолчанию?"
270
+#define EEPROM_SETTINGS_RU            "EEPROM"
271
+
272
+#define NEXT_RU                       "след."
273
+#define PREVIOUS_RU                   "пред."
274
+#define ENABLE_RU                     "да "
275
+#define DISABLE_RU                    "нет"
276
+#define KEY_CONFIRM_RU                "OK"
277
+
278
+#define MACHINE_PARA_TITLE_RU          "настройки"
279
+#define MACHINE_TYPE_CNOFIG_RU         "Hастройки принтера"
280
+#define MOTOR_CONFIG_RU                "Hастройки моторов"
281
+#define MACHINE_LEVELING_CONFIG_RU     "Hастройки уровня"
282
+#define ADVANCE_CONFIG_RU              "Pасширенные настройки"
283
+#define MACHINE_FILAMENT_CONFIG_RU     "Hастройки филамента"
284
+#define ENCODER_SETTINGS_RU            "Hастройки энкодера"
285
+
286
+#define LEVELING_CONF_TITLE_RU          "Hастройки принтера>Hастройки уровня"
287
+#define LEVELING_PARA_CONF_RU           "настройки уровня"
288
+#define LEVELING_MANUAL_POS_RU          "настройки координат для уровня"
289
+#define LEVELING_AUTO_COMMAND_RU        "настройки комманд увтоуровня"
290
+#define LEVELING_AUTO_ZOFFSET_RU        "координаты смещения сопла"
291
+
292
+#define MACHINE_CONFIG_TITLE_RU         "Hастройки принтера>настройки притера"
293
+#define MAXFEEDRATE_CONF_RU             "настройки максимальной скорости"
294
+#define ACCELERATION_CONF_RU            "настройки ускорений"
295
+#define JERKCONF_RU                     "настройки рывков"
296
+
297
+#define MOTOR_CONF_TITLE_RU             "Hастройки принтера>Hастройки моторов"
298
+#define STEPSCONF_RU                    "настройки шагов"
299
+#define TMC_CURRENT_RU                  "TMC настройки токов"
300
+#define TMC_STEP_MODE_RU                "TMC настрйоки режима шагов"
301
+
302
+#define ACCELERATION_CONF_TITLE_RU      "Hастройки принтера>ускорения"
303
+#define PRINT_ACCELERATION_RU           "ускорение печати"
304
+#define RETRACT_ACCELERATION_RU         "ускорение ретракта"
305
+#define TRAVEL_ACCELERATION_RU          "ускорение перемещений"
306
+#define X_ACCELERATION_RU               "ускорение оси X"
307
+#define Y_ACCELERATION_RU               "ускорение оси Y"
308
+#define Z_ACCELERATION_RU               "ускорение оси Z"
309
+#define E0_ACCELERATION_RU              "ускорение E0"
310
+#define E1_ACCELERATION_RU              "ускорение E1"
311
+
312
+#define MAXFEEDRATE_CONF_TITLE_RU       "Hастройки принтера>максимальная скорость"
313
+#define X_MAXFEEDRATE_RU                "максимальная скорость оси X"
314
+#define Y_MAXFEEDRATE_RU                "максимальная скорость оси Y"
315
+#define Z_MAXFEEDRATE_RU                "максимальная скорость оси Z"
316
+#define E0_MAXFEEDRATE_RU               "максимальная скорость E0"
317
+#define E1_MAXFEEDRATE_RU               "максимальная скорость E1"
318
+
319
+#define JERK_CONF_TITLE_RU              "Hастройки принтера>скорость рывка"
320
+#define X_JERK_RU                       "скорость рывка оси X"
321
+#define Y_JERK_RU                       "скорость рывка оси Y"
322
+#define Z_JERK_RU                       "скорость рывка оси Z"
323
+#define E_JERK_RU                       "скорость рывка оси E"
324
+
325
+#define STEPS_CONF_TITLE_RU             "Hастройки принтера>настройки шагов"
326
+#define X_STEPS_RU                      "шаги оси X"
327
+#define Y_STEPS_RU                      "шаги оси Y"
328
+#define Z_STEPS_RU                      "шаги оси Z"
329
+#define E0_STEPS_RU                     "шаги E0"
330
+#define E1_STEPS_RU                     "шаги E1"
331
+
332
+#define TMC_CURRENT_CONF_TITLE_RU       "Hастройки принтера>TMC настройка токов"
333
+#define X_TMC_CURRENT_RU                "ток оси X (mA)"
334
+#define Y_TMC_CURRENT_RU                "ток оси Y (mA)"
335
+#define Z_TMC_CURRENT_RU                "ток оси Z (mA)"
336
+#define E0_TMC_CURRENT_RU               "ток E0 (mA)"
337
+#define E1_TMC_CURRENT_RU               "ток E1 (mA)"
338
+
339
+#define TMC_MODE_CONF_TITLE_RU          "Hастройки принтера>TMC настройки режима шагов"
340
+#define X_TMC_MODE_RU                   "включает ли двигатель X режим StealthChop"
341
+#define Y_TMC_MODE_RU                   "включает ли ось Y режим StealthChop"
342
+#define Z_TMC_MODE_RU                   "включает ли ось Z режим StealthChop"
343
+#define E0_TMC_MODE_RU                  "включает ли E0 режим StealthChop"
344
+#define E1_TMC_MODE_RU                  "включает ли E1 режим StealthChop"
345
+
346
+#define ADVANCED_CONF_TITLE_RU          "Hастройки принтера>Pасширенные"
347
+#define PAUSE_POSITION_RU    "Hастройки позиции паузы печати"
348
+#define PAUSE_POSITION_X_RU  "положение по X (абс. полож., -1 недействит.)"
349
+#define PAUSE_POSITION_Y_RU  "положение по Y (абс. полож., -1 недействит.)"
350
+#define PAUSE_POSITION_Z_RU  "положение по Z (абс. полож., -1 недействит.)"
351
+
352
+#define OFFSET_TITLE_RU  "Hастройки принтера>отступ"
353
+#define OFFSET_X_RU      "X отступ"
354
+#define OFFSET_Y_RU      "Y отступ"
355
+#define OFFSET_Z_RU      "Z отступ"
356
+
357
+#define FILAMENT_CONF_TITLE_RU          "Hастройки принтера>Hастройки филамента"
358
+#define FILAMENT_IN_LENGTH_RU           "длинна загрузки"
359
+#define FILAMENT_IN_SPEED_RU            "скорость загрузки"
360
+#define FILAMENT_TEMPERATURE_RU         "температура филамента"
361
+#define FILAMENT_OUT_LENGTH_RU          "длинна извлечения"
362
+#define FILAMENT_OUT_SPEED_RU           "скорость извлечения"
363
+
364
+#define ENCODER_CONF_TITLE_RU           "Hастройки принтера>Hастройки энкодера"
365
+#define ENCODER_CONF_TEXT_RU            "энкодер используется?"
366
+
367
+//end of Malderin translate

+ 9
- 0
Marlin/src/lcd/extui/lib/mks_ui/tft_Language_s_cn.h View File

99
 #define PROBE_Z_SPEED_CN              "探针Z方向移动速度"
99
 #define PROBE_Z_SPEED_CN              "探针Z方向移动速度"
100
 #define ENABLE_CN                     "是"
100
 #define ENABLE_CN                     "是"
101
 #define DISABLE_CN                    "否"
101
 #define DISABLE_CN                    "否"
102
+#define LOCKED_CN                     "否"
102
 #define Z_MIN_CN                      "ZMin"
103
 #define Z_MIN_CN                      "ZMin"
103
 #define Z_MAX_CN                      "ZMax"
104
 #define Z_MAX_CN                      "ZMax"
104
 
105
 
491
 #define EEPROM_STORE_TIPS_CN  "是否保存参数到EEPROM?"
492
 #define EEPROM_STORE_TIPS_CN  "是否保存参数到EEPROM?"
492
 #define EEPROM_READ_TIPS_CN   "是否使用EEPROM参数?"
493
 #define EEPROM_READ_TIPS_CN   "是否使用EEPROM参数?"
493
 #define EEPROM_REVERT_TIPS_CN "是否恢复默认参数?"
494
 #define EEPROM_REVERT_TIPS_CN "是否恢复默认参数?"
495
+
496
+#define MORE_CUSTOM1_TEXT_CN  USER_DESC_1
497
+#define MORE_CUSTOM2_TEXT_CN  USER_DESC_2
498
+#define MORE_CUSTOM3_TEXT_CN  USER_DESC_3
499
+#define MORE_CUSTOM4_TEXT_CN  USER_DESC_4
500
+#define MORE_CUSTOM5_TEXT_CN  USER_DESC_5
501
+#define MORE_CUSTOM6_TEXT_CN  USER_DESC_6
502
+#define MORE_CUSTOM7_TEXT_CN  USER_DESC_7

+ 10
- 0
Marlin/src/lcd/extui/lib/mks_ui/tft_Language_sp.h View File

29
 #define PRINT_TEXT_SP           "Imprimir"
29
 #define PRINT_TEXT_SP           "Imprimir"
30
 #define EXTRUDE_TEXT_SP         "Extrusor"
30
 #define EXTRUDE_TEXT_SP         "Extrusor"
31
 #define LEVELING_TEXT_SP        "Leveling"
31
 #define LEVELING_TEXT_SP        "Leveling"
32
+#define MLEVELING_TEXT_SP       "Leveling"
32
 #define AUTO_LEVELING_TEXT_SP   "Autolevel"
33
 #define AUTO_LEVELING_TEXT_SP   "Autolevel"
33
 #define SET_TEXT_SP             "Config"
34
 #define SET_TEXT_SP             "Config"
34
 #define MORE_TEXT_SP            "Más"
35
 #define MORE_TEXT_SP            "Más"
50
 #define TOOL_MOVE_SP            "Mover"
51
 #define TOOL_MOVE_SP            "Mover"
51
 #define TOOL_HOME_SP            "Origen"
52
 #define TOOL_HOME_SP            "Origen"
52
 #define TOOL_LEVELING_SP        "Leveling"
53
 #define TOOL_LEVELING_SP        "Leveling"
54
+#define TOOL_MLEVELING_SP       "Leveling"
53
 #define TOOL_AUTO_LEVELING_SP   "Autolevel"
55
 #define TOOL_AUTO_LEVELING_SP   "Autolevel"
54
 #define TOOL_FILAMENT_SP        "Filamento"
56
 #define TOOL_FILAMENT_SP        "Filamento"
55
 #define TOOL_MORE_SP            "Más"
57
 #define TOOL_MORE_SP            "Más"
261
 #define EEPROM_STORE_TIPS_SP  "¿Guardar ajustes en EEPROM?"
263
 #define EEPROM_STORE_TIPS_SP  "¿Guardar ajustes en EEPROM?"
262
 #define EEPROM_READ_TIPS_SP   "Leer la configuración de EEPROM?"
264
 #define EEPROM_READ_TIPS_SP   "Leer la configuración de EEPROM?"
263
 #define EEPROM_REVERT_TIPS_SP "Revert settings to factory defaults?"
265
 #define EEPROM_REVERT_TIPS_SP "Revert settings to factory defaults?"
266
+
267
+#define MORE_CUSTOM1_TEXT_SP  USER_DESC_1
268
+#define MORE_CUSTOM2_TEXT_SP  USER_DESC_2
269
+#define MORE_CUSTOM3_TEXT_SP  USER_DESC_3
270
+#define MORE_CUSTOM4_TEXT_SP  USER_DESC_4
271
+#define MORE_CUSTOM5_TEXT_SP  USER_DESC_5
272
+#define MORE_CUSTOM6_TEXT_SP  USER_DESC_6
273
+#define MORE_CUSTOM7_TEXT_SP  USER_DESC_7

+ 9
- 0
Marlin/src/lcd/extui/lib/mks_ui/tft_Language_t_cn.h View File

99
 #define PROBE_Z_SPEED_T_CN              "探针Z方向移動速度"
99
 #define PROBE_Z_SPEED_T_CN              "探针Z方向移動速度"
100
 #define ENABLE_T_CN                     "是"
100
 #define ENABLE_T_CN                     "是"
101
 #define DISABLE_T_CN                    "否"
101
 #define DISABLE_T_CN                    "否"
102
+#define LOCKED_T_CN                     "否"
102
 #define Z_MIN_T_CN                      "ZMin"
103
 #define Z_MIN_T_CN                      "ZMin"
103
 #define Z_MAX_T_CN                      "ZMax"
104
 #define Z_MAX_T_CN                      "ZMax"
104
 
105
 
489
 #define EEPROM_STORE_TIPS_T_CN        "是否保存參數到EEPROM?"
490
 #define EEPROM_STORE_TIPS_T_CN        "是否保存參數到EEPROM?"
490
 #define EEPROM_READ_TIPS_T_CN         "是否使用EEPROM參數?"
491
 #define EEPROM_READ_TIPS_T_CN         "是否使用EEPROM參數?"
491
 #define EEPROM_REVERT_TIPS_T_CN       "是否恢復默認參數?"
492
 #define EEPROM_REVERT_TIPS_T_CN       "是否恢復默認參數?"
493
+
494
+#define MORE_CUSTOM1_TEXT_T_CN  USER_DESC_1
495
+#define MORE_CUSTOM2_TEXT_T_CN  USER_DESC_2
496
+#define MORE_CUSTOM3_TEXT_T_CN  USER_DESC_3
497
+#define MORE_CUSTOM4_TEXT_T_CN  USER_DESC_4
498
+#define MORE_CUSTOM5_TEXT_T_CN  USER_DESC_5
499
+#define MORE_CUSTOM6_TEXT_T_CN  USER_DESC_6
500
+#define MORE_CUSTOM7_TEXT_T_CN  USER_DESC_7

+ 36
- 26
Marlin/src/lcd/extui/lib/mks_ui/tft_lvgl_configuration.cpp View File

19
  * along with this program.  If not, see <https://www.gnu.org/licenses/>.
19
  * along with this program.  If not, see <https://www.gnu.org/licenses/>.
20
  *
20
  *
21
  */
21
  */
22
-
23
-/**
24
- * @file tft_lvgl_configuration.cpp
25
- * @date    2020-02-21
26
- */
27
-
28
 #include "../../../../inc/MarlinConfigPre.h"
22
 #include "../../../../inc/MarlinConfigPre.h"
29
 
23
 
30
 #if HAS_TFT_LVGL_UI
24
 #if HAS_TFT_LVGL_UI
56
   #include "draw_touch_calibration.h"
50
   #include "draw_touch_calibration.h"
57
 #endif
51
 #endif
58
 
52
 
53
+#if ENABLED(MKS_WIFI_MODULE)
54
+  #include "wifi_module.h"
55
+#endif
56
+
59
 #include <SPI.h>
57
 #include <SPI.h>
60
 
58
 
61
 #ifndef TFT_WIDTH
59
 #ifndef TFT_WIDTH
120
 
118
 
121
   watchdog_refresh();     // LVGL init takes time
119
   watchdog_refresh();     // LVGL init takes time
122
 
120
 
121
+  #if MB(MKS_ROBIN_NANO)
122
+    OUT_WRITE(PB0, LOW);  // HE1
123
+  #endif
124
+
123
   // Init TFT first!
125
   // Init TFT first!
124
   SPI_TFT.spi_init(SPI_FULL_SPEED);
126
   SPI_TFT.spi_init(SPI_FULL_SPEED);
125
   SPI_TFT.LCD_init();
127
   SPI_TFT.LCD_init();
137
 
139
 
138
   lv_init();
140
   lv_init();
139
 
141
 
140
-  lv_disp_buf_init(&disp_buf, bmp_public_buf, nullptr, LV_HOR_RES_MAX * 14); /*Initialize the display buffer*/
142
+  lv_disp_buf_init(&disp_buf, bmp_public_buf, nullptr, LV_HOR_RES_MAX * 14); // Initialize the display buffer
141
 
143
 
142
-  lv_disp_drv_t disp_drv;     /*Descriptor of a display driver*/
143
-  lv_disp_drv_init(&disp_drv);    /*Basic initialization*/
144
-  disp_drv.flush_cb = my_disp_flush; /*Set your driver function*/
145
-  disp_drv.buffer = &disp_buf;    /*Assign the buffer to the display*/
146
-  lv_disp_drv_register(&disp_drv);  /*Finally register the driver*/
144
+  lv_disp_drv_t disp_drv;     // Descriptor of a display driver
145
+  lv_disp_drv_init(&disp_drv);    // Basic initialization
146
+  disp_drv.flush_cb = my_disp_flush; // Set your driver function
147
+  disp_drv.buffer = &disp_buf;    // Assign the buffer to the display
148
+  lv_disp_drv_register(&disp_drv);  // Finally register the driver
147
 
149
 
148
   lv_indev_drv_t indev_drv;
150
   lv_indev_drv_t indev_drv;
149
-  lv_indev_drv_init(&indev_drv);     /*Descriptor of a input device driver*/
150
-  indev_drv.type = LV_INDEV_TYPE_POINTER; /*Touch pad is a pointer-like device*/
151
-  indev_drv.read_cb = my_touchpad_read;  /*Set your driver function*/
152
-  lv_indev_drv_register(&indev_drv);   /*Finally register the driver*/
151
+  lv_indev_drv_init(&indev_drv);     // Descriptor of a input device driver
152
+  indev_drv.type = LV_INDEV_TYPE_POINTER; // Touch pad is a pointer-like device
153
+  indev_drv.read_cb = my_touchpad_read;  // Set your driver function
154
+  lv_indev_drv_register(&indev_drv);   // Finally register the driver
153
 
155
 
154
   #if HAS_ROTARY_ENCODER
156
   #if HAS_ROTARY_ENCODER
155
     g = lv_group_create();
157
     g = lv_group_create();
193
 
195
 
194
   lv_encoder_pin_init();
196
   lv_encoder_pin_init();
195
 
197
 
198
+  TERN_(MKS_WIFI_MODULE, mks_wifi_firmware_update());
199
+
196
   bool ready = true;
200
   bool ready = true;
197
   #if ENABLED(POWER_LOSS_RECOVERY)
201
   #if ENABLED(POWER_LOSS_RECOVERY)
198
     recovery.load();
202
     recovery.load();
212
     }
216
     }
213
   #endif
217
   #endif
214
 
218
 
215
-  if (ready) {
216
-    lv_draw_ready_print();
217
-  }
219
+  if (ready) lv_draw_ready_print();
218
 
220
 
219
-  if (mks_test_flag == 0x1E)
220
-    mks_gpio_test();
221
+  if (mks_test_flag == 0x1E) mks_gpio_test();
221
 }
222
 }
222
 
223
 
223
 void my_disp_flush(lv_disp_drv_t * disp, const lv_area_t * area, lv_color_t * color_p) {
224
 void my_disp_flush(lv_disp_drv_t * disp, const lv_area_t * area, lv_color_t * color_p) {
229
   for (uint16_t i = 0; i < height; i++)
230
   for (uint16_t i = 0; i < height; i++)
230
     SPI_TFT.tftio.WriteSequence((uint16_t*)(color_p + width * i), width);
231
     SPI_TFT.tftio.WriteSequence((uint16_t*)(color_p + width * i), width);
231
 
232
 
232
-  lv_disp_flush_ready(disp);       /* Indicate you are ready with the flushing*/
233
+  lv_disp_flush_ready(disp); // Indicate you are ready with the flushing
234
+
235
+  W25QXX.init(SPI_QUARTER_SPEED);
236
+}
233
 
237
 
238
+void lv_fill_rect(lv_coord_t x1, lv_coord_t y1, lv_coord_t x2, lv_coord_t y2, lv_color_t bk_color) {
239
+  uint16_t width, height;
240
+  width = x2 - x1 + 1;
241
+  height = y2 - y1 + 1;
242
+  SPI_TFT.setWindow((uint16_t)x1, (uint16_t)y1, width, height);
243
+  SPI_TFT.tftio.WriteMultiple(bk_color.full, width * height);
234
   W25QXX.init(SPI_QUARTER_SPEED);
244
   W25QXX.init(SPI_QUARTER_SPEED);
235
 }
245
 }
236
 
246
 
298
 lv_indev_state_t state = LV_INDEV_STATE_REL;
308
 lv_indev_state_t state = LV_INDEV_STATE_REL;
299
 
309
 
300
 bool my_mousewheel_read(lv_indev_drv_t * indev_drv, lv_indev_data_t * data) {
310
 bool my_mousewheel_read(lv_indev_drv_t * indev_drv, lv_indev_data_t * data) {
301
-  (void) indev_drv;   /*Unused*/
311
+  (void) indev_drv;   // Unused
302
 
312
 
303
   data->state = state;
313
   data->state = state;
304
   data->enc_diff = enc_diff;
314
   data->enc_diff = enc_diff;
305
   enc_diff = 0;
315
   enc_diff = 0;
306
 
316
 
307
-  return false;       /*No more data to read so return false*/
317
+  return false;       // No more data to read so return false
308
 }
318
 }
309
 
319
 
310
 extern uint8_t currentFlashPage;
320
 extern uint8_t currentFlashPage;
327
 
337
 
328
 lv_fs_res_t spi_flash_close_cb (lv_fs_drv_t * drv, void * file_p) {
338
 lv_fs_res_t spi_flash_close_cb (lv_fs_drv_t * drv, void * file_p) {
329
   lv_fs_res_t res = LV_FS_RES_OK;
339
   lv_fs_res_t res = LV_FS_RES_OK;
330
-  /* Add your code here*/
340
+  /* Add your code here */
331
   pic_read_addr_offset = pic_read_base_addr;
341
   pic_read_addr_offset = pic_read_base_addr;
332
   return res;
342
   return res;
333
 }
343
 }
379
 }
389
 }
380
 
390
 
381
 lv_fs_res_t sd_close_cb (lv_fs_drv_t * drv, void * file_p) {
391
 lv_fs_res_t sd_close_cb (lv_fs_drv_t * drv, void * file_p) {
382
-  /* Add your code here*/
392
+  /* Add your code here */
383
   lv_close_gcode_file();
393
   lv_close_gcode_file();
384
   return LV_FS_RES_OK;
394
   return LV_FS_RES_OK;
385
 }
395
 }

+ 5
- 1
Marlin/src/lcd/extui/lib/mks_ui/tft_lvgl_configuration.h View File

33
 #include <lvgl.h>
33
 #include <lvgl.h>
34
 
34
 
35
 //#define TFT_ROTATION TFT_ROTATE_180
35
 //#define TFT_ROTATION TFT_ROTATE_180
36
-#define MKS_WIFI_MODULE 0
36
+
37
+extern uint8_t bmp_public_buf[14 * 1024];
38
+extern uint8_t public_buf[513];
37
 
39
 
38
 extern uint8_t bmp_public_buf[14 * 1024];
40
 extern uint8_t bmp_public_buf[14 * 1024];
39
 extern uint8_t public_buf[513];
41
 extern uint8_t public_buf[513];
63
 extern lv_fs_res_t sd_seek_cb(lv_fs_drv_t * drv, void * file_p, uint32_t pos);
65
 extern lv_fs_res_t sd_seek_cb(lv_fs_drv_t * drv, void * file_p, uint32_t pos);
64
 extern lv_fs_res_t sd_tell_cb(lv_fs_drv_t * drv, void * file_p, uint32_t * pos_p);
66
 extern lv_fs_res_t sd_tell_cb(lv_fs_drv_t * drv, void * file_p, uint32_t * pos_p);
65
 
67
 
68
+extern void lv_fill_rect(lv_coord_t x1, lv_coord_t y1, lv_coord_t x2, lv_coord_t y2, lv_color_t bk_color);
69
+
66
 #ifdef __cplusplus
70
 #ifdef __cplusplus
67
   } /* C-declarations for C++ */
71
   } /* C-declarations for C++ */
68
 #endif
72
 #endif

+ 286
- 12
Marlin/src/lcd/extui/lib/mks_ui/tft_multi_language.cpp View File

136
     machine_menu.ProbeZspeed          = PROBE_Z_SPEED_CN;
136
     machine_menu.ProbeZspeed          = PROBE_Z_SPEED_CN;
137
     machine_menu.enable               = ENABLE_CN;
137
     machine_menu.enable               = ENABLE_CN;
138
     machine_menu.disable              = DISABLE_CN;
138
     machine_menu.disable              = DISABLE_CN;
139
+    machine_menu.locked               = LOCKED_CN;
139
     machine_menu.z_min                = Z_MIN_CN;
140
     machine_menu.z_min                = Z_MIN_CN;
140
     machine_menu.z_max                = Z_MAX_CN;
141
     machine_menu.z_max                = Z_MAX_CN;
141
 
142
 
363
     machine_menu.ProbeZspeed          = PROBE_Z_SPEED_T_CN;
364
     machine_menu.ProbeZspeed          = PROBE_Z_SPEED_T_CN;
364
     machine_menu.enable               = ENABLE_T_CN;
365
     machine_menu.enable               = ENABLE_T_CN;
365
     machine_menu.disable              = DISABLE_T_CN;
366
     machine_menu.disable              = DISABLE_T_CN;
367
+    machine_menu.locked               = LOCKED_T_CN;
366
     machine_menu.z_min                = Z_MIN_T_CN;
368
     machine_menu.z_min                = Z_MIN_T_CN;
367
     machine_menu.z_max                = Z_MAX_T_CN;
369
     machine_menu.z_max                = Z_MAX_T_CN;
368
 
370
 
591
     machine_menu.ProbeZspeed          = PROBE_Z_SPEED_EN;
593
     machine_menu.ProbeZspeed          = PROBE_Z_SPEED_EN;
592
     machine_menu.enable               = ENABLE_EN;
594
     machine_menu.enable               = ENABLE_EN;
593
     machine_menu.disable              = DISABLE_EN;
595
     machine_menu.disable              = DISABLE_EN;
596
+    machine_menu.locked               = LOCKED_EN;
594
     machine_menu.z_min                = Z_MIN_EN;
597
     machine_menu.z_min                = Z_MIN_EN;
595
     machine_menu.z_max                = Z_MAX_EN;
598
     machine_menu.z_max                = Z_MAX_EN;
596
 
599
 
941
       filesys_menu.sd_sys  = SD_CARD_TEXT_CN;
944
       filesys_menu.sd_sys  = SD_CARD_TEXT_CN;
942
       filesys_menu.usb_sys = U_DISK_TEXT_CN;
945
       filesys_menu.usb_sys = U_DISK_TEXT_CN;
943
       //
946
       //
944
-      more_menu.title       = TITLE_MORE_CN;
947
+      more_menu.title = TITLE_MORE_CN;
948
+      #if ENABLED(USER_CMD_1_ENABLE)
949
+        more_menu.custom1 = MORE_CUSTOM1_TEXT_CN;
950
+      #endif
951
+      #if ENABLED(USER_CMD_2_ENABLE)
952
+        more_menu.custom2 = MORE_CUSTOM2_TEXT_CN;
953
+      #endif
954
+      #if ENABLED(USER_CMD_3_ENABLE)
955
+        more_menu.custom3 = MORE_CUSTOM3_TEXT_CN;
956
+      #endif
957
+      #if ENABLED(USER_CMD_4_ENABLE)
958
+        more_menu.custom4 = MORE_CUSTOM4_TEXT_CN;
959
+      #endif
960
+      #if ENABLED(USER_CMD_5_ENABLE)
961
+        more_menu.custom5 = MORE_CUSTOM5_TEXT_CN;
962
+      #endif
963
+      #if ENABLED(USER_CMD_6_ENABLE)
964
+        more_menu.custom6 = MORE_CUSTOM6_TEXT_CN;
965
+      #endif
966
+      #if ENABLED(USER_CMD_7_ENABLE)
967
+        more_menu.custom7 = MORE_CUSTOM7_TEXT_CN;
968
+      #endif
945
       // WIFI
969
       // WIFI
946
       wifi_menu.title = WIFI_TEXT;
970
       wifi_menu.title = WIFI_TEXT;
947
       wifi_menu.cloud     = CLOUD_TEXT_CN;
971
       wifi_menu.cloud     = CLOUD_TEXT_CN;
953
       cloud_menu.unbind       = CLOUD_UNBIND_CN;
977
       cloud_menu.unbind       = CLOUD_UNBIND_CN;
954
       cloud_menu.unbinding    = CLOUD_UNBINDED_CN;
978
       cloud_menu.unbinding    = CLOUD_UNBINDED_CN;
955
       cloud_menu.disconnected = CLOUD_DISCONNECTED_CN;
979
       cloud_menu.disconnected = CLOUD_DISCONNECTED_CN;
980
+      cloud_menu.unbinded     = CLOUD_UNBINDED_CN;
956
       cloud_menu.disable      = CLOUD_DISABLE_CN;
981
       cloud_menu.disable      = CLOUD_DISABLE_CN;
957
       //
982
       //
958
       about_menu.title   = ABOUT_TEXT_CN;
983
       about_menu.title   = ABOUT_TEXT_CN;
1166
             filesys_menu.sd_sys   = SD_CARD_TEXT_T_CN;
1191
             filesys_menu.sd_sys   = SD_CARD_TEXT_T_CN;
1167
             filesys_menu.usb_sys  = U_DISK_TEXT_T_CN;
1192
             filesys_menu.usb_sys  = U_DISK_TEXT_T_CN;
1168
             //
1193
             //
1169
-            more_menu.title       = TITLE_MORE_T_CN;
1194
+            more_menu.title     = TITLE_MORE_T_CN;
1195
+            #if ENABLED(USER_CMD_1_ENABLE)
1196
+              more_menu.custom1 = MORE_CUSTOM1_TEXT_T_CN;
1197
+            #endif
1198
+            #if ENABLED(USER_CMD_2_ENABLE)
1199
+              more_menu.custom2 = MORE_CUSTOM2_TEXT_T_CN;
1200
+            #endif
1201
+            #if ENABLED(USER_CMD_3_ENABLE)
1202
+              more_menu.custom3 = MORE_CUSTOM3_TEXT_T_CN;
1203
+            #endif
1204
+            #if ENABLED(USER_CMD_4_ENABLE)
1205
+              more_menu.custom4 = MORE_CUSTOM4_TEXT_T_CN;
1206
+            #endif
1207
+            #if ENABLED(USER_CMD_5_ENABLE)
1208
+              more_menu.custom5 = MORE_CUSTOM5_TEXT_T_CN;
1209
+            #endif
1210
+            #if ENABLED(USER_CMD_6_ENABLE)
1211
+              more_menu.custom6 = MORE_CUSTOM6_TEXT_T_CN;
1212
+            #endif
1213
+            #if ENABLED(USER_CMD_7_ENABLE)
1214
+              more_menu.custom7 = MORE_CUSTOM7_TEXT_T_CN;
1215
+            #endif
1170
             // WIFI
1216
             // WIFI
1171
-            wifi_menu.title = WIFI_TEXT;
1217
+            wifi_menu.title     = WIFI_TEXT;
1172
             wifi_menu.cloud     = CLOUD_TEXT_T_CN;
1218
             wifi_menu.cloud     = CLOUD_TEXT_T_CN;
1173
             wifi_menu.reconnect = WIFI_RECONNECT_TEXT_T_CN;
1219
             wifi_menu.reconnect = WIFI_RECONNECT_TEXT_T_CN;
1174
             // CLOUD
1220
             // CLOUD
1178
             cloud_menu.unbind       = CLOUD_UNBIND_T_CN;
1224
             cloud_menu.unbind       = CLOUD_UNBIND_T_CN;
1179
             cloud_menu.unbinding    = CLOUD_UNBINDED_T_CN;
1225
             cloud_menu.unbinding    = CLOUD_UNBINDED_T_CN;
1180
             cloud_menu.disconnected = CLOUD_DISCONNECTED_T_CN;
1226
             cloud_menu.disconnected = CLOUD_DISCONNECTED_T_CN;
1227
+            cloud_menu.unbinded     = CLOUD_UNBINDED_T_CN;
1181
             cloud_menu.disable      = CLOUD_DISABLE_T_CN;
1228
             cloud_menu.disable      = CLOUD_DISABLE_T_CN;
1182
             //
1229
             //
1183
             about_menu.title   = ABOUT_TEXT_T_CN;
1230
             about_menu.title   = ABOUT_TEXT_T_CN;
1334
             preheat_menu.hotbed       = HEATBED_TEXT_EN;
1381
             preheat_menu.hotbed       = HEATBED_TEXT_EN;
1335
             preheat_menu.off          = CLOSE_TEXT_EN;
1382
             preheat_menu.off          = CLOSE_TEXT_EN;
1336
             //
1383
             //
1337
-            move_menu.title = TITLE_MOVE_EN;
1384
+            move_menu.title    = TITLE_MOVE_EN;
1338
             //
1385
             //
1339
             home_menu.title    = TITLE_HOME_EN;
1386
             home_menu.title    = TITLE_HOME_EN;
1340
             home_menu.stopmove = HOME_STOPMOVE_EN;
1387
             home_menu.stopmove = HOME_STOPMOVE_EN;
1377
             set_menu.machine_para = MACHINE_PARA_EN;
1424
             set_menu.machine_para = MACHINE_PARA_EN;
1378
             set_menu.eepromSet    = EEPROM_SETTINGS_EN;
1425
             set_menu.eepromSet    = EEPROM_SETTINGS_EN;
1379
             more_menu.title       = TITLE_MORE_EN;
1426
             more_menu.title       = TITLE_MORE_EN;
1427
+            #if ENABLED(USER_CMD_1_ENABLE)
1428
+              more_menu.custom1 = MORE_CUSTOM1_TEXT_EN;
1429
+            #endif
1430
+            #if ENABLED(USER_CMD_2_ENABLE)
1431
+              more_menu.custom2 = MORE_CUSTOM2_TEXT_EN;
1432
+            #endif
1433
+            #if ENABLED(USER_CMD_3_ENABLE)
1434
+              more_menu.custom3 = MORE_CUSTOM3_TEXT_EN;
1435
+            #endif
1436
+            #if ENABLED(USER_CMD_4_ENABLE)
1437
+              more_menu.custom4 = MORE_CUSTOM4_TEXT_EN;
1438
+            #endif
1439
+            #if ENABLED(USER_CMD_5_ENABLE)
1440
+              more_menu.custom5 = MORE_CUSTOM5_TEXT_EN;
1441
+            #endif
1442
+            #if ENABLED(USER_CMD_6_ENABLE)
1443
+              more_menu.custom6 = MORE_CUSTOM6_TEXT_EN;
1444
+            #endif
1445
+            #if ENABLED(USER_CMD_7_ENABLE)
1446
+              more_menu.custom7 = MORE_CUSTOM7_TEXT_EN;
1447
+            #endif
1448
+
1380
             //
1449
             //
1381
             filesys_menu.title   = TITLE_FILESYS_EN;
1450
             filesys_menu.title   = TITLE_FILESYS_EN;
1382
             filesys_menu.sd_sys  = SD_CARD_TEXT_EN;
1451
             filesys_menu.sd_sys  = SD_CARD_TEXT_EN;
1383
             filesys_menu.usb_sys = U_DISK_TEXT_EN;
1452
             filesys_menu.usb_sys = U_DISK_TEXT_EN;
1384
             // WIFI
1453
             // WIFI
1385
-            wifi_menu.title = WIFI_TEXT;
1454
+            wifi_menu.title     = WIFI_TEXT;
1386
             wifi_menu.cloud     = CLOUD_TEXT_EN;
1455
             wifi_menu.cloud     = CLOUD_TEXT_EN;
1387
             wifi_menu.reconnect = WIFI_RECONNECT_TEXT_EN;
1456
             wifi_menu.reconnect = WIFI_RECONNECT_TEXT_EN;
1388
 
1457
 
1392
             cloud_menu.unbind       = CLOUD_UNBIND_EN;
1461
             cloud_menu.unbind       = CLOUD_UNBIND_EN;
1393
             cloud_menu.unbinding    = CLOUD_UNBINDED_EN;
1462
             cloud_menu.unbinding    = CLOUD_UNBINDED_EN;
1394
             cloud_menu.disconnected = CLOUD_DISCONNECTED_EN;
1463
             cloud_menu.disconnected = CLOUD_DISCONNECTED_EN;
1464
+            cloud_menu.unbinded     = CLOUD_UNBINDED_EN;
1395
             cloud_menu.disable      = CLOUD_DISABLE_EN;
1465
             cloud_menu.disable      = CLOUD_DISABLE_EN;
1396
             //
1466
             //
1397
             about_menu.title   = TITLE_ABOUT_EN;
1467
             about_menu.title   = TITLE_ABOUT_EN;
1545
             preheat_menu.hotbed       = HEATBED_TEXT_RU;
1615
             preheat_menu.hotbed       = HEATBED_TEXT_RU;
1546
             preheat_menu.off          = CLOSE_TEXT_RU;
1616
             preheat_menu.off          = CLOSE_TEXT_RU;
1547
             //
1617
             //
1548
-            move_menu.title = MOVE_TEXT_RU;
1618
+            move_menu.title    = MOVE_TEXT_RU;
1549
             //
1619
             //
1550
             home_menu.title    = TITLE_HOME_RU;
1620
             home_menu.title    = TITLE_HOME_RU;
1551
             home_menu.stopmove = HOME_STOPMOVE_RU;
1621
             home_menu.stopmove = HOME_STOPMOVE_RU;
1588
             set_menu.machine_para = MACHINE_PARA_RU;
1658
             set_menu.machine_para = MACHINE_PARA_RU;
1589
             set_menu.eepromSet    = EEPROM_SETTINGS_RU;
1659
             set_menu.eepromSet    = EEPROM_SETTINGS_RU;
1590
             more_menu.title       = TITLE_MORE_RU;
1660
             more_menu.title       = TITLE_MORE_RU;
1661
+            #if ENABLED(USER_CMD_1_ENABLE)
1662
+              more_menu.custom1 = MORE_CUSTOM1_TEXT_RU;
1663
+            #endif
1664
+            #if ENABLED(USER_CMD_2_ENABLE)
1665
+              more_menu.custom2 = MORE_CUSTOM2_TEXT_RU;
1666
+            #endif
1667
+            #if ENABLED(USER_CMD_3_ENABLE)
1668
+              more_menu.custom3 = MORE_CUSTOM3_TEXT_RU;
1669
+            #endif
1670
+            #if ENABLED(USER_CMD_4_ENABLE)
1671
+              more_menu.custom4 = MORE_CUSTOM4_TEXT_RU;
1672
+            #endif
1673
+            #if ENABLED(USER_CMD_5_ENABLE)
1674
+              more_menu.custom5 = MORE_CUSTOM5_TEXT_RU;
1675
+            #endif
1676
+            #if ENABLED(USER_CMD_6_ENABLE)
1677
+              more_menu.custom6 = MORE_CUSTOM6_TEXT_RU;
1678
+            #endif
1679
+            #if ENABLED(USER_CMD_7_ENABLE)
1680
+              more_menu.custom7 = MORE_CUSTOM7_TEXT_RU;
1681
+            #endif
1591
             //
1682
             //
1592
             filesys_menu.title   = TITLE_FILESYS_RU;
1683
             filesys_menu.title   = TITLE_FILESYS_RU;
1593
             filesys_menu.sd_sys  = SD_CARD_TEXT_RU;
1684
             filesys_menu.sd_sys  = SD_CARD_TEXT_RU;
1594
             filesys_menu.usb_sys = U_DISK_TEXT_RU;
1685
             filesys_menu.usb_sys = U_DISK_TEXT_RU;
1595
             // WIFI
1686
             // WIFI
1596
-            wifi_menu.title = WIFI_TEXT;
1687
+            wifi_menu.title     = WIFI_TEXT;
1597
             wifi_menu.cloud     = CLOUD_TEXT_RU;
1688
             wifi_menu.cloud     = CLOUD_TEXT_RU;
1598
             wifi_menu.reconnect = WIFI_RECONNECT_TEXT_RU;
1689
             wifi_menu.reconnect = WIFI_RECONNECT_TEXT_RU;
1599
 
1690
 
1691
+            machine_menu.next          = NEXT_RU;
1692
+            machine_menu.previous      = PREVIOUS_RU;
1693
+            machine_menu.enable        = ENABLE_RU;
1694
+            machine_menu.disable       = DISABLE_RU;
1695
+            machine_menu.key_confirm   = KEY_CONFIRM_RU;
1696
+
1697
+            MachinePara_menu.MachineSetting    = MACHINE_TYPE_CNOFIG_RU;
1698
+            MachinePara_menu.title             = MACHINE_PARA_TITLE_RU;
1699
+            machine_menu.MachineConfigTitle    = MACHINE_CONFIG_TITLE_RU;
1700
+            MachinePara_menu.MotorSetting      = MOTOR_CONFIG_RU;
1701
+            MachinePara_menu.leveling          = MACHINE_LEVELING_CONFIG_RU;
1702
+            MachinePara_menu.AdvanceSetting    = ADVANCE_CONFIG_RU;
1703
+            machine_menu.MotorConfTitle        = MOTOR_CONF_TITLE_RU;
1704
+            machine_menu.MaxFeedRateConf       = MAXFEEDRATE_CONF_RU;
1705
+            machine_menu.AccelerationConf      = ACCELERATION_CONF_RU;
1706
+            machine_menu.JerkConf              = JERKCONF_RU;
1707
+            machine_menu.StepsConf             = STEPSCONF_RU;
1708
+            machine_menu.TMCcurrentConf        = TMC_CURRENT_RU;
1709
+            machine_menu.TMCStepModeConf       = TMC_STEP_MODE_RU;
1710
+            machine_menu.PausePosition         = PAUSE_POSITION_RU;
1711
+            machine_menu.FilamentConf          = MACHINE_FILAMENT_CONFIG_RU;
1712
+            machine_menu.EncoderSettings       = ENCODER_SETTINGS_RU;
1713
+            machine_menu.AdvancedConfTitle     = ADVANCED_CONF_TITLE_RU;
1714
+
1715
+            machine_menu.LevelingParaConfTitle   = LEVELING_CONF_TITLE_RU;
1716
+            machine_menu.LevelingParaConf        = LEVELING_PARA_CONF_RU;
1717
+            machine_menu.LevelingManuPosConf     = LEVELING_MANUAL_POS_RU;
1718
+            machine_menu.LevelingAutoCommandConf = LEVELING_AUTO_COMMAND_RU;
1719
+            machine_menu.LevelingAutoZoffsetConf = LEVELING_AUTO_ZOFFSET_RU;
1720
+
1721
+            machine_menu.AccelerationConfTitle = ACCELERATION_CONF_TITLE_RU;
1722
+            machine_menu.PrintAcceleration     = PRINT_ACCELERATION_RU;
1723
+            machine_menu.RetractAcceleration   = RETRACT_ACCELERATION_RU;
1724
+            machine_menu.TravelAcceleration    = TRAVEL_ACCELERATION_RU;
1725
+            machine_menu.X_Acceleration        = X_ACCELERATION_RU;
1726
+            machine_menu.Y_Acceleration        = Y_ACCELERATION_RU;
1727
+            machine_menu.Z_Acceleration        = Z_ACCELERATION_RU;
1728
+            machine_menu.E0_Acceleration       = E0_ACCELERATION_RU;
1729
+            machine_menu.E1_Acceleration       = E1_ACCELERATION_RU;
1730
+
1731
+            machine_menu.MaxFeedRateConfTitle = MAXFEEDRATE_CONF_TITLE_RU;
1732
+            machine_menu.XMaxFeedRate         = X_MAXFEEDRATE_RU;
1733
+            machine_menu.YMaxFeedRate         = Y_MAXFEEDRATE_RU;
1734
+            machine_menu.ZMaxFeedRate         = Z_MAXFEEDRATE_RU;
1735
+            machine_menu.E0MaxFeedRate        = E0_MAXFEEDRATE_RU;
1736
+            machine_menu.E1MaxFeedRate        = E1_MAXFEEDRATE_RU;
1737
+
1738
+            machine_menu.JerkConfTitle = JERK_CONF_TITLE_RU;
1739
+            machine_menu.X_Jerk        = X_JERK_RU;
1740
+            machine_menu.Y_Jerk        = Y_JERK_RU;
1741
+            machine_menu.Z_Jerk        = Z_JERK_RU;
1742
+            machine_menu.E_Jerk        = E_JERK_RU;
1743
+
1744
+            machine_menu.StepsConfTitle = STEPS_CONF_TITLE_RU;
1745
+            machine_menu.X_Steps        = X_STEPS_RU;
1746
+            machine_menu.Y_Steps        = Y_STEPS_RU;
1747
+            machine_menu.Z_Steps        = Z_STEPS_RU;
1748
+            machine_menu.E0_Steps       = E0_STEPS_RU;
1749
+            machine_menu.E1_Steps       = E1_STEPS_RU;
1750
+
1751
+            machine_menu.TmcCurrentConfTitle = TMC_CURRENT_CONF_TITLE_RU;
1752
+            machine_menu.X_Current           = X_TMC_CURRENT_RU;
1753
+            machine_menu.Y_Current           = Y_TMC_CURRENT_RU;
1754
+            machine_menu.Z_Current           = Z_TMC_CURRENT_RU;
1755
+            machine_menu.E0_Current          = E0_TMC_CURRENT_RU;
1756
+            machine_menu.E1_Current          = E1_TMC_CURRENT_RU;
1757
+
1758
+            machine_menu.TmcStepModeConfTitle = TMC_MODE_CONF_TITLE_RU;
1759
+            machine_menu.X_StepMode           = X_TMC_MODE_RU;
1760
+            machine_menu.Y_StepMode           = Y_TMC_MODE_RU;
1761
+            machine_menu.Z_StepMode           = Z_TMC_MODE_RU;
1762
+            machine_menu.E0_StepMode          = E0_TMC_MODE_RU;
1763
+            machine_menu.E1_StepMode          = E1_TMC_MODE_RU;
1764
+
1765
+            machine_menu.PausePosText   = PAUSE_POSITION_RU;
1766
+            machine_menu.xPos           = PAUSE_POSITION_X_RU;
1767
+            machine_menu.yPos           = PAUSE_POSITION_Y_RU;
1768
+            machine_menu.zPos           = PAUSE_POSITION_Z_RU;
1769
+
1770
+            machine_menu.OffsetConfTitle = OFFSET_TITLE_RU;
1771
+            machine_menu.Xoffset         = OFFSET_X_RU;
1772
+            machine_menu.Yoffset         = OFFSET_Y_RU;
1773
+            machine_menu.Zoffset         = OFFSET_Z_RU;
1774
+
1775
+            machine_menu.FilamentConfTitle   = FILAMENT_CONF_TITLE_RU;
1776
+            machine_menu.InLength            = FILAMENT_IN_LENGTH_RU;
1777
+            machine_menu.InSpeed             = FILAMENT_IN_SPEED_RU;
1778
+            machine_menu.FilamentTemperature = FILAMENT_TEMPERATURE_RU;
1779
+            machine_menu.OutLength           = FILAMENT_OUT_LENGTH_RU;
1780
+            machine_menu.OutSpeed            = FILAMENT_OUT_SPEED_RU;
1781
+
1782
+            machine_menu.EncoderConfTitle    = ENCODER_CONF_TITLE_RU;
1783
+            machine_menu.EncoderConfText     = ENCODER_CONF_TEXT_RU;
1784
+
1600
             cloud_menu.title        = TITLE_CLOUD_TEXT_RU;
1785
             cloud_menu.title        = TITLE_CLOUD_TEXT_RU;
1601
             cloud_menu.bind         = CLOUD_BINDED_RU;
1786
             cloud_menu.bind         = CLOUD_BINDED_RU;
1602
             cloud_menu.binded       = CLOUD_BINDED_RU;
1787
             cloud_menu.binded       = CLOUD_BINDED_RU;
1603
             cloud_menu.unbind       = CLOUD_UNBIND_RU;
1788
             cloud_menu.unbind       = CLOUD_UNBIND_RU;
1604
             cloud_menu.unbinding    = CLOUD_UNBINDED_RU;
1789
             cloud_menu.unbinding    = CLOUD_UNBINDED_RU;
1605
             cloud_menu.disconnected = CLOUD_DISCONNECTED_RU;
1790
             cloud_menu.disconnected = CLOUD_DISCONNECTED_RU;
1791
+            cloud_menu.unbinded     = CLOUD_UNBINDED_RU;
1606
             cloud_menu.disable      = CLOUD_DISABLE_RU;
1792
             cloud_menu.disable      = CLOUD_DISABLE_RU;
1607
             //
1793
             //
1608
             about_menu.title   = ABOUT_TEXT_RU;
1794
             about_menu.title   = ABOUT_TEXT_RU;
1802
             set_menu.machine_para = MACHINE_PARA_SP;
1988
             set_menu.machine_para = MACHINE_PARA_SP;
1803
             set_menu.eepromSet    = EEPROM_SETTINGS_SP;
1989
             set_menu.eepromSet    = EEPROM_SETTINGS_SP;
1804
             more_menu.title       = TITLE_MORE_SP;
1990
             more_menu.title       = TITLE_MORE_SP;
1991
+            #if ENABLED(USER_CMD_1_ENABLE)
1992
+              more_menu.custom1 = MORE_CUSTOM1_TEXT_SP;
1993
+            #endif
1994
+            #if ENABLED(USER_CMD_2_ENABLE)
1995
+              more_menu.custom2 = MORE_CUSTOM2_TEXT_SP;
1996
+            #endif
1997
+            #if ENABLED(USER_CMD_3_ENABLE)
1998
+              more_menu.custom3 = MORE_CUSTOM3_TEXT_SP;
1999
+            #endif
2000
+            #if ENABLED(USER_CMD_4_ENABLE)
2001
+              more_menu.custom4 = MORE_CUSTOM4_TEXT_SP;
2002
+            #endif
2003
+            #if ENABLED(USER_CMD_5_ENABLE)
2004
+              more_menu.custom5 = MORE_CUSTOM5_TEXT_SP;
2005
+            #endif
2006
+            #if ENABLED(USER_CMD_6_ENABLE)
2007
+              more_menu.custom6 = MORE_CUSTOM6_TEXT_SP;
2008
+            #endif
2009
+            #if ENABLED(USER_CMD_7_ENABLE)
2010
+              more_menu.custom7 = MORE_CUSTOM7_TEXT_SP;
2011
+            #endif
1805
             //
2012
             //
1806
             filesys_menu.title   = TITLE_FILESYS_SP;
2013
             filesys_menu.title   = TITLE_FILESYS_SP;
1807
             filesys_menu.sd_sys  = SD_CARD_TEXT_SP;
2014
             filesys_menu.sd_sys  = SD_CARD_TEXT_SP;
1808
             filesys_menu.usb_sys = U_DISK_TEXT_SP;
2015
             filesys_menu.usb_sys = U_DISK_TEXT_SP;
1809
 
2016
 
1810
             // WIFI
2017
             // WIFI
1811
-            wifi_menu.title = WIFI_TEXT;
2018
+            wifi_menu.title     = WIFI_TEXT;
1812
             wifi_menu.cloud     = CLOUD_TEXT_SP;
2019
             wifi_menu.cloud     = CLOUD_TEXT_SP;
1813
             wifi_menu.reconnect = WIFI_RECONNECT_TEXT_SP;
2020
             wifi_menu.reconnect = WIFI_RECONNECT_TEXT_SP;
1814
 
2021
 
1818
             cloud_menu.unbind       = CLOUD_UNBIND_SP;
2025
             cloud_menu.unbind       = CLOUD_UNBIND_SP;
1819
             cloud_menu.unbinding    = CLOUD_UNBINDED_SP;
2026
             cloud_menu.unbinding    = CLOUD_UNBINDED_SP;
1820
             cloud_menu.disconnected = CLOUD_DISCONNECTED_SP;
2027
             cloud_menu.disconnected = CLOUD_DISCONNECTED_SP;
2028
+            cloud_menu.unbinded     = CLOUD_UNBINDED_SP;
1821
             cloud_menu.disable      = CLOUD_DISABLE_SP;
2029
             cloud_menu.disable      = CLOUD_DISABLE_SP;
1822
             //
2030
             //
1823
             about_menu.title   = ABOUT_TEXT_SP;
2031
             about_menu.title   = ABOUT_TEXT_SP;
2015
           set_menu.machine_para = MACHINE_PARA_FR;
2223
           set_menu.machine_para = MACHINE_PARA_FR;
2016
           set_menu.eepromSet    = EEPROM_SETTINGS_FR;
2224
           set_menu.eepromSet    = EEPROM_SETTINGS_FR;
2017
           more_menu.title       = TITLE_MORE_FR;
2225
           more_menu.title       = TITLE_MORE_FR;
2226
+          #if ENABLED(USER_CMD_1_ENABLE)
2227
+            more_menu.custom1 = MORE_CUSTOM1_TEXT_FR;
2228
+          #endif
2229
+          #if ENABLED(USER_CMD_2_ENABLE)
2230
+            more_menu.custom2 = MORE_CUSTOM2_TEXT_FR;
2231
+          #endif
2232
+          #if ENABLED(USER_CMD_3_ENABLE)
2233
+            more_menu.custom3 = MORE_CUSTOM3_TEXT_FR;
2234
+          #endif
2235
+          #if ENABLED(USER_CMD_4_ENABLE)
2236
+            more_menu.custom4 = MORE_CUSTOM4_TEXT_FR;
2237
+          #endif
2238
+          #if ENABLED(USER_CMD_5_ENABLE)
2239
+            more_menu.custom5 = MORE_CUSTOM5_TEXT_FR;
2240
+          #endif
2241
+          #if ENABLED(USER_CMD_6_ENABLE)
2242
+            more_menu.custom6 = MORE_CUSTOM6_TEXT_FR;
2243
+          #endif
2244
+          #if ENABLED(USER_CMD_7_ENABLE)
2245
+            more_menu.custom7 = MORE_CUSTOM7_TEXT_FR;
2246
+          #endif
2018
           //
2247
           //
2019
           filesys_menu.title          = TITLE_FILESYS_FR;
2248
           filesys_menu.title          = TITLE_FILESYS_FR;
2020
           filesys_menu.sd_sys         = SD_CARD_TEXT_FR;
2249
           filesys_menu.sd_sys         = SD_CARD_TEXT_FR;
2023
           file_menu.no_file           = NO_FILE_FR;
2252
           file_menu.no_file           = NO_FILE_FR;
2024
           file_menu.no_file_and_check = NO_FILE_FR;
2253
           file_menu.no_file_and_check = NO_FILE_FR;
2025
           // WIFI
2254
           // WIFI
2026
-          wifi_menu.title = WIFI_NAME_TEXT_FR;
2255
+          wifi_menu.title     = WIFI_NAME_TEXT_FR;
2027
           wifi_menu.cloud     = CLOUD_TEXT_FR;
2256
           wifi_menu.cloud     = CLOUD_TEXT_FR;
2028
           wifi_menu.reconnect = WIFI_RECONNECT_TEXT_FR;
2257
           wifi_menu.reconnect = WIFI_RECONNECT_TEXT_FR;
2029
 
2258
 
2033
           cloud_menu.unbind       = CLOUD_UNBIND_FR;
2262
           cloud_menu.unbind       = CLOUD_UNBIND_FR;
2034
           cloud_menu.unbinding    = CLOUD_UNBINDED_FR;
2263
           cloud_menu.unbinding    = CLOUD_UNBINDED_FR;
2035
           cloud_menu.disconnected = CLOUD_DISCONNECTED_FR;
2264
           cloud_menu.disconnected = CLOUD_DISCONNECTED_FR;
2265
+          cloud_menu.unbinded     = CLOUD_UNBINDED_FR;
2036
           cloud_menu.disable      = CLOUD_DISABLE_FR;
2266
           cloud_menu.disable      = CLOUD_DISABLE_FR;
2037
           //
2267
           //
2038
           about_menu.title   = ABOUT_TEXT_FR;
2268
           about_menu.title   = ABOUT_TEXT_FR;
2229
           set_menu.machine_para = MACHINE_PARA_IT;
2459
           set_menu.machine_para = MACHINE_PARA_IT;
2230
           set_menu.eepromSet    = EEPROM_SETTINGS_IT;
2460
           set_menu.eepromSet    = EEPROM_SETTINGS_IT;
2231
           more_menu.title       = TITLE_MORE_IT;
2461
           more_menu.title       = TITLE_MORE_IT;
2462
+          #if ENABLED(USER_CMD_1_ENABLE)
2463
+            more_menu.custom1 = MORE_CUSTOM1_TEXT_IT;
2464
+          #endif
2465
+          #if ENABLED(USER_CMD_2_ENABLE)
2466
+            more_menu.custom2 = MORE_CUSTOM2_TEXT_IT;
2467
+          #endif
2468
+          #if ENABLED(USER_CMD_3_ENABLE)
2469
+            more_menu.custom3 = MORE_CUSTOM3_TEXT_IT;
2470
+          #endif
2471
+          #if ENABLED(USER_CMD_4_ENABLE)
2472
+            more_menu.custom4 = MORE_CUSTOM4_TEXT_IT;
2473
+          #endif
2474
+          #if ENABLED(USER_CMD_5_ENABLE)
2475
+            more_menu.custom5 = MORE_CUSTOM5_TEXT_IT;
2476
+          #endif
2477
+          #if ENABLED(USER_CMD_6_ENABLE)
2478
+            more_menu.custom6 = MORE_CUSTOM6_TEXT_IT;
2479
+          #endif
2480
+          #if ENABLED(USER_CMD_7_ENABLE)
2481
+            more_menu.custom7 = MORE_CUSTOM7_TEXT_IT;
2482
+          #endif
2232
           //
2483
           //
2233
           filesys_menu.title   = TITLE_FILESYS_IT;
2484
           filesys_menu.title   = TITLE_FILESYS_IT;
2234
           filesys_menu.sd_sys  = SD_CARD_TEXT_IT;
2485
           filesys_menu.sd_sys  = SD_CARD_TEXT_IT;
2235
           filesys_menu.usb_sys = U_DISK_TEXT_IT;
2486
           filesys_menu.usb_sys = U_DISK_TEXT_IT;
2236
 
2487
 
2237
           // WIFI
2488
           // WIFI
2238
-          wifi_menu.title = WIFI_NAME_TEXT_IT;
2489
+          wifi_menu.title     = WIFI_NAME_TEXT_IT;
2239
           wifi_menu.cloud     = CLOSE_TEXT_IT;
2490
           wifi_menu.cloud     = CLOSE_TEXT_IT;
2240
           wifi_menu.reconnect = WIFI_RECONNECT_TEXT_IT;
2491
           wifi_menu.reconnect = WIFI_RECONNECT_TEXT_IT;
2241
 
2492
 
2245
           cloud_menu.unbind       = CLOUD_UNBIND_IT;
2496
           cloud_menu.unbind       = CLOUD_UNBIND_IT;
2246
           cloud_menu.unbinding    = CLOUD_UNBINDED_IT;
2497
           cloud_menu.unbinding    = CLOUD_UNBINDED_IT;
2247
           cloud_menu.disconnected = CLOUD_DISCONNECTED_IT;
2498
           cloud_menu.disconnected = CLOUD_DISCONNECTED_IT;
2499
+          cloud_menu.unbinded     = CLOUD_UNBINDED_IT;
2248
           cloud_menu.disable      = CLOUD_DISABLE_IT;
2500
           cloud_menu.disable      = CLOUD_DISABLE_IT;
2249
           //
2501
           //
2250
           about_menu.title   = ABOUT_TEXT_IT;
2502
           about_menu.title   = ABOUT_TEXT_IT;
2442
       set_menu.machine_para = MACHINE_PARA_EN;
2694
       set_menu.machine_para = MACHINE_PARA_EN;
2443
       set_menu.eepromSet    = EEPROM_SETTINGS_EN;
2695
       set_menu.eepromSet    = EEPROM_SETTINGS_EN;
2444
       //
2696
       //
2445
-      more_menu.title       = TITLE_MORE_EN;
2697
+      more_menu.title     = TITLE_MORE_EN;
2698
+      #if ENABLED(USER_CMD_1_ENABLE)
2699
+        more_menu.custom1 = MORE_CUSTOM1_TEXT_EN;
2700
+      #endif
2701
+      #if ENABLED(USER_CMD_2_ENABLE)
2702
+        more_menu.custom2 = MORE_CUSTOM2_TEXT_EN;
2703
+      #endif
2704
+      #if ENABLED(USER_CMD_3_ENABLE)
2705
+        more_menu.custom3 = MORE_CUSTOM3_TEXT_EN;
2706
+      #endif
2707
+      #if ENABLED(USER_CMD_4_ENABLE)
2708
+        more_menu.custom4 = MORE_CUSTOM4_TEXT_EN;
2709
+      #endif
2710
+      #if ENABLED(USER_CMD_5_ENABLE)
2711
+        more_menu.custom5 = MORE_CUSTOM5_TEXT_EN;
2712
+      #endif
2713
+      #if ENABLED(USER_CMD_6_ENABLE)
2714
+        more_menu.custom6 = MORE_CUSTOM6_TEXT_EN;
2715
+      #endif
2716
+      #if ENABLED(USER_CMD_7_ENABLE)
2717
+        more_menu.custom7 = MORE_CUSTOM7_TEXT_EN;
2718
+      #endif
2446
       //
2719
       //
2447
       filesys_menu.title   = TITLE_FILESYS_EN;
2720
       filesys_menu.title   = TITLE_FILESYS_EN;
2448
       filesys_menu.sd_sys  = SD_CARD_TEXT_EN;
2721
       filesys_menu.sd_sys  = SD_CARD_TEXT_EN;
2449
       filesys_menu.usb_sys = U_DISK_TEXT_EN;
2722
       filesys_menu.usb_sys = U_DISK_TEXT_EN;
2450
       // WIFI
2723
       // WIFI
2451
-      wifi_menu.title = WIFI_TEXT;
2724
+      wifi_menu.title     = WIFI_TEXT;
2452
       wifi_menu.cloud     = CLOUD_TEXT_EN;
2725
       wifi_menu.cloud     = CLOUD_TEXT_EN;
2453
       wifi_menu.reconnect = WIFI_RECONNECT_TEXT_EN;
2726
       wifi_menu.reconnect = WIFI_RECONNECT_TEXT_EN;
2454
 
2727
 
2458
       cloud_menu.unbind       = CLOUD_UNBIND_EN;
2731
       cloud_menu.unbind       = CLOUD_UNBIND_EN;
2459
       cloud_menu.unbinding    = CLOUD_UNBINDED_EN;
2732
       cloud_menu.unbinding    = CLOUD_UNBINDED_EN;
2460
       cloud_menu.disconnected = CLOUD_DISCONNECTED_EN;
2733
       cloud_menu.disconnected = CLOUD_DISCONNECTED_EN;
2734
+      cloud_menu.unbinded     = CLOUD_UNBINDED_EN;
2461
       cloud_menu.disable      = CLOUD_DISABLE_EN;
2735
       cloud_menu.disable      = CLOUD_DISABLE_EN;
2462
       //
2736
       //
2463
       about_menu.title   = TITLE_ABOUT_EN;
2737
       about_menu.title   = TITLE_ABOUT_EN;

+ 19
- 11
Marlin/src/lcd/extui/lib/mks_ui/tft_multi_language.h View File

118
   const char *ProbeZspeed;
118
   const char *ProbeZspeed;
119
   const char *enable;
119
   const char *enable;
120
   const char *disable;
120
   const char *disable;
121
+  const char *locked;
121
   const char *z_min;
122
   const char *z_min;
122
   const char *z_max;
123
   const char *z_max;
123
 
124
 
456
 
457
 
457
 typedef struct more_menu_disp {
458
 typedef struct more_menu_disp {
458
   const char *title;
459
   const char *title;
460
+  const char *custom1;
461
+  const char *custom2;
462
+  const char *custom3;
463
+  const char *custom4;
464
+  const char *custom5;
465
+  const char *custom6;
466
+  const char *custom7;
459
   const char *back;
467
   const char *back;
460
 } more_menu_def;
468
 } more_menu_def;
461
 
469
 
757
 #define AXIS_Y_DEC_TEXT     "Y-"
765
 #define AXIS_Y_DEC_TEXT     "Y-"
758
 #define AXIS_Z_ADD_TEXT     "Z+"
766
 #define AXIS_Z_ADD_TEXT     "Z+"
759
 #define AXIS_Z_DEC_TEXT     "Z-"
767
 #define AXIS_Z_DEC_TEXT     "Z-"
760
-#define TEXT_001MM          "0.01mm"
761
-#define TEXT_005MM          "0.05mm"
762
-#define TEXT_01MM           "0.1mm"
763
-#define TEXT_1MM            "1mm"
764
-#define TEXT_10MM           "10mm"
768
+#define TEXT_001MM          "0.01 mm"
769
+#define TEXT_005MM          "0.05 mm"
770
+#define TEXT_01MM           "0.1 mm"
771
+#define TEXT_1MM            "1 mm"
772
+#define TEXT_10MM           "10 mm"
765
 
773
 
766
-#define EXTRUDE_1MM_TEXT    "1mm"
767
-#define EXTRUDE_5MM_TEXT    "5mm"
768
-#define EXTRUDE_10MM_TEXT   "10mm"
774
+#define EXTRUDE_1MM_TEXT    "1 mm"
775
+#define EXTRUDE_5MM_TEXT    "5 mm"
776
+#define EXTRUDE_10MM_TEXT   "10 mm"
769
 
777
 
770
 #define STEP_1PERCENT       "1%"
778
 #define STEP_1PERCENT       "1%"
771
 #define STEP_5PERCENT       "5%"
779
 #define STEP_5PERCENT       "5%"
819
 #define DIALOG_UPDATE_WIFI_WEB_EN       "Updating wifi model web data"
827
 #define DIALOG_UPDATE_WIFI_WEB_EN       "Updating wifi model web data"
820
 #define DIALOG_UPDATE_NO_DEVICE_EN      "Please check whether\nmemory device inserted!"
828
 #define DIALOG_UPDATE_NO_DEVICE_EN      "Please check whether\nmemory device inserted!"
821
 
829
 
822
-#define ZOFFSET_STEP001                 "0.01mm"
823
-#define ZOFFSET_STEP01                  "0.1mm"
824
-#define ZOFFSET_STEP1                   "1mm"
830
+#define ZOFFSET_STEP001                 "0.01 mm"
831
+#define ZOFFSET_STEP01                  "0.1 mm"
832
+#define ZOFFSET_STEP1                   "1 mm"

+ 20
- 1
Marlin/src/lcd/extui/lib/mks_ui/wifiSerial.cpp View File

55
   static void disable_timer_if_necessary(timer_dev *dev, uint8 ch) {
55
   static void disable_timer_if_necessary(timer_dev *dev, uint8 ch) {
56
     if (dev) timer_set_mode(dev, ch, TIMER_DISABLED);
56
     if (dev) timer_set_mode(dev, ch, TIMER_DISABLED);
57
   }
57
   }
58
+  static void usart_enable_no_irq(usart_dev *usart_device, bool with_irq) {
59
+    if (with_irq) usart_enable(usart_device);
60
+    else {
61
+      usart_reg_map *regs = usart_device->regs;
62
+	    regs->CR1 |= (USART_CR1_TE | USART_CR1_RE);// don't change the word length etc, and 'or' in the patten not overwrite |USART_CR1_M_8N1);
63
+      regs->CR1 |= USART_CR1_UE;
64
+    }
65
+  }
66
+
58
 #elif STM32_MCU_SERIES == STM32_SERIES_F2 || STM32_MCU_SERIES == STM32_SERIES_F4
67
 #elif STM32_MCU_SERIES == STM32_SERIES_F2 || STM32_MCU_SERIES == STM32_SERIES_F4
59
   #define disable_timer_if_necessary(dev, ch) ((void)0)
68
   #define disable_timer_if_necessary(dev, ch) ((void)0)
69
+
70
+  static void usart_enable_no_irq(usart_dev *usart_device, bool with_irq) {
71
+    if (with_irq) usart_enable(usart_device);
72
+    else {
73
+      usart_reg_map *regs = usart_device->regs;
74
+	    regs->CR1 |= (USART_CR1_TE | USART_CR1_RE);// don't change the word length etc, and 'or' in the patten not overwrite |USART_CR1_M_8N1);
75
+      regs->CR1 |= USART_CR1_UE;
76
+    }
77
+  }
60
 #else
78
 #else
61
   #warning "Unsupported STM32 series; timer conflicts are possible"
79
   #warning "Unsupported STM32 series; timer conflicts are possible"
80
+  #define usart_enable_no_irq(X, Y) usart_enable(X)
62
 #endif
81
 #endif
63
 
82
 
64
 void WifiSerial::begin(uint32 baud) { begin(baud, SERIAL_8N1); }
83
 void WifiSerial::begin(uint32 baud) { begin(baud, SERIAL_8N1); }
89
                            txi->gpio_device, txi->gpio_bit,
108
                            txi->gpio_device, txi->gpio_bit,
90
                            config);
109
                            config);
91
   usart_set_baud_rate(this->usart_device, USART_USE_PCLK, baud);
110
   usart_set_baud_rate(this->usart_device, USART_USE_PCLK, baud);
92
-  usart_enable(this->usart_device);
111
+  usart_enable_no_irq(this->usart_device, baud == WIFI_BAUDRATE);
93
 }
112
 }
94
 
113
 
95
 void WifiSerial::end(void) {
114
 void WifiSerial::end(void) {

+ 2
- 1
Marlin/src/lcd/extui/lib/mks_ui/wifiSerial.h View File

89
 
89
 
90
     int wifi_rb_is_full(void);
90
     int wifi_rb_is_full(void);
91
 
91
 
92
-  private:
92
+
93
     struct usart_dev *usart_device;
93
     struct usart_dev *usart_device;
94
+    private:
94
     uint8 tx_pin;
95
     uint8 tx_pin;
95
     uint8 rx_pin;
96
     uint8 rx_pin;
96
 };
97
 };

+ 316
- 293
Marlin/src/lcd/extui/lib/mks_ui/wifi_module.cpp View File

26
 #include "draw_ui.h"
26
 #include "draw_ui.h"
27
 #include "wifi_module.h"
27
 #include "wifi_module.h"
28
 #include "wifi_upload.h"
28
 #include "wifi_upload.h"
29
+#include "SPI_TFT.h"
29
 
30
 
30
 #if ENABLED(MKS_WIFI_MODULE)
31
 #if ENABLED(MKS_WIFI_MODULE)
31
 
32
 
36
 #include "../../../../lcd/marlinui.h"
37
 #include "../../../../lcd/marlinui.h"
37
 #include "../../../../sd/cardreader.h"
38
 #include "../../../../sd/cardreader.h"
38
 #include "../../../../module/planner.h"
39
 #include "../../../../module/planner.h"
40
+#include "../../../../module/servo.h"
41
+#include "../../../../module/probe.h"
39
 #if ENABLED(POWER_LOSS_RECOVERY)
42
 #if ENABLED(POWER_LOSS_RECOVERY)
40
   #include "../../../../feature/powerloss.h"
43
   #include "../../../../feature/powerloss.h"
41
 #endif
44
 #endif
109
 extern CLOUD_PARA cloud_para;
112
 extern CLOUD_PARA cloud_para;
110
 
113
 
111
 extern bool once_flag, flash_preview_begin, default_preview_flg, gcode_preview_over;
114
 extern bool once_flag, flash_preview_begin, default_preview_flg, gcode_preview_over;
115
+extern bool flash_dma_mode;
112
 
116
 
113
-uint32_t getWifiTick() {
114
-  return millis();
115
-}
117
+uint32_t getWifiTick() { return millis(); }
116
 
118
 
117
 uint32_t getWifiTickDiff(int32_t lastTick, int32_t curTick) {
119
 uint32_t getWifiTickDiff(int32_t lastTick, int32_t curTick) {
118
   if (lastTick <= curTick)
120
   if (lastTick <= curTick)
149
   }
151
   }
150
 }
152
 }
151
 
153
 
152
-static void dma_init() {
153
-  #if 0
154
-  __HAL_RCC_DMA1_CLK_ENABLE();
155
-
156
-  //HAL_NVIC_SetPriorityGrouping(NVIC_PRIORITYGROUP_0);
157
-  HAL_NVIC_SetPriority(DMA1_Channel5_IRQn, 4, 0);
158
-  HAL_NVIC_EnableIRQ(DMA1_Channel5_IRQn);
159
-
160
-  hdma_usart1_rx.Instance = DMA1_Channel5;
161
-  //hdma_usart1_rx.Init.Channel = DMA_CHANNEL_4;
162
-  hdma_usart1_rx.Init.Direction = DMA_PERIPH_TO_MEMORY;
163
-  hdma_usart1_rx.Init.PeriphInc = DMA_PINC_DISABLE;
164
-  hdma_usart1_rx.Init.MemInc = DMA_MINC_ENABLE;
165
-  hdma_usart1_rx.Init.PeriphDataAlignment = DMA_PDATAALIGN_BYTE;
166
-  hdma_usart1_rx.Init.MemDataAlignment = DMA_PDATAALIGN_BYTE;
167
-  hdma_usart1_rx.Init.Mode = DMA_NORMAL;
168
-  hdma_usart1_rx.Init.Priority = DMA_PRIORITY_VERY_HIGH;
169
-  if (HAL_DMA_Init((DMA_HandleTypeDef *)&hdma_usart1_rx) != HAL_OK) {
170
-    Error_Handler();
154
+#include <libmaple/timer.h>
155
+#include <libmaple/util.h>
156
+#include <libmaple/rcc.h>
157
+
158
+#include <boards.h>
159
+#include <wirish.h>
160
+
161
+#include <libmaple/dma.h>
162
+#include <libmaple/bitband.h>
163
+
164
+#include <libmaple/libmaple.h>
165
+#include <libmaple/gpio.h>
166
+#include <libmaple/usart.h>
167
+#include <libmaple/ring_buffer.h>
168
+
169
+void changeFlashMode(const bool dmaMode) {
170
+  if (flash_dma_mode != dmaMode) {
171
+    flash_dma_mode = dmaMode;
172
+    if (!flash_dma_mode) {
173
+      dma_disable(DMA1, DMA_CH5);
174
+      dma_clear_isr_bits(DMA1, DMA_CH4);
175
+    }
171
   }
176
   }
177
+}
172
 
178
 
179
+static bool longName2DosName(const char *longName, uint8_t *dosName) {
180
+  uint8_t i;
181
+  for (i = FILENAME_LENGTH; i--;) dosName[i] = '\0';
182
+  while (*longName) {
183
+    uint8_t c = *longName++;
184
+    if (c == '.') { // For a dot...
185
+      if (i == 0) return false;
186
+      strcat((char *)dosName, ".GCO");
187
+      break;
188
+    }
189
+    else {
190
+      if (c < 0x21 || c == 0x7F) return false;                  // Check size, non-printable characters
191
+      // Fail for illegal characters
192
+      PGM_P p = PSTR("|<>^+=?/[];,*\"\\");
193
+      while (const uint8_t b = pgm_read_byte(p++)) if (b == c) return false;
194
+      dosName[i++] = c + (WITHIN(c, 'a', 'z') ? 'A' - 'a' : 0); // Uppercase required for 8.3 name
195
+    }
196
+    if (i >= 5) {
197
+      strcat((char *)dosName, "~1.GCO");
198
+      break;
199
+    }
200
+  }
201
+  return dosName[0] != '\0'; // Return true if any name was set
202
+}
173
 
203
 
174
-  HAL_DMA_Start_IT((DMA_HandleTypeDef *)&hdma_usart1_rx,
175
-      (uint32_t)&huart1.Instance->DR,
176
-      (uint32_t)(&WifiRxFifo.uartTxBuffer[0]),
177
-      UART_RX_BUFFER_SIZE);
204
+static int storeRcvData(volatile uint8_t *bufToCpy, int32_t len) {
205
+  unsigned char tmpW = wifiDmaRcvFifo.write_cur;
178
 
206
 
179
-    //HAL_UART_Receive_DMA(&huart1,(uint8_t*)&WifiRxFifo.uartTxBuffer[0], UART_RX_BUFFER_SIZE);
207
+  if (len > UDISKBUFLEN) return 0;
180
 
208
 
181
-      /* Enable the DMA transfer for the receiver request by setting the DMAR bit
182
-       in the UART CR3 register */
183
-      SET_BIT(huart1.Instance->CR3, USART_CR3_DMAR);
209
+  if (wifiDmaRcvFifo.state[tmpW] == udisk_buf_empty) {
210
+    memcpy((unsigned char *) wifiDmaRcvFifo.bufferAddr[tmpW], (uint8_t *)bufToCpy, len);
211
+    wifiDmaRcvFifo.state[tmpW] = udisk_buf_full;
212
+    wifiDmaRcvFifo.write_cur = (tmpW + 1) % TRANS_RCV_FIFO_BLOCK_NUM;
213
+    return 1;
214
+  }
215
+
216
+  return 0;
217
+}
218
+
219
+static void esp_dma_pre() {
220
+  dma_channel_reg_map *channel_regs = dma_tube_regs(DMA1, DMA_CH5);
221
+
222
+  CBI32(channel_regs->CCR, 0);
223
+  channel_regs->CMAR = (uint32_t)WIFISERIAL.usart_device->rb->buf;
224
+  channel_regs->CNDTR = 0x0000;
225
+  channel_regs->CNDTR = UART_RX_BUFFER_SIZE;
226
+  DMA1->regs->IFCR = 0xF0000;
227
+  SBI32(channel_regs->CCR, 0);
228
+}
229
+
230
+static void dma_ch5_irq_handle() {
231
+    uint8 status_bits = dma_get_isr_bits(DMA1, DMA_CH5);
232
+    dma_clear_isr_bits(DMA1, DMA_CH5);
233
+    if (status_bits & 0x8) {
234
+      // DMA transmit Error
235
+    }
236
+    else if (status_bits & 0x2) {
237
+      // DMA transmit complete
238
+      if (esp_state == TRANSFER_IDLE)
239
+        esp_state = TRANSFERING;
240
+
241
+      if (storeRcvData(WIFISERIAL.usart_device->rb->buf, UART_RX_BUFFER_SIZE)) {
242
+        esp_dma_pre();
243
+        if (wifiTransError.flag != 0x1)
244
+          WIFI_IO1_RESET();
245
+      }
246
+      else {
247
+        WIFI_IO1_SET();
248
+        esp_state = TRANSFER_STORE;
249
+      }
250
+    }
251
+    else if (status_bits & 0x4) {
252
+      // DMA transmit half
253
+      WIFI_IO1_SET();
254
+    }
255
+}
256
+static void wifi_usart_dma_init() {
257
+  dma_init(DMA1);
258
+  uint32_t flags = ( DMA_MINC_MODE | DMA_TRNS_CMPLT | DMA_HALF_TRNS | DMA_TRNS_ERR);
259
+  dma_xfer_size dma_bit_size = DMA_SIZE_8BITS;
260
+  dma_setup_transfer(DMA1, DMA_CH5, &USART1_BASE->DR, dma_bit_size,
261
+             (volatile void*)WIFISERIAL.usart_device->rb->buf, dma_bit_size, flags);// Transmit buffer DMA
262
+  dma_set_priority(DMA1, DMA_CH5, DMA_PRIORITY_LOW);
263
+  dma_attach_interrupt(DMA1, DMA_CH5, &dma_ch5_irq_handle);
264
+
265
+  dma_clear_isr_bits(DMA1, DMA_CH5);
266
+  dma_set_num_transfers(DMA1, DMA_CH5, UART_RX_BUFFER_SIZE);
267
+
268
+  bb_peri_set_bit(&USART1_BASE->CR3, USART_CR3_DMAR_BIT, 1);
269
+  dma_enable(DMA1, DMA_CH5);   // enable transmit
184
 
270
 
185
-  #endif
186
   for (uint8_t i = 0; i < TRANS_RCV_FIFO_BLOCK_NUM; i++) {
271
   for (uint8_t i = 0; i < TRANS_RCV_FIFO_BLOCK_NUM; i++) {
187
     wifiDmaRcvFifo.bufferAddr[i] = &bmp_public_buf[1024 * i];
272
     wifiDmaRcvFifo.bufferAddr[i] = &bmp_public_buf[1024 * i];
188
     wifiDmaRcvFifo.state[i] = udisk_buf_empty;
273
     wifiDmaRcvFifo.state[i] = udisk_buf_empty;
193
   wifiDmaRcvFifo.write_cur = 0;
278
   wifiDmaRcvFifo.write_cur = 0;
194
 }
279
 }
195
 
280
 
196
-static void wifi_deInit() {
197
-  #if 0
198
-  HAL_DMA_Abort((DMA_HandleTypeDef *)&hdma_usart1_rx);
199
-  HAL_DMA_DeInit((DMA_HandleTypeDef *)&hdma_usart1_rx);
200
-  __HAL_DMA_DISABLE((DMA_HandleTypeDef *)&hdma_usart1_rx);
201
-  #endif
202
-}
203
-
204
-extern uint8_t mksUsart1Rx;
205
-
206
 void esp_port_begin(uint8_t interrupt) {
281
 void esp_port_begin(uint8_t interrupt) {
207
   WifiRxFifo.uart_read_point = 0;
282
   WifiRxFifo.uart_read_point = 0;
208
   WifiRxFifo.uart_write_point = 0;
283
   WifiRxFifo.uart_write_point = 0;
209
-  #if 0
210
-  NVIC_InitTypeDef NVIC_InitStructure;
211
 
284
 
212
-  USART_InitTypeDef USART_InitStructure;
213
-  GPIO_InitTypeDef GPIO_InitStruct;
285
+  #if 1
214
 
286
 
215
-  WifiRxFifo.uart_read_point = 0;
216
-  WifiRxFifo.uart_write_point = 0;
217
-  memset((uint8_t*)WifiRxFifo.uartTxBuffer, 0, sizeof(WifiRxFifo.uartTxBuffer));
218
-
219
-  if (interrupt) {
220
-  #if TAN
221
-    wifi_deInit ();
222
-
223
-    //SZ_STM32_COMInit(COM1, 115200);
224
-    __HAL_UART_ENABLE_IT(USART1, USART_IT_RXNE);
225
-
226
-    USART_InitStructure.USART_BaudRate = 115200;        //���ڵIJ����ʣ�����115200 ��ߴ�4.5Mbits/s
227
-    USART_InitStructure.USART_WordLength = USART_WordLength_8b; //�����ֳ���(8λ��9λ)
228
-    USART_InitStructure.USART_StopBits = USART_StopBits_1;    //�����õ�ֹͣλ-֧��1��2��ֹͣλ
229
-    USART_InitStructure.USART_Parity = USART_Parity_No;     //����żУ��
230
-    USART_InitStructure.USART_HardwareFlowControl = USART_HardwareFlowControl_None; //��Ӳ��������
231
-    USART_InitStructure.USART_Mode = USART_Mode_Rx | USART_Mode_Tx; //˫��ģʽ��ʹ�ܷ��ͺͽ���
232
-
233
-    __HAL_RCC_USART1_CLK_ENABLE();
234
-
235
-    GPIO_InitStruct.Pin = TFT_WIFI_TX_Pin|TFT_WIFI_RX_Pin;
236
-    GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
237
-    GPIO_InitStruct.Pull = GPIO_PULLUP;
238
-    GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_HIGH;
239
-    GPIO_InitStruct.Alternate = GPIO_AF7_USART1;
240
-    HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
241
-      GPIO_InitStruct.Mode = GPIO_MODE_INPUT;
242
-      GPIO_InitStruct.Pin = TFT_WIFI_RX_Pin;
243
-      HAL_GPIO_Init(GPIOA,&GPIO_InitStruct);
244
-
245
-    USART_Init(USART1, &USART_InitStructure);
246
-
247
-    NVIC_InitStructure.NVIC_IRQChannel = USART1_IRQn;
248
-  //  NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0;
249
-  //  NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0;
250
-    NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 3;
251
-    NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0;
252
-    NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
253
-
254
-    NVIC_Init(&NVIC_InitStructure);
255
-    #else
256
-    HAL_UART_DeInit(&huart1);
257
-    MX_USART1_UART_Init(3);
258
-    //__HAL_UART_ENABLE_IT(&huart1, UART_IT_RXNE);
259
-    HAL_UART_Receive_IT(&huart1,&mksUsart1Rx,1);
287
+    #if ENABLED(MKS_WIFI_MODULE)
288
+      WIFISERIAL.end();
289
+      if (interrupt) {
290
+        for (uint16_t i = 0; i < 65535; i++) { /*nada*/ }
291
+        WIFISERIAL.begin(WIFI_BAUDRATE);
292
+        uint32_t serial_connect_timeout = millis() + 1000UL;
293
+        while (PENDING(millis(), serial_connect_timeout)) { /*nada*/ }
294
+      }
295
+      else {
296
+        WIFISERIAL.usart_device->regs->CR1 &= ~USART_CR1_RXNEIE;
297
+        WIFISERIAL.begin(WIFI_UPLOAD_BAUDRATE);
298
+        wifi_usart_dma_init();
299
+      }
260
     #endif
300
     #endif
261
-  }
262
-  else{
263
-    #if 0
264
-    NVIC_DisableIRQ(SZ_STM32_COM1_IRQn);
265
-
266
-    USART_Cmd(SZ_STM32_COM1, DISABLE);
267
-
268
-    RCC_APB2PeriphClockCmd(RCC_APB2Periph_USART1, DISABLE);
269
-    RCC_APB2PeriphClockCmd(RCC_APB2Periph_USART1, ENABLE);
270
 
301
 
271
-    SZ_STM32_COMInit(COM1, 1958400);
302
+  #else
272
 
303
 
273
-    USART_Cmd(SZ_STM32_COM1, ENABLE);
274
-
275
-    wifi_delay(10);
276
-
277
-    dma_init();
304
+    #if MKS_WIFI_MODULE
305
+      WIFISERIAL.end();
306
+      for (uint16_t i = 0; i < 65535; i++) { /*nada*/ }
307
+      WIFISERIAL.begin(interrupt ? WIFI_BAUDRATE : WIFI_UPLOAD_BAUDRATE);
308
+      uint32_t serial_connect_timeout = millis() + 1000UL;
309
+      while (PENDING(millis(), serial_connect_timeout)) { /*nada*/ }
278
     #endif
310
     #endif
279
-    HAL_UART_DeInit(&huart1);
280
-    MX_USART1_UART_Init(5);
281
-        //dma1_5_IRQ_sel = 1;
282
-    dma_init();
283
-  }
284
-  #endif
285
-
286
-  #if ENABLED(MKS_WIFI_MODULE)
287
-    WIFISERIAL.end();
288
-    for (uint16_t i = 0; i < 65535; i++) { /*nada*/ }
289
-    WIFISERIAL.begin(interrupt ? WIFI_BAUDRATE : WIFI_UPLOAD_BAUDRATE);
311
+    if (!interrupt) wifi_usart_dma_init();
290
 
312
 
291
-    const millis_t serial_connect_timeout = millis() + 1000UL;
292
-    while (/*!WIFISERIAL && */PENDING(millis(), serial_connect_timeout)) { /*nada*/ }
293
-
294
-    if (interrupt) {
295
-      //for (uint8_t i=0;i<100;i++) WIFISERIAL.write(0x33);
296
-    }
297
-    else {
298
-      //for (uint16_t i=0;i<65535;i++); //WIFISERIAL.write(0x33);
299
-    }
300
   #endif
313
   #endif
301
-
302
-  if (!interrupt) dma_init();
303
 }
314
 }
304
 
315
 
305
 #if ENABLED(MKS_WIFI_MODULE)
316
 #if ENABLED(MKS_WIFI_MODULE)
441
     ZERO(buf_to_wifi);
452
     ZERO(buf_to_wifi);
442
     index_to_wifi = 0;
453
     index_to_wifi = 0;
443
   }
454
   }
455
+  return 1;
444
 }
456
 }
445
 
457
 
446
 
458
 
447
-int send_to_wifi(char *buf, int len) { return package_to_wifi(WIFI_TRANS_INF, buf, len); }
459
+#define SEND_OK_TO_WIFI send_to_wifi((uint8_t *)"ok\r\n", strlen("ok\r\n"))
460
+int send_to_wifi(uint8_t *buf, int len) { return package_to_wifi(WIFI_TRANS_INF, buf, len); }
448
 
461
 
449
 void set_cur_file_sys(int fileType) { gCfgItems.fileSysType = fileType; }
462
 void set_cur_file_sys(int fileType) { gCfgItems.fileSysType = fileType; }
450
 
463
 
463
 char wait_ip_back_flag = 0;
476
 char wait_ip_back_flag = 0;
464
 
477
 
465
 typedef struct {
478
 typedef struct {
466
-  char write_buf[513];
467
   int write_index;
479
   int write_index;
468
   uint8_t saveFileName[30];
480
   uint8_t saveFileName[30];
481
+  uint8_t fileTransfer;
469
   uint32_t fileLen;
482
   uint32_t fileLen;
470
   uint32_t tick_begin;
483
   uint32_t tick_begin;
471
   uint32_t tick_end;
484
   uint32_t tick_end;
475
 
488
 
476
 int32_t lastFragment = 0;
489
 int32_t lastFragment = 0;
477
 
490
 
478
-char lastBinaryCmd[50] = { 0 };
491
+char saveFilePath[50];
479
 
492
 
480
-int total_write = 0;
481
-char binary_head[2] = { 0, 0 };
482
-unsigned char binary_data_len = 0;
493
+static SdFile upload_file, *upload_curDir;
494
+static filepos_t pos;
483
 
495
 
484
 int write_to_file(char *buf, int len) {
496
 int write_to_file(char *buf, int len) {
485
-  for (int i = 0; i < len; i++) {
486
-    file_writer.write_buf[file_writer.write_index++] = buf[i];
497
+  int i;
498
+  int res = 0;
499
+
500
+  for (i = 0; i < len; i++) {
501
+    public_buf[file_writer.write_index++] = buf[i];
487
     if (file_writer.write_index >= 512) {
502
     if (file_writer.write_index >= 512) {
488
-      int res = card.write(file_writer.write_buf, file_writer.write_index);
489
-      if (res == -1) return -1;
490
-      ZERO(file_writer.write_buf);
503
+      res = upload_file.write(public_buf, file_writer.write_index);
504
+
505
+      if (res == -1) {
506
+        upload_file.close();
507
+        const char * const fname = card.diveToFile(true, upload_curDir, saveFilePath);
508
+
509
+        if (upload_file.open(upload_curDir, fname, O_WRITE)) {
510
+          upload_file.setpos(&pos);
511
+          res = upload_file.write(public_buf, file_writer.write_index);
512
+        }
513
+      }
514
+      if (res == -1) {
515
+        return  -1;
516
+      }
517
+      upload_file.getpos(&pos);
491
       file_writer.write_index = 0;
518
       file_writer.write_index = 0;
492
     }
519
     }
493
   }
520
   }
521
+
522
+  if (res == -1) {
523
+    memset(public_buf, 0, sizeof(public_buf));
524
+    file_writer.write_index = 0;
525
+    return  -1;
526
+  }
527
+
494
   return 0;
528
   return 0;
495
 }
529
 }
496
 
530
 
543
   for (uint8_t i = 0; i < fileCnt; i++) {
577
   for (uint8_t i = 0; i < fileCnt; i++) {
544
     card.getfilename_sorted(SD_ORDER(i, fileCnt));
578
     card.getfilename_sorted(SD_ORDER(i, fileCnt));
545
 
579
 
546
-    //if (card.longFilename[0] == 0)
547
-      strcpy(tmp, card.filename);
548
-    //else
549
-    //  strcpy(tmp, card.longFilename);
580
+    memset(tmp, 0, sizeof(tmp));
581
+    strcpy(tmp, card.filename);
550
 
582
 
551
     ZERO(Fstream);
583
     ZERO(Fstream);
552
     strcpy(Fstream, tmp);
584
     strcpy(Fstream, tmp);
584
       switch (cmd_value) {
616
       switch (cmd_value) {
585
 
617
 
586
         case 20: // M20: Print SD / µdisk file
618
         case 20: // M20: Print SD / µdisk file
619
+          file_writer.fileTransfer = 0;
587
           if (uiCfg.print_state == IDLE) {
620
           if (uiCfg.print_state == IDLE) {
588
             int index = 0;
621
             int index = 0;
589
 
622
 
591
               gCfgItems.fileSysType = FILE_SYS_SD;
624
               gCfgItems.fileSysType = FILE_SYS_SD;
592
               send_to_wifi((uint8_t *)"Begin file list\r\n", strlen("Begin file list\r\n"));
625
               send_to_wifi((uint8_t *)"Begin file list\r\n", strlen("Begin file list\r\n"));
593
               get_file_list((char *)"0:/");
626
               get_file_list((char *)"0:/");
594
-              send_to_wifi((char *)"End file list\r\n", strlen("End file list\r\n"));
595
-              send_to_wifi((char *)"ok\r\n", strlen("ok\r\n"));
627
+              send_to_wifi((uint8_t *)"End file list\r\n", strlen("End file list\r\n"));
628
+              SEND_OK_TO_WIFI;
596
               break;
629
               break;
597
             }
630
             }
598
 
631
 
613
                 get_file_list(path);
646
                 get_file_list(path);
614
                 send_to_wifi((uint8_t *)"End file list\r\n", strlen("End file list\r\n"));
647
                 send_to_wifi((uint8_t *)"End file list\r\n", strlen("End file list\r\n"));
615
               }
648
               }
616
-              send_to_wifi((char *)"ok\r\n", strlen("ok\r\n"));
649
+              SEND_OK_TO_WIFI;
617
             }
650
             }
618
           }
651
           }
619
           break;
652
           break;
620
 
653
 
621
         case 21:
654
         case 21:
622
           /*init sd card*/
655
           /*init sd card*/
623
-          send_to_wifi((char *)"ok\r\n", strlen("ok\r\n"));
656
+          SEND_OK_TO_WIFI;
624
           break;
657
           break;
625
 
658
 
626
         case 23:
659
         case 23:
632
             if (strstr((char *)&tmpStr[index], ".g") || strstr((char *)&tmpStr[index], ".G")) {
665
             if (strstr((char *)&tmpStr[index], ".g") || strstr((char *)&tmpStr[index], ".G")) {
633
               if (strlen((char *)&tmpStr[index]) < 80) {
666
               if (strlen((char *)&tmpStr[index]) < 80) {
634
                 ZERO(list_file.file_name[sel_id]);
667
                 ZERO(list_file.file_name[sel_id]);
668
+                ZERO(list_file.long_name[sel_id]);
669
+                uint8_t has_path_selected = 0;
635
 
670
 
636
                 if (gCfgItems.wifi_type == ESP_WIFI) {
671
                 if (gCfgItems.wifi_type == ESP_WIFI) {
637
-                  if (strncmp((char *)&tmpStr[index], "1:", 2) == 0)
672
+                  if (strncmp((char *)&tmpStr[index], "1:", 2) == 0) {
638
                     gCfgItems.fileSysType = FILE_SYS_SD;
673
                     gCfgItems.fileSysType = FILE_SYS_SD;
639
-                  else if (strncmp((char *)&tmpStr[index], "0:", 2) == 0)
674
+                    has_path_selected = 1;
675
+                  }
676
+                  else if (strncmp((char *)&tmpStr[index], "0:", 2) == 0) {
640
                     gCfgItems.fileSysType = FILE_SYS_USB;
677
                     gCfgItems.fileSysType = FILE_SYS_USB;
678
+                    has_path_selected = 1;
679
+                  }
641
                   else if (tmpStr[index] != '/')
680
                   else if (tmpStr[index] != '/')
642
-                    strcat((char *)list_file.file_name[0], "/");
643
-                  strcat((char *)list_file.file_name[sel_id], (char *)&tmpStr[index]);
681
+                      strcat((char *)list_file.file_name[sel_id], "/");
682
+
683
+                  if (file_writer.fileTransfer == 1) {
684
+                    uint8_t dosName[FILENAME_LENGTH];
685
+                    uint8_t fileName[sizeof(list_file.file_name[sel_id])];
686
+                    fileName[0] = '\0';
687
+                    if (has_path_selected == 1) {
688
+                      strcat((char *)fileName, (char *)&tmpStr[index + 3]);
689
+                      strcat((char *)list_file.file_name[sel_id], "/");
690
+                    }
691
+                    else strcat((char *)fileName, (char *)&tmpStr[index]);
692
+                    if (!longName2DosName((const char *)fileName, dosName)) {
693
+                      strcpy(list_file.file_name[sel_id], "notValid");
694
+                    }
695
+                    strcat((char *)list_file.file_name[sel_id], (char *)dosName);
696
+                    strcat((char *)list_file.long_name[sel_id], (char *)dosName);
697
+                  }
698
+                  else {
699
+                    strcat((char *)list_file.file_name[sel_id], (char *)&tmpStr[index]);
700
+                    strcat((char *)list_file.long_name[sel_id], (char *)&tmpStr[index]);
701
+                  }
644
 
702
 
645
                 }
703
                 }
646
                 else
704
                 else
656
                   send_to_wifi((uint8_t *)"file.open failed\r\n", strlen("file.open failed\r\n"));
714
                   send_to_wifi((uint8_t *)"file.open failed\r\n", strlen("file.open failed\r\n"));
657
                   strcpy(list_file.file_name[sel_id], "notValid");
715
                   strcpy(list_file.file_name[sel_id], "notValid");
658
                 }
716
                 }
659
-                send_to_wifi((char *)"ok\r\n", strlen("ok\r\n"));
717
+                SEND_OK_TO_WIFI;
660
               }
718
               }
661
             }
719
             }
662
           }
720
           }
680
 
738
 
681
                   SdFile file;
739
                   SdFile file;
682
                   SdFile *curDir;
740
                   SdFile *curDir;
741
+                  card.endFilePrint();
683
                   const char * const fname = card.diveToFile(true, curDir, cur_name);
742
                   const char * const fname = card.diveToFile(true, curDir, cur_name);
684
                   if (!fname) return;
743
                   if (!fname) return;
685
                   if (file.open(curDir, fname, O_READ)) {
744
                   if (file.open(curDir, fname, O_READ)) {
726
               lv_draw_printing();
785
               lv_draw_printing();
727
             }
786
             }
728
           }
787
           }
729
-          send_to_wifi((char *)"ok\r\n", strlen("ok\r\n"));
788
+          SEND_OK_TO_WIFI;
730
           break;
789
           break;
731
 
790
 
732
         case 25:
791
         case 25:
745
             else
804
             else
746
               default_preview_flg = true;
805
               default_preview_flg = true;
747
             lv_draw_printing();
806
             lv_draw_printing();
748
-            send_to_wifi((char *)"ok\r\n", strlen("ok\r\n"));
807
+            SEND_OK_TO_WIFI;
749
           }
808
           }
750
           break;
809
           break;
751
 
810
 
762
 
821
 
763
             lv_draw_ready_print();
822
             lv_draw_ready_print();
764
 
823
 
765
-            send_to_wifi((char *)"ok\r\n", strlen("ok\r\n"));
824
+            SEND_OK_TO_WIFI;
766
           }
825
           }
767
           break;
826
           break;
768
 
827
 
805
                   ZERO(tempBuf);
864
                   ZERO(tempBuf);
806
                   sprintf((char *)tempBuf, "Writing to file: %s\r\n", (char *)file_writer.saveFileName);
865
                   sprintf((char *)tempBuf, "Writing to file: %s\r\n", (char *)file_writer.saveFileName);
807
                   wifi_ret_ack();
866
                   wifi_ret_ack();
808
-                  send_to_wifi((char *)tempBuf, strlen((char *)tempBuf));
809
-                  total_write = 0;
867
+                  send_to_wifi((uint8_t *)tempBuf, strlen((char *)tempBuf));
810
                   wifi_link_state = WIFI_WAIT_TRANS_START;
868
                   wifi_link_state = WIFI_WAIT_TRANS_START;
811
                 }
869
                 }
812
                 else {
870
                 else {
822
         case 991:
880
         case 991:
823
           ZERO(tempBuf);
881
           ZERO(tempBuf);
824
           if (cmd_value == 105) {
882
           if (cmd_value == 105) {
825
-            send_to_wifi((char *)"ok\r\n", strlen("ok\r\n"));
883
+            SEND_OK_TO_WIFI;
826
             sprintf((char *)tempBuf,"T:%.1f /%.1f B:%.1f /%.1f T0:%.1f /%.1f T1:%.1f /%.1f @:0 B@:0\r\n",
884
             sprintf((char *)tempBuf,"T:%.1f /%.1f B:%.1f /%.1f T0:%.1f /%.1f T1:%.1f /%.1f @:0 B@:0\r\n",
827
 
885
 
828
             (float)thermalManager.temp_hotend[0].celsius, (float)thermalManager.temp_hotend[0].target,
886
             (float)thermalManager.temp_hotend[0].celsius, (float)thermalManager.temp_hotend[0].target,
891
           }
949
           }
892
           else if (uiCfg.print_state == PAUSED) {
950
           else if (uiCfg.print_state == PAUSED) {
893
             wifi_ret_ack();
951
             wifi_ret_ack();
894
-            send_to_wifi((char *)"M997 PAUSE\r\n", strlen("M997 PAUSE\r\n"));
952
+            send_to_wifi((uint8_t *)"M997 PAUSE\r\n", strlen("M997 PAUSE\r\n"));
895
           }
953
           }
896
           else if (uiCfg.print_state == REPRINTING) {
954
           else if (uiCfg.print_state == REPRINTING) {
897
             wifi_ret_ack();
955
             wifi_ret_ack();
913
 
971
 
914
         case 115:
972
         case 115:
915
           ZERO(tempBuf);
973
           ZERO(tempBuf);
916
-          send_to_wifi((char *)"ok\r\n", strlen("ok\r\n"));
917
-          send_to_wifi((char *)"FIRMWARE_NAME:Robin_nano\r\n", strlen("FIRMWARE_NAME:Robin_nano\r\n"));
974
+          SEND_OK_TO_WIFI;
975
+          send_to_wifi((uint8_t *)"FIRMWARE_NAME:Robin_nano\r\n", strlen("FIRMWARE_NAME:Robin_nano\r\n"));
918
           break;
976
           break;
919
 
977
 
920
         default:
978
         default:
935
                 index++;
993
                 index++;
936
               }
994
               }
937
               if (left - WIFI_GCODE_BUFFER_LEAST_SIZE >= strlen((const char *)cmd_line))
995
               if (left - WIFI_GCODE_BUFFER_LEAST_SIZE >= strlen((const char *)cmd_line))
938
-                send_to_wifi((char *)"ok\r\n", strlen("ok\r\n"));
996
+                SEND_OK_TO_WIFI;
939
               else
997
               else
940
                 need_ok_later = true;
998
                 need_ok_later = true;
941
             }
999
             }
961
             index++;
1019
             index++;
962
           }
1020
           }
963
           if (left_g - WIFI_GCODE_BUFFER_LEAST_SIZE >= strlen((const char *)cmd_line))
1021
           if (left_g - WIFI_GCODE_BUFFER_LEAST_SIZE >= strlen((const char *)cmd_line))
964
-            send_to_wifi((char *)"ok\r\n", strlen("ok\r\n"));
1022
+            SEND_OK_TO_WIFI;
965
           else
1023
           else
966
             need_ok_later = true;
1024
             need_ok_later = true;
967
         }
1025
         }
1191
   COPY(source, FileName_unicode);
1249
   COPY(source, FileName_unicode);
1192
 }
1250
 }
1193
 
1251
 
1194
-char saveFilePath[50];
1195
-
1196
-static bool longName2DosName(const char* longName, uint8_t* dosName) {
1197
-  uint8_t i = 11;
1198
-  while (i--) dosName[i] = '\0';
1199
-  while (*longName) {
1200
-    uint8_t c = *longName++;
1201
-    if (c == '.') {                   // For a dot...
1202
-      if (i == 0) return false;
1203
-      else { strcat((char *)dosName,".GCO"); return dosName[0] != '\0'; }
1204
-    }
1205
-    else {
1206
-      // Fail for illegal characters
1207
-      PGM_P p = PSTR("|<>^+=?/[];,*\"\\");
1208
-      while (uint8_t b = pgm_read_byte(p++)) if (b == c) return false;
1209
-      if (c < 0x21 || c == 0x7F) return false;           // Check size, non-printable characters
1210
-      dosName[i++] = (c < 'a' || c > 'z') ? (c) : (c + ('A' - 'a')); // Uppercase required for 8.3 name
1211
-    }
1212
-    if (i >= 5) strcat((char *)dosName,"~1.GCO");
1213
-  }
1214
-  return dosName[0] != '\0';              // Return true if any name was set
1215
-}
1216
-
1217
 static void file_first_msg_handle(uint8_t * msg, uint16_t msgLen) {
1252
 static void file_first_msg_handle(uint8_t * msg, uint16_t msgLen) {
1218
   uint8_t fileNameLen = *msg;
1253
   uint8_t fileNameLen = *msg;
1219
 
1254
 
1226
 
1261
 
1227
   utf8_2_unicode(file_writer.saveFileName,fileNameLen);
1262
   utf8_2_unicode(file_writer.saveFileName,fileNameLen);
1228
 
1263
 
1229
-  ZERO(file_writer.write_buf);
1264
+  ZERO(public_buf);
1230
 
1265
 
1231
   if (strlen((const char *)file_writer.saveFileName) > sizeof(saveFilePath))
1266
   if (strlen((const char *)file_writer.saveFileName) > sizeof(saveFilePath))
1232
     return;
1267
     return;
1234
   ZERO(saveFilePath);
1269
   ZERO(saveFilePath);
1235
 
1270
 
1236
   if (gCfgItems.fileSysType == FILE_SYS_SD) {
1271
   if (gCfgItems.fileSysType == FILE_SYS_SD) {
1237
-    //sprintf((char *)saveFilePath, "/%s", file_writer.saveFileName);
1238
-    card.mount();
1239
-
1240
-    //ZERO(list_file.long_name[sel_id]);
1241
-    //memcpy(list_file.long_name[sel_id],file_writer.saveFileName,sizeof(list_file.long_name[sel_id]));
1272
+    TERN_(SDSUPPORT, card.mount());
1242
   }
1273
   }
1243
   else if (gCfgItems.fileSysType == FILE_SYS_USB) {
1274
   else if (gCfgItems.fileSysType == FILE_SYS_USB) {
1244
 
1275
 
1266
       lv_draw_dialog(DIALOG_TYPE_UPLOAD_FILE);
1297
       lv_draw_dialog(DIALOG_TYPE_UPLOAD_FILE);
1267
       return;
1298
       return;
1268
     }
1299
     }
1269
-    sprintf((char *)saveFilePath, "/%s", dosName);
1270
-
1271
-    ZERO(list_file.long_name[sel_id]);
1272
-    memcpy(list_file.long_name[sel_id], dosName, sizeof(dosName));
1300
+    sprintf((char *)saveFilePath, "%s", dosName);
1273
 
1301
 
1274
-    char *cur_name=strrchr((const char *)saveFilePath,'/');
1302
+    card.cdroot();
1303
+    upload_file.close();
1304
+    const char * const fname = card.diveToFile(true, upload_curDir, saveFilePath);
1275
 
1305
 
1276
-    SdFile file;
1277
-    SdFile *curDir;
1278
-    card.endFilePrint();
1279
-    const char * const fname = card.diveToFile(true, curDir, cur_name);
1280
-    if (!fname) return;
1281
-    if (file.open(curDir, fname, O_CREAT | O_APPEND | O_WRITE | O_TRUNC)) {
1282
-      gCfgItems.curFilesize = file.fileSize();
1283
-    }
1284
-    else {
1306
+    if (!upload_file.open(upload_curDir, fname, O_CREAT | O_APPEND | O_WRITE | O_TRUNC)) {
1285
       clear_cur_ui();
1307
       clear_cur_ui();
1286
       upload_result = 2;
1308
       upload_result = 2;
1309
+
1287
       wifiTransError.flag = 1;
1310
       wifiTransError.flag = 1;
1288
       wifiTransError.start_tick = getWifiTick();
1311
       wifiTransError.start_tick = getWifiTick();
1312
+
1289
       lv_draw_dialog(DIALOG_TYPE_UPLOAD_FILE);
1313
       lv_draw_dialog(DIALOG_TYPE_UPLOAD_FILE);
1290
       return;
1314
       return;
1291
     }
1315
     }
1302
   lv_task_handler();
1326
   lv_task_handler();
1303
 
1327
 
1304
   file_writer.tick_begin = getWifiTick();
1328
   file_writer.tick_begin = getWifiTick();
1329
+
1330
+  file_writer.fileTransfer = 1;
1305
 }
1331
 }
1306
 
1332
 
1307
-#define FRAG_MASK _BV32(31)
1333
+#define FRAG_MASK ~_BV32(31)
1308
 
1334
 
1309
 static void file_fragment_msg_handle(uint8_t * msg, uint16_t msgLen) {
1335
 static void file_fragment_msg_handle(uint8_t * msg, uint16_t msgLen) {
1310
   uint32_t frag = *((uint32_t *)msg);
1336
   uint32_t frag = *((uint32_t *)msg);
1311
-
1312
   if ((frag & FRAG_MASK) != (uint32_t)(lastFragment + 1)) {
1337
   if ((frag & FRAG_MASK) != (uint32_t)(lastFragment + 1)) {
1313
-    ZERO(file_writer.write_buf);
1338
+    ZERO(public_buf);
1314
     file_writer.write_index = 0;
1339
     file_writer.write_index = 0;
1315
     wifi_link_state = WIFI_CONNECTED;
1340
     wifi_link_state = WIFI_CONNECTED;
1316
     upload_result = 2;
1341
     upload_result = 2;
1317
   }
1342
   }
1318
   else {
1343
   else {
1319
     if (write_to_file((char *)msg + 4, msgLen - 4) < 0) {
1344
     if (write_to_file((char *)msg + 4, msgLen - 4) < 0) {
1320
-      ZERO(file_writer.write_buf);
1345
+      ZERO(public_buf);
1321
       file_writer.write_index = 0;
1346
       file_writer.write_index = 0;
1322
       wifi_link_state = WIFI_CONNECTED;
1347
       wifi_link_state = WIFI_CONNECTED;
1323
       upload_result = 2;
1348
       upload_result = 2;
1325
     }
1350
     }
1326
     lastFragment = frag;
1351
     lastFragment = frag;
1327
 
1352
 
1328
-    if ((frag & (~FRAG_MASK))) {
1329
-      int res = card.write(file_writer.write_buf, file_writer.write_index);
1353
+    if ((frag & (~FRAG_MASK)) != 0) {
1354
+      int res = upload_file.write(public_buf, file_writer.write_index);
1330
       if (res == -1) {
1355
       if (res == -1) {
1331
-        ZERO(file_writer.write_buf);
1356
+        upload_file.close();
1357
+        const char * const fname = card.diveToFile(true, upload_curDir, saveFilePath);
1358
+        if (upload_file.open(upload_curDir, fname, O_WRITE)) {
1359
+          upload_file.setpos(&pos);
1360
+          res = upload_file.write(public_buf, file_writer.write_index);
1361
+        }
1362
+      }
1363
+      upload_file.close();
1364
+      SdFile file, *curDir;
1365
+      const char * const fname = card.diveToFile(true, curDir, saveFilePath);
1366
+      if (file.open(curDir, fname, O_RDWR)) {
1367
+        gCfgItems.curFilesize = file.fileSize();
1368
+        file.close();
1369
+      }
1370
+      else {
1371
+        ZERO(public_buf);
1332
         file_writer.write_index = 0;
1372
         file_writer.write_index = 0;
1333
         wifi_link_state = WIFI_CONNECTED;
1373
         wifi_link_state = WIFI_CONNECTED;
1334
         upload_result = 2;
1374
         upload_result = 2;
1335
         return;
1375
         return;
1336
       }
1376
       }
1337
-      ZERO(file_writer.write_buf);
1377
+      ZERO(public_buf);
1338
       file_writer.write_index = 0;
1378
       file_writer.write_index = 0;
1339
       file_writer.tick_end = getWifiTick();
1379
       file_writer.tick_end = getWifiTick();
1340
       upload_time = getWifiTickDiff(file_writer.tick_begin, file_writer.tick_end) / 1000;
1380
       upload_time = getWifiTickDiff(file_writer.tick_begin, file_writer.tick_end) / 1000;
1342
       wifi_link_state = WIFI_CONNECTED;
1382
       wifi_link_state = WIFI_CONNECTED;
1343
       upload_result = 3;
1383
       upload_result = 3;
1344
     }
1384
     }
1345
-
1346
   }
1385
   }
1347
 }
1386
 }
1348
 
1387
 
1453
         esp_msg_index = 0;
1492
         esp_msg_index = 0;
1454
         return;
1493
         return;
1455
       }
1494
       }
1456
-
1457
       if ((charAtArray(esp_msg_buf, esp_msg_index,  ESP_PROTOC_HEAD) != -1) && (charAtArray(esp_msg_buf, esp_msg_index, ESP_PROTOC_TAIL) != -1))
1495
       if ((charAtArray(esp_msg_buf, esp_msg_index,  ESP_PROTOC_HEAD) != -1) && (charAtArray(esp_msg_buf, esp_msg_index, ESP_PROTOC_TAIL) != -1))
1458
         loop_again = true;
1496
         loop_again = true;
1459
     }
1497
     }
1461
 }
1499
 }
1462
 
1500
 
1463
 int32_t tick_net_time1, tick_net_time2;
1501
 int32_t tick_net_time1, tick_net_time2;
1464
-
1465
-int storeRcvData(int32_t len) {
1466
-  unsigned char tmpW = wifiDmaRcvFifo.write_cur;
1467
-  if (len <= UDISKBUFLEN && wifiDmaRcvFifo.state[tmpW] == udisk_buf_empty) {
1468
-    for (uint16_t i = 0; i < len; i++)
1469
-      wifiDmaRcvFifo.bufferAddr[tmpW][i] = WIFISERIAL.read();
1470
-    wifiDmaRcvFifo.state[tmpW] = udisk_buf_full;
1471
-    wifiDmaRcvFifo.write_cur = (tmpW + 1) % TRANS_RCV_FIFO_BLOCK_NUM;
1472
-    return 1;
1473
-  }
1474
-  return 0;
1475
-}
1476
-
1477
 int32_t readWifiFifo(uint8_t *retBuf, uint32_t bufLen) {
1502
 int32_t readWifiFifo(uint8_t *retBuf, uint32_t bufLen) {
1478
   unsigned char tmpR = wifiDmaRcvFifo.read_cur;
1503
   unsigned char tmpR = wifiDmaRcvFifo.read_cur;
1479
   if (bufLen >= UDISKBUFLEN && wifiDmaRcvFifo.state[tmpR] == udisk_buf_full) {
1504
   if (bufLen >= UDISKBUFLEN && wifiDmaRcvFifo.state[tmpR] == udisk_buf_full) {
1496
     wifiTransError.start_tick = getWifiTick();
1521
     wifiTransError.start_tick = getWifiTick();
1497
     card.removeFile((const char *)saveFilePath);
1522
     card.removeFile((const char *)saveFilePath);
1498
   }
1523
   }
1499
-  else {
1500
-  }
1524
+
1501
   wifi_delay(200);
1525
   wifi_delay(200);
1502
   WIFI_IO1_SET();
1526
   WIFI_IO1_SET();
1503
-  //exchangeFlashMode(1);  //change spi flash to use dma mode
1527
+
1528
+  // disable dma
1529
+  dma_clear_isr_bits(DMA1, DMA_CH5);
1530
+  bb_peri_set_bit(&USART1_BASE->CR3, USART_CR3_DMAR_BIT, 0);
1531
+  dma_disable(DMA1, DMA_CH5);
1532
+
1533
+  wifi_delay(200);
1534
+  changeFlashMode(true); // Set SPI flash to use DMA mode
1504
   esp_port_begin(1);
1535
   esp_port_begin(1);
1536
+  wifi_delay(200);
1537
+
1538
+  W25QXX.init(SPI_QUARTER_SPEED);
1539
+
1540
+  TERN_(HAS_TFT_LVGL_UI_SPI, SPI_TFT.spi_init(SPI_FULL_SPEED));
1541
+  TERN_(HAS_SERVOS, servo_init());
1542
+  TERN_(HAS_Z_SERVO_PROBE, probe.servo_probe_init());
1543
+
1505
   if (wifiTransError.flag != 0x1) WIFI_IO1_RESET();
1544
   if (wifiTransError.flag != 0x1) WIFI_IO1_RESET();
1506
 }
1545
 }
1507
 
1546
 
1508
 void wifi_rcv_handle() {
1547
 void wifi_rcv_handle() {
1509
   int32_t len = 0;
1548
   int32_t len = 0;
1510
-  uint8_t ucStr[(UART_RX_BUFFER_SIZE) + 1] = { 0 };
1549
+  uint8_t ucStr[(UART_RX_BUFFER_SIZE) + 1] = {0};
1511
   int8_t getDataF = 0;
1550
   int8_t getDataF = 0;
1512
-
1513
   if (wifi_link_state == WIFI_TRANS_FILE) {
1551
   if (wifi_link_state == WIFI_TRANS_FILE) {
1514
     #if 0
1552
     #if 0
1515
       if (WIFISERIAL.available() == UART_RX_BUFFER_SIZE) {
1553
       if (WIFISERIAL.available() == UART_RX_BUFFER_SIZE) {
1531
       getDataF = 1;
1569
       getDataF = 1;
1532
     }
1570
     }
1533
     if (esp_state == TRANSFER_STORE) {
1571
     if (esp_state == TRANSFER_STORE) {
1534
-      if (storeRcvData(UART_RX_BUFFER_SIZE)) {
1572
+      if (storeRcvData(WIFISERIAL.usart_device->rb->buf, UART_RX_BUFFER_SIZE)) {
1535
         esp_state = TRANSFERING;
1573
         esp_state = TRANSFERING;
1536
-        //esp_dma_pre();
1574
+        esp_dma_pre();
1537
         if (wifiTransError.flag != 0x1) WIFI_IO1_RESET();
1575
         if (wifiTransError.flag != 0x1) WIFI_IO1_RESET();
1538
       }
1576
       }
1539
       else
1577
       else
1541
     }
1579
     }
1542
   }
1580
   }
1543
   else {
1581
   else {
1544
-    //len = readUsartFifo((SZ_USART_FIFO *)&WifiRxFifo, (int8_t *)ucStr, UART_RX_BUFFER_SIZE);
1545
     len = readWifiBuf((int8_t *)ucStr, UART_RX_BUFFER_SIZE);
1582
     len = readWifiBuf((int8_t *)ucStr, UART_RX_BUFFER_SIZE);
1546
     if (len > 0) {
1583
     if (len > 0) {
1547
       esp_data_parser((char *)ucStr, len);
1584
       esp_data_parser((char *)ucStr, len);
1548
-
1549
       if (wifi_link_state == WIFI_TRANS_FILE) {
1585
       if (wifi_link_state == WIFI_TRANS_FILE) {
1550
-        //exchangeFlashMode(0);  //change spi flash not use dma mode
1586
+        changeFlashMode(false); // Set SPI flash to use non-DMA mode
1551
         wifi_delay(10);
1587
         wifi_delay(10);
1552
         esp_port_begin(0);
1588
         esp_port_begin(0);
1553
         wifi_delay(10);
1589
         wifi_delay(10);
1558
     }
1594
     }
1559
     if (need_ok_later &&  (queue.length < BUFSIZE)) {
1595
     if (need_ok_later &&  (queue.length < BUFSIZE)) {
1560
       need_ok_later = false;
1596
       need_ok_later = false;
1561
-      send_to_wifi((char *)"ok\r\n", strlen("ok\r\n"));
1597
+      send_to_wifi((uint8_t *)"ok\r\n", strlen("ok\r\n"));
1562
     }
1598
     }
1563
   }
1599
   }
1564
 
1600
 
1569
     tick_net_time2 = getWifiTick();
1605
     tick_net_time2 = getWifiTick();
1570
 
1606
 
1571
     if (wifi_link_state == WIFI_TRANS_FILE) {
1607
     if (wifi_link_state == WIFI_TRANS_FILE) {
1572
-      if ((tick_net_time1 != 0) && (getWifiTickDiff(tick_net_time1, tick_net_time2) > 4500)) {
1608
+      if (tick_net_time1 && getWifiTickDiff(tick_net_time1, tick_net_time2) > 8000) {
1573
         wifi_link_state = WIFI_CONNECTED;
1609
         wifi_link_state = WIFI_CONNECTED;
1574
         upload_result = 2;
1610
         upload_result = 2;
1575
         clear_cur_ui();
1611
         clear_cur_ui();
1577
         lv_draw_dialog(DIALOG_TYPE_UPLOAD_FILE);
1613
         lv_draw_dialog(DIALOG_TYPE_UPLOAD_FILE);
1578
       }
1614
       }
1579
     }
1615
     }
1580
-
1581
-    if ((tick_net_time1 != 0) && (getWifiTickDiff(tick_net_time1, tick_net_time2) > 10000))
1616
+    if (tick_net_time1 && getWifiTickDiff(tick_net_time1, tick_net_time2) > 10000)
1582
       wifi_link_state = WIFI_NOT_CONFIG;
1617
       wifi_link_state = WIFI_NOT_CONFIG;
1583
 
1618
 
1584
-    if ((tick_net_time1 != 0) && (getWifiTickDiff(tick_net_time1, tick_net_time2) > 120000)) {
1619
+    if (tick_net_time1 && getWifiTickDiff(tick_net_time1, tick_net_time2) > 120000) {
1585
       wifi_link_state = WIFI_NOT_CONFIG;
1620
       wifi_link_state = WIFI_NOT_CONFIG;
1586
       wifi_reset();
1621
       wifi_reset();
1587
       tick_net_time1 = getWifiTick();
1622
       tick_net_time1 = getWifiTick();
1598
 }
1633
 }
1599
 
1634
 
1600
 void wifi_looping() {
1635
 void wifi_looping() {
1601
-  do { wifi_rcv_handle(); } while (wifi_link_state == WIFI_TRANS_FILE);
1636
+  do {
1637
+    wifi_rcv_handle();
1638
+    watchdog_refresh();
1639
+  } while (wifi_link_state == WIFI_TRANS_FILE);
1602
 }
1640
 }
1603
 
1641
 
1604
 void mks_esp_wifi_init() {
1642
 void mks_esp_wifi_init() {
1616
   wifi_reset();
1654
   wifi_reset();
1617
 
1655
 
1618
   #if 0
1656
   #if 0
1619
-    res = f_open(&esp_upload.uploadFile, ESP_FIRMWARE_FILE,  FA_OPEN_EXISTING | FA_READ);
1620
-
1621
-    if (res ==  FR_OK) {
1622
-      f_close(&esp_upload.uploadFile);
1623
-
1624
-      wifi_delay(2000);
1625
-
1626
-      if (usartFifoAvailable((SZ_USART_FIFO *)&WifiRxFifo) < 20) {
1627
-        return;
1628
-      }
1629
-
1630
-      clear_cur_ui();
1631
-
1632
-      draw_dialog(DIALOG_TYPE_UPDATE_ESP_FIRMARE);
1633
-
1634
-      if (wifi_upload(0) >= 0) {
1635
-
1636
-        f_unlink("1:/MKS_WIFI_CUR");
1637
-        f_rename(ESP_FIRMWARE_FILE,"/MKS_WIFI_CUR");
1638
-      }
1639
-      draw_return_ui();
1640
-
1641
-      update_flag = 1;
1642
-    }
1643
-    if (update_flag == 0) {
1644
-      res = f_open(&esp_upload.uploadFile, ESP_WEB_FIRMWARE_FILE,  FA_OPEN_EXISTING | FA_READ);
1657
+  if (update_flag == 0) {
1658
+    res = f_open(&esp_upload.uploadFile, ESP_WEB_FIRMWARE_FILE,  FA_OPEN_EXISTING | FA_READ);
1645
 
1659
 
1646
       if (res ==  FR_OK) {
1660
       if (res ==  FR_OK) {
1647
         f_close(&esp_upload.uploadFile);
1661
         f_close(&esp_upload.uploadFile);
1694
   wifi_link_state = WIFI_NOT_CONFIG;
1708
   wifi_link_state = WIFI_NOT_CONFIG;
1695
 }
1709
 }
1696
 
1710
 
1697
-#define BUF_INC_POINTER(p)  ((p + 1 == UART_FIFO_BUFFER_SIZE) ? 0 : (p + 1))
1698
 
1711
 
1699
-int usartFifoAvailable(SZ_USART_FIFO *fifo) {
1700
-  int diff = fifo->uart_write_point - fifo->uart_read_point;
1701
-  if (diff < 0) diff += UART_FIFO_BUFFER_SIZE;
1702
-  return diff;
1703
-}
1712
+void mks_wifi_firmware_update() {
1713
+  card.openFileRead((char *)ESP_FIRMWARE_FILE);
1714
+
1715
+  if (card.isFileOpen()) {
1716
+    card.closefile();
1717
+
1718
+    wifi_delay(2000);
1704
 
1719
 
1705
-int readUsartFifo(SZ_USART_FIFO *fifo, int8_t *buf, int32_t len) {
1706
-  int i = 0 ;
1707
-  while (i < len && fifo->uart_read_point != fifo->uart_write_point) {
1708
-    buf[i++] = fifo->uartTxBuffer[fifo->uart_read_point];
1709
-    fifo->uart_read_point = BUF_INC_POINTER(fifo->uart_read_point);
1720
+    if (usartFifoAvailable((SZ_USART_FIFO *)&WifiRxFifo) < 20)
1721
+      return;
1722
+
1723
+    clear_cur_ui();
1724
+
1725
+    lv_draw_dialog(DIALOG_TYPE_UPDATE_ESP_FIRMARE);
1726
+
1727
+    lv_task_handler();
1728
+    watchdog_refresh();
1729
+
1730
+    if (wifi_upload(0) >= 0) {
1731
+      card.removeFile((char *)ESP_FIRMWARE_FILE_RENAME);
1732
+      SdFile file, *curDir;
1733
+      const char * const fname = card.diveToFile(true, curDir, ESP_FIRMWARE_FILE);
1734
+      if (file.open(curDir, fname, O_READ)) {
1735
+        file.rename(curDir, (char *)ESP_FIRMWARE_FILE_RENAME);
1736
+        file.close();
1737
+      }
1738
+    }
1739
+    clear_cur_ui();
1710
   }
1740
   }
1711
-  return i;
1712
 }
1741
 }
1713
 
1742
 
1714
-int writeUsartFifo(SZ_USART_FIFO *fifo, int8_t *buf, int32_t len) {
1715
-  if (buf == 0 || len <= 0) return -1;
1743
+#define BUF_INC_POINTER(p)  ((p + 1 == UART_FIFO_BUFFER_SIZE) ? 0:(p + 1))
1716
 
1744
 
1717
-  int i = 0 ;
1718
-  while (i < len && fifo->uart_read_point != BUF_INC_POINTER(fifo->uart_write_point)) {
1719
-    fifo->uartTxBuffer[fifo->uart_write_point] = buf[i++];
1720
-    fifo->uart_write_point = BUF_INC_POINTER(fifo->uart_write_point);
1721
-  }
1722
-  return i;
1745
+int usartFifoAvailable(SZ_USART_FIFO *fifo) {
1746
+  return WIFISERIAL.available();
1723
 }
1747
 }
1724
 
1748
 
1725
 void get_wifi_commands() {
1749
 void get_wifi_commands() {
1791
         if (!wifi_comment_mode) wifi_line_buffer[wifi_read_count++] = wifi_char;
1815
         if (!wifi_comment_mode) wifi_line_buffer[wifi_read_count++] = wifi_char;
1792
       }
1816
       }
1793
     }
1817
     }
1794
-  }// queue has space, serial has data
1795
-  else {
1818
+  } // queue has space, serial has data
1819
+  else
1796
     espGcodeFifo.wait_tick++;
1820
     espGcodeFifo.wait_tick++;
1797
-  }
1798
 }
1821
 }
1799
 
1822
 
1800
 int readWifiBuf(int8_t *buf, int32_t len) {
1823
 int readWifiBuf(int8_t *buf, int32_t len) {

+ 3
- 8
Marlin/src/lcd/extui/lib/mks_ui/wifi_module.h View File

34
 #define UART_RX_BUFFER_SIZE   1024
34
 #define UART_RX_BUFFER_SIZE   1024
35
 #define UART_FIFO_BUFFER_SIZE 1024
35
 #define UART_FIFO_BUFFER_SIZE 1024
36
 
36
 
37
-#define ESP_WIFI              0x02
38
-
39
-#define AP_MODEL              0x01
40
-#define STA_MODEL             0x02
41
-
42
 #define WIFI_DECODE_TYPE      1
37
 #define WIFI_DECODE_TYPE      1
43
 
38
 
44
 #define IP_DHCP_FLAG          1
39
 #define IP_DHCP_FLAG          1
66
   udisk_buf_full,
61
   udisk_buf_full,
67
 } UDISK_DATA_BUFFER_STATE;
62
 } UDISK_DATA_BUFFER_STATE;
68
 
63
 
69
-#define TRANS_RCV_FIFO_BLOCK_NUM    8
64
+#define TRANS_RCV_FIFO_BLOCK_NUM  14
70
 
65
 
71
 typedef struct {
66
 typedef struct {
72
   unsigned char *bufferAddr[TRANS_RCV_FIFO_BLOCK_NUM];
67
   unsigned char *bufferAddr[TRANS_RCV_FIFO_BLOCK_NUM];
164
 typedef struct {
159
 typedef struct {
165
   uint32_t uart_read_point;
160
   uint32_t uart_read_point;
166
   uint32_t uart_write_point;
161
   uint32_t uart_write_point;
167
-  uint8_t uartTxBuffer[UART_FIFO_BUFFER_SIZE];
162
+  //uint8_t uartTxBuffer[UART_FIFO_BUFFER_SIZE];
168
 } SZ_USART_FIFO;
163
 } SZ_USART_FIFO;
169
 
164
 
170
 #define WIFI_GCODE_BUFFER_LEAST_SIZE    96
165
 #define WIFI_GCODE_BUFFER_LEAST_SIZE    96
195
 extern void get_wifi_list_command_send();
190
 extern void get_wifi_list_command_send();
196
 extern void get_wifi_commands();
191
 extern void get_wifi_commands();
197
 extern int  readWifiBuf(int8_t *buf, int32_t len);
192
 extern int  readWifiBuf(int8_t *buf, int32_t len);
198
-extern int  storeRcvData(int32_t len);
193
+extern void mks_wifi_firmware_update();
199
 
194
 
200
 #ifdef __cplusplus
195
 #ifdef __cplusplus
201
   } /* C-declarations for C++ */
196
   } /* C-declarations for C++ */

+ 158
- 278
Marlin/src/lcd/extui/lib/mks_ui/wifi_upload.cpp View File

28
 #include "wifi_upload.h"
28
 #include "wifi_upload.h"
29
 
29
 
30
 #include "../../../../MarlinCore.h"
30
 #include "../../../../MarlinCore.h"
31
+#include "../../../../sd/cardreader.h"
31
 
32
 
32
 #define WIFI_SET()        WRITE(WIFI_RESET_PIN, HIGH);
33
 #define WIFI_SET()        WRITE(WIFI_RESET_PIN, HIGH);
33
 #define WIFI_RESET()      WRITE(WIFI_RESET_PIN, LOW);
34
 #define WIFI_RESET()      WRITE(WIFI_RESET_PIN, LOW);
85
 static const uint32_t eraseTimeout = 15000;
86
 static const uint32_t eraseTimeout = 15000;
86
 static const uint32_t blockWriteTimeout = 200;
87
 static const uint32_t blockWriteTimeout = 200;
87
 static const uint32_t blockWriteInterval = 15;      // 15ms is long enough, 10ms is mostly too short
88
 static const uint32_t blockWriteInterval = 15;      // 15ms is long enough, 10ms is mostly too short
89
+static SdFile update_file, *update_curDir;
88
 
90
 
89
 // Messages corresponding to result codes, should make sense when followed by " error"
91
 // Messages corresponding to result codes, should make sense when followed by " error"
90
 const char *resultMessages[] = {
92
 const char *resultMessages[] = {
113
   return esp_upload.state == upload_idle;
115
   return esp_upload.state == upload_idle;
114
 }
116
 }
115
 
117
 
116
-void uploadPort_write(const uint8_t *buf, size_t len) {
117
-  #if 0
118
-  int i;
119
-
120
-  for (i = 0; i < len; i++) {
121
-    while (USART_GetFlagStatus(USART1, USART_FLAG_TC) == RESET) { /* nada */ }
122
-    USART_SendData(USART1, *(buf + i));
123
-  }
124
-  #endif
118
+void uploadPort_write(const uint8_t *buf, const size_t len) {
119
+  for (size_t i = 0; i < len; i++)
120
+    WIFISERIAL.write(*(buf + i));
125
 }
121
 }
126
 
122
 
127
 char uploadPort_read() {
123
 char uploadPort_read() {
128
   uint8_t retChar;
124
   uint8_t retChar;
129
-  if (readUsartFifo(&WifiRxFifo, (int8_t *)&retChar, 1) == 1)
130
-    return retChar;
131
-  else
132
-    return 0;
125
+  retChar = WIFISERIAL.read();
126
+  return _MAX(retChar, 0);
133
 }
127
 }
134
 
128
 
135
 int uploadPort_available() {
129
 int uploadPort_available() {
156
 // Extract 1-4 bytes of a value in little-endian order from a buffer beginning at a specified offset
150
 // Extract 1-4 bytes of a value in little-endian order from a buffer beginning at a specified offset
157
 uint32_t getData(unsigned byteCnt, const uint8_t *buf, int ofst) {
151
 uint32_t getData(unsigned byteCnt, const uint8_t *buf, int ofst) {
158
   uint32_t val = 0;
152
   uint32_t val = 0;
159
-
160
   if (buf && byteCnt) {
153
   if (buf && byteCnt) {
161
     unsigned int shiftCnt = 0;
154
     unsigned int shiftCnt = 0;
162
-    if (byteCnt > 4)
163
-      byteCnt = 4;
164
-    do{
155
+    NOMORE(byteCnt, 4);
156
+    do {
165
       val |= (uint32_t)buf[ofst++] << shiftCnt;
157
       val |= (uint32_t)buf[ofst++] << shiftCnt;
166
       shiftCnt += 8;
158
       shiftCnt += 8;
167
     } while (--byteCnt);
159
     } while (--byteCnt);
168
   }
160
   }
169
-  return(val);
161
+  return val;
170
 }
162
 }
171
 
163
 
172
 // Put 1-4 bytes of a value in little-endian order into a buffer beginning at a specified offset.
164
 // Put 1-4 bytes of a value in little-endian order into a buffer beginning at a specified offset.
173
 void putData(uint32_t val, unsigned byteCnt, uint8_t *buf, int ofst) {
165
 void putData(uint32_t val, unsigned byteCnt, uint8_t *buf, int ofst) {
174
   if (buf && byteCnt) {
166
   if (buf && byteCnt) {
175
-    if (byteCnt > 4) {
176
-      byteCnt = 4;
177
-    }
167
+    NOMORE(byteCnt, 4);
178
     do {
168
     do {
179
       buf[ofst++] = (uint8_t)(val & 0xFF);
169
       buf[ofst++] = (uint8_t)(val & 0xFF);
180
       val >>= 8;
170
       val >>= 8;
191
 //   -2 - a SLIP escape byte was found but the following byte wasn't available
181
 //   -2 - a SLIP escape byte was found but the following byte wasn't available
192
 //   -3 - a SLIP escape byte was followed by an invalid byte
182
 //   -3 - a SLIP escape byte was followed by an invalid byte
193
 int ReadByte(uint8_t *data, signed char slipDecode) {
183
 int ReadByte(uint8_t *data, signed char slipDecode) {
194
-  if (uploadPort_available() == 0) {
195
-    return(0);
196
-  }
184
+  if (uploadPort_available() == 0) return 0;
197
 
185
 
198
-  // at least one byte is available
186
+  // At least one byte is available
199
   *data = uploadPort_read();
187
   *data = uploadPort_read();
200
-  if (!slipDecode) {
201
-    return(1);
202
-  }
203
 
188
 
204
-  if (*data == 0xC0) {
205
-    // this shouldn't happen
206
-    return(-1);
207
-  }
189
+  if (!slipDecode) return 1;
208
 
190
 
209
-  // if not the SLIP escape, we're done
210
-  if (*data != 0xDB) {
211
-    return(1);
212
-  }
191
+  if (*data == 0xC0) return -1; // This shouldn't happen
192
+  if (*data != 0xDB) return 1;  // If not the SLIP escape, we're done
213
 
193
 
214
   // SLIP escape, check availability of subsequent byte
194
   // SLIP escape, check availability of subsequent byte
215
-  if (uploadPort_available() == 0) {
216
-    return(-2);
217
-  }
195
+  if (uploadPort_available() == 0) return -2;
218
 
196
 
219
   // process the escaped byte
197
   // process the escaped byte
220
   *data = uploadPort_read();
198
   *data = uploadPort_read();
221
-  if (*data == 0xDC) {
222
-    *data = 0xC0;
223
-    return(2);
224
-  }
199
+  if (*data == 0xDC) { *data = 0xC0; return 2; }
200
+  if (*data == 0xDD) { *data = 0xDB; return 2; }
225
 
201
 
226
-  if (*data == 0xDD) {
227
-    *data = 0xDB;
228
-    return(2);
229
-  }
230
-  // invalid
231
-  return(-3);
202
+  return -3; // invalid
232
 }
203
 }
233
 // When we write a sync packet, there must be no gaps between most of the characters.
204
 // When we write a sync packet, there must be no gaps between most of the characters.
234
 // So use this function, which does a block write to the UART buffer in the latest CoreNG.
205
 // So use this function, which does a block write to the UART buffer in the latest CoreNG.
242
 }
213
 }
243
 
214
 
244
 // Write a byte to the serial port optionally SLIP encoding. Return the number of bytes actually written.
215
 // Write a byte to the serial port optionally SLIP encoding. Return the number of bytes actually written.
245
-void WriteByteSlip(uint8_t b) {
216
+void WriteByteSlip(const uint8_t b) {
246
   if (b == 0xC0) {
217
   if (b == 0xC0) {
247
     WriteByteRaw(0xDB);
218
     WriteByteRaw(0xDB);
248
     WriteByteRaw(0xDC);
219
     WriteByteRaw(0xDC);
251
     WriteByteRaw(0xDB);
222
     WriteByteRaw(0xDB);
252
     WriteByteRaw(0xDD);
223
     WriteByteRaw(0xDD);
253
   }
224
   }
254
-  else {
225
+  else
255
     uploadPort_write((const uint8_t *)&b, 1);
226
     uploadPort_write((const uint8_t *)&b, 1);
256
-  }
257
 }
227
 }
258
 
228
 
259
 // Wait for a data packet to be returned.  If the body of the packet is
229
 // Wait for a data packet to be returned.  If the body of the packet is
295
     EspUploadResult stat;
265
     EspUploadResult stat;
296
 
266
 
297
     //IWDG_ReloadCounter();
267
     //IWDG_ReloadCounter();
268
+    watchdog_refresh();
298
 
269
 
299
-    if (getWifiTickDiff(startTime, getWifiTick()) > msTimeout) {
300
-      return(timeout);
301
-    }
270
+    if (getWifiTickDiff(startTime, getWifiTick()) > msTimeout)
271
+      return timeout;
302
 
272
 
303
     if (uploadPort_available() < needBytes) {
273
     if (uploadPort_available() < needBytes) {
304
       // insufficient data available
274
       // insufficient data available
310
     switch (state) {
280
     switch (state) {
311
       case begin: // expecting frame start
281
       case begin: // expecting frame start
312
         c = uploadPort_read();
282
         c = uploadPort_read();
313
-        if (c != (uint8_t)0xC0) {
314
-          break;
315
-        }
283
+        if (c == (uint8_t)0xC0) break;
316
         state = header;
284
         state = header;
317
         needBytes = 2;
285
         needBytes = 2;
318
         break;
286
         break;
323
         break;
291
         break;
324
 
292
 
325
       case header:  // reading an 8-byte header
293
       case header:  // reading an 8-byte header
326
-      case body:    // reading the response body
327
-        {
328
-          int rslt;
329
-          // retrieve a byte with SLIP decoding
330
-          rslt = ReadByte(&c, 1);
331
-          if (rslt != 1 && rslt != 2) {
332
-            // some error occurred
333
-            stat = (rslt == 0 || rslt == -2) ? slipData : slipFrame;
334
-            return stat;
335
-          }
336
-          else if (state == header) {
337
-            //store the header byte
338
-            hdr[hdrIdx++] = c;
339
-            if (hdrIdx >= headerLength) {
340
-              // get the body length, prepare a buffer for it
341
-              *bodyLen = (uint16_t)getData(2, hdr, 2);
342
-
343
-              // extract the value, if requested
344
-              if (valp != 0) {
345
-                *valp = getData(4, hdr, 4);
346
-              }
347
-
348
-              if (*bodyLen != 0) {
349
-                state = body;
350
-              }
351
-              else {
352
-                needBytes = 1;
353
-                state = end;
354
-              }
355
-            }
356
-          }
357
-          else {
358
-            // Store the response body byte, check for completion
359
-            if (bodyIdx < ARRAY_SIZE(respBuf)) {
360
-              respBuf[bodyIdx] = c;
361
-            }
362
-            ++bodyIdx;
363
-            if (bodyIdx >= *bodyLen) {
294
+      case body: {  // reading the response body
295
+        int rslt;
296
+        // retrieve a byte with SLIP decoding
297
+        rslt = ReadByte(&c, 1);
298
+        if (rslt != 1 && rslt != 2) {
299
+          // some error occurred
300
+          stat = (rslt == 0 || rslt == -2) ? slipData : slipFrame;
301
+          return stat;
302
+        }
303
+        else if (state == header) {
304
+          //store the header byte
305
+          hdr[hdrIdx++] = c;
306
+          if (hdrIdx >= headerLength) {
307
+            // get the body length, prepare a buffer for it
308
+            *bodyLen = (uint16_t)getData(2, hdr, 2);
309
+
310
+            // extract the value, if requested
311
+            if (valp)
312
+              *valp = getData(4, hdr, 4);
313
+
314
+            if (*bodyLen != 0)
315
+              state = body;
316
+            else {
364
               needBytes = 1;
317
               needBytes = 1;
365
               state = end;
318
               state = end;
366
             }
319
             }
367
           }
320
           }
368
         }
321
         }
369
-        break;
322
+        else {
323
+          // Store the response body byte, check for completion
324
+          if (bodyIdx < ARRAY_SIZE(respBuf))
325
+            respBuf[bodyIdx] = c;
326
+
327
+          if (++bodyIdx >= *bodyLen) {
328
+            needBytes = 1;
329
+            state = end;
330
+          }
331
+        }
332
+      } break;
370
 
333
 
371
       default: return slipState;  // this shouldn't happen
334
       default: return slipState;  // this shouldn't happen
372
     }
335
     }
376
   resp = (uint8_t)getData(1, hdr, 0);
339
   resp = (uint8_t)getData(1, hdr, 0);
377
   opRet = (uint8_t)getData(1, hdr, 1);
340
   opRet = (uint8_t)getData(1, hdr, 1);
378
   // Sync packets often provoke a response with a zero opcode instead of ESP_SYNC
341
   // Sync packets often provoke a response with a zero opcode instead of ESP_SYNC
379
-  if (resp != 0x01 || opRet != op) {
380
-    return respHeader;
381
-  }
342
+  if (resp != 0x01 || opRet != op) return respHeader;
382
 
343
 
383
   return success;
344
   return success;
384
 }
345
 }
483
     for (;;) {
444
     for (;;) {
484
       size_t bodyLen;
445
       size_t bodyLen;
485
       EspUploadResult rc = readPacket(ESP_SYNC, 0, &bodyLen, defaultTimeout);
446
       EspUploadResult rc = readPacket(ESP_SYNC, 0, &bodyLen, defaultTimeout);
447
+      watchdog_refresh();
486
       if (rc != success || bodyLen != 2) break;
448
       if (rc != success || bodyLen != 2) break;
487
     }
449
     }
488
   }
450
   }
527
 }
489
 }
528
 
490
 
529
 EspUploadResult flashWriteBlock(uint16_t flashParmVal, uint16_t flashParmMask) {
491
 EspUploadResult flashWriteBlock(uint16_t flashParmVal, uint16_t flashParmMask) {
530
-  #if 0
531
   const uint32_t blkSize = EspFlashBlockSize;
492
   const uint32_t blkSize = EspFlashBlockSize;
532
   int i;
493
   int i;
533
 
494
 
548
   putData(0, 4, blkBuf, hdrOfst + 12);
509
   putData(0, 4, blkBuf, hdrOfst + 12);
549
 
510
 
550
   // Get the data for the block
511
   // Get the data for the block
551
-  f_read(&esp_upload.uploadFile, blkBuf + dataOfst,  blkSize, &cnt );//->Read(reinterpret_cast<char *>(blkBuf + dataOfst), blkSize);
512
+  cnt = update_file.read(blkBuf + dataOfst, blkSize); //->Read(reinterpret_cast<char *>(blkBuf + dataOfst), blkSize);
552
   if (cnt != blkSize) {
513
   if (cnt != blkSize) {
553
-    if (f_tell(&esp_upload.uploadFile) == esp_upload.fileSize) {
514
+    if (update_file.curPosition() == esp_upload.fileSize) {
554
       // partial last block, fill the remainder
515
       // partial last block, fill the remainder
555
       memset(blkBuf + dataOfst + cnt, 0xFF, blkSize - cnt);
516
       memset(blkBuf + dataOfst + cnt, 0xFF, blkSize - cnt);
556
     }
517
     }
557
-    else {
518
+    else
558
       return fileRead;
519
       return fileRead;
559
-    }
560
   }
520
   }
561
 
521
 
562
   // Patch the flash parameters into the first block if it is loaded at address 0
522
   // Patch the flash parameters into the first block if it is loaded at address 0
573
     if ((stat = doCommand(ESP_FLASH_DATA, blkBuf, blkBufSize, cksum, 0, blockWriteTimeout)) == success)
533
     if ((stat = doCommand(ESP_FLASH_DATA, blkBuf, blkBufSize, cksum, 0, blockWriteTimeout)) == success)
574
       break;
534
       break;
575
   return stat;
535
   return stat;
576
-  #else
577
-    return success;
578
-  #endif
579
 }
536
 }
580
 
537
 
581
 void upload_spin() {
538
 void upload_spin() {
582
-  #if 0
583
-  switch (esp_upload.state) {
584
-  case resetting:
585
-
586
-    if (esp_upload.connectAttemptNumber == 9) {
587
-      // Time to give up
588
-      //Network::ResetWiFi();
589
-      esp_upload.uploadResult = connected;
590
-      esp_upload.state = done;
591
-    }
592
-    else {
593
-
594
-      // Reset the serial port at the new baud rate. Also reset the ESP8266.
595
-      //  const uint32_t baud = uploadBaudRates[esp_upload.connectAttemptNumber/esp_upload.retriesPerBaudRate];
596
-      if (esp_upload.connectAttemptNumber % esp_upload.retriesPerBaudRate == 0) {
597
-      }
598
-      //uploadPort.begin(baud);
599
-      //uploadPort_close();
600
-
601
-      uploadPort_begin();
602
-
603
-      wifi_delay(2000);
604
-
605
-      flushInput();
606
-
607
-      esp_upload.lastAttemptTime = esp_upload.lastResetTime = getWifiTick();
608
-      esp_upload.state = connecting;
609
-    }
610
 
539
 
611
-    break;
612
-
613
-  case connecting:
614
-    if ((getWifiTickDiff(esp_upload.lastAttemptTime, getWifiTick()) >= connectAttemptInterval) && (getWifiTickDiff(esp_upload.lastResetTime, getWifiTick()) >= 500)) {
615
-      // Attempt to establish a connection to the ESP8266.
616
-      EspUploadResult res = Sync(5000);
617
-      esp_upload.lastAttemptTime = getWifiTick();
618
-      if (res == success) {
619
-        // Successful connection
620
-        //MessageF(" success on attempt %d\n", (connectAttemptNumber % retriesPerBaudRate) + 1);
621
-        //printf("connect success\n");
622
-        esp_upload.state = erasing;
623
-      }
624
-      else {
625
-        // This attempt failed
626
-        esp_upload.connectAttemptNumber++;
627
-        if (esp_upload.connectAttemptNumber % retriesPerReset == 0) {
628
-          esp_upload.state = resetting;   // try a reset and a lower baud rate
629
-        }
630
-      }
631
-    }
632
-    break;
633
-
634
-  case erasing:
635
-    if (getWifiTickDiff(esp_upload.lastAttemptTime, getWifiTick()) >= blockWriteInterval) {
636
-      uint32_t eraseSize;
637
-      const uint32_t sectorsPerBlock = 16;
638
-      const uint32_t sectorSize = 4096;
639
-      const uint32_t numSectors = (esp_upload.fileSize + sectorSize - 1)/sectorSize;
640
-      const uint32_t startSector = esp_upload.uploadAddress/sectorSize;
641
-
642
-      uint32_t headSectors = sectorsPerBlock - (startSector % sectorsPerBlock);
643
-      NOMORE(headSectors, numSectors);
644
-
645
-      eraseSize = (numSectors < 2 * headSectors)
646
-                ? (numSectors + 1) / 2 * sectorSize
647
-                : (numSectors - headSectors) * sectorSize;
648
-
649
-      //MessageF("Erasing %u bytes...\n", fileSize);
650
-      esp_upload.uploadResult = flashBegin(esp_upload.uploadAddress, eraseSize);
651
-      if (esp_upload.uploadResult == success) {
652
-        //MessageF("Uploading file...\n");
653
-        esp_upload.uploadBlockNumber = 0;
654
-        esp_upload.uploadNextPercentToReport = percentToReportIncrement;
655
-        esp_upload.lastAttemptTime = getWifiTick();
656
-        esp_upload.state = uploading;
540
+  switch (esp_upload.state) {
541
+    case resetting:
542
+      if (esp_upload.connectAttemptNumber == 9) {
543
+        esp_upload.uploadResult = connected;
544
+        esp_upload.state = done;
657
       }
545
       }
658
       else {
546
       else {
659
-        //MessageF("Erase failed\n");
660
-        esp_upload.state = done;
547
+        uploadPort_begin();
548
+        wifi_delay(2000);
549
+        flushInput();
550
+        esp_upload.lastAttemptTime = esp_upload.lastResetTime = getWifiTick();
551
+        esp_upload.state = connecting;
661
       }
552
       }
662
-    }
663
-    break;
664
-
665
-  case uploading:
666
-    // The ESP needs several milliseconds to recover from one packet before it will accept another
667
-    if (getWifiTickDiff(esp_upload.lastAttemptTime, getWifiTick()) >= 15) {
668
-      unsigned int percentComplete;
669
-      const uint32_t blkCnt = (esp_upload.fileSize + EspFlashBlockSize - 1) / EspFlashBlockSize;
670
-      if (esp_upload.uploadBlockNumber < blkCnt) {
671
-        esp_upload.uploadResult = flashWriteBlock(0, 0);
553
+      break;
554
+
555
+    case connecting:
556
+      if ((getWifiTickDiff(esp_upload.lastAttemptTime, getWifiTick()) >= connectAttemptInterval) && (getWifiTickDiff(esp_upload.lastResetTime, getWifiTick()) >= 500)) {
557
+        EspUploadResult res = Sync(5000);
672
         esp_upload.lastAttemptTime = getWifiTick();
558
         esp_upload.lastAttemptTime = getWifiTick();
673
-        if (esp_upload.uploadResult != success) {
674
-          //MessageF("Flash block upload failed\n");
675
-          esp_upload.state = done;
559
+        if (res == success)
560
+          esp_upload.state = erasing;
561
+        else {
562
+          esp_upload.connectAttemptNumber++;
563
+          if (esp_upload.connectAttemptNumber % retriesPerReset == 0)
564
+            esp_upload.state = resetting;
676
         }
565
         }
677
-        percentComplete = (100 * esp_upload.uploadBlockNumber)/blkCnt;
678
-        ++esp_upload.uploadBlockNumber;
679
-        if (percentComplete >= esp_upload.uploadNextPercentToReport) {
680
-          //MessageF("%u%% complete\n", percentComplete);
681
-          esp_upload.uploadNextPercentToReport += percentToReportIncrement;
682
-        }
683
-      }
684
-      else {
685
-        esp_upload.state = done;
686
       }
566
       }
687
-    }
688
-    break;
567
+      break;
689
 
568
 
690
-  case done:
691
-    f_close(&esp_upload.uploadFile);
692
-    //uploadPort.end();
693
-    //uploadPort_close();
569
+    case erasing:
570
+      if (getWifiTickDiff(esp_upload.lastAttemptTime, getWifiTick()) >= blockWriteInterval) {
571
+        uint32_t eraseSize;
572
+        const uint32_t sectorsPerBlock = 16;
573
+        const uint32_t sectorSize = 4096;
574
+        const uint32_t numSectors = (esp_upload.fileSize + sectorSize - 1)/sectorSize;
575
+        const uint32_t startSector = esp_upload.uploadAddress/sectorSize;
576
+
577
+        uint32_t headSectors = sectorsPerBlock - (startSector % sectorsPerBlock);
578
+        NOMORE(headSectors, numSectors);
579
+
580
+        eraseSize = (numSectors < 2 * headSectors)
581
+                  ? (numSectors + 1) / 2 * sectorSize
582
+                  : (numSectors - headSectors) * sectorSize;
583
+
584
+        esp_upload.uploadResult = flashBegin(esp_upload.uploadAddress, eraseSize);
585
+        if (esp_upload.uploadResult == success) {
586
+          esp_upload.uploadBlockNumber = 0;
587
+          esp_upload.uploadNextPercentToReport = percentToReportIncrement;
588
+          esp_upload.lastAttemptTime = getWifiTick();
589
+          esp_upload.state = uploading;
590
+        }
591
+        else
592
+          esp_upload.state = done;
593
+      }
594
+      break;
694
 
595
 
695
-    //WIFI_COM.begin(115200, true);
696
-    //wifi_init();
596
+    case uploading:
597
+      // The ESP needs several milliseconds to recover from one packet before it will accept another
598
+      if (getWifiTickDiff(esp_upload.lastAttemptTime, getWifiTick()) >= 15) {
599
+        unsigned int percentComplete;
600
+        const uint32_t blkCnt = (esp_upload.fileSize + EspFlashBlockSize - 1) / EspFlashBlockSize;
601
+        if (esp_upload.uploadBlockNumber < blkCnt) {
602
+          esp_upload.uploadResult = flashWriteBlock(0, 0);
603
+          esp_upload.lastAttemptTime = getWifiTick();
604
+          if (esp_upload.uploadResult != success)
605
+            esp_upload.state = done;
606
+          percentComplete = (100 * esp_upload.uploadBlockNumber)/blkCnt;
607
+          ++esp_upload.uploadBlockNumber;
608
+          if (percentComplete >= esp_upload.uploadNextPercentToReport)
609
+            esp_upload.uploadNextPercentToReport += percentToReportIncrement;
610
+        }
611
+        else
612
+          esp_upload.state = done;
613
+      }
614
+      break;
697
 
615
 
698
-    if (esp_upload.uploadResult == success) {
699
-      //printf("upload successfully\n");
700
-    }
701
-    else {
702
-      //printf("upload failed\n");
703
-    }
704
-    esp_upload.state = upload_idle;//idle;
705
-    break;
616
+    case done:
617
+      update_file.close();
618
+      esp_upload.state = upload_idle;
619
+      break;
706
 
620
 
707
     default: break;
621
     default: break;
708
   }
622
   }
709
-  #endif
710
 }
623
 }
711
 
624
 
712
 // Try to upload the given file at the given address
625
 // Try to upload the given file at the given address
713
 void SendUpdateFile(const char *file, uint32_t address) {
626
 void SendUpdateFile(const char *file, uint32_t address) {
714
-  #if 0
715
-  FRESULT res = f_open(&esp_upload.uploadFile, file,  FA_OPEN_EXISTING | FA_READ);
627
+  const char * const fname = card.diveToFile(true, update_curDir, ESP_FIRMWARE_FILE);
628
+  if (!update_file.open(update_curDir, fname, O_READ)) return;
716
 
629
 
717
-  if (res !=  FR_OK) return;
630
+  esp_upload.fileSize = update_file.fileSize();
718
 
631
 
719
-  esp_upload.fileSize = f_size(&esp_upload.uploadFile);
720
   if (esp_upload.fileSize == 0) {
632
   if (esp_upload.fileSize == 0) {
721
-    f_close(&esp_upload.uploadFile);
633
+    update_file.close();
722
     return;
634
     return;
723
   }
635
   }
724
-  f_lseek(&esp_upload.uploadFile, 0);
725
 
636
 
726
   esp_upload.uploadAddress = address;
637
   esp_upload.uploadAddress = address;
727
   esp_upload.connectAttemptNumber = 0;
638
   esp_upload.connectAttemptNumber = 0;
728
   esp_upload.state = resetting;
639
   esp_upload.state = resetting;
729
-  #endif
730
 }
640
 }
731
 
641
 
732
 static const uint32_t FirmwareAddress = 0x00000000, WebFilesAddress = 0x00100000;
642
 static const uint32_t FirmwareAddress = 0x00000000, WebFilesAddress = 0x00100000;
733
 
643
 
734
 void ResetWiFiForUpload(int begin_or_end) {
644
 void ResetWiFiForUpload(int begin_or_end) {
735
-  #if 0
736
-    uint32_t start, now;
737
-
738
-    GPIO_InitTypeDef GPIO_InitStructure;
739
-
740
-    #if V1_0_V1_1
741
-      GPIO_InitStructure.Speed = GPIO_SPEED_FREQ_HIGH;
742
-      GPIO_InitStructure.Pin = GPIO_Pin_8;
743
-      GPIO_InitStructure.Mode = GPIO_MODE_OUTPUT_PP;
744
-      HAL_GPIO_Init(GPIOA, &GPIO_InitStructure);
745
-    #else
746
-      GPIO_InitStructure.Speed = GPIO_SPEED_FREQ_LOW;
747
-      GPIO_InitStructure.Pin = GPIO_Pin_13;
748
-      GPIO_InitStructure.Mode = GPIO_MODE_OUTPUT_PP;
749
-      HAL_GPIO_Init(GPIOC, &GPIO_InitStructure);
750
-    #endif
751
-    start = getWifiTick();
752
-    now = start;
753
-
754
-    if (begin_or_end == 0) {
755
-      #if V1_0_V1_1
756
-        HAL_GPIO_WritePin(GPIOA,GPIO_Pin_8,GPIO_PIN_RESET); //update mode
757
-      #else
758
-        HAL_GPIO_WritePin(GPIOC,GPIO_Pin_13,GPIO_PIN_RESET); //update mode
759
-      #endif
760
-    }
761
-    else {
762
-      #if V1_0_V1_1
763
-        #if V1_0_V1_1
764
-          HAL_GPIO_WritePin(GPIOA,GPIO_Pin_8,GPIO_PIN_SET); //boot mode
765
-          GPIO_InitStructure.Speed = GPIO_SPEED_FREQ_HIGH;
766
-          GPIO_InitStructure.Pin = GPIO_Pin_8;
767
-          GPIO_InitStructure.Mode = GPIO_MODE_INPUT;
768
-          HAL_GPIO_Init(GPIOA, &GPIO_InitStructure);
769
-        #endif
770
-      #else
771
-        HAL_GPIO_WritePin(GPIOC,GPIO_Pin_13,GPIO_PIN_SET); //boot mode
772
-        GPIO_InitStructure.Speed = GPIO_SPEED_FREQ_LOW;
773
-        GPIO_InitStructure.Pin = GPIO_Pin_13;
774
-        GPIO_InitStructure.Mode = GPIO_MODE_INPUT;
775
-        HAL_GPIO_Init(GPIOC, &GPIO_InitStructure);
776
-      #endif
777
-    }
778
-    WIFI_RESET();
779
-    while (getWifiTickDiff(start, now) < 500) now = getWifiTick();
780
-    WIFI_SET();
781
-  #endif
645
+  //#if 0
646
+  uint32_t start, now;
647
+
648
+  start = getWifiTick();
649
+  now = start;
650
+
651
+  if (begin_or_end == 0) {
652
+    SET_OUTPUT(WIFI_IO0_PIN);
653
+    WRITE(WIFI_IO0_PIN, LOW);
654
+  }
655
+  else
656
+    SET_INPUT_PULLUP(WIFI_IO0_PIN);
657
+
658
+  WIFI_RESET();
659
+  while (getWifiTickDiff(start, now) < 500) now = getWifiTick();
660
+  WIFI_SET();
661
+  //#endif
782
 }
662
 }
783
 
663
 
784
 int32_t wifi_upload(int type) {
664
 int32_t wifi_upload(int type) {
797
 
677
 
798
   while (esp_upload.state != upload_idle) {
678
   while (esp_upload.state != upload_idle) {
799
     upload_spin();
679
     upload_spin();
800
-    //IWDG_ReloadCounter();
680
+    watchdog_refresh();
801
   }
681
   }
802
 
682
 
803
   ResetWiFiForUpload(1);
683
   ResetWiFiForUpload(1);

+ 4
- 3
Marlin/src/lcd/extui/lib/mks_ui/wifi_upload.h View File

25
   extern "C" { /* C-declarations for C++ */
25
   extern "C" { /* C-declarations for C++ */
26
 #endif
26
 #endif
27
 
27
 
28
-#define ESP_FIRMWARE_FILE     "1:/MksWifi.bin"
29
-#define ESP_WEB_FIRMWARE_FILE "1:/MksWifi_Web.bin"
30
-#define ESP_WEB_FILE          "1:/MksWifi_WebView.bin"
28
+#define ESP_FIRMWARE_FILE         "MksWifi.bin"
29
+#define ESP_FIRMWARE_FILE_RENAME  "MKSWIFI.CUR"
30
+#define ESP_WEB_FIRMWARE_FILE     "1:/MksWifi_Web.bin"
31
+#define ESP_WEB_FILE              "1:/MksWifi_WebView.bin"
31
 
32
 
32
 typedef enum {
33
 typedef enum {
33
   upload_idle,
34
   upload_idle,

+ 56
- 54
Marlin/src/libs/W25Qxx.cpp View File

49
 #define W25QXX_CS_H OUT_WRITE(SPI_FLASH_CS_PIN, HIGH)
49
 #define W25QXX_CS_H OUT_WRITE(SPI_FLASH_CS_PIN, HIGH)
50
 #define W25QXX_CS_L OUT_WRITE(SPI_FLASH_CS_PIN, LOW)
50
 #define W25QXX_CS_L OUT_WRITE(SPI_FLASH_CS_PIN, LOW)
51
 
51
 
52
+bool flash_dma_mode = true;
53
+
52
 void W25QXXFlash::init(uint8_t spiRate) {
54
 void W25QXXFlash::init(uint8_t spiRate) {
53
 
55
 
54
   OUT_WRITE(SPI_FLASH_CS_PIN, HIGH);
56
   OUT_WRITE(SPI_FLASH_CS_PIN, HIGH);
144
 }
146
 }
145
 
147
 
146
 void W25QXXFlash::SPI_FLASH_WriteEnable(void) {
148
 void W25QXXFlash::SPI_FLASH_WriteEnable(void) {
147
-  /* Select the FLASH: Chip Select low */
149
+  // Select the FLASH: Chip Select low
148
   W25QXX_CS_L;
150
   W25QXX_CS_L;
149
-  /* Send "Write Enable" instruction */
151
+  // Send "Write Enable" instruction
150
   spi_flash_Send(W25X_WriteEnable);
152
   spi_flash_Send(W25X_WriteEnable);
151
-  /* Deselect the FLASH: Chip Select high */
153
+  // Deselect the FLASH: Chip Select high
152
   W25QXX_CS_H;
154
   W25QXX_CS_H;
153
 }
155
 }
154
 
156
 
164
 void W25QXXFlash::SPI_FLASH_WaitForWriteEnd(void) {
166
 void W25QXXFlash::SPI_FLASH_WaitForWriteEnd(void) {
165
   uint8_t FLASH_Status = 0;
167
   uint8_t FLASH_Status = 0;
166
 
168
 
167
-  /* Select the FLASH: Chip Select low */
169
+  // Select the FLASH: Chip Select low
168
   W25QXX_CS_L;
170
   W25QXX_CS_L;
169
-  /* Send "Read Status Register" instruction */
171
+  // Send "Read Status Register" instruction
170
   spi_flash_Send(W25X_ReadStatusReg);
172
   spi_flash_Send(W25X_ReadStatusReg);
171
 
173
 
172
-  /* Loop as long as the memory is busy with a write cycle */
174
+  // Loop as long as the memory is busy with a write cycle
173
   do
175
   do
174
     /* Send a dummy byte to generate the clock needed by the FLASH
176
     /* Send a dummy byte to generate the clock needed by the FLASH
175
     and put the value of the status register in FLASH_Status variable */
177
     and put the value of the status register in FLASH_Status variable */
176
     FLASH_Status = spi_flash_Rec();
178
     FLASH_Status = spi_flash_Rec();
177
-  while ((FLASH_Status & WIP_Flag) == 0x01); /* Write in progress */
179
+  while ((FLASH_Status & WIP_Flag) == 0x01); // Write in progress
178
 
180
 
179
-  /* Deselect the FLASH: Chip Select high */
181
+  // Deselect the FLASH: Chip Select high
180
   W25QXX_CS_H;
182
   W25QXX_CS_H;
181
 }
183
 }
182
 
184
 
183
 void W25QXXFlash::SPI_FLASH_SectorErase(uint32_t SectorAddr) {
185
 void W25QXXFlash::SPI_FLASH_SectorErase(uint32_t SectorAddr) {
184
-  /* Send write enable instruction */
186
+  // Send write enable instruction
185
   SPI_FLASH_WriteEnable();
187
   SPI_FLASH_WriteEnable();
186
 
188
 
187
-  /* Sector Erase */
188
-  /* Select the FLASH: Chip Select low */
189
+  // Sector Erase
190
+  // Select the FLASH: Chip Select low
189
   W25QXX_CS_L;
191
   W25QXX_CS_L;
190
-  /* Send Sector Erase instruction */
192
+  // Send Sector Erase instruction
191
   spi_flash_Send(W25X_SectorErase);
193
   spi_flash_Send(W25X_SectorErase);
192
-  /* Send SectorAddr high nibble address byte */
194
+  // Send SectorAddr high nibble address byte
193
   spi_flash_Send((SectorAddr & 0xFF0000) >> 16);
195
   spi_flash_Send((SectorAddr & 0xFF0000) >> 16);
194
-  /* Send SectorAddr medium nibble address byte */
196
+  // Send SectorAddr medium nibble address byte
195
   spi_flash_Send((SectorAddr & 0xFF00) >> 8);
197
   spi_flash_Send((SectorAddr & 0xFF00) >> 8);
196
-  /* Send SectorAddr low nibble address byte */
198
+  // Send SectorAddr low nibble address byte
197
   spi_flash_Send(SectorAddr & 0xFF);
199
   spi_flash_Send(SectorAddr & 0xFF);
198
-  /* Deselect the FLASH: Chip Select high */
200
+  // Deselect the FLASH: Chip Select high
199
 
201
 
200
   W25QXX_CS_H;
202
   W25QXX_CS_H;
201
-  /* Wait the end of Flash writing */
203
+  // Wait the end of Flash writing
202
   SPI_FLASH_WaitForWriteEnd();
204
   SPI_FLASH_WaitForWriteEnd();
203
 }
205
 }
204
 
206
 
205
 void W25QXXFlash::SPI_FLASH_BlockErase(uint32_t BlockAddr) {
207
 void W25QXXFlash::SPI_FLASH_BlockErase(uint32_t BlockAddr) {
206
   SPI_FLASH_WriteEnable();
208
   SPI_FLASH_WriteEnable();
207
   W25QXX_CS_L;
209
   W25QXX_CS_L;
208
-  /* Send Sector Erase instruction */
210
+  // Send Sector Erase instruction
209
   spi_flash_Send(W25X_BlockErase);
211
   spi_flash_Send(W25X_BlockErase);
210
-  /* Send SectorAddr high nibble address byte */
212
+  // Send SectorAddr high nibble address byte
211
   spi_flash_Send((BlockAddr & 0xFF0000) >> 16);
213
   spi_flash_Send((BlockAddr & 0xFF0000) >> 16);
212
-  /* Send SectorAddr medium nibble address byte */
214
+  // Send SectorAddr medium nibble address byte
213
   spi_flash_Send((BlockAddr & 0xFF00) >> 8);
215
   spi_flash_Send((BlockAddr & 0xFF00) >> 8);
214
-  /* Send SectorAddr low nibble address byte */
216
+  // Send SectorAddr low nibble address byte
215
   spi_flash_Send(BlockAddr & 0xFF);
217
   spi_flash_Send(BlockAddr & 0xFF);
216
 
218
 
217
   W25QXX_CS_H;
219
   W25QXX_CS_H;
227
 * Return         : None
229
 * Return         : None
228
 *******************************************************************************/
230
 *******************************************************************************/
229
 void W25QXXFlash::SPI_FLASH_BulkErase(void) {
231
 void W25QXXFlash::SPI_FLASH_BulkErase(void) {
230
-  /* Send write enable instruction */
232
+  // Send write enable instruction
231
   SPI_FLASH_WriteEnable();
233
   SPI_FLASH_WriteEnable();
232
 
234
 
233
-  /* Bulk Erase */
234
-  /* Select the FLASH: Chip Select low */
235
+  // Bulk Erase
236
+  // Select the FLASH: Chip Select low
235
   W25QXX_CS_L;
237
   W25QXX_CS_L;
236
 
238
 
237
-  /* Send Bulk Erase instruction  */
239
+  // Send Bulk Erase instruction
238
   spi_flash_Send(W25X_ChipErase);
240
   spi_flash_Send(W25X_ChipErase);
239
-  /* Deselect the FLASH: Chip Select high */
241
+  // Deselect the FLASH: Chip Select high
240
   W25QXX_CS_H;
242
   W25QXX_CS_H;
241
-  /* Wait the end of Flash writing */
243
+  // Wait the end of Flash writing
242
   SPI_FLASH_WaitForWriteEnd();
244
   SPI_FLASH_WaitForWriteEnd();
243
 }
245
 }
244
 
246
 
256
 * Return         : None
258
 * Return         : None
257
 *******************************************************************************/
259
 *******************************************************************************/
258
 void W25QXXFlash::SPI_FLASH_PageWrite(uint8_t* pBuffer, uint32_t WriteAddr, uint16_t NumByteToWrite) {
260
 void W25QXXFlash::SPI_FLASH_PageWrite(uint8_t* pBuffer, uint32_t WriteAddr, uint16_t NumByteToWrite) {
259
-  /* Enable the write access to the FLASH */
261
+  // Enable the write access to the FLASH
260
   SPI_FLASH_WriteEnable();
262
   SPI_FLASH_WriteEnable();
261
 
263
 
262
-  /* Select the FLASH: Chip Select low */
264
+  // Select the FLASH: Chip Select low
263
   W25QXX_CS_L;
265
   W25QXX_CS_L;
264
-  /* Send "Write to Memory " instruction */
266
+  // Send "Write to Memory " instruction
265
   spi_flash_Send(W25X_PageProgram);
267
   spi_flash_Send(W25X_PageProgram);
266
-  /* Send WriteAddr high nibble address byte to write to */
268
+  // Send WriteAddr high nibble address byte to write to
267
   spi_flash_Send((WriteAddr & 0xFF0000) >> 16);
269
   spi_flash_Send((WriteAddr & 0xFF0000) >> 16);
268
-  /* Send WriteAddr medium nibble address byte to write to */
270
+  // Send WriteAddr medium nibble address byte to write to
269
   spi_flash_Send((WriteAddr & 0xFF00) >> 8);
271
   spi_flash_Send((WriteAddr & 0xFF00) >> 8);
270
-  /* Send WriteAddr low nibble address byte to write to */
272
+  // Send WriteAddr low nibble address byte to write to
271
   spi_flash_Send(WriteAddr & 0xFF);
273
   spi_flash_Send(WriteAddr & 0xFF);
272
 
274
 
273
   NOMORE(NumByteToWrite, SPI_FLASH_PerWritePageSize);
275
   NOMORE(NumByteToWrite, SPI_FLASH_PerWritePageSize);
274
 
276
 
275
-  /* while there is data to be written on the FLASH */
277
+  // While there is data to be written on the FLASH
276
   while (NumByteToWrite--) {
278
   while (NumByteToWrite--) {
277
-    /* Send the current byte */
279
+    // Send the current byte
278
     spi_flash_Send(*pBuffer);
280
     spi_flash_Send(*pBuffer);
279
-    /* Point on the next byte to be written */
281
+    // Point on the next byte to be written
280
     pBuffer++;
282
     pBuffer++;
281
   }
283
   }
282
 
284
 
283
-  /* Deselect the FLASH: Chip Select high */
285
+  // Deselect the FLASH: Chip Select high
284
   W25QXX_CS_H;
286
   W25QXX_CS_H;
285
 
287
 
286
-  /* Wait the end of Flash writing */
288
+  // Wait the end of Flash writing
287
   SPI_FLASH_WaitForWriteEnd();
289
   SPI_FLASH_WaitForWriteEnd();
288
 }
290
 }
289
 
291
 
306
   NumOfPage = NumByteToWrite / SPI_FLASH_PageSize;
308
   NumOfPage = NumByteToWrite / SPI_FLASH_PageSize;
307
   NumOfSingle = NumByteToWrite % SPI_FLASH_PageSize;
309
   NumOfSingle = NumByteToWrite % SPI_FLASH_PageSize;
308
 
310
 
309
-  if (Addr == 0) { /* WriteAddr is SPI_FLASH_PageSize aligned  */
310
-    if (NumOfPage == 0) { /* NumByteToWrite < SPI_FLASH_PageSize */
311
+  if (Addr == 0) { // WriteAddr is SPI_FLASH_PageSize aligned
312
+    if (NumOfPage == 0) { // NumByteToWrite < SPI_FLASH_PageSize
311
       SPI_FLASH_PageWrite(pBuffer, WriteAddr, NumByteToWrite);
313
       SPI_FLASH_PageWrite(pBuffer, WriteAddr, NumByteToWrite);
312
     }
314
     }
313
-    else { /* NumByteToWrite > SPI_FLASH_PageSize */
315
+    else { // NumByteToWrite > SPI_FLASH_PageSize
314
       while (NumOfPage--) {
316
       while (NumOfPage--) {
315
         SPI_FLASH_PageWrite(pBuffer, WriteAddr, SPI_FLASH_PageSize);
317
         SPI_FLASH_PageWrite(pBuffer, WriteAddr, SPI_FLASH_PageSize);
316
         WriteAddr += SPI_FLASH_PageSize;
318
         WriteAddr += SPI_FLASH_PageSize;
319
       SPI_FLASH_PageWrite(pBuffer, WriteAddr, NumOfSingle);
321
       SPI_FLASH_PageWrite(pBuffer, WriteAddr, NumOfSingle);
320
     }
322
     }
321
   }
323
   }
322
-  else { /* WriteAddr is not SPI_FLASH_PageSize aligned  */
323
-    if (NumOfPage == 0) { /* NumByteToWrite < SPI_FLASH_PageSize */
324
-      if (NumOfSingle > count) { /* (NumByteToWrite + WriteAddr) > SPI_FLASH_PageSize */
324
+  else { // WriteAddr is not SPI_FLASH_PageSize aligned
325
+    if (NumOfPage == 0) { // NumByteToWrite < SPI_FLASH_PageSize
326
+      if (NumOfSingle > count) { // (NumByteToWrite + WriteAddr) > SPI_FLASH_PageSize
325
         temp = NumOfSingle - count;
327
         temp = NumOfSingle - count;
326
         SPI_FLASH_PageWrite(pBuffer, WriteAddr, count);
328
         SPI_FLASH_PageWrite(pBuffer, WriteAddr, count);
327
         WriteAddr += count;
329
         WriteAddr += count;
332
         SPI_FLASH_PageWrite(pBuffer, WriteAddr, NumByteToWrite);
334
         SPI_FLASH_PageWrite(pBuffer, WriteAddr, NumByteToWrite);
333
       }
335
       }
334
     }
336
     }
335
-    else { /* NumByteToWrite > SPI_FLASH_PageSize */
337
+    else { // NumByteToWrite > SPI_FLASH_PageSize
336
       NumByteToWrite -= count;
338
       NumByteToWrite -= count;
337
       NumOfPage = NumByteToWrite / SPI_FLASH_PageSize;
339
       NumOfPage = NumByteToWrite / SPI_FLASH_PageSize;
338
       NumOfSingle = NumByteToWrite % SPI_FLASH_PageSize;
340
       NumOfSingle = NumByteToWrite % SPI_FLASH_PageSize;
364
 * Return         : None
366
 * Return         : None
365
 *******************************************************************************/
367
 *******************************************************************************/
366
 void W25QXXFlash::SPI_FLASH_BufferRead(uint8_t* pBuffer, uint32_t ReadAddr, uint16_t NumByteToRead) {
368
 void W25QXXFlash::SPI_FLASH_BufferRead(uint8_t* pBuffer, uint32_t ReadAddr, uint16_t NumByteToRead) {
367
-  /* Select the FLASH: Chip Select low */
369
+  // Select the FLASH: Chip Select low
368
   W25QXX_CS_L;
370
   W25QXX_CS_L;
369
 
371
 
370
-  /* Send "Read from Memory " instruction */
372
+  // Send "Read from Memory " instruction
371
   spi_flash_Send(W25X_ReadData);
373
   spi_flash_Send(W25X_ReadData);
372
 
374
 
373
-  /* Send ReadAddr high nibble address byte to read from */
375
+  // Send ReadAddr high nibble address byte to read from
374
   spi_flash_Send((ReadAddr & 0xFF0000) >> 16);
376
   spi_flash_Send((ReadAddr & 0xFF0000) >> 16);
375
-  /* Send ReadAddr medium nibble address byte to read from */
377
+  // Send ReadAddr medium nibble address byte to read from
376
   spi_flash_Send((ReadAddr & 0xFF00) >> 8);
378
   spi_flash_Send((ReadAddr & 0xFF00) >> 8);
377
-  /* Send ReadAddr low nibble address byte to read from */
379
+  // Send ReadAddr low nibble address byte to read from
378
   spi_flash_Send(ReadAddr & 0xFF);
380
   spi_flash_Send(ReadAddr & 0xFF);
379
 
381
 
380
-  if (NumByteToRead < 33) {
381
-    while (NumByteToRead--) { /* while there is data to be read */
382
-      /* Read a byte from the FLASH */
382
+  if (NumByteToRead <= 32 || !flash_dma_mode) {
383
+    while (NumByteToRead--) { // While there is data to be read
384
+      // Read a byte from the FLASH
383
       *pBuffer = spi_flash_Rec();
385
       *pBuffer = spi_flash_Rec();
384
-      /* Point to the next location where the byte read will be saved */
386
+      // Point to the next location where the byte read will be saved
385
       pBuffer++;
387
       pBuffer++;
386
     }
388
     }
387
   }
389
   }

+ 2
- 2
Marlin/src/sd/SdBaseFile.cpp View File

401
       // Fail for illegal characters
401
       // Fail for illegal characters
402
       PGM_P p = PSTR("|<>^+=?/[];,*\"\\");
402
       PGM_P p = PSTR("|<>^+=?/[];,*\"\\");
403
       while (uint8_t b = pgm_read_byte(p++)) if (b == c) return false;
403
       while (uint8_t b = pgm_read_byte(p++)) if (b == c) return false;
404
-      if (i > n || c < 0x21 || c == 0x7F) return false;           // Check size, non-printable characters
405
-      name[i++] = (c < 'a' || c > 'z') ? (c) : (c + ('A' - 'a')); // Uppercase required for 8.3 name
404
+      if (i > n || c < 0x21 || c == 0x7F) return false;       // Check size, non-printable characters
405
+      name[i++] = c + (WITHIN(c, 'a', 'z') ? 'A' - 'a' : 0);  // Uppercase required for 8.3 name
406
     }
406
     }
407
   }
407
   }
408
   *ptr = str;                         // Set passed pointer to the end
408
   *ptr = str;                         // Set passed pointer to the end

+ 1
- 0
platformio.ini View File

214
 HAS_TFT_LVGL_UI         = lvgl=https://github.com/makerbase-mks/LVGL-6.1.1-MKS/archive/master.zip
214
 HAS_TFT_LVGL_UI         = lvgl=https://github.com/makerbase-mks/LVGL-6.1.1-MKS/archive/master.zip
215
                           src_filter=+<src/lcd/extui/lib/mks_ui>
215
                           src_filter=+<src/lcd/extui/lib/mks_ui>
216
                           extra_scripts=download_mks_assets.py
216
                           extra_scripts=download_mks_assets.py
217
+MKS_WIFI_MODULE         = QRCode=https://github.com/makerbase-mks/QRCode/archive/master.zip
217
 HAS_TRINAMIC_CONFIG     = TMCStepper@~0.7.1
218
 HAS_TRINAMIC_CONFIG     = TMCStepper@~0.7.1
218
                           src_filter=+<src/feature/tmc_util.cpp> +<src/module/stepper/trinamic.cpp> +<src/gcode/feature/trinamic/M122.cpp> +<src/gcode/feature/trinamic/M906.cpp> +<src/gcode/feature/trinamic/M911-M914.cpp>
219
                           src_filter=+<src/feature/tmc_util.cpp> +<src/module/stepper/trinamic.cpp> +<src/gcode/feature/trinamic/M122.cpp> +<src/gcode/feature/trinamic/M906.cpp> +<src/gcode/feature/trinamic/M911-M914.cpp>
219
 HAS_STEALTHCHOP         = src_filter=+<src/gcode/feature/trinamic/M569.cpp>
220
 HAS_STEALTHCHOP         = src_filter=+<src/gcode/feature/trinamic/M569.cpp>

Loading…
Cancel
Save