Browse Source

LVGL UI G-code console (#20755)

X-Ryl669 3 years ago
parent
commit
c74f972627
No account linked to committer's email address

+ 2
- 2
Marlin/src/HAL/AVR/HAL.h View File

@@ -82,14 +82,14 @@ typedef int8_t pin_t;
82 82
 
83 83
 // Serial ports
84 84
 #ifdef USBCON
85
-  #include "../../core/serial_hook.h" 
85
+  #include "../../core/serial_hook.h"
86 86
   typedef ForwardSerial0Type< decltype(Serial) > DefaultSerial;
87 87
   extern DefaultSerial MSerial;
88 88
   #ifdef BLUETOOTH
89 89
     typedef ForwardSerial0Type< decltype(bluetoothSerial) > BTSerial;
90 90
     extern BTSerial btSerial;
91 91
   #endif
92
-  
92
+
93 93
   #define MYSERIAL0 TERN(BLUETOOTH, btSerial, MSerial)
94 94
 #else
95 95
   #if !WITHIN(SERIAL_PORT, -1, 3)

+ 1
- 1
Marlin/src/HAL/AVR/MarlinSerial.cpp View File

@@ -611,7 +611,7 @@ MSerialT customizedSerial1(MSerialT::HasEmergencyParser);
611 611
 
612 612
   template class MarlinSerial< LCDSerialCfg<LCD_SERIAL_PORT> >;
613 613
   MSerialT4 lcdSerial(MSerialT4::HasEmergencyParser);
614
- 
614
+
615 615
   #if HAS_DGUS_LCD
616 616
     template<typename Cfg>
617 617
     typename MarlinSerial<Cfg>::ring_buffer_pos_t MarlinSerial<Cfg>::get_tx_buffer_free() {

+ 4
- 4
Marlin/src/HAL/AVR/MarlinSerial.h View File

@@ -238,11 +238,11 @@
238 238
     static constexpr bool MAX_RX_QUEUED     = ENABLED(SERIAL_STATS_MAX_RX_QUEUED);
239 239
   };
240 240
 
241
-  typedef Serial0Type< MarlinSerial< MarlinSerialCfg<SERIAL_PORT> > > MSerialT; 
241
+  typedef Serial0Type< MarlinSerial< MarlinSerialCfg<SERIAL_PORT> > > MSerialT;
242 242
   extern MSerialT customizedSerial1;
243 243
 
244 244
   #ifdef SERIAL_PORT_2
245
-    typedef Serial0Type< MarlinSerial< MarlinSerialCfg<SERIAL_PORT_2> > > MSerialT2; 
245
+    typedef Serial0Type< MarlinSerial< MarlinSerialCfg<SERIAL_PORT_2> > > MSerialT2;
246 246
     extern MSerialT2 customizedSerial2;
247 247
   #endif
248 248
 
@@ -262,7 +262,7 @@
262 262
     static constexpr bool RX_OVERRUNS       = false;
263 263
   };
264 264
 
265
-  typedef Serial0Type< MarlinSerial< MMU2SerialCfg<MMU2_SERIAL_PORT> > > MSerialT3; 
265
+  typedef Serial0Type< MarlinSerial< MMU2SerialCfg<MMU2_SERIAL_PORT> > > MSerialT3;
266 266
   extern MSerial3 mmuSerial;
267 267
 #endif
268 268
 
@@ -292,7 +292,7 @@
292 292
   };
293 293
 
294 294
 
295
-  typedef Serial0Type< MarlinSerial< LCDSerialCfg<LCD_SERIAL_PORT> > > MSerialT4; 
295
+  typedef Serial0Type< MarlinSerial< LCDSerialCfg<LCD_SERIAL_PORT> > > MSerialT4;
296 296
   extern MSerialT4 lcdSerial;
297 297
 #endif
298 298
 

+ 1
- 1
Marlin/src/HAL/STM32/HAL.h View File

@@ -39,7 +39,7 @@
39 39
 
40 40
 #ifdef USBCON
41 41
   #include <USBSerial.h>
42
-  #include "../../core/serial_hook.h" 
42
+  #include "../../core/serial_hook.h"
43 43
   typedef ForwardSerial0Type< decltype(SerialUSB) > DefaultSerial;
44 44
   extern DefaultSerial MSerial;
45 45
 #endif

+ 0
- 1
Marlin/src/HAL/STM32/Sd2Card_sdio_stm32duino.cpp View File

@@ -163,7 +163,6 @@
163 163
     GPIO_InitStruct.Pin = GPIO_PIN_2;
164 164
     HAL_GPIO_Init(GPIOD, &GPIO_InitStruct);
165 165
 
166
-
167 166
     #if DISABLED(STM32F1xx)
168 167
       // TODO: use __HAL_RCC_SDIO_RELEASE_RESET() and __HAL_RCC_SDIO_CLK_ENABLE();
169 168
       RCC->APB2RSTR &= ~RCC_APB2RSTR_SDIORST_Msk;  // take SDIO out of reset

+ 26
- 0
Marlin/src/HAL/STM32F1/MarlinSerial.h View File

@@ -28,6 +28,10 @@
28 28
 #include "../../inc/MarlinConfigPre.h"
29 29
 #include "../../core/serial_hook.h"
30 30
 
31
+#if HAS_TFT_LVGL_UI
32
+  extern "C" { extern char public_buf_m[100]; }
33
+#endif
34
+
31 35
 // Increase priority of serial interrupts, to reduce overflow errors
32 36
 #define UART_IRQ_PRIO 1
33 37
 
@@ -45,6 +49,28 @@ struct MarlinSerial : public HardwareSerial {
45 49
       nvic_irq_set_priority(c_dev()->irq_num, UART_IRQ_PRIO);
46 50
     }
47 51
   #endif
52
+
53
+  #if HAS_TFT_LVGL_UI
54
+    // Hook the serial write method to capture the output of GCode command sent via LCD
55
+    uint32_t current_wpos;
56
+    void (*line_callback)(void *, const char * msg);
57
+    void *user_pointer;
58
+
59
+    void set_hook(void (*hook)(void *, const char *), void * that) { line_callback = hook; user_pointer = that; current_wpos = 0; }
60
+
61
+    size_t write(uint8_t c) {
62
+      if (line_callback) {
63
+        if (c == '\n' || current_wpos == sizeof(public_buf_m) - 1) { // End of line, probably end of command anyway
64
+          public_buf_m[current_wpos] = 0;
65
+          line_callback(user_pointer, public_buf_m);
66
+          current_wpos = 0;
67
+        }
68
+        else
69
+          public_buf_m[current_wpos++] = c;
70
+      }
71
+      return HardwareSerial::write(c);
72
+    }
73
+  #endif
48 74
 };
49 75
 
50 76
 typedef Serial0Type<MarlinSerial> MSerialT;

+ 2
- 2
Marlin/src/core/macros.h View File

@@ -320,8 +320,8 @@
320 320
     template<bool, typename _Tp = void> struct enable_if { };
321 321
     template<typename _Tp>              struct enable_if<true, _Tp> { typedef _Tp type; };
322 322
   }
