mirror of
https://github.com/MarlinFirmware/Marlin.git
synced 2024-11-27 13:56:24 +00:00
Fix LVGL_UI G-code preview (#20564)
This commit is contained in:
parent
28a3d95cda
commit
9eaa69874a
@ -298,8 +298,8 @@ void disp_gcode_icon(uint8_t file_num) {
|
|||||||
strcat(test_public_buf_l, list_file.file_name[i]);
|
strcat(test_public_buf_l, list_file.file_name[i]);
|
||||||
char *temp = strstr(test_public_buf_l, ".GCO");
|
char *temp = strstr(test_public_buf_l, ".GCO");
|
||||||
if (temp) strcpy(temp, ".bin");
|
if (temp) strcpy(temp, ".bin");
|
||||||
lv_obj_set_event_cb_mks(buttonGcode[i], event_handler, (i + 1), "", 0);
|
lv_obj_set_event_cb_mks(buttonGcode[i], event_handler, (i + 1), test_public_buf_l, 0);
|
||||||
lv_imgbtn_set_src_both(buttonGcode[i], test_public_buf_l);
|
lv_imgbtn_set_src_both(buttonGcode[i], buttonGcode[i]->mks_pic_name);
|
||||||
if (i < 3) {
|
if (i < 3) {
|
||||||
lv_obj_set_pos(buttonGcode[i], BTN_X_PIXEL * i + INTERVAL_V * (i + 1) + FILE_PRE_PIC_X_OFFSET, titleHeight + FILE_PRE_PIC_Y_OFFSET);
|
lv_obj_set_pos(buttonGcode[i], BTN_X_PIXEL * i + INTERVAL_V * (i + 1) + FILE_PRE_PIC_X_OFFSET, titleHeight + FILE_PRE_PIC_Y_OFFSET);
|
||||||
buttonText[i] = lv_btn_create(scr, nullptr);
|
buttonText[i] = lv_btn_create(scr, nullptr);
|
||||||
@ -358,7 +358,7 @@ void disp_gcode_icon(uint8_t file_num) {
|
|||||||
uint32_t lv_open_gcode_file(char *path) {
|
uint32_t lv_open_gcode_file(char *path) {
|
||||||
#if ENABLED(SDSUPPORT)
|
#if ENABLED(SDSUPPORT)
|
||||||
uint32_t *ps4;
|
uint32_t *ps4;
|
||||||
uint32_t pre_sread_cnt = 0;
|
uint32_t pre_sread_cnt = UINT32_MAX;
|
||||||
char *cur_name;
|
char *cur_name;
|
||||||
|
|
||||||
cur_name = strrchr(path, '/');
|
cur_name = strrchr(path, '/');
|
||||||
@ -399,6 +399,7 @@ void lv_gcode_file_read(uint8_t *data_buf) {
|
|||||||
char temp_test[200];
|
char temp_test[200];
|
||||||
volatile uint16_t *p_index;
|
volatile uint16_t *p_index;
|
||||||
|
|
||||||
|
watchdog_refresh();
|
||||||
memset(public_buf, 0, 200);
|
memset(public_buf, 0, 200);
|
||||||
|
|
||||||
while (card.isFileOpen()) {
|
while (card.isFileOpen()) {
|
||||||
@ -418,7 +419,7 @@ void lv_gcode_file_read(uint8_t *data_buf) {
|
|||||||
uint16_t c = card.get();
|
uint16_t c = card.get();
|
||||||
// check if we have more data or finished the line (CR)
|
// check if we have more data or finished the line (CR)
|
||||||
if (c == '\r') break;
|
if (c == '\r') break;
|
||||||
card.setIndex(card.getIndex());
|
card.setIndex(card.getIndex() - 1);
|
||||||
k++;
|
k++;
|
||||||
j = 0;
|
j = 0;
|
||||||
ignore_start = false;
|
ignore_start = false;
|
||||||
|
@ -380,7 +380,7 @@ lv_fs_res_t sd_open_cb (lv_fs_drv_t * drv, void * file_p, const char * path, lv_
|
|||||||
if (temp) strcpy(temp, ".GCO");
|
if (temp) strcpy(temp, ".GCO");
|
||||||
sd_read_base_addr = lv_open_gcode_file((char *)name_buf);
|
sd_read_base_addr = lv_open_gcode_file((char *)name_buf);
|
||||||
sd_read_addr_offset = sd_read_base_addr;
|
sd_read_addr_offset = sd_read_base_addr;
|
||||||
if (sd_read_addr_offset == 0) return LV_FS_RES_NOT_EX;
|
if (sd_read_addr_offset == UINT32_MAX) return LV_FS_RES_NOT_EX;
|
||||||
return LV_FS_RES_OK;
|
return LV_FS_RES_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user