Browse Source

🚸 Tweak MKS UI G-code console

Scott Lahteine 3 years ago
parent
commit
741e70541d

+ 1
- 1
Marlin/src/gcode/queue.h View File

@@ -133,7 +133,7 @@ public:
133 133
    * Enqueue command(s) to run from SRAM. Drained by process_injected_command().
134 134
    * Aborts the current SRAM queue so only use for one or two commands.
135 135
    */
136
-  static inline void inject(char * const gcode) {
136
+  static inline void inject(const char * const gcode) {
137 137
     strncpy(injected_commands, gcode, sizeof(injected_commands) - 1);
138 138
   }
139 139
 

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

@@ -82,8 +82,6 @@ void lv_serial_capt_hook(void * userPointer, uint8_t c) {
82 82
 void lv_eom_hook(void *) {
83 83
   // Message is done, let's remove the hook now
84 84
   MYSERIAL1.setHook();
85
-  // We are back from the keyboard, so let's redraw ourselves
86
-  draw_return_ui();
87 85
 }
88 86
 
89 87
 void lv_draw_gcode(bool clear) {

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

@@ -164,13 +164,13 @@ static void lv_kb_event_cb(lv_obj_t *kb, lv_event_t event) {
164 164
           draw_return_ui();
165 165
           break;
166 166
         case GCodeCommand:
167
-          if (!queue.ring_buffer.full(3)) {
168
-            // Hook anything that goes to the serial port
167
+          if (ret_ta_txt[0] && !queue.ring_buffer.full(3)) {
168
+            // Hook for the next bytes to arrive from the serial port
169 169
             MYSERIAL1.setHook(lv_serial_capt_hook, lv_eom_hook, 0);
170
-            queue.enqueue_one_now(ret_ta_txt);
170
+            // Run the command as soon as possible
171
+            queue.inject(ret_ta_txt);
171 172
           }
172
-          lv_clear_keyboard();
173
-          // draw_return_ui is called in the end of message hook
173
+          goto_previous_ui();
174 174
           break;
175 175
         default: break;
176 176
       }

Loading…
Cancel
Save