323
-  // C++11 solution using SFINAE to detect the existance of a member in a class at compile time. 
324
-  // It creates a HasMember<Type> structure containing 'value' set to true if the member exists  
323
+  // C++11 solution using SFINAE to detect the existance of a member in a class at compile time.
324
+  // It creates a HasMember<Type> structure containing 'value' set to true if the member exists
325 325
   #define HAS_MEMBER_IMPL(Member) \
326 326
     namespace Private { \
327 327
       template <typename Type, typename Yes=char, typename No=long> struct HasMember_ ## Member { \

+ 4
- 3
Marlin/src/core/serial_hook.h View File

@@ -131,10 +131,11 @@ struct RuntimeSerial : public SerialBase< RuntimeSerial<SerialT> >, public Seria
131 131
   using BaseClassT::print;
132 132
   using BaseClassT::println;
133 133
 
134
+
134 135
   // Underlying implementation might use Arduino's bool operator
135
-  bool connected() { 
136
-    return Private::HasMember_connected<SerialT>::value ? CALL_IF_EXISTS(bool, static_cast<SerialT*>(this), connected) : static_cast<SerialT*>(this)->operator bool(); 
137
-  }  
136
+  bool connected() {
137
+    return Private::HasMember_connected<SerialT>::value ? CALL_IF_EXISTS(bool, static_cast<SerialT*>(this), connected) : static_cast<SerialT*>(this)->operator bool();
138
+  }
138 139
 
139 140
   void setHook(WriteHook writeHook = 0, EndOfMessageHook eofHook = 0, void * userPointer = 0) {
140 141
     // Order is important here as serial code can be called inside interrupts

+ 109
- 0
Marlin/src/lcd/extui/lib/mks_ui/draw_gcode.cpp View File

@@ -0,0 +1,109 @@
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 "draw_ui.h"
27
+#include <lv_conf.h>
28
+
29
+#include "../../../../inc/MarlinConfig.h"
30
+
31
+extern lv_group_t *g;
32
+static lv_obj_t *scr,*outL,*outV = 0;
33
+static int currentWritePos = 0;
34
+extern uint8_t public_buf[513];
35
+extern "C" { extern char public_buf_m[100]; }
36
+
37
+enum {
38
+  ID_GCODE_RETURN = 1,
39
+  ID_GCODE_COMMAND,
40
+};
41
+
42
+static void event_handler(lv_obj_t *obj, lv_event_t event) {
43
+  if (event != LV_EVENT_RELEASED) return;
44
+  lv_clear_gcode();
45
+  switch (obj->mks_obj_id) {
46
+    case ID_GCODE_RETURN:
47
+      lv_draw_more();
48
+      return;
49
+    case ID_GCODE_COMMAND:
50
+      keyboard_value = GCodeCommand;
51
+      lv_draw_keyboard();
52
+      break;
53
+  }
54
+}
55
+
56
+void lv_show_gcode_output(void * that, const char * txt) {
57
+  // Ignore echo of command
58
+  if (!memcmp(txt, "echo:", 5)) {
59
+    public_buf[0] = 0; // Clear output buffer
60
+    return;
61
+   }
62
+
63
+  // Avoid overflow if the answer is too large
64
+  size_t len = strlen((const char*)public_buf), tlen = strlen(txt);
65
+  if (len + tlen + 1 < sizeof(public_buf)) {
66
+    memcpy(public_buf + len, txt, tlen);
67
+    public_buf[len + tlen] = '\n';
68
+  }
69
+}
70
+
71
+void lv_serial_capt_hook(void * userPointer, uint8_t c)
72
+{
73
+  if (c == '\n' || currentWritePos == sizeof(public_buf_m) - 1) { // End of line, probably end of command anyway
74
+    public_buf_m[currentWritePos] = 0;
75
+    lv_show_gcode_output(userPointer, public_buf_m);
76
+    currentWritePos = 0;
77
+  }
78
+  else public_buf_m[currentWritePos++] = c;
79
+}
80
+void lv_eom_hook(void *)
81
+{
82
+  // Message is done, let's remove the hook now
83
+  MYSERIAL0.setHook();
84
+  // We are back from the keyboard, so let's redraw ourselves
85
+  draw_return_ui();
86
+}
87
+
88
+void lv_draw_gcode(bool clear) {
89
+  if (clear) {
90
+    currentWritePos = 0;
91
+    public_buf[0] = 0;
92
+  }
93
+  scr = lv_screen_create(GCODE_UI, more_menu.gcode);
94
+  lv_screen_menu_item(scr, more_menu.entergcode, PARA_UI_POS_X, PARA_UI_POS_Y, event_handler, ID_GCODE_COMMAND, 1);
95
+  outL = lv_label_create(scr, PARA_UI_POS_X, PARA_UI_POS_Y * 2, "Result:");
96
+  outV = lv_label_create(scr, PARA_UI_POS_X, PARA_UI_POS_Y * 3, (const char*)public_buf);
97
+
98
+  lv_big_button_create(scr, "F:/bmp_back70x40.bin", common_menu.text_back, PARA_UI_BACL_POS_X + 10, PARA_UI_BACL_POS_Y, event_handler, ID_GCODE_RETURN, true);
99
+}
100
+
101
+void lv_clear_gcode() {
102
+  #if HAS_ROTARY_ENCODER
103
+    if (gCfgItems.encoder_enable) lv_group_remove_all_objs(g);
104
+  #endif
105
+  lv_obj_del(scr);
106
+  outV = 0;
107
+}
108
+
109
+#endif // HAS_TFT_LVGL_UI

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

@@ -0,0 +1,33 @@
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_gcode(bool clear = false);
29
+extern void lv_clear_gcode();
30
+
31
+#ifdef __cplusplus
32
+  } /* C-declarations for C++ */
33
+#endif

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

@@ -27,6 +27,7 @@
27 27
 #include <lv_conf.h>
28 28
 
29 29
 #include "../../../../inc/MarlinConfig.h"
30
+#include "../../../../gcode/queue.h"
30 31
 
31 32
 extern lv_group_t *g;
32 33
 static lv_obj_t *scr;
@@ -153,13 +154,22 @@ static void lv_kb_event_cb(lv_obj_t *kb, lv_event_t event) {
153 154
             lv_draw_wifi_tips();
154 155
             break;
155 156
         #endif // MKS_WIFI_MODULE
156
-        case gcodeCommand:
157
+        case autoLevelGcodeCommand:
157 158
           uint8_t buf[100];
158 159
           strncpy((char *)buf,ret_ta_txt,sizeof(buf));
159 160
           update_gcode_command(AUTO_LEVELING_COMMAND_ADDR,buf);
160 161
           lv_clear_keyboard();
161 162
           draw_return_ui();
162 163
           break;
164
+        case GCodeCommand:
165
+          if (queue.length <= (BUFSIZE - 3)) {
166
+            // Hook anything that goes to the serial port
167
+            MYSERIAL0.setHook(lv_serial_capt_hook, lv_eom_hook, 0);
168
+            queue.enqueue_one_now(ret_ta_txt);
169
+          }
170
+          lv_clear_keyboard();
171
+          // draw_return_ui is called in the end of message hook
172
+          break;
163 173
         default: break;
164 174
       }
165 175
     }
