🚸 Tweak MKS UI G-code console
This commit is contained in:
parent
01a0f3a8cf
commit
af08f16efc
|
@ -133,7 +133,7 @@ public:
|
||||||
* Enqueue command(s) to run from SRAM. Drained by process_injected_command().
|
* Enqueue command(s) to run from SRAM. Drained by process_injected_command().
|
||||||
* Aborts the current SRAM queue so only use for one or two commands.
|
* Aborts the current SRAM queue so only use for one or two commands.
|
||||||
*/
|
*/
|
||||||
static inline void inject(char * const gcode) {
|
static inline void inject(const char * const gcode) {
|
||||||
strncpy(injected_commands, gcode, sizeof(injected_commands) - 1);
|
strncpy(injected_commands, gcode, sizeof(injected_commands) - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -82,8 +82,6 @@ void lv_serial_capt_hook(void * userPointer, uint8_t c) {
|
||||||
void lv_eom_hook(void *) {
|
void lv_eom_hook(void *) {
|
||||||
// Message is done, let's remove the hook now
|
// Message is done, let's remove the hook now
|
||||||
MYSERIAL1.setHook();
|
MYSERIAL1.setHook();
|
||||||
// We are back from the keyboard, so let's redraw ourselves
|
|
||||||
draw_return_ui();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void lv_draw_gcode(bool clear) {
|
void lv_draw_gcode(bool clear) {
|
||||||
|
|
|
@ -164,13 +164,13 @@ static void lv_kb_event_cb(lv_obj_t *kb, lv_event_t event) {
|
||||||
draw_return_ui();
|
draw_return_ui();
|
||||||
break;
|
break;
|
||||||
case GCodeCommand:
|
case GCodeCommand:
|
||||||
if (!queue.ring_buffer.full(3)) {
|
if (ret_ta_txt[0] && !queue.ring_buffer.full(3)) {
|
||||||
// Hook anything that goes to the serial port
|
// Hook for the next bytes to arrive from the serial port
|
||||||
MYSERIAL1.setHook(lv_serial_capt_hook, lv_eom_hook, 0);
|
MYSERIAL1.setHook(lv_serial_capt_hook, lv_eom_hook, 0);
|
||||||
queue.enqueue_one_now(ret_ta_txt);
|
// Run the command as soon as possible
|
||||||
|
queue.inject(ret_ta_txt);
|
||||||
}
|
}
|
||||||
lv_clear_keyboard();
|
goto_previous_ui();
|
||||||
// draw_return_ui is called in the end of message hook
|
|
||||||
break;
|
break;
|
||||||
default: break;
|
default: break;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue