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
    * Enqueue command(s) to run from SRAM. Drained by process_injected_command().
133
    * Enqueue command(s) to run from SRAM. Drained by process_injected_command().
134
    * Aborts the current SRAM queue so only use for one or two commands.
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
     strncpy(injected_commands, gcode, sizeof(injected_commands) - 1);
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
 void lv_eom_hook(void *) {
82
 void lv_eom_hook(void *) {
83
   // Message is done, let's remove the hook now
83
   // Message is done, let's remove the hook now
84
   MYSERIAL1.setHook();
84
   MYSERIAL1.setHook();
85
-  // We are back from the keyboard, so let's redraw ourselves
86
-  draw_return_ui();
87
 }
85
 }
88
 
86
 
89
 void lv_draw_gcode(bool clear) {
87
 void lv_draw_gcode(bool clear) {

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

164
           draw_return_ui();
164
           draw_return_ui();
165
           break;
165
           break;
166
         case GCodeCommand:
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
             MYSERIAL1.setHook(lv_serial_capt_hook, lv_eom_hook, 0);
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
           break;
174
           break;
175
         default: break;
175
         default: break;
176
       }
176
       }

Loading…
Cancel
Save