@@ -238,12 +248,18 @@ void lv_draw_keyboard() {
238 248
   // Create a text area. The keyboard will write here
239 249
   lv_obj_t *ta = lv_ta_create(scr, nullptr);
240 250
   lv_obj_align(ta, nullptr, LV_ALIGN_IN_TOP_MID, 0, 10);
241
-  if (keyboard_value == gcodeCommand) {
251
+  switch (keyboard_value) {
252
+    case autoLevelGcodeCommand:
242 253
     get_gcode_command(AUTO_LEVELING_COMMAND_ADDR,(uint8_t *)public_buf_m);
243 254
     public_buf_m[sizeof(public_buf_m)-1] = 0;
244 255
     lv_ta_set_text(ta, public_buf_m);
245
-  }
246
-  else {
256
+      break;
257
+    case GCodeCommand:
258
+      // Start with uppercase by default
259
+      lv_btnm_set_map(kb, kb_map_uc);
260
+      lv_btnm_set_ctrl_map(kb, kb_ctrl_uc_map);
261
+      // Fallthrough
262
+    default:
247 263
     lv_ta_set_text(ta, "");
248 264
   }
249 265
 

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

@@ -49,7 +49,7 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) {
49 49
       lv_draw_manual_level_pos_settings();
50 50
       break;
51 51
     case ID_LEVEL_COMMAND:
52
-      keyboard_value = gcodeCommand;
52
+      keyboard_value = autoLevelGcodeCommand;
53 53
       lv_draw_keyboard();
54 54
       break;
55 55
     #if HAS_BED_PROBE

+ 15
- 19
Marlin/src/lcd/extui/lib/mks_ui/draw_more.cpp View File

@@ -41,20 +41,19 @@ enum {
41 41
   ID_CUSTOM_4,
42 42
   ID_CUSTOM_5,
43 43
   ID_CUSTOM_6,
44
-  ID_CUSTOM_7,
45 44
   ID_M_RETURN,
46 45
 };
47 46
 
48 47
 static void event_handler(lv_obj_t * obj, lv_event_t event) {
49 48
   if (event != LV_EVENT_RELEASED) return;
50 49
   switch (obj->mks_obj_id) {
50
+    case ID_GCODE: lv_clear_more(); lv_draw_gcode(true); break;
51 51
     case ID_CUSTOM_1: TERN_(USER_CMD_1_ENABLE, queue.inject_P(PSTR(USER_GCODE_1))); break;
52 52
     case ID_CUSTOM_2: TERN_(USER_CMD_2_ENABLE, queue.inject_P(PSTR(USER_GCODE_2))); break;
53 53
     case ID_CUSTOM_3: TERN_(USER_CMD_3_ENABLE, queue.inject_P(PSTR(USER_GCODE_3))); break;
54 54
     case ID_CUSTOM_4: TERN_(USER_CMD_4_ENABLE, queue.inject_P(PSTR(USER_GCODE_4))); break;
55 55
     case ID_CUSTOM_5: TERN_(USER_CMD_5_ENABLE, queue.inject_P(PSTR(USER_GCODE_5))); break;
56 56
     case ID_CUSTOM_6: TERN_(USER_CMD_6_ENABLE, queue.inject_P(PSTR(USER_GCODE_6))); break;
57
-    case ID_CUSTOM_7: TERN_(USER_CMD_7_ENABLE, queue.inject_P(PSTR(USER_GCODE_7))); break;
58 57
     case ID_M_RETURN:
59 58
       lv_clear_more();
60 59
       lv_draw_tool();
@@ -67,53 +66,54 @@ void lv_draw_more() {
67 66
 
68 67
   const bool enc_ena = TERN0(HAS_ROTARY_ENCODER, gCfgItems.encoder_enable);
69 68
 
69
+  lv_obj_t *buttonGCode = lv_imgbtn_create(scr, "F:/bmp_machine_para.bin", INTERVAL_V, titleHeight, event_handler, ID_GCODE);
70
+  if (enc_ena) lv_group_add_obj(g, buttonGCode);
71
+  lv_obj_t *labelGCode = lv_label_create_empty(buttonGCode);
72
+
70 73
   #if ENABLED(USER_CMD_1_ENABLE)
71
-    lv_obj_t *buttonCustom1 = lv_imgbtn_create(scr, "F:/bmp_custom1.bin", INTERVAL_V, titleHeight, event_handler, ID_CUSTOM_1);
74
+    lv_obj_t *buttonCustom1 = lv_imgbtn_create(scr, "F:/bmp_custom1.bin", BTN_X_PIXEL + INTERVAL_V * 2, titleHeight, event_handler, ID_CUSTOM_1);
72 75
     if (enc_ena) lv_group_add_obj(g, buttonCustom1);
73 76
     lv_obj_t *labelCustom1 = lv_label_create_empty(buttonCustom1);
74 77
   #endif
75 78
 
76 79
   #if ENABLED(USER_CMD_2_ENABLE)
77
-    lv_obj_t *buttonCustom2 = lv_imgbtn_create(scr, "F:/bmp_custom2.bin", BTN_X_PIXEL + INTERVAL_V * 2, titleHeight, event_handler, ID_CUSTOM_2);
80
+    lv_obj_t *buttonCustom2 = lv_imgbtn_create(scr, "F:/bmp_custom2.bin", BTN_X_PIXEL * 2 + INTERVAL_V * 3, titleHeight, event_handler, ID_CUSTOM_2);
78 81
     if (enc_ena) lv_group_add_obj(g, buttonCustom2);
79 82
     lv_obj_t *labelCustom2 = lv_label_create_empty(buttonCustom2);
80 83
   #endif
81 84
 
82 85
   #if ENABLED(USER_CMD_3_ENABLE)
83
-    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);
86
+    lv_obj_t *buttonCustom3 = lv_imgbtn_create(scr, "F:/bmp_custom3.bin", BTN_X_PIXEL * 3 + INTERVAL_V * 4, titleHeight, event_handler, ID_CUSTOM_3);
84 87
     if (enc_ena) lv_group_add_obj(g, buttonCustom3);
85 88
     lv_obj_t *labelCustom3 = lv_label_create_empty(buttonCustom3);
86 89
   #endif
87 90
 
88 91
   #if ENABLED(USER_CMD_4_ENABLE)
89
-    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);
92
+    lv_obj_t *buttonCustom4 = lv_imgbtn_create(scr, "F:/bmp_custom4.bin", INTERVAL_V, BTN_Y_PIXEL + INTERVAL_H + titleHeight, event_handler, ID_CUSTOM_4);
90 93
     if (enc_ena) lv_group_add_obj(g, buttonCustom4);
91 94
     lv_obj_t *labelCustom4 = lv_label_create_empty(buttonCustom4);
92 95
   #endif
93 96
 
94 97
   #if ENABLED(USER_CMD_5_ENABLE)
95
-    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);
98
+    lv_obj_t *buttonCustom5 = lv_imgbtn_create(scr, "F:/bmp_custom5.bin", BTN_X_PIXEL + INTERVAL_V * 2, BTN_Y_PIXEL + INTERVAL_H + titleHeight, event_handler, ID_CUSTOM_5);
96 99
     if (enc_ena) lv_group_add_obj(g, buttonCustom5);
97 100
     lv_obj_t *labelCustom5 = lv_label_create_empty(buttonCustom5);
98 101
   #endif
99 102
 
100 103
   #if ENABLED(USER_CMD_6_ENABLE)
101
-    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);
104
+    lv_obj_t *buttonCustom6 = lv_imgbtn_create(scr, "F:/bmp_custom6.bin", BTN_X_PIXEL * 2 + INTERVAL_V * 3, BTN_Y_PIXEL + INTERVAL_H + titleHeight, event_handler, ID_CUSTOM_6);
102 105
     if (enc_ena) lv_group_add_obj(g, buttonCustom6);
103 106
     lv_obj_t *labelCustom6 = lv_label_create_empty(buttonCustom6);
104 107
   #endif
105 108
 
106
-  #if ENABLED(USER_CMD_7_ENABLE)
107
-    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);
108
-    if (enc_ena) lv_group_add_obj(g, buttonCustom7);
109
-    lv_obj_t *labelCustom7 = lv_label_create_empty(buttonCustom7);
110
-  #endif
111
-
112 109
   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);
