🚸 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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user