🚸 Fix and improve MKS LVGL UI (#22783)

Co-authored-by: makerbase <4164049@qq.com>
Co-authored-by: MKS-Sean <56996910+MKS-Sean@users.noreply.github.com>
Co-authored-by: Scott Lahteine <thinkyhead@users.noreply.github.com>
This commit is contained in:
Sola
2021-09-16 19:48:24 +08:00
committed by GitHub
parent 323b38ee88
commit 8df3e62c89
38 changed files with 320 additions and 283 deletions

View File

@@ -30,7 +30,7 @@
#include "../../../inc/MarlinConfig.h"
extern lv_group_t *g;
static lv_obj_t *scr,*outL,*outV = 0;
static lv_obj_t *scr, *outL, *outV = 0;
static int currentWritePos = 0;
extern uint8_t public_buf[513];
extern "C" { extern char public_buf_m[100]; }
@@ -59,7 +59,7 @@ void lv_show_gcode_output(void * that, const char * txt) {
if (!memcmp(txt, "echo:", 5)) {
public_buf[0] = 0; // Clear output buffer
return;
}
}
// Avoid overflow if the answer is too large
size_t len = strlen((const char*)public_buf), tlen = strlen(txt);
@@ -69,17 +69,17 @@ void lv_show_gcode_output(void * that, const char * txt) {
}
}
void lv_serial_capt_hook(void * userPointer, uint8_t c)
{
void lv_serial_capt_hook(void * userPointer, uint8_t c) {
if (c == '\n' || currentWritePos == sizeof(public_buf_m) - 1) { // End of line, probably end of command anyway
public_buf_m[currentWritePos] = 0;
lv_show_gcode_output(userPointer, public_buf_m);
currentWritePos = 0;
}
else public_buf_m[currentWritePos++] = c;
else
public_buf_m[currentWritePos++] = c;
}
void lv_eom_hook(void *)
{
void lv_eom_hook(void *) {
// Message is done, let's remove the hook now
MYSERIAL1.setHook();
// We are back from the keyboard, so let's redraw ourselves