113 110
   if (enc_ena) lv_group_add_obj(g, buttonBack);
114 111
   lv_obj_t *label_Back = lv_label_create_empty(buttonBack);
115 112
 
116 113
   if (gCfgItems.multiple_language != 0) {
114
+    lv_label_set_text(labelGCode, more_menu.gcode);
115
+    lv_obj_align(labelGCode, buttonGCode, LV_ALIGN_IN_BOTTOM_MID, 0, BUTTON_TEXT_Y_OFFSET);
116
+
117 117
     #if ENABLED(USER_CMD_1_ENABLE)
118 118
       lv_label_set_text(labelCustom1, more_menu.custom1);
119 119
       lv_obj_align(labelCustom1, buttonCustom1, LV_ALIGN_IN_BOTTOM_MID, 0, BUTTON_TEXT_Y_OFFSET);
@@ -138,23 +138,19 @@ void lv_draw_more() {
138 138
       lv_label_set_text(labelCustom6, more_menu.custom6);
139 139
       lv_obj_align(labelCustom6, buttonCustom6, LV_ALIGN_IN_BOTTOM_MID, 0, BUTTON_TEXT_Y_OFFSET);
140 140
     #endif
141
-    #if ENABLED(USER_CMD_7_ENABLE)
142
-      lv_label_set_text(labelCustom7, more_menu.custom7);
143
-      lv_obj_align(labelCustom7, buttonCustom7, LV_ALIGN_IN_BOTTOM_MID, 0, BUTTON_TEXT_Y_OFFSET);
144
-    #endif
145 141
     lv_label_set_text(label_Back, common_menu.text_back);
146 142
     lv_obj_align(label_Back, buttonBack, LV_ALIGN_IN_BOTTOM_MID, 0, BUTTON_TEXT_Y_OFFSET);
147 143
   }
148 144
 
149 145
   #if BUTTONS_EXIST(EN1, EN2, ENC)
150 146
     if (enc_ena) {
147
+      lv_group_add_obj(g, buttonGCode);
151 148
       TERN_(USER_CMD_1_ENABLE, lv_group_add_obj(g, buttonCustom1));
152 149
       TERN_(USER_CMD_2_ENABLE, lv_group_add_obj(g, buttonCustom2));
153 150
       TERN_(USER_CMD_3_ENABLE, lv_group_add_obj(g, buttonCustom3));
154 151
       TERN_(USER_CMD_4_ENABLE, lv_group_add_obj(g, buttonCustom4));
155 152
       TERN_(USER_CMD_5_ENABLE, lv_group_add_obj(g, buttonCustom5));
156 153
       TERN_(USER_CMD_6_ENABLE, lv_group_add_obj(g, buttonCustom6));
157
-      TERN_(USER_CMD_7_ENABLE, lv_group_add_obj(g, buttonCustom7));
158 154
       lv_group_add_obj(g, buttonBack);
159 155
     }
160 156
   #endif

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

@@ -71,7 +71,7 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) {
71 71
       uiCfg.desireSprayerTempBak = thermalManager.temp_hotend[uiCfg.curSprayerChoose].target;
72 72
       lv_draw_filament_change();
73 73
       break;
74
-    case ID_T_MORE: break;
74
+    case ID_T_MORE: lv_draw_more(); break;
75 75
     case ID_T_RETURN:
76 76
       TERN_(MKS_TEST, curent_disp_ui = 1);
77 77
       lv_draw_ready_print();
@@ -87,6 +87,7 @@ void lv_draw_tool() {
87 87
   lv_big_button_create(scr, "F:/bmp_zero.bin", tool_menu.home, BTN_X_PIXEL * 3 + INTERVAL_V * 4, titleHeight, event_handler, ID_T_HOME);
88 88
   lv_big_button_create(scr, "F:/bmp_leveling.bin", tool_menu.TERN(AUTO_BED_LEVELING_BILINEAR, autoleveling, leveling), INTERVAL_V, BTN_Y_PIXEL + INTERVAL_H + titleHeight, event_handler, ID_T_LEVELING);
89 89
   lv_big_button_create(scr, "F:/bmp_filamentchange.bin", tool_menu.filament, BTN_X_PIXEL+INTERVAL_V*2,BTN_Y_PIXEL+INTERVAL_H+titleHeight, event_handler,ID_T_FILAMENT);
90
+  lv_big_button_create(scr, "F:/bmp_more.bin", tool_menu.more, BTN_X_PIXEL * 2 + INTERVAL_V * 3, BTN_Y_PIXEL + INTERVAL_H + titleHeight, event_handler, ID_T_MORE);
90 91
   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_T_RETURN);
91 92
 }
92 93
 

+ 1
- 0
Marlin/src/lcd/extui/lib/mks_ui/draw_ui.cpp View File

