Robin nano V2, TFT LVGL UI parameters, and more (#18500)
This commit is contained in:
@@ -26,10 +26,11 @@
|
||||
|
||||
#include "../../../../inc/MarlinConfigPre.h"
|
||||
|
||||
#if ENABLED(TFT_LVGL_UI)
|
||||
#if HAS_TFT_LVGL_UI
|
||||
|
||||
#include "lv_conf.h"
|
||||
#include "draw_ui.h"
|
||||
|
||||
//#include "../lvgl/src/lv_objx/lv_imgbtn.h"
|
||||
//#include "../lvgl/src/lv_objx/lv_img.h"
|
||||
//#include "../lvgl/src/lv_core/lv_disp.h"
|
||||
@@ -48,6 +49,7 @@
|
||||
#if ENABLED(PARK_HEAD_ON_PAUSE)
|
||||
#include "../../../../feature/pause.h"
|
||||
#endif
|
||||
#include "../../../../gcode/gcode.h"
|
||||
|
||||
static lv_obj_t * scr;
|
||||
extern uint8_t sel_id;
|
||||
@@ -72,36 +74,36 @@ static void btn_ok_event_cb(lv_obj_t * btn, lv_event_t event) {
|
||||
lv_draw_printing();
|
||||
|
||||
#if ENABLED(SDSUPPORT)
|
||||
if (gcode_preview_over != 1) {
|
||||
char *cur_name;
|
||||
cur_name = strrchr(list_file.file_name[sel_id], '/');
|
||||
if (gcode_preview_over != 1) {
|
||||
char *cur_name;
|
||||
cur_name = strrchr(list_file.file_name[sel_id], '/');
|
||||
|
||||
SdFile file, *curDir;
|
||||
card.endFilePrint();
|
||||
const char * const fname = card.diveToFile(true, curDir, cur_name);
|
||||
if (!fname) return;
|
||||
if (file.open(curDir, fname, O_READ)) {
|
||||
gCfgItems.curFilesize = file.fileSize();
|
||||
file.close();
|
||||
update_spi_flash();
|
||||
SdFile file, *curDir;
|
||||
card.endFilePrint();
|
||||
const char * const fname = card.diveToFile(true, curDir, cur_name);
|
||||
if (!fname) return;
|
||||
if (file.open(curDir, fname, O_READ)) {
|
||||
gCfgItems.curFilesize = file.fileSize();
|
||||
file.close();
|
||||
update_spi_flash();
|
||||
}
|
||||
card.openFileRead(cur_name);
|
||||
if (card.isFileOpen()) {
|
||||
feedrate_percentage = 100;
|
||||
//saved_feedrate_percentage = feedrate_percentage;
|
||||
planner.flow_percentage[0] = 100;
|
||||
planner.e_factor[0] = planner.flow_percentage[0] * 0.01f;
|
||||
#if EXTRUDERS == 2
|
||||
planner.flow_percentage[1] = 100;
|
||||
planner.e_factor[1] = planner.flow_percentage[1] * 0.01f;
|
||||
#endif
|
||||
card.startFileprint();
|
||||
#if ENABLED(POWER_LOSS_RECOVERY)
|
||||
recovery.prepare();
|
||||
#endif
|
||||
once_flag = 0;
|
||||
}
|
||||
}
|
||||
card.openFileRead(cur_name);
|
||||
if (card.isFileOpen()) {
|
||||
feedrate_percentage = 100;
|
||||
//saved_feedrate_percentage = feedrate_percentage;
|
||||
planner.flow_percentage[0] = 100;
|
||||
planner.e_factor[0] = planner.flow_percentage[0] * 0.01f;
|
||||
#if EXTRUDERS == 2
|
||||
planner.flow_percentage[1] = 100;
|
||||
planner.e_factor[1] = planner.flow_percentage[1] * 0.01f;
|
||||
#endif
|
||||
card.startFileprint();
|
||||
#if ENABLED(POWER_LOSS_RECOVERY)
|
||||
recovery.prepare();
|
||||
#endif
|
||||
once_flag = 0;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
else if (DialogType == DIALOG_TYPE_STOP) {
|
||||
@@ -112,7 +114,7 @@ static void btn_ok_event_cb(lv_obj_t * btn, lv_event_t event) {
|
||||
#if ENABLED(SDSUPPORT)
|
||||
//card.endFilePrint();
|
||||
//wait_for_heatup = false;
|
||||
uiCfg.print_state = IDLE;
|
||||
uiCfg.print_state = IDLE;
|
||||
card.flag.abort_sd_printing = true;
|
||||
//queue.clear();
|
||||
//quickstop_stepper();
|
||||
@@ -120,12 +122,9 @@ static void btn_ok_event_cb(lv_obj_t * btn, lv_event_t event) {
|
||||
//thermalManager.disable_all_heaters();
|
||||
|
||||
//#if ENABLED(POWER_LOSS_RECOVERY)
|
||||
//recovery.purge();
|
||||
// recovery.purge();
|
||||
//#endif
|
||||
//queue.enqueue_one_now(PSTR("G91"));
|
||||
//queue.enqueue_one_now(PSTR("G1 Z10"));
|
||||
//queue.enqueue_one_now(PSTR("G90"));
|
||||
//queue.enqueue_one_now(PSTR("G28 X0 Y0"));
|
||||
//queue.enqueue_now_P(PSTR("G91\nG1 Z10\nG90\nG28 X0 Y0"));
|
||||
//queue.inject_P(PSTR("G91\nG1 Z10\nG90\nG28 X0 Y0\nM84\nM107"));
|
||||
#endif
|
||||
}
|
||||
@@ -148,6 +147,21 @@ static void btn_ok_event_cb(lv_obj_t * btn, lv_event_t event) {
|
||||
draw_return_ui();
|
||||
}
|
||||
#endif
|
||||
else if (DialogType == DIALOG_STORE_EEPROM_TIPS) {
|
||||
gcode.process_subcommands_now_P(PSTR("M500"));
|
||||
clear_cur_ui();
|
||||
draw_return_ui();
|
||||
}
|
||||
else if (DialogType == DIALOG_READ_EEPROM_TIPS) {
|
||||
gcode.process_subcommands_now_P(PSTR("M501"));
|
||||
clear_cur_ui();
|
||||
draw_return_ui();
|
||||
}
|
||||
else if (DialogType == DIALOG_REVERT_EEPROM_TIPS) {
|
||||
gcode.process_subcommands_now_P(PSTR("M502"));
|
||||
clear_cur_ui();
|
||||
draw_return_ui();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -186,7 +200,7 @@ void lv_draw_dialog(uint8_t type) {
|
||||
lv_obj_clean(scr);
|
||||
|
||||
lv_obj_t * title = lv_label_create(scr, NULL);
|
||||
lv_obj_set_style(title, &tft_style_lable_rel);
|
||||
lv_obj_set_style(title, &tft_style_label_rel);
|
||||
lv_obj_set_pos(title, TITLE_XPOS, TITLE_YPOS);
|
||||
lv_label_set_text(title, creat_title_text());
|
||||
|
||||
@@ -194,51 +208,52 @@ void lv_draw_dialog(uint8_t type) {
|
||||
|
||||
//LV_IMG_DECLARE(bmp_pic);
|
||||
|
||||
static lv_style_t style_btn_rel; // A variable to store the released style
|
||||
lv_style_copy(&style_btn_rel, &lv_style_plain); // Initialize from a built-in style
|
||||
static lv_style_t style_btn_rel; // A variable to store the released style
|
||||
lv_style_copy(&style_btn_rel, &lv_style_plain); // Initialize from a built-in style
|
||||
style_btn_rel.body.border.color = lv_color_hex3(0x269);
|
||||
style_btn_rel.body.border.width = 1;
|
||||
style_btn_rel.body.main_color = lv_color_hex3(0xADF);
|
||||
style_btn_rel.body.grad_color = lv_color_hex3(0x46B);
|
||||
style_btn_rel.body.main_color = lv_color_hex3(0xADF);
|
||||
style_btn_rel.body.grad_color = lv_color_hex3(0x46B);
|
||||
style_btn_rel.body.shadow.width = 4;
|
||||
style_btn_rel.body.shadow.type = LV_SHADOW_BOTTOM;
|
||||
style_btn_rel.body.radius = LV_RADIUS_CIRCLE;
|
||||
style_btn_rel.text.color = lv_color_hex3(0xDEF);
|
||||
style_btn_rel.text.font = &lv_font_roboto_22;
|
||||
style_btn_rel.body.shadow.type = LV_SHADOW_BOTTOM;
|
||||
style_btn_rel.body.radius = LV_RADIUS_CIRCLE;
|
||||
style_btn_rel.text.color = lv_color_hex3(0xDEF);
|
||||
style_btn_rel.text.font = &TERN(HAS_SPI_FLASH_FONT, gb2312_puhui32, lv_font_roboto_22);
|
||||
|
||||
static lv_style_t style_btn_pr; // A variable to store the pressed style
|
||||
lv_style_copy(&style_btn_pr, &style_btn_rel); // Initialize from the released style
|
||||
static lv_style_t style_btn_pr; // A variable to store the pressed style
|
||||
lv_style_copy(&style_btn_pr, &style_btn_rel); // Initialize from the released style
|
||||
style_btn_pr.body.border.color = lv_color_hex3(0x46B);
|
||||
style_btn_pr.body.main_color = lv_color_hex3(0x8BD);
|
||||
style_btn_pr.body.grad_color = lv_color_hex3(0x24A);
|
||||
style_btn_pr.body.main_color = lv_color_hex3(0x8BD);
|
||||
style_btn_pr.body.grad_color = lv_color_hex3(0x24A);
|
||||
style_btn_pr.body.shadow.width = 2;
|
||||
style_btn_pr.text.color = lv_color_hex3(0xBCD);
|
||||
style_btn_pr.text.font = &lv_font_roboto_22;
|
||||
style_btn_pr.text.color = lv_color_hex3(0xBCD);
|
||||
style_btn_pr.text.font = &TERN(HAS_SPI_FLASH_FONT, gb2312_puhui32, lv_font_roboto_22);
|
||||
|
||||
lv_obj_t * labelDialog = lv_label_create(scr, NULL);
|
||||
lv_obj_set_style(labelDialog, &tft_style_lable_rel);
|
||||
lv_obj_set_style(labelDialog, &tft_style_label_rel);
|
||||
|
||||
if (DialogType == DIALOG_TYPE_FINISH_PRINT || DialogType == DIALOG_PAUSE_MESSAGE_RESUME) {
|
||||
lv_obj_t * btnOk = lv_btn_create(scr, NULL); // Add a button the current screen
|
||||
lv_obj_set_pos(btnOk, BTN_OK_X + 90, BTN_OK_Y); // Set its position
|
||||
lv_obj_set_size(btnOk, 100, 50); // Set its size
|
||||
lv_obj_t * btnOk = lv_btn_create(scr, NULL); // Add a button the current screen
|
||||
lv_obj_set_pos(btnOk, BTN_OK_X + 90, BTN_OK_Y); // Set its position
|
||||
lv_obj_set_size(btnOk, 100, 50); // Set its size
|
||||
lv_obj_set_event_cb(btnOk, btn_ok_event_cb);
|
||||
lv_btn_set_style(btnOk, LV_BTN_STYLE_REL, &style_btn_rel); // Set the button's released style
|
||||
lv_btn_set_style(btnOk, LV_BTN_STYLE_PR, &style_btn_pr); // Set the button's pressed style
|
||||
lv_obj_t * labelOk = lv_label_create(btnOk, NULL); // Add a label to the button
|
||||
lv_label_set_text(labelOk, print_file_dialog_menu.confirm); // Set the labels text
|
||||
lv_btn_set_style(btnOk, LV_BTN_STYLE_REL, &style_btn_rel); // Set the button's released style
|
||||
lv_btn_set_style(btnOk, LV_BTN_STYLE_PR, &style_btn_pr); // Set the button's pressed style
|
||||
lv_obj_t * labelOk = lv_label_create(btnOk, NULL); // Add a label to the button
|
||||
lv_label_set_text(labelOk, print_file_dialog_menu.confirm); // Set the labels text
|
||||
}
|
||||
else if (DialogType == DIALOG_PAUSE_MESSAGE_WAITING
|
||||
|| DialogType == DIALOG_PAUSE_MESSAGE_INSERT
|
||||
|| DialogType == DIALOG_PAUSE_MESSAGE_HEAT) {
|
||||
lv_obj_t * btnOk = lv_btn_create(scr, NULL); // Add a button the current screen
|
||||
lv_obj_set_pos(btnOk, BTN_OK_X + 90, BTN_OK_Y); // Set its position
|
||||
lv_obj_set_size(btnOk, 100, 50); // Set its size
|
||||
|| DialogType == DIALOG_PAUSE_MESSAGE_INSERT
|
||||
|| DialogType == DIALOG_PAUSE_MESSAGE_HEAT
|
||||
) {
|
||||
lv_obj_t * btnOk = lv_btn_create(scr, NULL); // Add a button the current screen
|
||||
lv_obj_set_pos(btnOk, BTN_OK_X + 90, BTN_OK_Y); // Set its position
|
||||
lv_obj_set_size(btnOk, 100, 50); // Set its size
|
||||
lv_obj_set_event_cb(btnOk, btn_ok_event_cb);
|
||||
lv_btn_set_style(btnOk, LV_BTN_STYLE_REL, &style_btn_rel); // Set the button's released style
|
||||
lv_btn_set_style(btnOk, LV_BTN_STYLE_PR, &style_btn_pr); // Set the button's pressed style
|
||||
lv_obj_t * labelOk = lv_label_create(btnOk, NULL); // Add a label to the button
|
||||
lv_label_set_text(labelOk, print_file_dialog_menu.confirm); // Set the labels text
|
||||
lv_btn_set_style(btnOk, LV_BTN_STYLE_REL, &style_btn_rel); // Set the button's released style
|
||||
lv_btn_set_style(btnOk, LV_BTN_STYLE_PR, &style_btn_pr); // Set the button's pressed style
|
||||
lv_obj_t * labelOk = lv_label_create(btnOk, NULL); // Add a label to the button
|
||||
lv_label_set_text(labelOk, print_file_dialog_menu.confirm); // Set the labels text
|
||||
}
|
||||
else if (DialogType == DIALOG_PAUSE_MESSAGE_PAUSING
|
||||
|| DialogType == DIALOG_PAUSE_MESSAGE_CHANGING
|
||||
@@ -251,28 +266,28 @@ void lv_draw_dialog(uint8_t type) {
|
||||
// nothing to do
|
||||
}
|
||||
else {
|
||||
lv_obj_t * btnOk = lv_btn_create(scr, NULL); // Add a button the current screen
|
||||
lv_obj_set_pos(btnOk, BTN_OK_X, BTN_OK_Y); // Set its position
|
||||
lv_obj_set_size(btnOk, 100, 50); // Set its size
|
||||
lv_obj_t * btnOk = lv_btn_create(scr, NULL); // Add a button the current screen
|
||||
lv_obj_set_pos(btnOk, BTN_OK_X, BTN_OK_Y); // Set its position
|
||||
lv_obj_set_size(btnOk, 100, 50); // Set its size
|
||||
lv_obj_set_event_cb(btnOk, btn_ok_event_cb);
|
||||
lv_btn_set_style(btnOk, LV_BTN_STYLE_REL, &style_btn_rel); // Set the button's released style
|
||||
lv_btn_set_style(btnOk, LV_BTN_STYLE_PR, &style_btn_pr); // Set the button's pressed style
|
||||
lv_obj_t * labelOk = lv_label_create(btnOk, NULL); // Add a label to the button
|
||||
lv_btn_set_style(btnOk, LV_BTN_STYLE_REL, &style_btn_rel); // Set the button's released style
|
||||
lv_btn_set_style(btnOk, LV_BTN_STYLE_PR, &style_btn_pr); // Set the button's pressed style
|
||||
lv_obj_t * labelOk = lv_label_create(btnOk, NULL); // Add a label to the button
|
||||
|
||||
lv_obj_t * btnCancel = lv_btn_create(scr, NULL); // Add a button the current screen
|
||||
lv_obj_set_pos(btnCancel, BTN_CANCEL_X, BTN_CANCEL_Y); // Set its position
|
||||
lv_obj_set_size(btnCancel, 100, 50); // Set its size
|
||||
lv_obj_t * btnCancel = lv_btn_create(scr, NULL); // Add a button the current screen
|
||||
lv_obj_set_pos(btnCancel, BTN_CANCEL_X, BTN_CANCEL_Y); // Set its position
|
||||
lv_obj_set_size(btnCancel, 100, 50); // Set its size
|
||||
lv_obj_set_event_cb(btnCancel, btn_cancel_event_cb);
|
||||
lv_btn_set_style(btnCancel, LV_BTN_STYLE_REL, &style_btn_rel); // Set the button's released style
|
||||
lv_btn_set_style(btnCancel, LV_BTN_STYLE_PR, &style_btn_pr); // Set the button's pressed style
|
||||
lv_obj_t * labelCancel = lv_label_create(btnCancel, NULL); // Add a label to the button
|
||||
lv_btn_set_style(btnCancel, LV_BTN_STYLE_REL, &style_btn_rel); // Set the button's released style
|
||||
lv_btn_set_style(btnCancel, LV_BTN_STYLE_PR, &style_btn_pr); // Set the button's pressed style
|
||||
lv_obj_t * labelCancel = lv_label_create(btnCancel, NULL); // Add a label to the button
|
||||
|
||||
if (DialogType == DIALOG_PAUSE_MESSAGE_OPTION) {
|
||||
lv_label_set_text(labelOk, pause_msg_menu.purgeMore); // Set the labels text
|
||||
lv_label_set_text(labelOk, pause_msg_menu.purgeMore); // Set the labels text
|
||||
lv_label_set_text(labelCancel, pause_msg_menu.continuePrint);
|
||||
}
|
||||
else {
|
||||
lv_label_set_text(labelOk, print_file_dialog_menu.confirm); // Set the labels text
|
||||
lv_label_set_text(labelOk, print_file_dialog_menu.confirm); // Set the labels text
|
||||
lv_label_set_text(labelCancel, print_file_dialog_menu.cancle);
|
||||
}
|
||||
}
|
||||
@@ -281,7 +296,7 @@ void lv_draw_dialog(uint8_t type) {
|
||||
lv_obj_align(labelDialog, NULL, LV_ALIGN_CENTER, 0, -20);
|
||||
|
||||
lv_obj_t * labelFile = lv_label_create(scr, NULL);
|
||||
lv_obj_set_style(labelFile, &tft_style_lable_rel);
|
||||
lv_obj_set_style(labelFile, &tft_style_label_rel);
|
||||
|
||||
lv_label_set_text(labelFile, list_file.long_name[sel_id]);
|
||||
lv_obj_align(labelFile, NULL, LV_ALIGN_CENTER, 0, -60);
|
||||
@@ -338,8 +353,20 @@ void lv_draw_dialog(uint8_t type) {
|
||||
lv_label_set_text(labelDialog, pause_msg_menu.option);
|
||||
lv_obj_align(labelDialog, NULL, LV_ALIGN_CENTER, 0, -20);
|
||||
}
|
||||
else if (DialogType == DIALOG_STORE_EEPROM_TIPS) {
|
||||
lv_label_set_text(labelDialog, eeprom_menu.storeTips);
|
||||
lv_obj_align(labelDialog, NULL, LV_ALIGN_CENTER, 0, -20);
|
||||
}
|
||||
else if (DialogType == DIALOG_READ_EEPROM_TIPS) {
|
||||
lv_label_set_text(labelDialog, eeprom_menu.readTips);
|
||||
lv_obj_align(labelDialog, NULL, LV_ALIGN_CENTER, 0, -20);
|
||||
}
|
||||
else if (DialogType == DIALOG_REVERT_EEPROM_TIPS) {
|
||||
lv_label_set_text(labelDialog, eeprom_menu.revertTips);
|
||||
lv_obj_align(labelDialog, NULL, LV_ALIGN_CENTER, 0, -20);
|
||||
}
|
||||
}
|
||||
|
||||
void lv_clear_dialog() { lv_obj_del(scr); }
|
||||
|
||||
#endif // TFT_LVGL_UI
|
||||
#endif // HAS_TFT_LVGL_UI
|
||||
|
||||
Reference in New Issue
Block a user