Skip to content

Commit af08f16

Browse files
committed
🚸 Tweak MKS UI G-code console
1 parent 01a0f3a commit af08f16

File tree

3 files changed

+6
-8
lines changed

3 files changed

+6
-8
lines changed

Marlin/src/gcode/queue.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ class GCodeQueue {
133133
* Enqueue command(s) to run from SRAM. Drained by process_injected_command().
134134
* Aborts the current SRAM queue so only use for one or two commands.
135135
*/
136-
static inline void inject(char * const gcode) {
136+
static inline void inject(const char * const gcode) {
137137
strncpy(injected_commands, gcode, sizeof(injected_commands) - 1);
138138
}
139139

Marlin/src/lcd/extui/mks_ui/draw_gcode.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,6 @@ void lv_serial_capt_hook(void * userPointer, uint8_t c) {
8282
void lv_eom_hook(void *) {
8383
// Message is done, let's remove the hook now
8484
MYSERIAL1.setHook();
85-
// We are back from the keyboard, so let's redraw ourselves
86-
draw_return_ui();
8785
}
8886

8987
void lv_draw_gcode(bool clear) {

Marlin/src/lcd/extui/mks_ui/draw_keyboard.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -164,13 +164,13 @@ static void lv_kb_event_cb(lv_obj_t *kb, lv_event_t event) {
164164
draw_return_ui();
165165
break;
166166
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
169169
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);
171172
}
172-
lv_clear_keyboard();
173-
// draw_return_ui is called in the end of message hook
173+
goto_previous_ui();
174174
break;
175175
default: break;
176176
}

0 commit comments

Comments
 (0)