@@ -1077,6 +1077,7 @@ void draw_return_ui() {
1077 1077
         case NOZZLE_PROBE_OFFSET_UI:    lv_draw_auto_level_offset_settings(); break;
1078 1078
       #endif
1079 1079
       case TOOL_UI:                     lv_draw_tool(); break;
1080
+      case GCODE_UI:                    lv_draw_gcode(); break;
1080 1081
       case MESHLEVELING_UI:             break;
1081 1082
       case HARDWARE_TEST_UI:            break;
1082 1083
       #if ENABLED(MKS_WIFI_MODULE)

+ 7
- 2
Marlin/src/lcd/extui/lib/mks_ui/draw_ui.h View File

@@ -46,6 +46,7 @@
46 46
 #include "draw_preHeat.h"
47 47
 #include "draw_extrusion.h"
48 48
 #include "draw_home.h"
49
+#include "draw_gcode.h"
49 50
 #include "draw_more.h"
50 51
 #include "draw_move_motor.h"
51 52
 #include "draw_fan.h"
@@ -326,7 +327,8 @@ typedef enum {
326 327
   WIFI_SETTINGS_UI,
327 328
   HOMING_SENSITIVITY_UI,
328 329
   ENCODER_SETTINGS_UI,
329
-  TOUCH_CALIBRATION_UI
330
+  TOUCH_CALIBRATION_UI,
331
+  GCODE_UI,
330 332
 } DISP_STATE;
331 333
 
332 334
 typedef struct {
@@ -413,7 +415,8 @@ typedef enum {
413 415
   wifiName,
414 416
   wifiPassWord,
415 417
   wifiConfig,
416
-  gcodeCommand
418
+  autoLevelGcodeCommand,
419
+  GCodeCommand,
417 420
 } keyboard_value_state;
418 421
 extern keyboard_value_state keyboard_value;
419 422
 
@@ -449,6 +452,8 @@ extern void preview_gcode_prehandle(char *path);
449 452
 extern void update_spi_flash();
450 453
 extern void update_gcode_command(int addr,uint8_t *s);
451 454
 extern void get_gcode_command(int addr,uint8_t *d);
455
+extern void lv_serial_capt_hook(void *, uint8_t);
456
+extern void lv_eom_hook(void *);
452 457
 #if HAS_GCODE_PREVIEW
453 458
   extern void disp_pre_gcode(int xpos_pixel, int ypos_pixel);
454 459
 #endif

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

@@ -279,6 +279,8 @@
279 279
 #define AUTO_LEVELING_TEXT_EN   "AutoLevel"
280 280
 #define SET_TEXT_EN             "Settings"
281 281
 #define MORE_TEXT_EN            "More"
282
+#define MORE_GCODE_EN           "G-Code"
283
+#define MORE_ENTER_GCODE_EN     "Enter G-Code"
282 284
 
283 285
 #define ADD_TEXT_EN             "Add"
284 286
 #define DEC_TEXT_EN             "Dec"

+ 26
- 24
Marlin/src/lcd/extui/lib/mks_ui/tft_Language_fr.h View File

@@ -22,7 +22,7 @@
22 22
 #pragma once
23 23
 
24 24
 //*************法文****************************//
25
-#define TOOL_TEXT_FR                  "prêt"
25
+#define TOOL_TEXT_FR                  "Prêt"
26 26
 #define PREHEAT_TEXT_FR               "Préchauffe"
27 27
 #define MOVE_TEXT_FR                  "Déplace"
28 28
 #define HOME_TEXT_FR                  "Acceuil"
@@ -32,6 +32,8 @@
32 32
 #define AUTO_LEVELING_TEXT_FR         "AutoLevel"
33 33
 #define SET_TEXT_FR                   "Config"
34 34
 #define MORE_TEXT_FR                  "Plus"
35
+#define MORE_GCODE_FR                 "G-Code"
36
+#define MORE_ENTER_GCODE_FR           "Saisir G-Code"
35 37
 
36 38
 #define ADD_TEXT_FR                   "Ajouter"
37 39
 #define DEC_TEXT_FR                   "Réduire"
@@ -74,7 +76,7 @@
74 76
 #define PAGE_DOWN_TEXT_FR             "En bas"
75 77
 
76 78
 #define EXTRUDER_IN_TEXT_FR           "Insérer"
77
-#define EXTRUDER_OUT_TEXT_FR          "éjecter"
79
+#define EXTRUDER_OUT_TEXT_FR          "Éjecter"
78 80
 #define EXTRUDE_1MM_TEXT_FR           "1mm"
79 81
 #define EXTRUDE_5MM_TEXT_FR           "5mm"
80 82
 #define EXTRUDE_10MM_TEXT_FR          "10mm"
@@ -91,13 +93,13 @@
91 93
 #define FILESYS_TEXT_FR               "Fichier"
92 94
 #define WIFI_TEXT_FR                  "WiFi"
93 95
 #define FAN_TEXT_FR                   "Fan"
94
-#define ABOUT_TEXT_FR                 "A propos"
96
+#define ABOUT_TEXT_FR                 "À propos"
95 97
 #define BREAK_POINT_TEXT_FR           "Continuer"
96 98
 #define FILAMENT_TEXT_FR              "Remplacer"
97 99
 #define LANGUAGE_TEXT_FR              "Langue"
98 100
 #define MOTOR_OFF_TEXT_FR             "M-hors"
99 101
 #define MOTOR_OFF_XY_TEXT_FR          "M-hors-XY"
100
-#define SHUTDOWN_TEXT_FR              "Eteindre"
102
+#define SHUTDOWN_TEXT_FR              "Éteindre"
101 103
 #define MACHINE_PARA_FR               "Config"
102 104
 #define EEPROM_SETTINGS_FR            "Eeprom Set"
103 105
 
@@ -130,27 +132,27 @@
130 132
 #define FAN_TIPS2_TEXT_FR             "ventilateur\n0"
131 133
 
132 134
 #define FILAMENT_IN_TEXT_FR           "Insérer"
133
-#define FILAMENT_OUT_TEXT_FR          "éjecter"
135
+#define FILAMENT_OUT_TEXT_FR          "Éjecter"
134 136
 #define FILAMENT_EXT0_TEXT_FR         "Extr1"
135 137
 #define FILAMENT_EXT1_TEXT_FR         "Extr2"
136 138
 #define FILAMENT_HEAT_TEXT_FR         "Preheat"
137 139
 #define FILAMENT_STOP_TEXT_FR         "Arrêter"
138 140
 #define FILAMENT_TIPS2_TEXT_FR        "T:"
139 141
 #define FILAMENT_TIPS3_TEXT_FR        "Insérer le filament..."
140
-#define FILAMENT_TIPS4_TEXT_FR        "éjecter le filament..."
142
+#define FILAMENT_TIPS4_TEXT_FR        "Éjecter le filament..."
141 143
 #define FILAMENT_TIPS5_TEXT_FR        "Température trop basse pour démarrer, chauffez svp"
142 144
 #define FILAMENT_TIPS6_TEXT_FR        "Terminé"
143 145
 
144
-#define FILAMENT_CHANGE_TEXT_FR                   "Please click <Load> \nor <unload>,After \npinter pause."
145
-#define FILAMENT_DIALOG_LOAD_HEAT_TIPS_FR         "Heating up the nozzle,\nplease wait..."
146
-#define FILAMENT_DIALOG_UNLOAD_HEAT_TIPS_FR       "Heating up the nozzle,\nplease wait..."
147
-#define FILAMENT_DIALOG_LOAD_CONFIRM1_TIPS_FR     "Heat completed,please load filament \nto extruder,and click <confirm> \nfor start loading."
148
-#define FILAMENT_DIALOG_LOAD_CONFIRM2_TIPS_FR     "Please load filament to extruder,\nand click <confirm> for start loading."
149
-#define FILAMENT_DIALOG_UNLOAD_CONFIRM_TIPS_FR    "Heat completed,please \nclick <confirm> for start unloading.!"
150
-#define FILAMENT_DIALOG_LOADING_TIPS_FR           "Is loading ,please wait!"
151
-#define FILAMENT_DIALOG_UNLOADING_TIPS_FR         "Is unloading,please wait!"
152
-#define FILAMENT_DIALOG_LOAD_COMPLETE_TIPS_FR     "Load filament completed,\nclick <confirm> for return!"
153
-#define FILAMENT_DIALOG_UNLOAD_COMPLETE_TIPS_FR   "Unload filament completed,\nclick <confirm> for return!"
146
+#define FILAMENT_CHANGE_TEXT_FR                   "Veuillez presser <Load> \nou <unload>, après \nla pause."
147
+#define FILAMENT_DIALOG_LOAD_HEAT_TIPS_FR         "Chauffe de la tête\nPatientez SVP..."
148
+#define FILAMENT_DIALOG_UNLOAD_HEAT_TIPS_FR       "Chauffe de la tête\nPatientez SVP..."
149
+#define FILAMENT_DIALOG_LOAD_CONFIRM1_TIPS_FR     "Tête chaude, veuillez charger le\nfilament dans l'extruder & <confirmer>\nle chargement."
150
+#define FILAMENT_DIALOG_LOAD_CONFIRM2_TIPS_FR     "Veuillez charger le filament dans\nl'extruder & <confirmer> le chargement."
151
+#define FILAMENT_DIALOG_UNLOAD_CONFIRM_TIPS_FR    "Tête chaude, <confirmez>\npour le déchargement."
152
+#define FILAMENT_DIALOG_LOADING_TIPS_FR           "Chargement, patientez SVP."
153
+#define FILAMENT_DIALOG_UNLOADING_TIPS_FR         "Déchargement, patientez SVP."
154
+#define FILAMENT_DIALOG_LOAD_COMPLETE_TIPS_FR     "Chargement terminé,\n<confirmez> pour revenir!"
155
+#define FILAMENT_DIALOG_UNLOAD_COMPLETE_TIPS_FR   "Déchargement terminé,\n<confirmez> pour revenir!"
154 156
 
155 157
 
156 158
 #define PRE_HEAT_EXT_TEXT_FR          "E"
@@ -205,12 +207,12 @@
205 207
 #define TITLE_FAN_FR                  "Ventilateur"
206 208
 #define TITLE_LANGUAGE_FR             "Langue"
207 209
 #define TITLE_PAUSE_FR                "Pause"
208
-#define TITLE_CHANGESPEED_FR          "Speed"
210
+#define TITLE_CHANGESPEED_FR          "Vitesse"
209 211
 #define TITLE_CLOUD_TEXT_FR           "Cloud"
210
-#define TITLE_DIALOG_CONFIRM_FR       "Confirm"
212
+#define TITLE_DIALOG_CONFIRM_FR       "Confirmer"
211 213
 #define TITLE_FILESYS_FR              "FileSys"
212 214
 
213
-#define DIALOG_CLOSE_MACHINE_FR       "Closing machine......"
215
+#define DIALOG_CLOSE_MACHINE_FR       "Extinction..."
214 216
 
215 217
 #define AUTO_SHUTDOWN_FR              "Auto"
216 218
 #define MANUAL_SHUTDOWN_FR            "Manuel"
@@ -220,7 +222,7 @@
220 222
 #define DIALOG_OK_FR                  "OK"
221 223
 #define DIALOG_RESET_FR               "Réinitialiser"
222 224
 #define DIALOG_RETRY_FR               "Recommencez"
223
-#define DIALOG_DISABLE_FR             "Disable"
225
+#define DIALOG_DISABLE_FR             "Désactiver"
224 226
 #define DIALOG_PRINT_MODEL_FR         "Imprimer le fichier?"
225 227
 #define DIALOG_CANCEL_PRINT_FR        "Arrêter?"
226 228
 
@@ -229,12 +231,12 @@
229 231
 #define DIALOG_ERROR_TIPS1_FR         "Erreur:error:Aucun fichier, \nvérifiez à nouveau."
230 232
 #define DIALOG_ERROR_TIPS2_FR         "Erreur:La opération a échoué. \nVerifiez que le baudrate de l'écran et de \nla carte mère soient identique!"
231 233
 #define DIALOG_ERROR_TIPS3_FR         "Erreur: le nom du fichier ou le \nchemin d'accès est trop long."
232
-#define DIALOG_UNBIND_PRINTER_FR      "Unbind the printer?"
233
-#define DIALOG_FILAMENT_NO_PRESS_FR   "Filament detection switch is not pressed"
234
+#define DIALOG_UNBIND_PRINTER_FR      "Déconnecter l'imprimante?"
235
+#define DIALOG_FILAMENT_NO_PRESS_FR   "Détecteur de filament non pressé"
234 236
 #define DIALOG_PRINT_FINISH_FR        "L'impression est terminée!"
235 237
 #define DIALOG_PRINT_TIME_FR          "Temps d'impression: "
236
-#define DIALOG_REPRINT_FR             "Print again"
237
-#define DIALOG_WIFI_ENABLE_TIPS_FR    "The wifi module is being configured,\nplease wait a moment....."
238
+#define DIALOG_REPRINT_FR             "Réimprimer"
239
+#define DIALOG_WIFI_ENABLE_TIPS_FR    "Le module WIFI se charge\nAttendez SVP..."
238 240
 
239 241
 #define MESSAGE_PAUSING_FR        "Parking..."
240 242
 #define MESSAGE_CHANGING_FR       "Attente filament pour démarrer"

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

@@ -32,6 +32,8 @@
32 32
 #define AUTO_LEVELING_TEXT_IT         "AutoLevel"
33 33
 #define SET_TEXT_IT                   "Imposta"
34 34
 #define MORE_TEXT_IT                  "Di più"
35
+#define MORE_GCODE_IT                 "G-Code"
36
+#define MORE_ENTER_GCODE_IT           "Inserisci il G-Code"
35 37
 
36 38
 #define ADD_TEXT_IT                   "Aumentare"
37 39
 #define DEC_TEXT_IT                   "Ridurre"

+ 2
- 0
Marlin/src/lcd/extui/lib/mks_ui/tft_Language_ru.h View File

@@ -32,6 +32,8 @@
32 32
 #define AUTO_LEVELING_TEXT_RU           "aвтоуровень"
33 33
 #define SET_TEXT_RU                     "настройки"
34 34
 #define MORE_TEXT_RU                    "больше"
35
+#define MORE_GCODE_RU                   "G-код"
36
+#define MORE_ENTER_GCODE_RU             "Введите G-код"
35 37
 
36 38
 #define ADD_TEXT_RU                     "добавить"
37 39
 #define DEC_TEXT_RU                     "уменьшить"

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

@@ -263,6 +263,8 @@
263 263
 #define AUTO_LEVELING_TEXT_CN       "自动调平"
264 264
 #define SET_TEXT_CN                 "设置"
265 265
 #define MORE_TEXT_CN                "更多"
266
+#define MORE_GCODE_CN               "G-Code"
267
+#define MORE_ENTER_GCODE_CN         "Enter G-Code"
266 268
 
267 269
 #define ADD_TEXT_CN                 "增加"
268 270
 #define DEC_TEXT_CN                 "减少"

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

@@ -33,6 +33,8 @@
33 33
 #define AUTO_LEVELING_TEXT_SP   "Autolevel"
34 34
 #define SET_TEXT_SP             "Config"
35 35
 #define MORE_TEXT_SP            "Más"
36
+#define MORE_GCODE_SP           "G-Code"
37
+#define MORE_ENTER_GCODE_SP     "Introduzca el G-Code"
36 38
 
37 39
 #define ADD_TEXT_SP             "Más"
38 40
 #define DEC_TEXT_SP             "Menos"

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

@@ -263,6 +263,8 @@
263 263
 #define AUTO_LEVELING_TEXT_T_CN         "自動調平"
264 264
 #define SET_TEXT_T_CN                   "設置"
265 265
 #define MORE_TEXT_T_CN                  "更多"
266
+#define MORE_GCODE_T_CN                 "G-Code"
267
+#define MORE_ENTER_GCODE_T_CN           "Enter G-Code"
266 268
 
267 269
 #define ADD_TEXT_T_CN                   "增加"
268 270
 #define DEC_TEXT_T_CN                   "減少"

+ 16
- 0
Marlin/src/lcd/extui/lib/mks_ui/tft_multi_language.cpp View File

@@ -943,6 +943,8 @@ void disp_language_init() {
943 943
       filesys_menu.usb_sys = U_DISK_TEXT_CN;
944 944
       //
945 945
       more_menu.title       = TITLE_MORE_CN;
946
+      more_menu.gcode       = MORE_GCODE_CN;
947
+      more_menu.entergcode  = MORE_ENTER_GCODE_CN;
946 948
       TERN_(USER_CMD_1_ENABLE, more_menu.custom1 = MORE_CUSTOM1_TEXT_CN);
947 949
       TERN_(USER_CMD_2_ENABLE, more_menu.custom2 = MORE_CUSTOM2_TEXT_CN);
948 950
       TERN_(USER_CMD_3_ENABLE, more_menu.custom3 = MORE_CUSTOM3_TEXT_CN);
@@ -1175,6 +1177,8 @@ void disp_language_init() {
1175 1177
             filesys_menu.usb_sys  = U_DISK_TEXT_T_CN;
1176 1178
             //
1177 1179
             more_menu.title       = TITLE_MORE_T_CN;
1180
+            more_menu.gcode       = MORE_GCODE_T_CN;
1181
+            more_menu.entergcode  = MORE_ENTER_GCODE_T_CN;
1178 1182
             TERN_(USER_CMD_1_ENABLE, more_menu.custom1 = MORE_CUSTOM1_TEXT_T_CN);
1179 1183
             TERN_(USER_CMD_2_ENABLE, more_menu.custom2 = MORE_CUSTOM2_TEXT_T_CN);
1180 1184
             TERN_(USER_CMD_3_ENABLE, more_menu.custom3 = MORE_CUSTOM3_TEXT_T_CN);
@@ -1394,6 +1398,8 @@ void disp_language_init() {
1394 1398
             set_menu.eepromSet    = EEPROM_SETTINGS_EN;
1395 1399
             //
1396 1400
             more_menu.title       = TITLE_MORE_EN;
1401
+            more_menu.gcode       = MORE_GCODE_EN;
1402
+            more_menu.entergcode  = MORE_ENTER_GCODE_EN;
1397 1403
             TERN_(USER_CMD_1_ENABLE, more_menu.custom1 = MORE_CUSTOM1_TEXT_EN);
1398 1404
             TERN_(USER_CMD_2_ENABLE, more_menu.custom2 = MORE_CUSTOM2_TEXT_EN);
1399 1405
             TERN_(USER_CMD_3_ENABLE, more_menu.custom3 = MORE_CUSTOM3_TEXT_EN);
@@ -1614,6 +1620,8 @@ void disp_language_init() {
1614 1620
             set_menu.machine_para = MACHINE_PARA_RU;
1615 1621
             set_menu.eepromSet    = EEPROM_SETTINGS_RU;
1616 1622
             more_menu.title       = TITLE_MORE_RU;
1623
+            more_menu.gcode       = MORE_GCODE_RU;
1624
+            more_menu.entergcode  = MORE_ENTER_GCODE_RU;
1617 1625
             #if ENABLED(USER_CMD_1_ENABLE)
1618 1626
               more_menu.custom1 = MORE_CUSTOM1_TEXT_RU;
1619 1627
             #endif
@@ -1944,6 +1952,8 @@ void disp_language_init() {
1944 1952
             set_menu.machine_para = MACHINE_PARA_SP;
1945 1953
             set_menu.eepromSet    = EEPROM_SETTINGS_SP;
1946 1954
             more_menu.title       = TITLE_MORE_SP;
1955
+            more_menu.gcode       = MORE_GCODE_SP;
1956
+            more_menu.entergcode  = MORE_ENTER_GCODE_SP;
1947 1957
             #if ENABLED(USER_CMD_1_ENABLE)
1948 1958
               more_menu.custom1 = MORE_CUSTOM1_TEXT_SP;
1949 1959
             #endif
@@ -2179,6 +2189,8 @@ void disp_language_init() {
2179 2189
           set_menu.machine_para = MACHINE_PARA_FR;
2180 2190
           set_menu.eepromSet    = EEPROM_SETTINGS_FR;
2181 2191
           more_menu.title       = TITLE_MORE_FR;
2192
+          more_menu.gcode       = MORE_GCODE_FR;
2193
+          more_menu.entergcode  = MORE_ENTER_GCODE_FR;
2182 2194
           #if ENABLED(USER_CMD_1_ENABLE)
2183 2195
             more_menu.custom1 = MORE_CUSTOM1_TEXT_FR;
2184 2196
           #endif
@@ -2415,6 +2427,8 @@ void disp_language_init() {
2415 2427
           set_menu.machine_para = MACHINE_PARA_IT;
2416 2428
           set_menu.eepromSet    = EEPROM_SETTINGS_IT;
2417 2429
           more_menu.title       = TITLE_MORE_IT;
2430
+          more_menu.gcode       = MORE_GCODE_IT;
2431
+          more_menu.entergcode  = MORE_ENTER_GCODE_IT;
2418 2432
           #if ENABLED(USER_CMD_1_ENABLE)
2419 2433
             more_menu.custom1 = MORE_CUSTOM1_TEXT_IT;
2420 2434
           #endif
@@ -2651,6 +2665,8 @@ void disp_language_init() {
2651 2665
       set_menu.eepromSet    = EEPROM_SETTINGS_EN;
2652 2666
       //
2653 2667
       more_menu.title       = TITLE_MORE_EN;
2668
+      more_menu.gcode       = MORE_GCODE_EN;
2669
+      more_menu.entergcode  = MORE_ENTER_GCODE_EN;
2654 2670
       TERN_(USER_CMD_1_ENABLE, more_menu.custom1 = MORE_CUSTOM1_TEXT_EN);
2655 2671
       TERN_(USER_CMD_2_ENABLE, more_menu.custom2 = MORE_CUSTOM2_TEXT_EN);
2656 2672
       TERN_(USER_CMD_3_ENABLE, more_menu.custom3 = MORE_CUSTOM3_TEXT_EN);

+ 2
- 0
Marlin/src/lcd/extui/lib/mks_ui/tft_multi_language.h View File

@@ -464,6 +464,8 @@ typedef struct more_menu_disp {
464 464
   const char *custom5;
465 465
   const char *custom6;
466 466
   const char *custom7;
467
+  const char *gcode;
468
+  const char *entergcode;
467 469
   const char *back;
468 470
 } more_menu_def;
469 471
 

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

@@ -80,10 +80,10 @@ class WifiSerial {
80 80
       }
81 81
       /* TXE signifies readiness to send a byte to DR. */
82 82
       if ((regs->CR1 & USART_CR1_TXEIE) && (regs->SR & USART_SR_TXE)) {
83
-          if (!rb_is_empty(this->usart_device->wb))
84
-              regs->DR=rb_remove(this->usart_device->wb);
85
-          else
86
-              regs->CR1 &= ~((uint32)USART_CR1_TXEIE); // disable TXEIE
83
+        if (!rb_is_empty(this->usart_device->wb))
84
+          regs->DR=rb_remove(this->usart_device->wb);
85
+        else
86
+          regs->CR1 &= ~((uint32)USART_CR1_TXEIE); // disable TXEIE
87 87
       }
88 88
     }
89 89
 

+ 3
- 2
buildroot/tests/mega2560-tests View File

@@ -72,8 +72,9 @@ opt_set TEMP_SENSOR_1 1
72 72
 opt_set TEMP_SENSOR_2 1
73 73
 opt_set TEMP_SENSOR_3 1
74 74
 opt_set TEMP_SENSOR_4 1
75
-opt_enable VIKI2 Z_PROBE_SERVO_NR Z_SERVO_ANGLES DEACTIVATE_SERVOS_AFTER_MOVE BOOT_MARLIN_LOGO_ANIMATED \
76
-           AUTO_BED_LEVELING_3POINT DEBUG_LEVELING_FEATURE EEPROM_SETTINGS EEPROM_CHITCHAT M114_DETAIL \
75
+opt_enable VIKI2 BOOT_MARLIN_LOGO_ANIMATED SDSUPPORT AUTO_REPORT_SD_STATUS \
76
+           Z_PROBE_SERVO_NR Z_SERVO_ANGLES DEACTIVATE_SERVOS_AFTER_MOVE AUTO_BED_LEVELING_3POINT DEBUG_LEVELING_FEATURE \
77
+           EEPROM_SETTINGS EEPROM_CHITCHAT M114_DETAIL \
77 78
            NO_VOLUMETRICS EXTENDED_CAPABILITIES_REPORT AUTO_REPORT_TEMPERATURES AUTOTEMP G38_PROBE_TARGET JOYSTICK \
78 79
            DIRECT_STEPPING DETECT_BROKEN_ENDSTOP \
79 80
            FILAMENT_RUNOUT_SENSOR NOZZLE_PARK_FEATURE ADVANCED_PAUSE_FEATURE Z_SAFE_HOMING FIL_RUNOUT3_PULLUP

+ 8
- 8
docs/Serial.md View File

@@ -10,13 +10,13 @@ Starting with version `2.0.9`, Marlin provides a common interface for its serial
10 10
 
11 11
 ## Common interface
12 12
 
13
-This interface is declared in `Marlin/src/core/serial_base.h` 
13
+This interface is declared in `Marlin/src/core/serial_base.h`
14 14
 Any implementation will need to follow this interface for being used transparently in Marlin's codebase.
15 15
 
16 16
 The implementation was written to prioritize performance over abstraction, so the base interface is not using virtual inheritance to avoid the cost of virtual dispatching while calling methods.
17 17
 Instead, the Curiously Recurring Template Pattern (**CRTP**) is used so that, upon compilation, the interface abstraction does not incur a performance cost.
18 18
 
19
-Because some platform do not follow the same interface, the missing method in the actual low-level implementation are detected via SFINAE and a wrapper is generated when such method are missing. See `CALL_IF_EXISTS` macro in `Marlin/src/core/macros.h` for the documentation of this technic.  
19
+Because some platform do not follow the same interface, the missing method in the actual low-level implementation are detected via SFINAE and a wrapper is generated when such method are missing. See `CALL_IF_EXISTS` macro in `Marlin/src/core/macros.h` for the documentation of this technic.
20 20
 
21 21
 ## Composing the desired feature
22 22
 The different specificities for each architecture are provided by composing the serial type based on desired functionality.
@@ -25,11 +25,11 @@ In the `Marlin/src/core/serial_hook.h` file, the different serial feature are de
25 25
 2. `ForwardSerial` is a composing wrapper. It references an actual Arduino compatible `Serial` instance. You'll use this if the instance is declared in the platform's framework and is being referred directly in the framework. This is not as efficient as the `BaseSerial` implementation since static dereferencing is done for each method call (it'll still be faster than virtual dispatching)
26 26
 3. `ConditionalSerial` is working a bit like the `ForwardSerial` interface, but it checks a boolean condition before calling the referenced instance. You'll use it when the serial output can be switch off at runtime, for example in a *telnet* like serial output that should not emit any packet if no client is connected.
27 27
 4. `RuntimeSerial` is providing a runtime-modifiable hooking method for its `write` and `msgDone` method. You'll use it if you need to capture the serial output of Marlin, for example to display the G-Code parser's output on a GUI interface. The hooking interface is setup via the `setHook` method.
28
-5. `MultiSerial` is a runtime modifiable serial output multiplexer. It can output (*respectively input*) to 2 different interface based on a port *mask*. You'll use this if you need to output the same serial stream to multiple port. You can plug a `MultiSerial` to itself to duplicate to more than 2 ports. 
28
+5. `MultiSerial` is a runtime modifiable serial output multiplexer. It can output (*respectively input*) to 2 different interface based on a port *mask*. You'll use this if you need to output the same serial stream to multiple port. You can plug a `MultiSerial` to itself to duplicate to more than 2 ports.
29 29
 
30 30
 ## Plumbing
31
-Since all the types above are using CRTP, it's possible to combine them to get the appropriate functionality. 
32
-This is easily done via type definition of the feature. 
31
+Since all the types above are using CRTP, it's possible to combine them to get the appropriate functionality.
32
+This is easily done via type definition of the feature.
33 33
 
34 34
 For example, to present a serial interface that's outputting to 2 serial port, the first one being hooked at runtime and the second one connected to a runtime switchable telnet client, you'll declare the type to use as:
35 35
 ```
@@ -37,8 +37,8 @@ typedef MultiSerial< RuntimeSerial<Serial>, ConditionalSerial<TelnetClient> > Se
37 37
 ```
38 38
 
39 39
 ## Emergency parser
40
-By default, the serial base interface provide an emergency parser that's only enable for serial classes that support it. 
41
-Because of this condition, all underlying type takes a first `bool emergencyParserEnabled` argument to their constructor. You must take into account this parameter when defining the actual type used. 
40
+By default, the serial base interface provide an emergency parser that's only enable for serial classes that support it.
41
+Because of this condition, all underlying type takes a first `bool emergencyParserEnabled` argument to their constructor. You must take into account this parameter when defining the actual type used.
42 42
 
43 43
 
44
-*This document was written by [X-Ryl669](https://blog.cyril.by) and is under [CC-SA license](https://creativecommons.org/licenses/by-sa)*
44
+*This document was written by [X-Ryl669](https://blog.cyril.by) and is under [CC-SA license](https://creativecommons.org/licenses/by-sa)*

Loading…
Cancel
Save