Robin nano V2, TFT LVGL UI parameters, and more (#18500)
This commit is contained in:
@@ -21,7 +21,7 @@
|
||||
*/
|
||||
#include "../../../../inc/MarlinConfigPre.h"
|
||||
|
||||
#if ENABLED(TFT_LVGL_UI)
|
||||
#if HAS_TFT_LVGL_UI
|
||||
|
||||
#include "lv_conf.h"
|
||||
#include "draw_ui.h"
|
||||
@@ -59,11 +59,11 @@ static void event_handler(lv_obj_t * obj, lv_event_t event) {
|
||||
}
|
||||
else if (event == LV_EVENT_RELEASED) {
|
||||
if (thermalManager.temp_hotend[uiCfg.curSprayerChoose].celsius >= EXTRUDE_MINTEMP) {
|
||||
queue.enqueue_one_now(PSTR("G91"));
|
||||
memset(public_buf_l, 0, sizeof(public_buf_l));
|
||||
sprintf((char *)public_buf_l, "G1 E%d F%d", uiCfg.extruStep, 60 * uiCfg.extruSpeed);
|
||||
queue.enqueue_one_now(PSTR(public_buf_l));
|
||||
queue.enqueue_one_now(PSTR("G90"));
|
||||
queue.enqueue_now_P(PSTR("G91"));
|
||||
ZERO(public_buf_l);
|
||||
sprintf_P((char *)public_buf_l, PSTR("G1 E%d F%d"), uiCfg.extruStep, 60 * uiCfg.extruSpeed);
|
||||
queue.enqueue_one_now(public_buf_l);
|
||||
queue.enqueue_now_P(PSTR("G90"));
|
||||
extructAmount += uiCfg.extruStep;
|
||||
disp_extru_amount();
|
||||
}
|
||||
@@ -75,11 +75,11 @@ static void event_handler(lv_obj_t * obj, lv_event_t event) {
|
||||
}
|
||||
else if (event == LV_EVENT_RELEASED) {
|
||||
if (thermalManager.temp_hotend[uiCfg.curSprayerChoose].celsius >= EXTRUDE_MINTEMP) {
|
||||
queue.enqueue_one_now(PSTR("G91"));
|
||||
memset(public_buf_l, 0, sizeof(public_buf_l));
|
||||
sprintf((char *)public_buf_l, "G1 E%d F%d", 0 - uiCfg.extruStep, 60 * uiCfg.extruSpeed);
|
||||
queue.enqueue_one_now(PSTR(public_buf_l));
|
||||
queue.enqueue_one_now(PSTR("G90"));
|
||||
queue.enqueue_now_P(PSTR("G91"));
|
||||
ZERO(public_buf_l);
|
||||
sprintf_P((char *)public_buf_l, PSTR("G1 E%d F%d"), 0 - uiCfg.extruStep, 60 * uiCfg.extruSpeed);
|
||||
queue.enqueue_one_now(public_buf_l);
|
||||
queue.enqueue_now_P(PSTR("G90"));
|
||||
extructAmount -= uiCfg.extruStep;
|
||||
disp_extru_amount();
|
||||
}
|
||||
@@ -166,7 +166,7 @@ void lv_draw_extrusion(void) {
|
||||
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());
|
||||
|
||||
@@ -175,55 +175,54 @@ void lv_draw_extrusion(void) {
|
||||
LV_IMG_DECLARE(bmp_pic);
|
||||
|
||||
/*Create an Image button*/
|
||||
buttonAdd = lv_imgbtn_create(scr, NULL);
|
||||
buttonDec = lv_imgbtn_create(scr, NULL);
|
||||
buttoType = lv_imgbtn_create(scr, NULL);
|
||||
buttonStep = lv_imgbtn_create(scr, NULL);
|
||||
buttonAdd = lv_imgbtn_create(scr, NULL);
|
||||
buttonDec = lv_imgbtn_create(scr, NULL);
|
||||
buttoType = lv_imgbtn_create(scr, NULL);
|
||||
buttonStep = lv_imgbtn_create(scr, NULL);
|
||||
buttonSpeed = lv_imgbtn_create(scr, NULL);
|
||||
buttonBack = lv_imgbtn_create(scr, NULL);
|
||||
buttonBack = lv_imgbtn_create(scr, NULL);
|
||||
|
||||
lv_obj_set_event_cb_mks(buttonAdd, event_handler, ID_E_ADD, "bmp_In.bin", 0);
|
||||
lv_obj_set_event_cb_mks(buttonAdd, event_handler, ID_E_ADD, "bmp_in.bin", 0);
|
||||
lv_imgbtn_set_src(buttonAdd, LV_BTN_STATE_REL, &bmp_pic);
|
||||
lv_imgbtn_set_src(buttonAdd, LV_BTN_STATE_PR, &bmp_pic);
|
||||
lv_imgbtn_set_style(buttonAdd, LV_BTN_STATE_PR, &tft_style_lable_pre);
|
||||
lv_imgbtn_set_style(buttonAdd, LV_BTN_STATE_REL, &tft_style_lable_rel);
|
||||
lv_imgbtn_set_style(buttonAdd, LV_BTN_STATE_PR, &tft_style_label_pre);
|
||||
lv_imgbtn_set_style(buttonAdd, LV_BTN_STATE_REL, &tft_style_label_rel);
|
||||
lv_obj_clear_protect(buttonAdd, LV_PROTECT_FOLLOW);
|
||||
|
||||
#if 1
|
||||
lv_obj_set_event_cb_mks(buttonDec, event_handler, ID_E_DEC, "bmp_Out.bin", 0);
|
||||
lv_obj_set_event_cb_mks(buttonDec, event_handler, ID_E_DEC, "bmp_out.bin", 0);
|
||||
lv_imgbtn_set_src(buttonDec, LV_BTN_STATE_REL, &bmp_pic);
|
||||
lv_imgbtn_set_src(buttonDec, LV_BTN_STATE_PR, &bmp_pic);
|
||||
lv_imgbtn_set_style(buttonDec, LV_BTN_STATE_PR, &tft_style_lable_pre);
|
||||
lv_imgbtn_set_style(buttonDec, LV_BTN_STATE_REL, &tft_style_lable_rel);
|
||||
lv_imgbtn_set_style(buttonDec, LV_BTN_STATE_PR, &tft_style_label_pre);
|
||||
lv_imgbtn_set_style(buttonDec, LV_BTN_STATE_REL, &tft_style_label_rel);
|
||||
|
||||
lv_imgbtn_set_src(buttoType, LV_BTN_STATE_REL, &bmp_pic);
|
||||
lv_imgbtn_set_src(buttoType, LV_BTN_STATE_PR, &bmp_pic);
|
||||
lv_imgbtn_set_style(buttoType, LV_BTN_STATE_PR, &tft_style_lable_pre);
|
||||
lv_imgbtn_set_style(buttoType, LV_BTN_STATE_REL, &tft_style_lable_rel);
|
||||
lv_imgbtn_set_style(buttoType, LV_BTN_STATE_PR, &tft_style_label_pre);
|
||||
lv_imgbtn_set_style(buttoType, LV_BTN_STATE_REL, &tft_style_label_rel);
|
||||
|
||||
lv_imgbtn_set_src(buttonStep, LV_BTN_STATE_REL, &bmp_pic);
|
||||
lv_imgbtn_set_src(buttonStep, LV_BTN_STATE_PR, &bmp_pic);
|
||||
lv_imgbtn_set_style(buttonStep, LV_BTN_STATE_PR, &tft_style_lable_pre);
|
||||
lv_imgbtn_set_style(buttonStep, LV_BTN_STATE_REL, &tft_style_lable_rel);
|
||||
lv_imgbtn_set_style(buttonStep, LV_BTN_STATE_PR, &tft_style_label_pre);
|
||||
lv_imgbtn_set_style(buttonStep, LV_BTN_STATE_REL, &tft_style_label_rel);
|
||||
|
||||
lv_imgbtn_set_src(buttonSpeed, LV_BTN_STATE_REL, &bmp_pic);
|
||||
lv_imgbtn_set_src(buttonSpeed, LV_BTN_STATE_PR, &bmp_pic);
|
||||
lv_imgbtn_set_style(buttonSpeed, LV_BTN_STATE_PR, &tft_style_lable_pre);
|
||||
lv_imgbtn_set_style(buttonSpeed, LV_BTN_STATE_REL, &tft_style_lable_rel);
|
||||
lv_imgbtn_set_style(buttonSpeed, LV_BTN_STATE_PR, &tft_style_label_pre);
|
||||
lv_imgbtn_set_style(buttonSpeed, LV_BTN_STATE_REL, &tft_style_label_rel);
|
||||
|
||||
lv_obj_set_event_cb_mks(buttonBack, event_handler, ID_E_RETURN, "bmp_Return.bin", 0);
|
||||
lv_obj_set_event_cb_mks(buttonBack, event_handler, ID_E_RETURN, "bmp_return.bin", 0);
|
||||
lv_imgbtn_set_src(buttonBack, LV_BTN_STATE_REL, &bmp_pic);
|
||||
lv_imgbtn_set_src(buttonBack, LV_BTN_STATE_PR, &bmp_pic);
|
||||
lv_imgbtn_set_style(buttonBack, LV_BTN_STATE_PR, &tft_style_lable_pre);
|
||||
lv_imgbtn_set_style(buttonBack, LV_BTN_STATE_REL, &tft_style_lable_rel);
|
||||
lv_imgbtn_set_style(buttonBack, LV_BTN_STATE_PR, &tft_style_label_pre);
|
||||
lv_imgbtn_set_style(buttonBack, LV_BTN_STATE_REL, &tft_style_label_rel);
|
||||
#endif
|
||||
|
||||
lv_obj_set_pos(buttonAdd, INTERVAL_V, titleHeight);
|
||||
lv_obj_set_pos(buttonDec, BTN_X_PIXEL * 3 + INTERVAL_V * 4, titleHeight);
|
||||
lv_obj_set_pos(buttoType, INTERVAL_V, BTN_Y_PIXEL + INTERVAL_H + titleHeight);
|
||||
lv_obj_set_pos(buttoType, INTERVAL_V, BTN_Y_PIXEL + INTERVAL_H + titleHeight);
|
||||
lv_obj_set_pos(buttonStep, BTN_X_PIXEL + INTERVAL_V * 2, BTN_Y_PIXEL + INTERVAL_H + titleHeight);
|
||||
lv_obj_set_pos(buttonSpeed, BTN_X_PIXEL * 2 + INTERVAL_V * 3, BTN_Y_PIXEL + INTERVAL_H + titleHeight);
|
||||
lv_obj_set_pos(buttonBack, BTN_X_PIXEL * 3 + INTERVAL_V * 4, BTN_Y_PIXEL + INTERVAL_H + titleHeight);
|
||||
lv_obj_set_pos(buttonSpeed, BTN_X_PIXEL * 2 + INTERVAL_V * 3, BTN_Y_PIXEL + INTERVAL_H + titleHeight);
|
||||
lv_obj_set_pos(buttonBack, BTN_X_PIXEL * 3 + INTERVAL_V * 4, BTN_Y_PIXEL + INTERVAL_H + titleHeight);
|
||||
|
||||
/*Create a label on the Image button*/
|
||||
lv_btn_set_layout(buttonAdd, LV_LAYOUT_OFF);
|
||||
@@ -235,8 +234,8 @@ void lv_draw_extrusion(void) {
|
||||
|
||||
lv_obj_t * labelAdd = lv_label_create(buttonAdd, NULL);
|
||||
lv_obj_t * labelDec = lv_label_create(buttonDec, NULL);
|
||||
labelType = lv_label_create(buttoType, NULL);
|
||||
labelStep = lv_label_create(buttonStep, NULL);
|
||||
labelType = lv_label_create(buttoType, NULL);
|
||||
labelStep = lv_label_create(buttonStep, NULL);
|
||||
labelSpeed = lv_label_create(buttonSpeed, NULL);
|
||||
lv_obj_t * label_Back = lv_label_create(buttonBack, NULL);
|
||||
|
||||
@@ -256,24 +255,24 @@ void lv_draw_extrusion(void) {
|
||||
disp_ext_speed();
|
||||
|
||||
tempText = lv_label_create(scr, NULL);
|
||||
lv_obj_set_style(tempText, &tft_style_lable_rel);
|
||||
lv_obj_set_style(tempText, &tft_style_label_rel);
|
||||
disp_hotend_temp();
|
||||
|
||||
ExtruText = lv_label_create(scr, NULL);
|
||||
lv_obj_set_style(ExtruText, &tft_style_lable_rel);
|
||||
lv_obj_set_style(ExtruText, &tft_style_label_rel);
|
||||
disp_extru_amount();
|
||||
}
|
||||
|
||||
void disp_ext_type() {
|
||||
if (uiCfg.curSprayerChoose == 1) {
|
||||
lv_obj_set_event_cb_mks(buttoType, event_handler, ID_E_TYPE, "bmp_Extru2.bin", 0);
|
||||
lv_obj_set_event_cb_mks(buttoType, event_handler, ID_E_TYPE, "bmp_extru2.bin", 0);
|
||||
if (gCfgItems.multiple_language != 0) {
|
||||
lv_label_set_text(labelType, extrude_menu.ext2);
|
||||
lv_obj_align(labelType, buttoType, LV_ALIGN_IN_BOTTOM_MID, 0, BUTTON_TEXT_Y_OFFSET);
|
||||
}
|
||||
}
|
||||
else {
|
||||
lv_obj_set_event_cb_mks(buttoType, event_handler, ID_E_TYPE, "bmp_Extru1.bin", 0);
|
||||
lv_obj_set_event_cb_mks(buttoType, event_handler, ID_E_TYPE, "bmp_extru1.bin", 0);
|
||||
if (gCfgItems.multiple_language != 0) {
|
||||
lv_label_set_text(labelType, extrude_menu.ext1);
|
||||
lv_obj_align(labelType, buttoType, LV_ALIGN_IN_BOTTOM_MID, 0, BUTTON_TEXT_Y_OFFSET);
|
||||
@@ -283,11 +282,11 @@ void disp_ext_type() {
|
||||
|
||||
void disp_ext_speed() {
|
||||
if (uiCfg.extruSpeed == 20)
|
||||
lv_obj_set_event_cb_mks(buttonSpeed, event_handler, ID_E_SPEED, "bmp_Speed_high.bin", 0);
|
||||
lv_obj_set_event_cb_mks(buttonSpeed, event_handler, ID_E_SPEED, "bmp_speed_high.bin", 0);
|
||||
else if (uiCfg.extruSpeed == 1)
|
||||
lv_obj_set_event_cb_mks(buttonSpeed, event_handler, ID_E_SPEED, "bmp_Speed_slow.bin", 0);
|
||||
lv_obj_set_event_cb_mks(buttonSpeed, event_handler, ID_E_SPEED, "bmp_speed_slow.bin", 0);
|
||||
else
|
||||
lv_obj_set_event_cb_mks(buttonSpeed, event_handler, ID_E_SPEED, "bmp_Speed_normal.bin", 0);
|
||||
lv_obj_set_event_cb_mks(buttonSpeed, event_handler, ID_E_SPEED, "bmp_speed_normal.bin", 0);
|
||||
|
||||
if (gCfgItems.multiple_language != 0) {
|
||||
if (uiCfg.extruSpeed == 20) {
|
||||
@@ -351,11 +350,11 @@ void disp_extru_amount() {
|
||||
|
||||
void disp_ext_step() {
|
||||
if (uiCfg.extruStep == 1)
|
||||
lv_obj_set_event_cb_mks(buttonStep, event_handler, ID_E_STEP, "bmp_Step1_mm.bin", 0);
|
||||
lv_obj_set_event_cb_mks(buttonStep, event_handler, ID_E_STEP, "bmp_step1_mm.bin", 0);
|
||||
else if (uiCfg.extruStep == 5)
|
||||
lv_obj_set_event_cb_mks(buttonStep, event_handler, ID_E_STEP, "bmp_Step5_mm.bin", 0);
|
||||
lv_obj_set_event_cb_mks(buttonStep, event_handler, ID_E_STEP, "bmp_step5_mm.bin", 0);
|
||||
else if (uiCfg.extruStep == 10)
|
||||
lv_obj_set_event_cb_mks(buttonStep, event_handler, ID_E_STEP, "bmp_Step10_mm.bin", 0);
|
||||
lv_obj_set_event_cb_mks(buttonStep, event_handler, ID_E_STEP, "bmp_step10_mm.bin", 0);
|
||||
|
||||
if (gCfgItems.multiple_language != 0) {
|
||||
if (uiCfg.extruStep == 1) {
|
||||
@@ -375,4 +374,4 @@ void disp_ext_step() {
|
||||
|
||||
void lv_clear_extrusion() { lv_obj_del(scr); }
|
||||
|
||||
#endif // TFT_LVGL_UI
|
||||
#endif // HAS_TFT_LVGL_UI
|
||||
|
||||
Reference in New Issue
Block a user