Slim down MKS UI code (#19843)

This commit is contained in:
Scott Lahteine 2020-10-22 20:22:17 -05:00
parent 994cda3b6b
commit 1b51000736
44 changed files with 1166 additions and 3162 deletions

View File

@ -53,7 +53,6 @@ static void event_handler(lv_obj_t * obj, lv_event_t event) {
} }
void lv_draw_about(void) { void lv_draw_about(void) {
lv_obj_t *buttonBack, *label_Back;
if (disp_state_stack._disp_state[disp_state_stack._disp_index] != ABOUT_UI) { if (disp_state_stack._disp_state[disp_state_stack._disp_index] != ABOUT_UI) {
disp_state_stack._disp_index++; disp_state_stack._disp_index++;
disp_state_stack._disp_state[disp_state_stack._disp_index] = ABOUT_UI; disp_state_stack._disp_state[disp_state_stack._disp_index] = ABOUT_UI;
@ -66,51 +65,31 @@ void lv_draw_about(void) {
lv_scr_load(scr); lv_scr_load(scr);
lv_obj_clean(scr); lv_obj_clean(scr);
lv_obj_t * title = lv_label_create(scr, NULL); (void)lv_label_create(scr, TITLE_XPOS, TITLE_YPOS, creat_title_text());
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());
lv_refr_now(lv_refr_get_disp_refreshing()); lv_refr_now(lv_refr_get_disp_refreshing());
// Create an Image button // Create an Image button
buttonBack = lv_imgbtn_create(scr, NULL); lv_obj_t *buttonBack = lv_imgbtn_create(scr, "F:/bmp_return.bin", BTN_X_PIXEL * 3 + INTERVAL_V * 4, BTN_Y_PIXEL + INTERVAL_H + titleHeight, event_handler, ID_A_RETURN);
#if HAS_ROTARY_ENCODER
#if 1 if (gCfgItems.encoder_enable) lv_group_add_obj(g, buttonBack);
lv_obj_set_event_cb_mks(buttonBack, event_handler, ID_A_RETURN, NULL, 0);
lv_imgbtn_set_src(buttonBack, LV_BTN_STATE_REL, "F:/bmp_return.bin");
lv_imgbtn_set_src(buttonBack, LV_BTN_STATE_PR, "F:/bmp_return.bin");
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);
#if HAS_ROTARY_ENCODER
if (gCfgItems.encoder_enable) lv_group_add_obj(g, buttonBack);
#endif
#endif #endif
lv_obj_set_pos(buttonBack, BTN_X_PIXEL * 3 + INTERVAL_V * 4, BTN_Y_PIXEL + INTERVAL_H + titleHeight);
lv_btn_set_layout(buttonBack, LV_LAYOUT_OFF);
// Create a label on the image button // Create a label on the image button
label_Back = lv_label_create(buttonBack, NULL); lv_obj_t *label_Back = lv_label_create_empty(buttonBack);
if (gCfgItems.multiple_language) { if (gCfgItems.multiple_language) {
lv_label_set_text(label_Back, common_menu.text_back); lv_label_set_text(label_Back, common_menu.text_back);
lv_obj_align(label_Back, buttonBack, LV_ALIGN_IN_BOTTOM_MID, 0, BUTTON_TEXT_Y_OFFSET); lv_obj_align(label_Back, buttonBack, LV_ALIGN_IN_BOTTOM_MID, 0, BUTTON_TEXT_Y_OFFSET);
} }
//fw_version = lv_label_create(scr, NULL); //fw_version = lv_label_create(scr, SHORT_BUILD_VERSION);
//lv_obj_set_style(fw_version, &tft_style_label_rel);
//lv_label_set_text(fw_version, SHORT_BUILD_VERSION);
//lv_obj_align(fw_version, NULL, LV_ALIGN_CENTER, 0, -60); //lv_obj_align(fw_version, NULL, LV_ALIGN_CENTER, 0, -60);
fw_type = lv_label_create(scr, NULL); fw_type = lv_label_create(scr, "Firmware: Marlin " SHORT_BUILD_VERSION);
lv_obj_set_style(fw_type, &tft_style_label_rel);
lv_label_set_text(fw_type, "Firmware: Marlin " SHORT_BUILD_VERSION);
lv_obj_align(fw_type, NULL, LV_ALIGN_CENTER, 0, -20); lv_obj_align(fw_type, NULL, LV_ALIGN_CENTER, 0, -20);
board = lv_label_create(scr, NULL); board = lv_label_create(scr, "Board: " BOARD_INFO_NAME);
lv_obj_set_style(board, &tft_style_label_rel);
lv_label_set_text(board, "Board: " BOARD_INFO_NAME);
lv_obj_align(board, NULL, LV_ALIGN_CENTER, 0, -60); lv_obj_align(board, NULL, LV_ALIGN_CENTER, 0, -60);
} }

View File

@ -161,14 +161,14 @@ static void event_handler(lv_obj_t * obj, lv_event_t event) {
void lv_draw_acceleration_settings(void) { void lv_draw_acceleration_settings(void) {
lv_obj_t *buttonBack = NULL, *label_Back = NULL, *buttonTurnPage = NULL, *labelTurnPage = NULL; lv_obj_t *buttonBack = NULL, *label_Back = NULL, *buttonTurnPage = NULL, *labelTurnPage = NULL;
lv_obj_t *labelPrintText = NULL, *buttonPrintValue = NULL, *labelPrintValue = NULL; lv_obj_t *buttonPrintValue = NULL, *labelPrintValue = NULL;
lv_obj_t *labelRetraText = NULL, *buttonRetraValue = NULL, *labelRetraValue = NULL; lv_obj_t *buttonRetraValue = NULL, *labelRetraValue = NULL;
lv_obj_t *labelTravelText = NULL, *buttonTravelValue = NULL, *labelTravelValue = NULL; lv_obj_t *buttonTravelValue = NULL, *labelTravelValue = NULL;
lv_obj_t *labelXText = NULL, *buttonXValue = NULL, *labelXValue = NULL; lv_obj_t *buttonXValue = NULL, *labelXValue = NULL;
lv_obj_t *labelYText = NULL, *buttonYValue = NULL, *labelYValue = NULL; lv_obj_t *buttonYValue = NULL, *labelYValue = NULL;
lv_obj_t *labelZText = NULL, *buttonZValue = NULL, *labelZValue = NULL; lv_obj_t *buttonZValue = NULL, *labelZValue = NULL;
lv_obj_t *labelE0Text = NULL, *buttonE0Value = NULL, *labelE0Value = NULL; lv_obj_t *buttonE0Value = NULL, *labelE0Value = NULL;
lv_obj_t *labelE1Text = NULL, *buttonE1Value = NULL, *labelE1Value = NULL; lv_obj_t *buttonE1Value = NULL, *labelE1Value = NULL;
lv_obj_t * line1 = NULL, * line2 = NULL, * line3 = NULL, * line4 = NULL; lv_obj_t * line1 = NULL, * line2 = NULL, * line3 = NULL, * line4 = NULL;
if (disp_state_stack._disp_state[disp_state_stack._disp_index] != ACCELERATION_UI) { if (disp_state_stack._disp_state[disp_state_stack._disp_index] != ACCELERATION_UI) {
disp_state_stack._disp_index++; disp_state_stack._disp_index++;
@ -182,83 +182,45 @@ void lv_draw_acceleration_settings(void) {
lv_scr_load(scr); lv_scr_load(scr);
lv_obj_clean(scr); lv_obj_clean(scr);
lv_obj_t * title = lv_label_create(scr, NULL); (void)lv_label_create(scr, TITLE_XPOS, TITLE_YPOS, machine_menu.AccelerationConfTitle);
lv_obj_set_style(title, &tft_style_label_rel);
lv_obj_set_pos(title, TITLE_XPOS, TITLE_YPOS);
lv_label_set_text(title, machine_menu.AccelerationConfTitle);
lv_refr_now(lv_refr_get_disp_refreshing()); lv_refr_now(lv_refr_get_disp_refreshing());
if (uiCfg.para_ui_page != 1) { if (uiCfg.para_ui_page != 1) {
labelPrintText = lv_label_create(scr, NULL); (void)lv_label_create(scr, PARA_UI_POS_X, PARA_UI_POS_Y + 10, machine_menu.PrintAcceleration);
lv_obj_set_style(labelPrintText, &tft_style_label_rel);
lv_obj_set_pos(labelPrintText, PARA_UI_POS_X, PARA_UI_POS_Y + 10);
lv_label_set_text(labelPrintText, machine_menu.PrintAcceleration);
buttonPrintValue = lv_btn_create(scr, NULL); buttonPrintValue = lv_btn_create(scr, PARA_UI_VALUE_POS_X, PARA_UI_POS_Y + PARA_UI_VALUE_V, PARA_UI_VALUE_BTN_X_SIZE, PARA_UI_VALUE_BTN_Y_SIZE, event_handler, ID_ACCE_PRINT);
lv_obj_set_pos(buttonPrintValue, PARA_UI_VALUE_POS_X, PARA_UI_POS_Y + PARA_UI_VALUE_V); labelPrintValue = lv_label_create_empty(buttonPrintValue);
lv_obj_set_size(buttonPrintValue, PARA_UI_VALUE_BTN_X_SIZE, PARA_UI_VALUE_BTN_Y_SIZE);
lv_obj_set_event_cb_mks(buttonPrintValue, event_handler, ID_ACCE_PRINT, NULL, 0);
lv_btn_set_style(buttonPrintValue, LV_BTN_STYLE_REL, &style_para_value);
lv_btn_set_style(buttonPrintValue, LV_BTN_STYLE_PR, &style_para_value);
labelPrintValue = lv_label_create(buttonPrintValue, NULL);
line1 = lv_line_create(scr, NULL); line1 = lv_line_create(scr, NULL);
lv_ex_line(line1, line_points[0]); lv_ex_line(line1, line_points[0]);
labelRetraText = lv_label_create(scr, NULL); (void)lv_label_create(scr, PARA_UI_POS_X, PARA_UI_POS_Y * 2 + 10, machine_menu.RetractAcceleration);
lv_obj_set_style(labelRetraText, &tft_style_label_rel);
lv_obj_set_pos(labelRetraText, PARA_UI_POS_X, PARA_UI_POS_Y * 2 + 10);
lv_label_set_text(labelRetraText, machine_menu.RetractAcceleration);
buttonRetraValue = lv_btn_create(scr, NULL); buttonRetraValue = lv_btn_create(scr, PARA_UI_VALUE_POS_X, PARA_UI_POS_Y * 2 + PARA_UI_VALUE_V, PARA_UI_VALUE_BTN_X_SIZE, PARA_UI_VALUE_BTN_Y_SIZE, event_handler, ID_ACCE_RETRA);
lv_obj_set_pos(buttonRetraValue, PARA_UI_VALUE_POS_X, PARA_UI_POS_Y * 2 + PARA_UI_VALUE_V); labelRetraValue = lv_label_create_empty(buttonRetraValue);
lv_obj_set_size(buttonRetraValue, PARA_UI_VALUE_BTN_X_SIZE, PARA_UI_VALUE_BTN_Y_SIZE);
lv_obj_set_event_cb_mks(buttonRetraValue, event_handler, ID_ACCE_RETRA, NULL, 0);
lv_btn_set_style(buttonRetraValue, LV_BTN_STYLE_REL, &style_para_value);
lv_btn_set_style(buttonRetraValue, LV_BTN_STYLE_PR, &style_para_value);
labelRetraValue = lv_label_create(buttonRetraValue, NULL);
line2 = lv_line_create(scr, NULL); line2 = lv_line_create(scr, NULL);
lv_ex_line(line2, line_points[1]); lv_ex_line(line2, line_points[1]);
labelTravelText = lv_label_create(scr, NULL); (void)lv_label_create(scr, PARA_UI_POS_X, PARA_UI_POS_Y * 3 + 10, machine_menu.TravelAcceleration);
lv_obj_set_style(labelTravelText, &tft_style_label_rel);
lv_obj_set_pos(labelTravelText, PARA_UI_POS_X, PARA_UI_POS_Y * 3 + 10);
lv_label_set_text(labelTravelText, machine_menu.TravelAcceleration);
buttonTravelValue = lv_btn_create(scr, NULL); buttonTravelValue = lv_btn_create(scr, PARA_UI_VALUE_POS_X, PARA_UI_POS_Y * 3 + PARA_UI_VALUE_V, PARA_UI_VALUE_BTN_X_SIZE, PARA_UI_VALUE_BTN_Y_SIZE, event_handler, ID_ACCE_TRAVEL);
lv_obj_set_pos(buttonTravelValue, PARA_UI_VALUE_POS_X, PARA_UI_POS_Y * 3 + PARA_UI_VALUE_V); labelTravelValue = lv_label_create_empty(buttonTravelValue);
lv_obj_set_size(buttonTravelValue, PARA_UI_VALUE_BTN_X_SIZE, PARA_UI_VALUE_BTN_Y_SIZE);
lv_obj_set_event_cb_mks(buttonTravelValue, event_handler, ID_ACCE_TRAVEL, NULL, 0);
lv_btn_set_style(buttonTravelValue, LV_BTN_STYLE_REL, &style_para_value);
lv_btn_set_style(buttonTravelValue, LV_BTN_STYLE_PR, &style_para_value);
labelTravelValue = lv_label_create(buttonTravelValue, NULL);
line3 = lv_line_create(scr, NULL); line3 = lv_line_create(scr, NULL);
lv_ex_line(line3, line_points[2]); lv_ex_line(line3, line_points[2]);
labelXText = lv_label_create(scr, NULL); (void)lv_label_create(scr, PARA_UI_POS_X, PARA_UI_POS_Y * 4 + 10, machine_menu.X_Acceleration);
lv_obj_set_style(labelXText, &tft_style_label_rel);
lv_obj_set_pos(labelXText, PARA_UI_POS_X, PARA_UI_POS_Y * 4 + 10);
lv_label_set_text(labelXText, machine_menu.X_Acceleration);
buttonXValue = lv_btn_create(scr, NULL); buttonXValue = lv_btn_create(scr, PARA_UI_VALUE_POS_X, PARA_UI_POS_Y * 4 + PARA_UI_VALUE_V, PARA_UI_VALUE_BTN_X_SIZE, PARA_UI_VALUE_BTN_Y_SIZE, event_handler, ID_ACCE_X);
lv_obj_set_pos(buttonXValue, PARA_UI_VALUE_POS_X, PARA_UI_POS_Y * 4 + PARA_UI_VALUE_V); labelXValue = lv_label_create_empty(buttonXValue);
lv_obj_set_size(buttonXValue, PARA_UI_VALUE_BTN_X_SIZE, PARA_UI_VALUE_BTN_Y_SIZE);
lv_obj_set_event_cb_mks(buttonXValue, event_handler, ID_ACCE_X, NULL, 0);
lv_btn_set_style(buttonXValue, LV_BTN_STYLE_REL, &style_para_value);
lv_btn_set_style(buttonXValue, LV_BTN_STYLE_PR, &style_para_value);
labelXValue = lv_label_create(buttonXValue, NULL);
line4 = lv_line_create(scr, NULL); line4 = lv_line_create(scr, NULL);
lv_ex_line(line4, line_points[3]); lv_ex_line(line4, line_points[3]);
buttonTurnPage = lv_btn_create(scr, NULL); buttonTurnPage = lv_btn_create_back(scr, event_handler, ID_ACCE_DOWN);
lv_obj_set_event_cb_mks(buttonTurnPage, event_handler, ID_ACCE_DOWN, NULL, 0);
lv_btn_set_style(buttonTurnPage, LV_BTN_STYLE_REL, &style_para_back);
lv_btn_set_style(buttonTurnPage, LV_BTN_STYLE_PR, &style_para_back);
#if HAS_ROTARY_ENCODER #if HAS_ROTARY_ENCODER
if (gCfgItems.encoder_enable) { if (gCfgItems.encoder_enable) {
@ -271,81 +233,43 @@ void lv_draw_acceleration_settings(void) {
#endif #endif
} }
else { else {
labelYText = lv_label_create(scr, NULL); (void)lv_label_create(scr, PARA_UI_POS_X, PARA_UI_POS_Y + 10, machine_menu.Y_Acceleration);
lv_obj_set_style(labelYText, &tft_style_label_rel);
lv_obj_set_pos(labelYText, PARA_UI_POS_X, PARA_UI_POS_Y + 10);
lv_label_set_text(labelYText, machine_menu.Y_Acceleration);
buttonYValue = lv_btn_create(scr, NULL); buttonYValue = lv_btn_create(scr, PARA_UI_VALUE_POS_X, PARA_UI_POS_Y + PARA_UI_VALUE_V, PARA_UI_VALUE_BTN_X_SIZE, PARA_UI_VALUE_BTN_Y_SIZE, event_handler, ID_ACCE_Y);
lv_obj_set_pos(buttonYValue, PARA_UI_VALUE_POS_X, PARA_UI_POS_Y + PARA_UI_VALUE_V); labelYValue = lv_label_create_empty(buttonYValue);
lv_obj_set_size(buttonYValue, PARA_UI_VALUE_BTN_X_SIZE, PARA_UI_VALUE_BTN_Y_SIZE);
lv_obj_set_event_cb_mks(buttonYValue, event_handler, ID_ACCE_Y, NULL, 0);
lv_btn_set_style(buttonYValue, LV_BTN_STYLE_REL, &style_para_value);
lv_btn_set_style(buttonYValue, LV_BTN_STYLE_PR, &style_para_value);
labelYValue = lv_label_create(buttonYValue, NULL);
line1 = lv_line_create(scr, NULL); line1 = lv_line_create(scr, NULL);
lv_ex_line(line1, line_points[0]); lv_ex_line(line1, line_points[0]);
labelZText = lv_label_create(scr, NULL); (void)lv_label_create(scr, PARA_UI_POS_X, PARA_UI_POS_Y * 2 + 10, machine_menu.Z_Acceleration);
lv_obj_set_style(labelZText, &tft_style_label_rel);
lv_obj_set_pos(labelZText, PARA_UI_POS_X, PARA_UI_POS_Y * 2 + 10);
lv_label_set_text(labelZText, machine_menu.Z_Acceleration);
buttonZValue = lv_btn_create(scr, NULL); buttonZValue = lv_btn_create(scr, PARA_UI_VALUE_POS_X, PARA_UI_POS_Y * 2 + PARA_UI_VALUE_V, PARA_UI_VALUE_BTN_X_SIZE, PARA_UI_VALUE_BTN_Y_SIZE, event_handler, ID_ACCE_Z);
lv_obj_set_pos(buttonZValue, PARA_UI_VALUE_POS_X, PARA_UI_POS_Y * 2 + PARA_UI_VALUE_V); labelZValue = lv_label_create_empty(buttonZValue);
lv_obj_set_size(buttonZValue, PARA_UI_VALUE_BTN_X_SIZE, PARA_UI_VALUE_BTN_Y_SIZE); lv_obj_set_event_cb_mks(buttonYValue, event_handler, ID_ACCE_Y, NULL, 0);
lv_obj_set_event_cb_mks(buttonZValue, event_handler, ID_ACCE_Z, NULL, 0);
lv_btn_set_style(buttonZValue, LV_BTN_STYLE_REL, &style_para_value);
lv_btn_set_style(buttonZValue, LV_BTN_STYLE_PR, &style_para_value);
labelZValue = lv_label_create(buttonZValue, NULL);
line2 = lv_line_create(scr, NULL); line2 = lv_line_create(scr, NULL);
lv_ex_line(line2, line_points[1]); lv_ex_line(line2, line_points[1]);
labelE0Text = lv_label_create(scr, NULL); (void)lv_label_create(scr, PARA_UI_POS_X, PARA_UI_POS_Y * 3 + 10, machine_menu.E0_Acceleration);
lv_obj_set_style(labelE0Text, &tft_style_label_rel);
lv_obj_set_pos(labelE0Text, PARA_UI_POS_X, PARA_UI_POS_Y * 3 + 10);
lv_label_set_text(labelE0Text, machine_menu.E0_Acceleration);
buttonE0Value = lv_btn_create(scr, NULL); buttonE0Value = lv_btn_create(scr, PARA_UI_VALUE_POS_X, PARA_UI_POS_Y * 3 + PARA_UI_VALUE_V, PARA_UI_VALUE_BTN_X_SIZE, PARA_UI_VALUE_BTN_Y_SIZE, event_handler, ID_ACCE_E0);
lv_obj_set_pos(buttonE0Value, PARA_UI_VALUE_POS_X, PARA_UI_POS_Y * 3 + PARA_UI_VALUE_V); labelE0Value = lv_label_create_empty(buttonE0Value);
lv_obj_set_size(buttonE0Value, PARA_UI_VALUE_BTN_X_SIZE, PARA_UI_VALUE_BTN_Y_SIZE); lv_obj_set_event_cb_mks(buttonYValue, event_handler, ID_ACCE_Y, NULL, 0);
lv_obj_set_event_cb_mks(buttonE0Value, event_handler, ID_ACCE_E0, NULL, 0);
lv_btn_set_style(buttonE0Value, LV_BTN_STYLE_REL, &style_para_value);
lv_btn_set_style(buttonE0Value, LV_BTN_STYLE_PR, &style_para_value);
labelE0Value = lv_label_create(buttonE0Value, NULL);
line3 = lv_line_create(scr, NULL); line3 = lv_line_create(scr, NULL);
lv_ex_line(line3, line_points[2]); lv_ex_line(line3, line_points[2]);
labelE1Text = lv_label_create(scr, NULL); (void)lv_label_create(scr, PARA_UI_POS_X, PARA_UI_POS_Y * 4 + 10, machine_menu.E1_Acceleration);
lv_obj_set_style(labelE1Text, &tft_style_label_rel);
lv_obj_set_pos(labelE1Text, PARA_UI_POS_X, PARA_UI_POS_Y * 4 + 10);
lv_label_set_text(labelE1Text, machine_menu.E1_Acceleration);
buttonE1Value = lv_btn_create(scr, NULL);
lv_obj_set_pos(buttonE1Value, PARA_UI_VALUE_POS_X, PARA_UI_POS_Y * 4 + PARA_UI_VALUE_V);
lv_obj_set_size(buttonE1Value, PARA_UI_VALUE_BTN_X_SIZE, PARA_UI_VALUE_BTN_Y_SIZE); lv_obj_set_event_cb_mks(buttonYValue, event_handler, ID_ACCE_Y, NULL, 0);
lv_obj_set_event_cb_mks(buttonE1Value, event_handler, ID_ACCE_E1, NULL, 0);
lv_btn_set_style(buttonE1Value, LV_BTN_STYLE_REL, &style_para_value);
lv_btn_set_style(buttonE1Value, LV_BTN_STYLE_PR, &style_para_value);
labelE1Value = lv_label_create(buttonE1Value, NULL);
buttonE1Value = lv_btn_create(scr, PARA_UI_VALUE_POS_X, PARA_UI_POS_Y * 4 + PARA_UI_VALUE_V, PARA_UI_VALUE_BTN_X_SIZE, PARA_UI_VALUE_BTN_Y_SIZE, event_handler, ID_ACCE_E1);
labelE1Value = lv_label_create_empty(buttonE1Value);
line4 = lv_line_create(scr, NULL); line4 = lv_line_create(scr, NULL);
lv_ex_line(line4, line_points[3]); lv_ex_line(line4, line_points[3]);
buttonTurnPage = lv_btn_create(scr, NULL); buttonTurnPage = lv_btn_create_back(scr, event_handler, ID_ACCE_UP);
lv_obj_set_event_cb_mks(buttonTurnPage, event_handler, ID_ACCE_UP, NULL, 0); //lv_imgbtn_set_src_both(buttonTurnPage, "F:/bmp_back70x40.bin");
//lv_imgbtn_set_src(buttonTurnPage, LV_BTN_STATE_REL, "F:/bmp_back70x40.bin"); //lv_imgbtn_use_label_style(buttonTurnPage);
//lv_imgbtn_set_src(buttonTurnPage, LV_BTN_STATE_PR, "F:/bmp_back70x40.bin");
//lv_imgbtn_set_style(buttonTurnPage, LV_BTN_STATE_PR, &tft_style_label_pre);
//lv_imgbtn_set_style(buttonTurnPage, LV_BTN_STATE_REL, &tft_style_label_rel);
lv_btn_set_style(buttonTurnPage, LV_BTN_STYLE_REL, &style_para_back);
lv_btn_set_style(buttonTurnPage, LV_BTN_STYLE_PR, &style_para_back);
#if HAS_ROTARY_ENCODER #if HAS_ROTARY_ENCODER
if (gCfgItems.encoder_enable) { if (gCfgItems.encoder_enable) {
@ -360,22 +284,15 @@ void lv_draw_acceleration_settings(void) {
//lv_obj_set_pos(buttonTurnPage, PARA_UI_TURN_PAGE_POS_X, PARA_UI_TURN_PAGE_POS_Y); //lv_obj_set_pos(buttonTurnPage, PARA_UI_TURN_PAGE_POS_X, PARA_UI_TURN_PAGE_POS_Y);
//lv_btn_set_layout(buttonTurnPage, LV_LAYOUT_OFF); //lv_btn_set_layout(buttonTurnPage, LV_LAYOUT_OFF);
//labelTurnPage = lv_label_create(buttonTurnPage, NULL); //labelTurnPage = lv_label_create_empty(buttonTurnPage);
lv_obj_set_pos(buttonTurnPage, PARA_UI_TURN_PAGE_POS_X, PARA_UI_TURN_PAGE_POS_Y); lv_obj_set_pos(buttonTurnPage, PARA_UI_TURN_PAGE_POS_X, PARA_UI_TURN_PAGE_POS_Y);
lv_obj_set_size(buttonTurnPage, PARA_UI_BACK_BTN_X_SIZE, PARA_UI_BACK_BTN_Y_SIZE); lv_obj_set_size(buttonTurnPage, PARA_UI_BACK_BTN_X_SIZE, PARA_UI_BACK_BTN_Y_SIZE);
labelTurnPage = lv_label_create(buttonTurnPage, NULL); labelTurnPage = lv_label_create_empty(buttonTurnPage);
buttonBack = lv_btn_create(scr, NULL); buttonBack = lv_btn_create_back(scr, PARA_UI_BACL_POS_X, PARA_UI_BACL_POS_Y, PARA_UI_BACK_BTN_X_SIZE, PARA_UI_BACK_BTN_Y_SIZE, event_handler, ID_ACCE_RETURN);
lv_obj_set_event_cb_mks(buttonBack, event_handler, ID_ACCE_RETURN, NULL, 0); //lv_imgbtn_set_src_both(buttonBack, "F:/bmp_back70x40.bin");
//lv_imgbtn_set_src(buttonBack, LV_BTN_STATE_REL, "F:/bmp_back70x40.bin"); //lv_imgbtn_use_label_style(buttonBack);
//lv_imgbtn_set_src(buttonBack, LV_BTN_STATE_PR, "F:/bmp_back70x40.bin"); label_Back = lv_label_create_empty(buttonBack);
//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);
lv_btn_set_style(buttonBack, LV_BTN_STYLE_REL, &style_para_back);
lv_btn_set_style(buttonBack, LV_BTN_STYLE_PR, &style_para_back);
lv_obj_set_pos(buttonBack, PARA_UI_BACL_POS_X, PARA_UI_BACL_POS_Y);
lv_obj_set_size(buttonBack, PARA_UI_BACK_BTN_X_SIZE, PARA_UI_BACK_BTN_Y_SIZE);
label_Back = lv_label_create(buttonBack, NULL);
#if HAS_ROTARY_ENCODER #if HAS_ROTARY_ENCODER
if (gCfgItems.encoder_enable) lv_group_add_obj(g, buttonBack); if (gCfgItems.encoder_enable) lv_group_add_obj(g, buttonBack);
#endif #endif

View File

@ -133,14 +133,14 @@ static void event_handler(lv_obj_t * obj, lv_event_t event) {
void lv_draw_advance_settings(void) { void lv_draw_advance_settings(void) {
lv_obj_t *buttonBack, *label_Back; lv_obj_t *buttonBack, *label_Back;
lv_obj_t *buttonPausePos, *labelPausePos, *buttonPausePosNarrow; lv_obj_t *buttonPausePos, *labelPausePos;
lv_obj_t *buttonFilamentSettings, *labelFilamentSettings, *buttonFilamentSettingsNarrow; lv_obj_t *buttonFilamentSettings, *labelFilamentSettings;
lv_obj_t * line1,* line2; lv_obj_t * line1,* line2;
#if ENABLED(USE_WIFI_FUNCTION) #if ENABLED(USE_WIFI_FUNCTION)
lv_obj_t *buttonWifiSet,*labelWifiSet,*buttonWifiSetNarrow; lv_obj_t *buttonWifiSet, *labelWifiSet, *buttonWifiSetNarrow;
#endif #endif
#if HAS_ROTARY_ENCODER #if HAS_ROTARY_ENCODER
lv_obj_t *buttonEcoder,*labelEcoder,*buttonEcoderNarrow; lv_obj_t *buttonEncoder, *labelEncoder, *buttonEncoderNarrow;
#endif #endif
if (disp_state_stack._disp_state[disp_state_stack._disp_index] != ADVANCED_UI) { if (disp_state_stack._disp_state[disp_state_stack._disp_index] != ADVANCED_UI) {
@ -155,10 +155,7 @@ void lv_draw_advance_settings(void) {
lv_scr_load(scr); lv_scr_load(scr);
lv_obj_clean(scr); lv_obj_clean(scr);
lv_obj_t * title = lv_label_create(scr, NULL); (void)lv_label_create(scr, TITLE_XPOS, TITLE_YPOS, machine_menu.AdvancedConfTitle);
lv_obj_set_style(title, &tft_style_label_rel);
lv_obj_set_pos(title, TITLE_XPOS, TITLE_YPOS);
lv_label_set_text(title, machine_menu.AdvancedConfTitle);
lv_refr_now(lv_refr_get_disp_refreshing()); lv_refr_now(lv_refr_get_disp_refreshing());
@ -167,22 +164,14 @@ void lv_draw_advance_settings(void) {
lv_obj_set_size(buttonPausePos, PARA_UI_SIZE_X, PARA_UI_SIZE_Y); lv_obj_set_size(buttonPausePos, PARA_UI_SIZE_X, PARA_UI_SIZE_Y);
//lv_obj_set_event_cb(buttonMachine, event_handler); //lv_obj_set_event_cb(buttonMachine, event_handler);
lv_obj_set_event_cb_mks(buttonPausePos, event_handler, ID_PAUSE_POS, NULL, 0); lv_obj_set_event_cb_mks(buttonPausePos, event_handler, ID_PAUSE_POS, NULL, 0);
lv_btn_set_style(buttonPausePos, LV_BTN_STYLE_REL, &tft_style_label_rel); lv_btn_use_label_style(buttonPausePos);
lv_btn_set_style(buttonPausePos, LV_BTN_STYLE_PR, &tft_style_label_pre);
lv_btn_set_layout(buttonPausePos, LV_LAYOUT_OFF); lv_btn_set_layout(buttonPausePos, LV_LAYOUT_OFF);
labelPausePos = lv_label_create(buttonPausePos, NULL); labelPausePos = lv_label_create_empty(buttonPausePos);
#if HAS_ROTARY_ENCODER #if HAS_ROTARY_ENCODER
if (gCfgItems.encoder_enable) lv_group_add_obj(g, buttonPausePos); if (gCfgItems.encoder_enable) lv_group_add_obj(g, buttonPausePos);
#endif #endif
buttonPausePosNarrow = lv_imgbtn_create(scr, NULL); (void)lv_imgbtn_create(scr, "F:/bmp_arrow.bin", PARA_UI_POS_X + PARA_UI_SIZE_X, PARA_UI_POS_Y + PARA_UI_ARROW_V, event_handler, ID_PAUSE_POS_ARROW);
lv_obj_set_pos(buttonPausePosNarrow, PARA_UI_POS_X + PARA_UI_SIZE_X, PARA_UI_POS_Y + PARA_UI_ARROW_V);
lv_obj_set_event_cb_mks(buttonPausePosNarrow, event_handler, ID_PAUSE_POS_ARROW, NULL, 0);
lv_imgbtn_set_src(buttonPausePosNarrow, LV_BTN_STATE_REL, "F:/bmp_arrow.bin");
lv_imgbtn_set_src(buttonPausePosNarrow, LV_BTN_STATE_PR, "F:/bmp_arrow.bin");
lv_imgbtn_set_style(buttonPausePosNarrow, LV_BTN_STATE_PR, &tft_style_label_pre);
lv_imgbtn_set_style(buttonPausePosNarrow, LV_BTN_STATE_REL, &tft_style_label_rel);
lv_btn_set_layout(buttonPausePosNarrow, LV_LAYOUT_OFF);
line1 = lv_line_create(lv_scr_act(), NULL); line1 = lv_line_create(lv_scr_act(), NULL);
lv_ex_line(line1, line_points[0]); lv_ex_line(line1, line_points[0]);
@ -191,22 +180,14 @@ void lv_draw_advance_settings(void) {
lv_obj_set_pos(buttonFilamentSettings, PARA_UI_POS_X, PARA_UI_POS_Y*2); lv_obj_set_pos(buttonFilamentSettings, PARA_UI_POS_X, PARA_UI_POS_Y*2);
lv_obj_set_size(buttonFilamentSettings, PARA_UI_SIZE_X, PARA_UI_SIZE_Y); lv_obj_set_size(buttonFilamentSettings, PARA_UI_SIZE_X, PARA_UI_SIZE_Y);
lv_obj_set_event_cb_mks(buttonFilamentSettings, event_handler, ID_FILAMENT_SETTINGS, NULL, 0); lv_obj_set_event_cb_mks(buttonFilamentSettings, event_handler, ID_FILAMENT_SETTINGS, NULL, 0);
lv_btn_set_style(buttonFilamentSettings, LV_BTN_STYLE_REL, &tft_style_label_rel); lv_btn_use_label_style(buttonFilamentSettings);
lv_btn_set_style(buttonFilamentSettings, LV_BTN_STYLE_PR, &tft_style_label_pre);
lv_btn_set_layout(buttonFilamentSettings, LV_LAYOUT_OFF); lv_btn_set_layout(buttonFilamentSettings, LV_LAYOUT_OFF);
labelFilamentSettings = lv_label_create(buttonFilamentSettings, NULL); labelFilamentSettings = lv_label_create_empty(buttonFilamentSettings);
#if HAS_ROTARY_ENCODER #if HAS_ROTARY_ENCODER
if (gCfgItems.encoder_enable) lv_group_add_obj(g, buttonFilamentSettings); if (gCfgItems.encoder_enable) lv_group_add_obj(g, buttonFilamentSettings);
#endif #endif
buttonFilamentSettingsNarrow = lv_imgbtn_create(scr, NULL); (void)lv_imgbtn_create(scr, "F:/bmp_arrow.bin", PARA_UI_POS_X + PARA_UI_SIZE_X, PARA_UI_POS_Y*2 + PARA_UI_ARROW_V, event_handler, ID_FILAMENT_SETTINGS_ARROW);
lv_obj_set_pos(buttonFilamentSettingsNarrow, PARA_UI_POS_X + PARA_UI_SIZE_X, PARA_UI_POS_Y*2 + PARA_UI_ARROW_V);
lv_obj_set_event_cb_mks(buttonFilamentSettingsNarrow, event_handler, ID_FILAMENT_SETTINGS_ARROW, NULL, 0);
lv_imgbtn_set_src(buttonFilamentSettingsNarrow, LV_BTN_STATE_REL, "F:/bmp_arrow.bin");
lv_imgbtn_set_src(buttonFilamentSettingsNarrow, LV_BTN_STATE_PR, "F:/bmp_arrow.bin");
lv_imgbtn_set_style(buttonFilamentSettingsNarrow, LV_BTN_STATE_PR, &tft_style_label_pre);
lv_imgbtn_set_style(buttonFilamentSettingsNarrow, LV_BTN_STATE_REL, &tft_style_label_rel);
lv_btn_set_layout(buttonFilamentSettingsNarrow, LV_LAYOUT_OFF);
line2 = lv_line_create(lv_scr_act(), NULL); line2 = lv_line_create(lv_scr_act(), NULL);
lv_ex_line(line2, line_points[1]); lv_ex_line(line2, line_points[1]);
@ -216,91 +197,58 @@ void lv_draw_advance_settings(void) {
buttonWifiSet = lv_btn_create(scr, NULL); /*Add a button the current screen*/ buttonWifiSet = lv_btn_create(scr, NULL); /*Add a button the current screen*/
lv_obj_set_pos(buttonWifiSet, PARA_UI_POS_X,PARA_UI_POS_Y*3); lv_obj_set_pos(buttonWifiSet, PARA_UI_POS_X,PARA_UI_POS_Y*3);
lv_obj_set_size(buttonWifiSet, PARA_UI_SIZE_X,PARA_UI_SIZE_Y); lv_obj_set_size(buttonWifiSet, PARA_UI_SIZE_X,PARA_UI_SIZE_Y);
lv_obj_set_event_cb_mks(buttonWifiSet, event_handler,ID_WIFI_PARA,NULL,0); lv_obj_set_event_cb_mks(buttonWifiSet, event_handler,ID_WIFI_PARA,NULL, 0);
lv_btn_set_style(buttonWifiSet, LV_BTN_STYLE_REL, &tft_style_label_rel); lv_btn_use_label_style(buttonWifiSet);
lv_btn_set_style(buttonWifiSet, LV_BTN_STYLE_PR, &tft_style_label_pre);
lv_btn_set_layout(buttonWifiSet, LV_LAYOUT_OFF); lv_btn_set_layout(buttonWifiSet, LV_LAYOUT_OFF);
labelWifiSet = lv_label_create(buttonWifiSet, NULL); labelWifiSet = lv_label_create_empty(buttonWifiSet);
#if HAS_ROTARY_ENCODER #if HAS_ROTARY_ENCODER
if (gCfgItems.encoder_enable) lv_group_add_obj(g, buttonWifiSet); if (gCfgItems.encoder_enable) lv_group_add_obj(g, buttonWifiSet);
#endif #endif
buttonWifiSetNarrow = lv_imgbtn_create(scr, NULL); buttonWifiSetNarrow = lv_imgbtn_create(scr, "F:/bmp_arrow.bin", PARA_UI_POS_X + PARA_UI_SIZE_X, PARA_UI_POS_Y * 3 + PARA_UI_ARROW_V, event_handler, ID_WIFI_PARA_ARROW);
lv_obj_set_pos(buttonWifiSetNarrow,PARA_UI_POS_X+PARA_UI_SIZE_X,PARA_UI_POS_Y*3+PARA_UI_ARROW_V);
lv_obj_set_event_cb_mks(buttonWifiSetNarrow, event_handler,ID_WIFI_PARA_ARROW, NULL,0);
lv_imgbtn_set_src(buttonWifiSetNarrow, LV_BTN_STATE_REL, "F:/bmp_arrow.bin");
lv_imgbtn_set_src(buttonWifiSetNarrow, LV_BTN_STATE_PR, "F:/bmp_arrow.bin");
lv_imgbtn_set_style(buttonWifiSetNarrow, LV_BTN_STATE_PR, &tft_style_label_pre);
lv_imgbtn_set_style(buttonWifiSetNarrow, LV_BTN_STATE_REL, &tft_style_label_rel);
lv_btn_set_layout(buttonWifiSetNarrow, LV_LAYOUT_OFF);
lv_obj_t * line3 = lv_line_create(scr, NULL); lv_obj_t * line3 = lv_line_create(scr, NULL);
lv_ex_line(line3,line_points[2]); lv_ex_line(line3,line_points[2]);
#if HAS_ROTARY_ENCODER #if HAS_ROTARY_ENCODER
buttonEcoder = lv_btn_create(scr, NULL); /*Add a button the current screen*/ buttonEncoder = lv_btn_create(scr, NULL); /*Add a button the current screen*/
lv_obj_set_pos(buttonEcoder, PARA_UI_POS_X,PARA_UI_POS_Y*4); lv_obj_set_pos(buttonEncoder, PARA_UI_POS_X,PARA_UI_POS_Y*4);
lv_obj_set_size(buttonEcoder, PARA_UI_SIZE_X,PARA_UI_SIZE_Y); lv_obj_set_size(buttonEncoder, PARA_UI_SIZE_X,PARA_UI_SIZE_Y);
lv_obj_set_event_cb_mks(buttonEcoder, event_handler,ID_ENCODER_SETTINGS,NULL,0); lv_obj_set_event_cb_mks(buttonEncoder, event_handler,ID_ENCODER_SETTINGS,NULL, 0);
lv_btn_set_style(buttonEcoder, LV_BTN_STYLE_REL, &tft_style_label_rel); lv_btn_use_label_style(buttonEncoder);
lv_btn_set_style(buttonEcoder, LV_BTN_STYLE_PR, &tft_style_label_pre); lv_btn_set_layout(buttonEncoder, LV_LAYOUT_OFF);
lv_btn_set_layout(buttonEcoder, LV_LAYOUT_OFF); labelEncoder = lv_label_create_empty(buttonEncoder);
labelEcoder = lv_label_create(buttonEcoder, NULL);
if (gCfgItems.encoder_enable) lv_group_add_obj(g, buttonEcoder); if (gCfgItems.encoder_enable) lv_group_add_obj(g, buttonEncoder);
buttonEcoderNarrow = lv_imgbtn_create(scr, NULL); buttonEncoderNarrow = lv_imgbtn_create(scr, "F:/bmp_arrow.bin", PARA_UI_POS_X + PARA_UI_SIZE_X, PARA_UI_POS_Y * 4 + PARA_UI_ARROW_V, event_handler, ID_ENCODER_SETTINGS_ARROW);
lv_obj_set_pos(buttonEcoderNarrow,PARA_UI_POS_X+PARA_UI_SIZE_X,PARA_UI_POS_Y*4+PARA_UI_ARROW_V);
lv_obj_set_event_cb_mks(buttonEcoderNarrow, event_handler,ID_ENCODER_SETTINGS_ARROW, NULL,0);
lv_imgbtn_set_src(buttonEcoderNarrow, LV_BTN_STATE_REL, "F:/bmp_arrow.bin");
lv_imgbtn_set_src(buttonEcoderNarrow, LV_BTN_STATE_PR, "F:/bmp_arrow.bin");
lv_imgbtn_set_style(buttonEcoderNarrow, LV_BTN_STATE_PR, &tft_style_label_pre);
lv_imgbtn_set_style(buttonEcoderNarrow, LV_BTN_STATE_REL, &tft_style_label_rel);
lv_btn_set_layout(buttonEcoderNarrow, LV_LAYOUT_OFF);
lv_obj_t * line4 = lv_line_create(scr, NULL); lv_obj_t * line4 = lv_line_create(scr, NULL);
lv_ex_line(line4,line_points[3]); lv_ex_line(line4,line_points[3]);
#endif #endif
#elif HAS_ROTARY_ENCODER #elif HAS_ROTARY_ENCODER
buttonEcoder = lv_btn_create(scr, NULL); /*Add a button the current screen*/ buttonEncoder = lv_btn_create(scr, NULL); /*Add a button the current screen*/
lv_obj_set_pos(buttonEcoder, PARA_UI_POS_X,PARA_UI_POS_Y*3); lv_obj_set_pos(buttonEncoder, PARA_UI_POS_X,PARA_UI_POS_Y*3);
lv_obj_set_size(buttonEcoder, PARA_UI_SIZE_X,PARA_UI_SIZE_Y); lv_obj_set_size(buttonEncoder, PARA_UI_SIZE_X,PARA_UI_SIZE_Y);
lv_obj_set_event_cb_mks(buttonEcoder, event_handler,ID_ENCODER_SETTINGS,NULL,0); lv_obj_set_event_cb_mks(buttonEncoder, event_handler,ID_ENCODER_SETTINGS,NULL, 0);
lv_btn_set_style(buttonEcoder, LV_BTN_STYLE_REL, &tft_style_label_rel); lv_btn_use_label_style(buttonEncoder);
lv_btn_set_style(buttonEcoder, LV_BTN_STYLE_PR, &tft_style_label_pre); lv_btn_set_layout(buttonEncoder, LV_LAYOUT_OFF);
lv_btn_set_layout(buttonEcoder, LV_LAYOUT_OFF); labelEncoder = lv_label_create_empty(buttonEncoder);
labelEcoder = lv_label_create(buttonEcoder, NULL);
if (gCfgItems.encoder_enable) lv_group_add_obj(g, buttonEcoder); if (gCfgItems.encoder_enable) lv_group_add_obj(g, buttonEncoder);
buttonEcoderNarrow = lv_imgbtn_create(scr, NULL); buttonEncoderNarrow = lv_imgbtn_create(scr, "F:/bmp_arrow.bin", PARA_UI_POS_X + PARA_UI_SIZE_X, PARA_UI_POS_Y * 3 + PARA_UI_ARROW_V, event_handler, ID_ENCODER_SETTINGS_ARROW);
lv_obj_set_pos(buttonEcoderNarrow,PARA_UI_POS_X+PARA_UI_SIZE_X,PARA_UI_POS_Y*3+PARA_UI_ARROW_V);
lv_obj_set_event_cb_mks(buttonEcoderNarrow, event_handler,ID_ENCODER_SETTINGS_ARROW, NULL,0);
lv_imgbtn_set_src(buttonEcoderNarrow, LV_BTN_STATE_REL, "F:/bmp_arrow.bin");
lv_imgbtn_set_src(buttonEcoderNarrow, LV_BTN_STATE_PR, "F:/bmp_arrow.bin");
lv_imgbtn_set_style(buttonEcoderNarrow, LV_BTN_STATE_PR, &tft_style_label_pre);
lv_imgbtn_set_style(buttonEcoderNarrow, LV_BTN_STATE_REL, &tft_style_label_rel);
lv_btn_set_layout(buttonEcoderNarrow, LV_LAYOUT_OFF);
lv_obj_t * line3 = lv_line_create(scr, NULL); lv_obj_t * line3 = lv_line_create(scr, NULL);
lv_ex_line(line3,line_points[2]); lv_ex_line(line3,line_points[2]);
#endif #endif
buttonBack = lv_imgbtn_create(scr, NULL); buttonBack = lv_imgbtn_create(scr, "F:/bmp_back70x40.bin", PARA_UI_BACL_POS_X, PARA_UI_BACL_POS_Y, event_handler, ID_ADVANCE_RETURN);
lv_obj_set_event_cb_mks(buttonBack, event_handler, ID_ADVANCE_RETURN, NULL, 0);
lv_imgbtn_set_src(buttonBack, LV_BTN_STATE_REL, "F:/bmp_back70x40.bin");
lv_imgbtn_set_src(buttonBack, LV_BTN_STATE_PR, "F:/bmp_back70x40.bin");
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);
#if HAS_ROTARY_ENCODER #if HAS_ROTARY_ENCODER
if (gCfgItems.encoder_enable) lv_group_add_obj(g, buttonBack); if (gCfgItems.encoder_enable) lv_group_add_obj(g, buttonBack);
#endif #endif
label_Back = lv_label_create_empty(buttonBack);
lv_obj_set_pos(buttonBack, PARA_UI_BACL_POS_X, PARA_UI_BACL_POS_Y);
lv_btn_set_layout(buttonBack, LV_LAYOUT_OFF);
label_Back = lv_label_create(buttonBack, NULL);
if (gCfgItems.multiple_language) { if (gCfgItems.multiple_language) {
lv_label_set_text(label_Back, common_menu.text_back); lv_label_set_text(label_Back, common_menu.text_back);
@ -317,8 +265,8 @@ void lv_draw_advance_settings(void) {
lv_obj_align(labelWifiSet, buttonWifiSet, LV_ALIGN_IN_LEFT_MID,0, 0); lv_obj_align(labelWifiSet, buttonWifiSet, LV_ALIGN_IN_LEFT_MID,0, 0);
#endif #endif
#if HAS_ROTARY_ENCODER #if HAS_ROTARY_ENCODER
lv_label_set_text(labelEcoder, machine_menu.EncoderSettings); lv_label_set_text(labelEncoder, machine_menu.EncoderSettings);
lv_obj_align(labelEcoder, buttonEcoder, LV_ALIGN_IN_LEFT_MID,0, 0); lv_obj_align(labelEncoder, buttonEncoder, LV_ALIGN_IN_LEFT_MID,0, 0);
#endif #endif
} }

View File

@ -83,9 +83,9 @@ static void event_handler(lv_obj_t * obj, lv_event_t event) {
void lv_draw_auto_level_offset_settings(void) { void lv_draw_auto_level_offset_settings(void) {
lv_obj_t *buttonBack = NULL, *label_Back = NULL; lv_obj_t *buttonBack = NULL, *label_Back = NULL;
lv_obj_t *labelXText = NULL, *buttonXValue = NULL, *labelXValue = NULL; lv_obj_t *buttonXValue = NULL, *labelXValue = NULL;
lv_obj_t *labelYText = NULL, *buttonYValue = NULL, *labelYValue = NULL; lv_obj_t *buttonYValue = NULL, *labelYValue = NULL;
lv_obj_t *labelZText = NULL, *buttonZValue = NULL, *labelZValue = NULL; lv_obj_t *buttonZValue = NULL, *labelZValue = NULL;
lv_obj_t * line1 = NULL, * line2 = NULL, * line3 = NULL; lv_obj_t * line1 = NULL, * line2 = NULL, * line3 = NULL;
if (disp_state_stack._disp_state[disp_state_stack._disp_index] != NOZZLE_PROBE_OFFSET_UI) { if (disp_state_stack._disp_state[disp_state_stack._disp_index] != NOZZLE_PROBE_OFFSET_UI) {
disp_state_stack._disp_index++; disp_state_stack._disp_index++;
@ -99,68 +99,36 @@ void lv_draw_auto_level_offset_settings(void) {
lv_scr_load(scr); lv_scr_load(scr);
lv_obj_clean(scr); lv_obj_clean(scr);
lv_obj_t * title = lv_label_create(scr, NULL); (void)lv_label_create(scr, TITLE_XPOS, TITLE_YPOS, machine_menu.OffsetConfTitle);
lv_obj_set_style(title, &tft_style_label_rel);
lv_obj_set_pos(title, TITLE_XPOS, TITLE_YPOS);
lv_label_set_text(title, machine_menu.OffsetConfTitle);
lv_refr_now(lv_refr_get_disp_refreshing()); lv_refr_now(lv_refr_get_disp_refreshing());
labelXText = lv_label_create(scr, NULL); (void)lv_label_create(scr, PARA_UI_POS_X, PARA_UI_POS_Y + 10, machine_menu.Xoffset);
lv_obj_set_style(labelXText, &tft_style_label_rel);
lv_obj_set_pos(labelXText, PARA_UI_POS_X, PARA_UI_POS_Y + 10);
lv_label_set_text(labelXText, machine_menu.Xoffset);
buttonXValue = lv_btn_create(scr, NULL); buttonXValue = lv_btn_create(scr, PARA_UI_VALUE_POS_X, PARA_UI_POS_Y + PARA_UI_VALUE_V_2, PARA_UI_VALUE_BTN_X_SIZE, PARA_UI_VALUE_BTN_Y_SIZE, event_handler, ID_OFFSET_X);
lv_obj_set_pos(buttonXValue, PARA_UI_VALUE_POS_X, PARA_UI_POS_Y + PARA_UI_VALUE_V_2); labelXValue = lv_label_create_empty(buttonXValue);
lv_obj_set_size(buttonXValue, PARA_UI_VALUE_BTN_X_SIZE, PARA_UI_VALUE_BTN_Y_SIZE);
lv_obj_set_event_cb_mks(buttonXValue, event_handler, ID_OFFSET_X, NULL, 0);
lv_btn_set_style(buttonXValue, LV_BTN_STYLE_REL, &style_para_value);
lv_btn_set_style(buttonXValue, LV_BTN_STYLE_PR, &style_para_value);
labelXValue = lv_label_create(buttonXValue, NULL);
line1 = lv_line_create(scr, NULL); line1 = lv_line_create(scr, NULL);
lv_ex_line(line1, line_points[0]); lv_ex_line(line1, line_points[0]);
labelYText = lv_label_create(scr, NULL); lv_label_create(scr, PARA_UI_POS_X, PARA_UI_POS_Y * 2 + 10, machine_menu.Yoffset);
lv_obj_set_style(labelYText, &tft_style_label_rel);
lv_obj_set_pos(labelYText, PARA_UI_POS_X, PARA_UI_POS_Y * 2 + 10);
lv_label_set_text(labelYText, machine_menu.Yoffset);
buttonYValue = lv_btn_create(scr, NULL); buttonYValue = lv_btn_create(scr, PARA_UI_VALUE_POS_X, PARA_UI_POS_Y * 2 + PARA_UI_VALUE_V_2, PARA_UI_VALUE_BTN_X_SIZE, PARA_UI_VALUE_BTN_Y_SIZE, event_handler, ID_OFFSET_Y);
lv_obj_set_pos(buttonYValue, PARA_UI_VALUE_POS_X, PARA_UI_POS_Y * 2 + PARA_UI_VALUE_V_2); labelYValue = lv_label_create_empty(buttonYValue);
lv_obj_set_size(buttonYValue, PARA_UI_VALUE_BTN_X_SIZE, PARA_UI_VALUE_BTN_Y_SIZE);
lv_obj_set_event_cb_mks(buttonYValue, event_handler, ID_OFFSET_Y, NULL, 0);
lv_btn_set_style(buttonYValue, LV_BTN_STYLE_REL, &style_para_value);
lv_btn_set_style(buttonYValue, LV_BTN_STYLE_PR, &style_para_value);
labelYValue = lv_label_create(buttonYValue, NULL);
line2 = lv_line_create(scr, NULL); line2 = lv_line_create(scr, NULL);
lv_ex_line(line2, line_points[1]); lv_ex_line(line2, line_points[1]);
labelZText = lv_label_create(scr, NULL); (void)lv_label_create(scr, PARA_UI_POS_X, PARA_UI_POS_Y * 3 + 10, machine_menu.Zoffset);
lv_obj_set_style(labelZText, &tft_style_label_rel);
lv_obj_set_pos(labelZText, PARA_UI_POS_X, PARA_UI_POS_Y * 3 + 10);
lv_label_set_text(labelZText, machine_menu.Zoffset);
buttonZValue = lv_btn_create(scr, NULL); buttonZValue = lv_btn_create(scr, PARA_UI_VALUE_POS_X, PARA_UI_POS_Y * 3 + PARA_UI_VALUE_V_2, PARA_UI_VALUE_BTN_X_SIZE, PARA_UI_VALUE_BTN_Y_SIZE, event_handler, ID_OFFSET_Z);
lv_obj_set_pos(buttonZValue, PARA_UI_VALUE_POS_X, PARA_UI_POS_Y * 3 + PARA_UI_VALUE_V_2); labelZValue = lv_label_create_empty(buttonZValue);
lv_obj_set_size(buttonZValue, PARA_UI_VALUE_BTN_X_SIZE, PARA_UI_VALUE_BTN_Y_SIZE);
lv_obj_set_event_cb_mks(buttonZValue, event_handler, ID_OFFSET_Z, NULL, 0);
lv_btn_set_style(buttonZValue, LV_BTN_STYLE_REL, &style_para_value);
lv_btn_set_style(buttonZValue, LV_BTN_STYLE_PR, &style_para_value);
labelZValue = lv_label_create(buttonZValue, NULL);
line3 = lv_line_create(scr, NULL); line3 = lv_line_create(scr, NULL);
lv_ex_line(line3, line_points[2]); lv_ex_line(line3, line_points[2]);
buttonBack = lv_btn_create(scr, NULL); buttonBack = lv_btn_create_back(scr, PARA_UI_BACL_POS_X, PARA_UI_BACL_POS_Y, PARA_UI_BACK_BTN_X_SIZE, PARA_UI_BACK_BTN_Y_SIZE, event_handler, ID_OFFSET_RETURN);
lv_obj_set_event_cb_mks(buttonBack, event_handler, ID_OFFSET_RETURN, NULL, 0); label_Back = lv_label_create_empty(buttonBack);
lv_btn_set_style(buttonBack, LV_BTN_STYLE_REL, &style_para_back);
lv_btn_set_style(buttonBack, LV_BTN_STYLE_PR, &style_para_back);
lv_obj_set_pos(buttonBack, PARA_UI_BACL_POS_X, PARA_UI_BACL_POS_Y);
lv_obj_set_size(buttonBack, PARA_UI_BACK_BTN_X_SIZE, PARA_UI_BACK_BTN_Y_SIZE);
label_Back = lv_label_create(buttonBack, NULL);
#if HAS_ROTARY_ENCODER #if HAS_ROTARY_ENCODER
if (gCfgItems.encoder_enable) { if (gCfgItems.encoder_enable) {

View File

@ -30,6 +30,10 @@
#include "../../../../gcode/gcode.h" #include "../../../../gcode/gcode.h"
#include "../../../../inc/MarlinConfig.h" #include "../../../../inc/MarlinConfig.h"
#if ENABLED(EEPROM_SETTINGS)
#include "../../../../module/settings.h"
#endif
#if HAS_BED_PROBE #if HAS_BED_PROBE
#include "../../../../module/probe.h" #include "../../../../module/probe.h"
#endif #endif
@ -59,7 +63,6 @@ static void event_handler(lv_obj_t * obj, lv_event_t event) {
// nothing to do // nothing to do
} }
else if (event == LV_EVENT_RELEASED) { else if (event == LV_EVENT_RELEASED) {
ZERO(baby_buf);
sprintf_P(baby_buf, PSTR("M290 X%.3f"),babystep_dist); sprintf_P(baby_buf, PSTR("M290 X%.3f"),babystep_dist);
gcode.process_subcommands_now_P(PSTR(baby_buf)); gcode.process_subcommands_now_P(PSTR(baby_buf));
has_adjust_z = 1; has_adjust_z = 1;
@ -70,7 +73,6 @@ static void event_handler(lv_obj_t * obj, lv_event_t event) {
// nothing to do // nothing to do
} }
else if (event == LV_EVENT_RELEASED) { else if (event == LV_EVENT_RELEASED) {
ZERO(baby_buf);
sprintf_P(baby_buf, PSTR("M290 X%.3f"),((float)0 - babystep_dist)); sprintf_P(baby_buf, PSTR("M290 X%.3f"),((float)0 - babystep_dist));
gcode.process_subcommands_now_P(PSTR(baby_buf)); gcode.process_subcommands_now_P(PSTR(baby_buf));
has_adjust_z = 1; has_adjust_z = 1;
@ -81,7 +83,6 @@ static void event_handler(lv_obj_t * obj, lv_event_t event) {
// nothing to do // nothing to do
} }
else if (event == LV_EVENT_RELEASED) { else if (event == LV_EVENT_RELEASED) {
ZERO(baby_buf);
sprintf_P(baby_buf, PSTR("M290 Y%.3f"), babystep_dist); sprintf_P(baby_buf, PSTR("M290 Y%.3f"), babystep_dist);
gcode.process_subcommands_now_P(PSTR(baby_buf)); gcode.process_subcommands_now_P(PSTR(baby_buf));
has_adjust_z = 1; has_adjust_z = 1;
@ -92,7 +93,6 @@ static void event_handler(lv_obj_t * obj, lv_event_t event) {
// nothing to do // nothing to do
} }
else if (event == LV_EVENT_RELEASED) { else if (event == LV_EVENT_RELEASED) {
ZERO(baby_buf);
sprintf_P(baby_buf, PSTR("M290 Y%.3f"),((float)0 - babystep_dist)); sprintf_P(baby_buf, PSTR("M290 Y%.3f"),((float)0 - babystep_dist));
gcode.process_subcommands_now_P(PSTR(baby_buf)); gcode.process_subcommands_now_P(PSTR(baby_buf));
has_adjust_z = 1; has_adjust_z = 1;
@ -103,7 +103,6 @@ static void event_handler(lv_obj_t * obj, lv_event_t event) {
// nothing to do // nothing to do
} }
else if (event == LV_EVENT_RELEASED) { else if (event == LV_EVENT_RELEASED) {
ZERO(baby_buf);
sprintf_P(baby_buf, PSTR("M290 Z%.3f"), babystep_dist); sprintf_P(baby_buf, PSTR("M290 Z%.3f"), babystep_dist);
gcode.process_subcommands_now_P(PSTR(baby_buf)); gcode.process_subcommands_now_P(PSTR(baby_buf));
has_adjust_z = 1; has_adjust_z = 1;
@ -114,7 +113,6 @@ static void event_handler(lv_obj_t * obj, lv_event_t event) {
// nothing to do // nothing to do
} }
else if (event == LV_EVENT_RELEASED) { else if (event == LV_EVENT_RELEASED) {
ZERO(baby_buf);
sprintf_P(baby_buf, PSTR("M290 Z%.3f"),((float)0 - babystep_dist)); sprintf_P(baby_buf, PSTR("M290 Z%.3f"),((float)0 - babystep_dist));
gcode.process_subcommands_now_P(PSTR(baby_buf)); gcode.process_subcommands_now_P(PSTR(baby_buf));
has_adjust_z = 1; has_adjust_z = 1;
@ -141,7 +139,7 @@ static void event_handler(lv_obj_t * obj, lv_event_t event) {
} }
else if (event == LV_EVENT_RELEASED) { else if (event == LV_EVENT_RELEASED) {
if (has_adjust_z == 1) { if (has_adjust_z == 1) {
gcode.process_subcommands_now_P(PSTR("M500")); TERN_(EEPROM_SETTINGS, (void)settings.save());
has_adjust_z = 0; has_adjust_z = 0;
} }
clear_cur_ui(); clear_cur_ui();
@ -152,8 +150,6 @@ static void event_handler(lv_obj_t * obj, lv_event_t event) {
} }
void lv_draw_baby_stepping(void) { void lv_draw_baby_stepping(void) {
lv_obj_t *buttonXI, *buttonXD, *buttonYI, *buttonYD, *buttonZI, *buttonZD, *buttonBack;
if (disp_state_stack._disp_state[disp_state_stack._disp_index] != BABY_STEP_UI) { if (disp_state_stack._disp_state[disp_state_stack._disp_index] != BABY_STEP_UI) {
disp_state_stack._disp_index++; disp_state_stack._disp_index++;
disp_state_stack._disp_state[disp_state_stack._disp_index] = BABY_STEP_UI; disp_state_stack._disp_state[disp_state_stack._disp_index] = BABY_STEP_UI;
@ -166,98 +162,29 @@ void lv_draw_baby_stepping(void) {
lv_scr_load(scr); lv_scr_load(scr);
lv_obj_clean(scr); lv_obj_clean(scr);
lv_obj_t * title = lv_label_create(scr, NULL); (void)lv_label_create(scr, TITLE_XPOS, TITLE_YPOS, creat_title_text());
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());
lv_refr_now(lv_refr_get_disp_refreshing()); lv_refr_now(lv_refr_get_disp_refreshing());
// Create an Image button // Create an Image button
buttonXI = lv_imgbtn_create(scr, NULL); lv_obj_t *buttonXI = lv_imgbtn_create(scr, "F:/bmp_xAdd.bin", INTERVAL_V, titleHeight, event_handler, ID_BABY_STEP_X_P);
buttonXD = lv_imgbtn_create(scr, NULL); lv_obj_t *buttonXD = lv_imgbtn_create(scr, "F:/bmp_xDec.bin", INTERVAL_V, BTN_Y_PIXEL + INTERVAL_H + titleHeight, event_handler, ID_BABY_STEP_X_N);
buttonYI = lv_imgbtn_create(scr, NULL); lv_obj_t *buttonYI = lv_imgbtn_create(scr, "F:/bmp_yAdd.bin", BTN_X_PIXEL + INTERVAL_V * 2, titleHeight, event_handler, ID_BABY_STEP_Y_P);
buttonYD = lv_imgbtn_create(scr, NULL); lv_obj_t *buttonYD = lv_imgbtn_create(scr, "F:/bmp_yDec.bin", BTN_X_PIXEL + INTERVAL_V * 2, BTN_Y_PIXEL + INTERVAL_H + titleHeight, event_handler, ID_BABY_STEP_Y_N);
buttonZI = lv_imgbtn_create(scr, NULL); lv_obj_t *buttonZI = lv_imgbtn_create(scr, "F:/bmp_zAdd.bin", BTN_X_PIXEL * 2 + INTERVAL_V * 3, titleHeight, event_handler, ID_BABY_STEP_Z_P);
buttonZD = lv_imgbtn_create(scr, NULL); lv_obj_t *buttonZD = lv_imgbtn_create(scr, "F:/bmp_zDec.bin", BTN_X_PIXEL * 2 + INTERVAL_V * 3, BTN_Y_PIXEL + INTERVAL_H + titleHeight, event_handler, ID_BABY_STEP_Z_N);
buttonV = lv_imgbtn_create(scr, NULL); buttonV = lv_imgbtn_create(scr, NULL, BTN_X_PIXEL * 3 + INTERVAL_V * 4, titleHeight, event_handler, ID_BABY_STEP_DIST);
buttonBack = lv_imgbtn_create(scr, NULL); lv_obj_t *buttonBack = lv_imgbtn_create(scr, "F:/bmp_return.bin", BTN_X_PIXEL * 3 + INTERVAL_V * 4, BTN_Y_PIXEL + INTERVAL_H + titleHeight, event_handler, ID_BABY_STEP_RETURN);
lv_obj_set_event_cb_mks(buttonXI, event_handler, ID_BABY_STEP_X_P, NULL, 0);
lv_imgbtn_set_src(buttonXI, LV_BTN_STATE_REL, "F:/bmp_xAdd.bin");
lv_imgbtn_set_src(buttonXI, LV_BTN_STATE_PR, "F:/bmp_xAdd.bin");
lv_imgbtn_set_style(buttonXI, LV_BTN_STATE_PR, &tft_style_label_pre);
lv_imgbtn_set_style(buttonXI, LV_BTN_STATE_REL, &tft_style_label_rel);
#if 1
lv_obj_set_event_cb_mks(buttonXD, event_handler, ID_BABY_STEP_X_N, NULL, 0);
lv_imgbtn_set_src(buttonXD, LV_BTN_STATE_REL, "F:/bmp_xDec.bin");
lv_imgbtn_set_src(buttonXD, LV_BTN_STATE_PR, "F:/bmp_xDec.bin");
lv_imgbtn_set_style(buttonXD, LV_BTN_STATE_PR, &tft_style_label_pre);
lv_imgbtn_set_style(buttonXD, LV_BTN_STATE_REL, &tft_style_label_rel);
lv_obj_set_event_cb_mks(buttonYI, event_handler, ID_BABY_STEP_Y_P, NULL, 0);
lv_imgbtn_set_src(buttonYI, LV_BTN_STATE_REL, "F:/bmp_yAdd.bin");
lv_imgbtn_set_src(buttonYI, LV_BTN_STATE_PR, "F:/bmp_yAdd.bin");
lv_imgbtn_set_style(buttonYI, LV_BTN_STATE_PR, &tft_style_label_pre);
lv_imgbtn_set_style(buttonYI, LV_BTN_STATE_REL, &tft_style_label_rel);
lv_obj_set_event_cb_mks(buttonYD, event_handler, ID_BABY_STEP_Y_N, NULL, 0);
lv_imgbtn_set_src(buttonYD, LV_BTN_STATE_REL, "F:/bmp_yDec.bin");
lv_imgbtn_set_src(buttonYD, LV_BTN_STATE_PR, "F:/bmp_yDec.bin");
lv_imgbtn_set_style(buttonYD, LV_BTN_STATE_PR, &tft_style_label_pre);
lv_imgbtn_set_style(buttonYD, LV_BTN_STATE_REL, &tft_style_label_rel);
lv_obj_set_event_cb_mks(buttonZI, event_handler, ID_BABY_STEP_Z_P, NULL, 0);
lv_imgbtn_set_src(buttonZI, LV_BTN_STATE_REL, "F:/bmp_zAdd.bin");
lv_imgbtn_set_src(buttonZI, LV_BTN_STATE_PR, "F:/bmp_zAdd.bin");
lv_imgbtn_set_style(buttonZI, LV_BTN_STATE_PR, &tft_style_label_pre);
lv_imgbtn_set_style(buttonZI, LV_BTN_STATE_REL, &tft_style_label_rel);
lv_obj_set_event_cb_mks(buttonZD, event_handler, ID_BABY_STEP_Z_N, NULL, 0);
lv_imgbtn_set_src(buttonZD, LV_BTN_STATE_REL, "F:/bmp_zDec.bin");
lv_imgbtn_set_src(buttonZD, LV_BTN_STATE_PR, "F:/bmp_zDec.bin");
lv_imgbtn_set_style(buttonZD, LV_BTN_STATE_PR, &tft_style_label_pre);
lv_imgbtn_set_style(buttonZD, LV_BTN_STATE_REL, &tft_style_label_rel);
lv_obj_set_event_cb_mks(buttonV, event_handler, ID_BABY_STEP_DIST, NULL, 0);
lv_imgbtn_set_style(buttonV, LV_BTN_STATE_PR, &tft_style_label_pre);
lv_imgbtn_set_style(buttonV, LV_BTN_STATE_REL, &tft_style_label_rel);
lv_obj_set_event_cb_mks(buttonBack, event_handler, ID_BABY_STEP_RETURN, NULL, 0);
lv_imgbtn_set_src(buttonBack, LV_BTN_STATE_REL, "F:/bmp_return.bin");
lv_imgbtn_set_src(buttonBack, LV_BTN_STATE_PR, "F:/bmp_return.bin");
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 // if 1
lv_obj_set_pos(buttonXI, INTERVAL_V, titleHeight);
lv_obj_set_pos(buttonYI, BTN_X_PIXEL + INTERVAL_V * 2, titleHeight);
lv_obj_set_pos(buttonZI, BTN_X_PIXEL * 2 + INTERVAL_V * 3, titleHeight);
lv_obj_set_pos(buttonV, BTN_X_PIXEL * 3 + INTERVAL_V * 4, titleHeight);
lv_obj_set_pos(buttonXD, INTERVAL_V, BTN_Y_PIXEL + INTERVAL_H + titleHeight);
lv_obj_set_pos(buttonYD, BTN_X_PIXEL + INTERVAL_V * 2, BTN_Y_PIXEL + INTERVAL_H + titleHeight);
lv_obj_set_pos(buttonZD, 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 labels on the image buttons // Create labels on the image buttons
lv_btn_set_layout(buttonXI, LV_LAYOUT_OFF); lv_obj_t *labelXI = lv_label_create_empty(buttonXI);
lv_btn_set_layout(buttonXD, LV_LAYOUT_OFF); lv_obj_t *labelXD = lv_label_create_empty(buttonXD);
lv_btn_set_layout(buttonYI, LV_LAYOUT_OFF); lv_obj_t *labelYI = lv_label_create_empty(buttonYI);
lv_btn_set_layout(buttonYD, LV_LAYOUT_OFF); lv_obj_t *labelYD = lv_label_create_empty(buttonYD);
lv_btn_set_layout(buttonZI, LV_LAYOUT_OFF); lv_obj_t *labelZI = lv_label_create_empty(buttonZI);
lv_btn_set_layout(buttonZD, LV_LAYOUT_OFF); lv_obj_t *labelZD = lv_label_create_empty(buttonZD);
lv_btn_set_layout(buttonV, LV_LAYOUT_OFF); labelV = lv_label_create_empty(buttonV);
lv_btn_set_layout(buttonBack, LV_LAYOUT_OFF); lv_obj_t *label_Back = lv_label_create_empty(buttonBack);
lv_obj_t *labelXI = lv_label_create(buttonXI, NULL);
lv_obj_t *labelXD = lv_label_create(buttonXD, NULL);
lv_obj_t *labelYI = lv_label_create(buttonYI, NULL);
lv_obj_t *labelYD = lv_label_create(buttonYD, NULL);
lv_obj_t *labelZI = lv_label_create(buttonZI, NULL);
lv_obj_t *labelZD = lv_label_create(buttonZD, NULL);
labelV = lv_label_create(buttonV, NULL);
lv_obj_t *label_Back = lv_label_create(buttonBack, NULL);
if (gCfgItems.multiple_language) { if (gCfgItems.multiple_language) {
lv_label_set_text(labelXI, move_menu.x_add); lv_label_set_text(labelXI, move_menu.x_add);
@ -297,27 +224,19 @@ void lv_draw_baby_stepping(void) {
disp_baby_step_dist(); disp_baby_step_dist();
zOffsetText = lv_label_create(scr, NULL); zOffsetText = lv_label_create(scr, 290, TITLE_YPOS, NULL);
lv_obj_set_style(zOffsetText, &tft_style_label_rel);
lv_obj_set_pos(zOffsetText, 290, TITLE_YPOS);
disp_z_offset_value(); disp_z_offset_value();
} }
void disp_baby_step_dist() { void disp_baby_step_dist() {
// char buf[30] = {0}; // char buf[30] = {0};
if ((int)(100 * babystep_dist) == 1)
lv_imgbtn_set_src_both(buttonV, "F:/bmp_baby_move0_01.bin");
else if ((int)(100 * babystep_dist) == 5)
lv_imgbtn_set_src_both(buttonV, "F:/bmp_baby_move0_05.bin");
else if ((int)(100 * babystep_dist) == 10)
lv_imgbtn_set_src_both(buttonV, "F:/bmp_baby_move0_1.bin");
if ((int)(100 * babystep_dist) == 1) {
lv_imgbtn_set_src(buttonV, LV_BTN_STATE_REL, "F:/bmp_baby_move0_01.bin");
lv_imgbtn_set_src(buttonV, LV_BTN_STATE_PR, "F:/bmp_baby_move0_01.bin");
}
else if ((int)(100 * babystep_dist) == 5) {
lv_imgbtn_set_src(buttonV, LV_BTN_STATE_REL, "F:/bmp_baby_move0_05.bin");
lv_imgbtn_set_src(buttonV, LV_BTN_STATE_PR, "F:/bmp_baby_move0_05.bin");
}
else if ((int)(100 * babystep_dist) == 10) {
lv_imgbtn_set_src(buttonV, LV_BTN_STATE_REL, "F:/bmp_baby_move0_1.bin");
lv_imgbtn_set_src(buttonV, LV_BTN_STATE_PR, "F:/bmp_baby_move0_1.bin");
}
if (gCfgItems.multiple_language) { if (gCfgItems.multiple_language) {
if ((int)(100 * babystep_dist) == 1) { if ((int)(100 * babystep_dist) == 1) {
lv_label_set_text(labelV, move_menu.step_001mm); lv_label_set_text(labelV, move_menu.step_001mm);
@ -336,8 +255,6 @@ void disp_baby_step_dist() {
void disp_z_offset_value() { void disp_z_offset_value() {
char buf[20]; char buf[20];
ZERO(buf);
sprintf_P(buf, PSTR("offset Z: %.3f"), (double)TERN(HAS_BED_PROBE, probe.offset.z, 0)); sprintf_P(buf, PSTR("offset Z: %.3f"), (double)TERN(HAS_BED_PROBE, probe.offset.z, 0));
lv_label_set_text(zOffsetText, buf); lv_label_set_text(zOffsetText, buf);
} }

View File

@ -168,75 +168,25 @@ void lv_draw_change_speed(void) {
lv_scr_load(scr); lv_scr_load(scr);
lv_obj_clean(scr); lv_obj_clean(scr);
lv_obj_t * title = lv_label_create(scr, NULL); (void)lv_label_create(scr, TITLE_XPOS, TITLE_YPOS, creat_title_text());
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());
lv_refr_now(lv_refr_get_disp_refreshing()); lv_refr_now(lv_refr_get_disp_refreshing());
// Create an Image button // Create an Image button
buttonAdd = lv_imgbtn_create(scr, NULL); buttonAdd = lv_imgbtn_create(scr, "F:/bmp_Add.bin", INTERVAL_V, titleHeight, event_handler, ID_C_ADD);
buttonDec = lv_imgbtn_create(scr, NULL); buttonDec = lv_imgbtn_create(scr, "F:/bmp_Dec.bin", BTN_X_PIXEL * 3 + INTERVAL_V * 4, titleHeight, event_handler, ID_C_DEC);
buttonMov = lv_imgbtn_create(scr, NULL); buttonMov = lv_imgbtn_create(scr, NULL, INTERVAL_V, BTN_Y_PIXEL + INTERVAL_H + titleHeight, event_handler, ID_C_MOVE);
buttonExt = lv_imgbtn_create(scr, NULL); buttonExt = lv_imgbtn_create(scr, NULL, BTN_X_PIXEL + INTERVAL_V * 2, BTN_Y_PIXEL + INTERVAL_H + titleHeight, event_handler, ID_C_EXT);
buttonStep = lv_imgbtn_create(scr, NULL); buttonStep = lv_imgbtn_create(scr, NULL, BTN_X_PIXEL * 2 + INTERVAL_V * 3, BTN_Y_PIXEL + INTERVAL_H + titleHeight, event_handler, ID_C_STEP);
buttonBack = lv_imgbtn_create(scr, NULL); buttonBack = lv_imgbtn_create(scr, "F:/bmp_return.bin", BTN_X_PIXEL * 3 + INTERVAL_V * 4, BTN_Y_PIXEL + INTERVAL_H + titleHeight, event_handler, ID_C_RETURN);
lv_obj_set_event_cb_mks(buttonAdd, event_handler, ID_C_ADD, NULL, 0);
lv_imgbtn_set_src(buttonAdd, LV_BTN_STATE_REL, "F:/bmp_Add.bin");
lv_imgbtn_set_src(buttonAdd, LV_BTN_STATE_PR, "F:/bmp_Add.bin");
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);
#if 1
lv_obj_set_event_cb_mks(buttonDec, event_handler, ID_C_DEC, NULL, 0);
lv_imgbtn_set_src(buttonDec, LV_BTN_STATE_REL, "F:/bmp_Dec.bin");
lv_imgbtn_set_src(buttonDec, LV_BTN_STATE_PR, "F:/bmp_Dec.bin");
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_obj_set_event_cb_mks(buttonMov, event_handler, ID_C_MOVE, NULL, 0);
lv_imgbtn_set_style(buttonMov, LV_BTN_STATE_PR, &tft_style_label_pre);
lv_imgbtn_set_style(buttonMov, LV_BTN_STATE_REL, &tft_style_label_rel);
lv_obj_set_event_cb_mks(buttonExt, event_handler, ID_C_EXT, NULL, 0);
lv_imgbtn_set_style(buttonExt, LV_BTN_STATE_PR, &tft_style_label_pre);
lv_imgbtn_set_style(buttonExt, LV_BTN_STATE_REL, &tft_style_label_rel);
lv_obj_set_event_cb_mks(buttonStep, event_handler, ID_C_STEP, NULL, 0);
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_obj_set_event_cb_mks(buttonBack, event_handler, ID_C_RETURN, NULL, 0);
lv_imgbtn_set_src(buttonBack, LV_BTN_STATE_REL, "F:/bmp_return.bin");
lv_imgbtn_set_src(buttonBack, LV_BTN_STATE_PR, "F:/bmp_return.bin");
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(buttonMov, INTERVAL_V, BTN_Y_PIXEL + INTERVAL_H + titleHeight);
lv_obj_set_pos(buttonExt, BTN_X_PIXEL + INTERVAL_V * 2, BTN_Y_PIXEL + INTERVAL_H + titleHeight);
lv_obj_set_pos(buttonStep, 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 labels on the image buttons // Create labels on the image buttons
lv_btn_set_layout(buttonAdd, LV_LAYOUT_OFF); lv_obj_t *labelAdd = lv_label_create_empty(buttonAdd);
lv_btn_set_layout(buttonDec, LV_LAYOUT_OFF); lv_obj_t *labelDec = lv_label_create_empty(buttonDec);
lv_btn_set_layout(buttonMov, LV_LAYOUT_OFF); labelMov = lv_label_create_empty(buttonMov);
lv_btn_set_layout(buttonExt, LV_LAYOUT_OFF); labelExt = lv_label_create_empty(buttonExt);
lv_btn_set_layout(buttonStep, LV_LAYOUT_OFF); labelStep = lv_label_create_empty(buttonStep);
lv_btn_set_layout(buttonBack, LV_LAYOUT_OFF); lv_obj_t *label_Back = lv_label_create_empty(buttonBack);
lv_obj_t *labelAdd = lv_label_create(buttonAdd, NULL);
lv_obj_t *labelDec = lv_label_create(buttonDec, NULL);
labelMov = lv_label_create(buttonMov, NULL);
labelExt = lv_label_create(buttonExt, NULL);
labelStep = lv_label_create(buttonStep, NULL);
lv_obj_t *label_Back = lv_label_create(buttonBack, NULL);
if (gCfgItems.multiple_language) { if (gCfgItems.multiple_language) {
lv_label_set_text(labelAdd, speed_menu.add); lv_label_set_text(labelAdd, speed_menu.add);
@ -262,24 +212,19 @@ void lv_draw_change_speed(void) {
disp_speed_type(); disp_speed_type();
disp_speed_step(); disp_speed_step();
printSpeedText = lv_label_create(scr, NULL); printSpeedText = lv_label_create_empty(scr);
lv_obj_set_style(printSpeedText, &tft_style_label_rel); lv_obj_set_style(printSpeedText, &tft_style_label_rel);
disp_print_speed(); disp_print_speed();
} }
void disp_speed_step() { void disp_speed_step() {
if (uiCfg.stepPrintSpeed == 1) { if (uiCfg.stepPrintSpeed == 1)
lv_imgbtn_set_src(buttonStep, LV_BTN_STATE_REL, "F:/bmp_step1_percent.bin"); lv_imgbtn_set_src_both(buttonStep, "F:/bmp_step1_percent.bin");
lv_imgbtn_set_src(buttonStep, LV_BTN_STATE_PR, "F:/bmp_step1_percent.bin"); else if (uiCfg.stepPrintSpeed == 5)
} lv_imgbtn_set_src_both(buttonStep, "F:/bmp_step5_percent.bin");
else if (uiCfg.stepPrintSpeed == 5) { else if (uiCfg.stepPrintSpeed == 10)
lv_imgbtn_set_src(buttonStep, LV_BTN_STATE_REL, "F:/bmp_step5_percent.bin"); lv_imgbtn_set_src_both(buttonStep, "F:/bmp_step10_percent.bin");
lv_imgbtn_set_src(buttonStep, LV_BTN_STATE_PR, "F:/bmp_step5_percent.bin");
}
else if (uiCfg.stepPrintSpeed == 10) {
lv_imgbtn_set_src(buttonStep, LV_BTN_STATE_REL, "F:/bmp_step10_percent.bin");
lv_imgbtn_set_src(buttonStep, LV_BTN_STATE_PR, "F:/bmp_step10_percent.bin");
}
if (gCfgItems.multiple_language) { if (gCfgItems.multiple_language) {
if (uiCfg.stepPrintSpeed == 1) { if (uiCfg.stepPrintSpeed == 1) {
lv_label_set_text(labelStep, speed_menu.step_1percent); lv_label_set_text(labelStep, speed_menu.step_1percent);
@ -320,17 +265,13 @@ void disp_print_speed() {
void disp_speed_type() { void disp_speed_type() {
switch (speedType) { switch (speedType) {
case 1: case 1:
lv_imgbtn_set_src(buttonMov, LV_BTN_STATE_REL, "F:/bmp_mov_changeSpeed.bin"); lv_imgbtn_set_src_both(buttonMov, "F:/bmp_mov_changeSpeed.bin");
lv_imgbtn_set_src(buttonMov, LV_BTN_STATE_PR, "F:/bmp_mov_changeSpeed.bin"); lv_imgbtn_set_src_both(buttonExt, "F:/bmp_extruct_sel.bin");
lv_imgbtn_set_src(buttonExt, LV_BTN_STATE_REL, "F:/bmp_extruct_sel.bin");
lv_imgbtn_set_src(buttonExt, LV_BTN_STATE_PR, "F:/bmp_extruct_sel.bin");
break; break;
default: default:
lv_imgbtn_set_src(buttonMov, LV_BTN_STATE_REL, "F:/bmp_mov_sel.bin"); lv_imgbtn_set_src_both(buttonMov, "F:/bmp_mov_sel.bin");
lv_imgbtn_set_src(buttonMov, LV_BTN_STATE_PR, "F:/bmp_mov_sel.bin"); lv_imgbtn_set_src_both(buttonExt, "F:/bmp_speed_extruct.bin");
lv_imgbtn_set_src(buttonExt, LV_BTN_STATE_REL, "F:/bmp_speed_extruct.bin");
lv_imgbtn_set_src(buttonExt, LV_BTN_STATE_PR, "F:/bmp_speed_extruct.bin");
break; break;
} }
lv_obj_refresh_ext_draw_pad(buttonExt); lv_obj_refresh_ext_draw_pad(buttonExt);

View File

@ -43,6 +43,10 @@
#include "../../../../gcode/gcode.h" #include "../../../../gcode/gcode.h"
#include "../../../../inc/MarlinConfig.h" #include "../../../../inc/MarlinConfig.h"
#if ENABLED(EEPROM_SETTINGS)
#include "../../../../module/settings.h"
#endif
#if ENABLED(POWER_LOSS_RECOVERY) #if ENABLED(POWER_LOSS_RECOVERY)
#include "../../../../feature/powerloss.h" #include "../../../../feature/powerloss.h"
#endif #endif
@ -155,17 +159,17 @@ static void btn_ok_event_cb(lv_obj_t * btn, lv_event_t event) {
} }
#endif #endif
else if (uiCfg.dialogType == DIALOG_STORE_EEPROM_TIPS) { else if (uiCfg.dialogType == DIALOG_STORE_EEPROM_TIPS) {
gcode.process_subcommands_now_P(PSTR("M500")); TERN_(EEPROM_SETTINGS, (void)settings.save());
clear_cur_ui(); clear_cur_ui();
draw_return_ui(); draw_return_ui();
} }
else if (uiCfg.dialogType == DIALOG_READ_EEPROM_TIPS) { else if (uiCfg.dialogType == DIALOG_READ_EEPROM_TIPS) {
gcode.process_subcommands_now_P(PSTR("M501")); TERN_(EEPROM_SETTINGS, (void)settings.load());
clear_cur_ui(); clear_cur_ui();
draw_return_ui(); draw_return_ui();
} }
else if (uiCfg.dialogType == DIALOG_REVERT_EEPROM_TIPS) { else if (uiCfg.dialogType == DIALOG_REVERT_EEPROM_TIPS) {
gcode.process_subcommands_now_P(PSTR("M502")); TERN_(EEPROM_SETTINGS, (void)settings.reset());
clear_cur_ui(); clear_cur_ui();
draw_return_ui(); draw_return_ui();
} }
@ -199,7 +203,7 @@ static void btn_cancel_event_cb(lv_obj_t * btn, lv_event_t event) {
pause_menu_response = PAUSE_RESPONSE_RESUME_PRINT; pause_menu_response = PAUSE_RESPONSE_RESUME_PRINT;
#endif #endif
} }
else if ((uiCfg.dialogType == DIALOG_TYPE_FILAMENT_LOAD_HEAT) else if ((uiCfg.dialogType == DIALOG_TYPE_FILAMENT_LOAD_HEAT)
|| (uiCfg.dialogType == DIALOG_TYPE_FILAMENT_UNLOAD_HEAT) || (uiCfg.dialogType == DIALOG_TYPE_FILAMENT_UNLOAD_HEAT)
|| (uiCfg.dialogType == DIALOG_TYPE_FILAMENT_HEAT_LOAD_COMPLETED) || (uiCfg.dialogType == DIALOG_TYPE_FILAMENT_HEAT_LOAD_COMPLETED)
|| (uiCfg.dialogType == DIALOG_TYPE_FILAMENT_HEAT_UNLOAD_COMPLETED) || (uiCfg.dialogType == DIALOG_TYPE_FILAMENT_HEAT_UNLOAD_COMPLETED)
@ -244,19 +248,14 @@ void lv_draw_dialog(uint8_t type) {
scr = lv_obj_create(NULL, NULL); scr = lv_obj_create(NULL, NULL);
lv_obj_set_style(scr, &tft_style_scr); lv_obj_set_style(scr, &tft_style_scr);
lv_scr_load(scr); lv_scr_load(scr);
lv_obj_clean(scr); lv_obj_clean(scr);
lv_obj_t * title = lv_label_create(scr, NULL); (void)lv_label_create(scr, TITLE_XPOS, TITLE_YPOS, creat_title_text());
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());
lv_refr_now(lv_refr_get_disp_refreshing()); lv_refr_now(lv_refr_get_disp_refreshing());
static lv_style_t style_btn_rel; // A variable to store the released 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 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.color = lv_color_hex3(0x269);
@ -278,17 +277,21 @@ void lv_draw_dialog(uint8_t type) {
style_btn_pr.text.color = lv_color_hex3(0xBCD); 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); 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); // Set button styles for Released and Pressed
lv_obj_set_style(labelDialog, &tft_style_label_rel); auto lv_btn_use_button_style = [&](lv_obj_t *btn) {
lv_btn_set_style(btn, LV_BTN_STYLE_REL, &style_btn_rel);
lv_btn_set_style(btn, LV_BTN_STYLE_PR, &style_btn_pr);
};
lv_obj_t *labelDialog = lv_label_create_empty(scr);
if (uiCfg.dialogType == DIALOG_TYPE_FINISH_PRINT || uiCfg.dialogType == DIALOG_PAUSE_MESSAGE_RESUME) { if (uiCfg.dialogType == DIALOG_TYPE_FINISH_PRINT || uiCfg.dialogType == DIALOG_PAUSE_MESSAGE_RESUME) {
btnOk = lv_btn_create(scr, NULL); // Add a button the current screen 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_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_size(btnOk, 100, 50); // Set its size
lv_obj_set_event_cb(btnOk, btn_ok_event_cb); 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_use_button_style(btnOk);
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_empty(btnOk); // Add a label to the button
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_label_set_text(labelOk, print_file_dialog_menu.confirm); // Set the labels text
} }
else if (uiCfg.dialogType == DIALOG_PAUSE_MESSAGE_WAITING else if (uiCfg.dialogType == DIALOG_PAUSE_MESSAGE_WAITING
@ -299,9 +302,8 @@ void lv_draw_dialog(uint8_t type) {
lv_obj_set_pos(btnOk, BTN_OK_X + 90, BTN_OK_Y); // Set its position 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_size(btnOk, 100, 50); // Set its size
lv_obj_set_event_cb(btnOk, btn_ok_event_cb); 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_use_button_style(btnOk);
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_empty(btnOk); // Add a label to the button
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_label_set_text(labelOk, print_file_dialog_menu.confirm); // Set the labels text
} }
else if (uiCfg.dialogType == DIALOG_PAUSE_MESSAGE_PAUSING else if (uiCfg.dialogType == DIALOG_PAUSE_MESSAGE_PAUSING
@ -319,9 +321,8 @@ void lv_draw_dialog(uint8_t type) {
lv_obj_set_pos(btnCancel, BTN_OK_X+90, BTN_OK_Y); lv_obj_set_pos(btnCancel, BTN_OK_X+90, BTN_OK_Y);
lv_obj_set_size(btnCancel, 100, 50); lv_obj_set_size(btnCancel, 100, 50);
lv_obj_set_event_cb(btnCancel, btn_cancel_event_cb); lv_obj_set_event_cb(btnCancel, btn_cancel_event_cb);
lv_btn_set_style(btnCancel, LV_BTN_STYLE_REL, &style_btn_rel); lv_btn_use_button_style(btnCancel);
lv_btn_set_style(btnCancel, LV_BTN_STYLE_PR, &style_btn_pr); lv_obj_t *labelCancel = lv_label_create_empty(btnCancel);
lv_obj_t *labelCancel = lv_label_create(btnCancel, NULL);
lv_label_set_text(labelCancel, print_file_dialog_menu.cancle); lv_label_set_text(labelCancel, print_file_dialog_menu.cancle);
} }
else if (uiCfg.dialogType == DIALOG_TRANSFER_NO_DEVICE) { else if (uiCfg.dialogType == DIALOG_TRANSFER_NO_DEVICE) {
@ -329,9 +330,8 @@ void lv_draw_dialog(uint8_t type) {
lv_obj_set_pos(btnCancel, BTN_OK_X+90, BTN_OK_Y); lv_obj_set_pos(btnCancel, BTN_OK_X+90, BTN_OK_Y);
lv_obj_set_size(btnCancel, 100, 50); lv_obj_set_size(btnCancel, 100, 50);
lv_obj_set_event_cb(btnCancel, btn_cancel_event_cb); lv_obj_set_event_cb(btnCancel, btn_cancel_event_cb);
lv_btn_set_style(btnCancel, LV_BTN_STYLE_REL, &style_btn_rel); lv_btn_use_button_style(btnCancel);
lv_btn_set_style(btnCancel, LV_BTN_STYLE_PR, &style_btn_pr); lv_obj_t *labelCancel = lv_label_create_empty(btnCancel);
lv_obj_t *labelCancel = lv_label_create(btnCancel, NULL);
lv_label_set_text(labelCancel, print_file_dialog_menu.cancle); lv_label_set_text(labelCancel, print_file_dialog_menu.cancle);
} }
#if ENABLED(USE_WIFI_FUNCTION) #if ENABLED(USE_WIFI_FUNCTION)
@ -341,9 +341,8 @@ void lv_draw_dialog(uint8_t type) {
lv_obj_set_pos(btnCancel, BTN_OK_X+90, BTN_OK_Y); lv_obj_set_pos(btnCancel, BTN_OK_X+90, BTN_OK_Y);
lv_obj_set_size(btnCancel, 100, 50); lv_obj_set_size(btnCancel, 100, 50);
lv_obj_set_event_cb(btnCancel, btn_cancel_event_cb); lv_obj_set_event_cb(btnCancel, btn_cancel_event_cb);
lv_btn_set_style(btnCancel, LV_BTN_STYLE_REL, &style_btn_rel); lv_btn_use_button_style(btnCancel);
lv_btn_set_style(btnCancel, LV_BTN_STYLE_PR, &style_btn_pr); lv_obj_t *labelCancel = lv_label_create_empty(btnCancel);
lv_obj_t *labelCancel = lv_label_create(btnCancel, NULL);
lv_label_set_text(labelCancel, print_file_dialog_menu.cancle); lv_label_set_text(labelCancel, print_file_dialog_menu.cancle);
} }
else if (upload_result == 3) { else if (upload_result == 3) {
@ -351,9 +350,8 @@ void lv_draw_dialog(uint8_t type) {
lv_obj_set_pos(btnOk, BTN_OK_X+90, BTN_OK_Y); lv_obj_set_pos(btnOk, BTN_OK_X+90, BTN_OK_Y);
lv_obj_set_size(btnOk, 100, 50); lv_obj_set_size(btnOk, 100, 50);
lv_obj_set_event_cb(btnOk, btn_ok_event_cb); lv_obj_set_event_cb(btnOk, btn_ok_event_cb);
lv_btn_set_style(btnOk, LV_BTN_STYLE_REL, &style_btn_rel); lv_btn_use_button_style(btnOk);
lv_btn_set_style(btnOk, LV_BTN_STYLE_PR, &style_btn_pr); lv_obj_t *labelOk = lv_label_create_empty(btnOk);
lv_obj_t *labelOk = lv_label_create(btnOk, NULL);
lv_label_set_text(labelOk, print_file_dialog_menu.confirm); lv_label_set_text(labelOk, print_file_dialog_menu.confirm);
} }
} }
@ -365,25 +363,22 @@ void lv_draw_dialog(uint8_t type) {
lv_obj_set_pos(btnCancel, BTN_OK_X+90, BTN_OK_Y); lv_obj_set_pos(btnCancel, BTN_OK_X+90, BTN_OK_Y);
lv_obj_set_size(btnCancel, 100, 50); lv_obj_set_size(btnCancel, 100, 50);
lv_obj_set_event_cb(btnCancel, btn_cancel_event_cb); lv_obj_set_event_cb(btnCancel, btn_cancel_event_cb);
lv_btn_set_style(btnCancel, LV_BTN_STYLE_REL, &style_btn_rel); lv_btn_use_button_style(btnCancel);
lv_btn_set_style(btnCancel, LV_BTN_STYLE_PR, &style_btn_pr); lv_obj_t *labelCancel = lv_label_create_empty(btnCancel);
lv_obj_t *labelCancel = lv_label_create(btnCancel, NULL);
lv_label_set_text(labelCancel, print_file_dialog_menu.cancle); lv_label_set_text(labelCancel, print_file_dialog_menu.cancle);
tempText1 = lv_label_create(scr, NULL); tempText1 = lv_label_create_empty(scr);
lv_obj_set_style(tempText1, &tft_style_label_rel);
filament_sprayer_temp(); filament_sprayer_temp();
} }
else if (uiCfg.dialogType == DIALOG_TYPE_FILAMENT_LOAD_COMPLETED else if (uiCfg.dialogType == DIALOG_TYPE_FILAMENT_LOAD_COMPLETED
|| uiCfg.dialogType == DIALOG_TYPE_FILAMENT_UNLOAD_COMPLETED || uiCfg.dialogType == DIALOG_TYPE_FILAMENT_UNLOAD_COMPLETED
) { ) {
btnOk = lv_btn_create(scr, NULL); btnOk = lv_btn_create(scr, NULL);
lv_obj_set_pos(btnOk, BTN_OK_X+90, BTN_OK_Y); lv_obj_set_pos(btnOk, BTN_OK_X + 90, BTN_OK_Y);
lv_obj_set_size(btnOk, 100, 50); lv_obj_set_size(btnOk, 100, 50);
lv_obj_set_event_cb(btnOk, btn_ok_event_cb); lv_obj_set_event_cb(btnOk, btn_ok_event_cb);
lv_btn_set_style(btnOk, LV_BTN_STYLE_REL, &style_btn_rel); lv_btn_use_button_style(btnOk);
lv_btn_set_style(btnOk, LV_BTN_STYLE_PR, &style_btn_pr); lv_obj_t *labelOk = lv_label_create_empty(btnOk);
lv_obj_t *labelOk = lv_label_create(btnOk, NULL);
lv_label_set_text(labelOk, print_file_dialog_menu.confirm); lv_label_set_text(labelOk, print_file_dialog_menu.confirm);
} }
else if (uiCfg.dialogType == DIALOG_TYPE_FILAMENT_LOADING else if (uiCfg.dialogType == DIALOG_TYPE_FILAMENT_LOADING
@ -393,9 +388,8 @@ void lv_draw_dialog(uint8_t type) {
lv_obj_set_pos(btnCancel, BTN_OK_X+90, BTN_OK_Y); lv_obj_set_pos(btnCancel, BTN_OK_X+90, BTN_OK_Y);
lv_obj_set_size(btnCancel, 100, 50); lv_obj_set_size(btnCancel, 100, 50);
lv_obj_set_event_cb(btnCancel, btn_cancel_event_cb); lv_obj_set_event_cb(btnCancel, btn_cancel_event_cb);
lv_btn_set_style(btnCancel, LV_BTN_STYLE_REL, &style_btn_rel); lv_btn_use_button_style(btnCancel);
lv_btn_set_style(btnCancel, LV_BTN_STYLE_PR, &style_btn_pr); lv_obj_t *labelCancel = lv_label_create_empty(btnCancel);
lv_obj_t *labelCancel = lv_label_create(btnCancel, NULL);
lv_label_set_text(labelCancel, print_file_dialog_menu.cancle); lv_label_set_text(labelCancel, print_file_dialog_menu.cancle);
filament_bar = lv_bar_create(scr, NULL); filament_bar = lv_bar_create(scr, NULL);
@ -410,17 +404,15 @@ void lv_draw_dialog(uint8_t type) {
lv_obj_set_pos(btnOk, BTN_OK_X, BTN_OK_Y); // Set its position 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_size(btnOk, 100, 50); // Set its size
lv_obj_set_event_cb(btnOk, btn_ok_event_cb); 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_use_button_style(btnOk);
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_empty(btnOk); // Add a label to the button
lv_obj_t *labelOk = lv_label_create(btnOk, NULL); // Add a label to the button
btnCancel = lv_btn_create(scr, NULL); // Add a button the current screen 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_pos(btnCancel, BTN_CANCEL_X, BTN_CANCEL_Y); // Set its position
lv_obj_set_size(btnCancel, 100, 50); // Set its size lv_obj_set_size(btnCancel, 100, 50); // Set its size
lv_obj_set_event_cb(btnCancel, btn_cancel_event_cb); 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_use_button_style(btnCancel);
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_empty(btnCancel); // Add a label to the button
lv_obj_t *labelCancel = lv_label_create(btnCancel, NULL); // Add a label to the button
if (uiCfg.dialogType == DIALOG_PAUSE_MESSAGE_OPTION) { if (uiCfg.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
@ -435,10 +427,7 @@ void lv_draw_dialog(uint8_t type) {
lv_label_set_text(labelDialog, print_file_dialog_menu.print_file); lv_label_set_text(labelDialog, print_file_dialog_menu.print_file);
lv_obj_align(labelDialog, NULL, LV_ALIGN_CENTER, 0, -20); lv_obj_align(labelDialog, NULL, LV_ALIGN_CENTER, 0, -20);
lv_obj_t *labelFile = lv_label_create(scr, NULL); lv_obj_t *labelFile = lv_label_create(scr, list_file.long_name[sel_id]);
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); lv_obj_align(labelFile, NULL, LV_ALIGN_CENTER, 0, -60);
} }
else if (uiCfg.dialogType == DIALOG_TYPE_STOP) { else if (uiCfg.dialogType == DIALOG_TYPE_STOP) {
@ -558,7 +547,6 @@ void lv_draw_dialog(uint8_t type) {
lv_label_set_text(labelDialog, buf); lv_label_set_text(labelDialog, buf);
lv_obj_align(labelDialog, NULL, LV_ALIGN_CENTER, 0, -20); lv_obj_align(labelDialog, NULL, LV_ALIGN_CENTER, 0, -20);
} }
} }
#endif //USE_WIFI_FUNCTION #endif //USE_WIFI_FUNCTION
@ -634,10 +622,8 @@ void filament_dialog_handle() {
planner.synchronize(); planner.synchronize();
uiCfg.filament_loading_time_flg = 1; uiCfg.filament_loading_time_flg = 1;
uiCfg.filament_loading_time_cnt = 0; uiCfg.filament_loading_time_cnt = 0;
ZERO(public_buf_m); sprintf_P(public_buf_m, PSTR("T%d\nG91\nG1 E%d F%d\nG90"), uiCfg.curSprayerChoose, gCfgItems.filamentchange_load_length, gCfgItems.filamentchange_load_speed);
sprintf_P(public_buf_m,PSTR("T%d\nG91\nG1 E%d F%d\nG90"),uiCfg.curSprayerChoose,gCfgItems.filamentchange_load_length,gCfgItems.filamentchange_load_speed); queue.inject(public_buf_m);
queue.inject_P(PSTR(public_buf_m));
//gcode.process_subcommands_now_P(PSTR(public_buf_m));
} }
if (uiCfg.filament_heat_completed_unload == 1) { if (uiCfg.filament_heat_completed_unload == 1) {
uiCfg.filament_heat_completed_unload = 0; uiCfg.filament_heat_completed_unload = 0;
@ -646,9 +632,8 @@ void filament_dialog_handle() {
planner.synchronize(); planner.synchronize();
uiCfg.filament_unloading_time_flg = 1; uiCfg.filament_unloading_time_flg = 1;
uiCfg.filament_unloading_time_cnt = 0; uiCfg.filament_unloading_time_cnt = 0;
ZERO(public_buf_m); sprintf_P(public_buf_m, PSTR("T%d\nG91\nG1 E-%d F%d\nG90"), uiCfg.curSprayerChoose, gCfgItems.filamentchange_unload_length, gCfgItems.filamentchange_unload_speed);
sprintf_P(public_buf_m,PSTR("T%d\nG91\nG1 E-%d F%d\nG90"),uiCfg.curSprayerChoose,gCfgItems.filamentchange_unload_length,gCfgItems.filamentchange_unload_speed); queue.inject(public_buf_m);
queue.inject_P(PSTR(public_buf_m));
} }
if (((abs((int)((int)thermalManager.temp_hotend[uiCfg.curSprayerChoose].celsius - gCfgItems.filament_limit_temper)) <= 1) if (((abs((int)((int)thermalManager.temp_hotend[uiCfg.curSprayerChoose].celsius - gCfgItems.filament_limit_temper)) <= 1)

View File

@ -111,9 +111,9 @@ static void event_handler(lv_obj_t * obj, lv_event_t event) {
void lv_draw_eeprom_settings(void) { void lv_draw_eeprom_settings(void) {
lv_obj_t *buttonBack, *label_Back; lv_obj_t *buttonBack, *label_Back;
lv_obj_t *buttonStore,*labelStore,*buttonStoreNarrow; lv_obj_t *buttonStore, *labelStore;
//lv_obj_t *buttonRead,*labelRead,*buttonReadNarrow; //lv_obj_t *buttonRead,*labelRead,*buttonReadNarrow;
lv_obj_t *buttonRevert, *labelRevert, *buttonRevertNarrow; lv_obj_t *buttonRevert, *labelRevert;
lv_obj_t * line1, * line2; //* line3; lv_obj_t * line1, * line2; //* line3;
if (disp_state_stack._disp_state[disp_state_stack._disp_index] != EEPROM_SETTINGS_UI) { if (disp_state_stack._disp_state[disp_state_stack._disp_index] != EEPROM_SETTINGS_UI) {
disp_state_stack._disp_index++; disp_state_stack._disp_index++;
@ -127,10 +127,7 @@ void lv_draw_eeprom_settings(void) {
lv_scr_load(scr); lv_scr_load(scr);
lv_obj_clean(scr); lv_obj_clean(scr);
lv_obj_t * title = lv_label_create(scr, NULL); (void)lv_label_create(scr, TITLE_XPOS, TITLE_YPOS, creat_title_text());
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());
lv_refr_now(lv_refr_get_disp_refreshing()); lv_refr_now(lv_refr_get_disp_refreshing());
@ -139,19 +136,11 @@ void lv_draw_eeprom_settings(void) {
lv_obj_set_size(buttonRevert, PARA_UI_SIZE_X, PARA_UI_SIZE_Y); /*Set its size*/ lv_obj_set_size(buttonRevert, PARA_UI_SIZE_X, PARA_UI_SIZE_Y); /*Set its size*/
//lv_obj_set_event_cb(buttonMotor, event_handler); //lv_obj_set_event_cb(buttonMotor, event_handler);
lv_obj_set_event_cb_mks(buttonRevert, event_handler, ID_EEPROM_REVERT, NULL, 0); lv_obj_set_event_cb_mks(buttonRevert, event_handler, ID_EEPROM_REVERT, NULL, 0);
lv_btn_set_style(buttonRevert, LV_BTN_STYLE_REL, &tft_style_label_rel); /*Set the button's released style*/ lv_btn_use_label_style(buttonRevert);
lv_btn_set_style(buttonRevert, LV_BTN_STYLE_PR, &tft_style_label_pre); /*Set the button's pressed style*/
lv_btn_set_layout(buttonRevert, LV_LAYOUT_OFF); lv_btn_set_layout(buttonRevert, LV_LAYOUT_OFF);
labelRevert = lv_label_create(buttonRevert, NULL); /*Add a label to the button*/ labelRevert = lv_label_create_empty(buttonRevert); /*Add a label to the button*/
buttonRevertNarrow = lv_imgbtn_create(scr, NULL); (void)lv_imgbtn_create(scr, "F:/bmp_arrow.bin", PARA_UI_POS_X + PARA_UI_SIZE_X, PARA_UI_POS_Y + PARA_UI_ARROW_V, event_handler, ID_EEPROM_REVERT_ARROW);
lv_obj_set_pos(buttonRevertNarrow, PARA_UI_POS_X + PARA_UI_SIZE_X, PARA_UI_POS_Y + PARA_UI_ARROW_V);
lv_obj_set_event_cb_mks(buttonRevertNarrow, event_handler, ID_EEPROM_REVERT_ARROW, NULL, 0);
lv_imgbtn_set_src(buttonRevertNarrow, LV_BTN_STATE_REL, "F:/bmp_arrow.bin");
lv_imgbtn_set_src(buttonRevertNarrow, LV_BTN_STATE_PR, "F:/bmp_arrow.bin");
lv_imgbtn_set_style(buttonRevertNarrow, LV_BTN_STATE_PR, &tft_style_label_pre);
lv_imgbtn_set_style(buttonRevertNarrow, LV_BTN_STATE_REL, &tft_style_label_rel);
lv_btn_set_layout(buttonRevertNarrow, LV_LAYOUT_OFF);
//line3 = lv_line_create(scr, NULL); //line3 = lv_line_create(scr, NULL);
//lv_ex_line(line3,line_points[2]); //lv_ex_line(line3,line_points[2]);
@ -163,33 +152,17 @@ void lv_draw_eeprom_settings(void) {
lv_obj_set_size(buttonStore, PARA_UI_SIZE_X, PARA_UI_SIZE_Y); /*Set its size*/ lv_obj_set_size(buttonStore, PARA_UI_SIZE_X, PARA_UI_SIZE_Y); /*Set its size*/
//lv_obj_set_event_cb(buttonMotor, event_handler); //lv_obj_set_event_cb(buttonMotor, event_handler);
lv_obj_set_event_cb_mks(buttonStore, event_handler, ID_EEPROM_STORE, NULL, 0); lv_obj_set_event_cb_mks(buttonStore, event_handler, ID_EEPROM_STORE, NULL, 0);
lv_btn_set_style(buttonStore, LV_BTN_STYLE_REL, &tft_style_label_rel); /*Set the button's released style*/ lv_btn_use_label_style(buttonStore);
lv_btn_set_style(buttonStore, LV_BTN_STYLE_PR, &tft_style_label_pre); /*Set the button's pressed style*/
lv_btn_set_layout(buttonStore, LV_LAYOUT_OFF); lv_btn_set_layout(buttonStore, LV_LAYOUT_OFF);
labelStore = lv_label_create(buttonStore, NULL); /*Add a label to the button*/ labelStore = lv_label_create_empty(buttonStore); /*Add a label to the button*/
buttonStoreNarrow = lv_imgbtn_create(scr, NULL); (void)lv_imgbtn_create(scr, "F:/bmp_arrow.bin", PARA_UI_POS_X + PARA_UI_SIZE_X, PARA_UI_POS_Y * 2 + PARA_UI_ARROW_V, event_handler, ID_EEPROM_STORE_ARROW);
lv_obj_set_pos(buttonStoreNarrow, PARA_UI_POS_X + PARA_UI_SIZE_X, PARA_UI_POS_Y * 2 + PARA_UI_ARROW_V);
lv_obj_set_event_cb_mks(buttonStoreNarrow, event_handler, ID_EEPROM_STORE_ARROW, NULL, 0);
lv_imgbtn_set_src(buttonStoreNarrow, LV_BTN_STATE_REL, "F:/bmp_arrow.bin");
lv_imgbtn_set_src(buttonStoreNarrow, LV_BTN_STATE_PR, "F:/bmp_arrow.bin");
lv_imgbtn_set_style(buttonStoreNarrow, LV_BTN_STATE_PR, &tft_style_label_pre);
lv_imgbtn_set_style(buttonStoreNarrow, LV_BTN_STATE_REL, &tft_style_label_rel);
lv_btn_set_layout(buttonStoreNarrow, LV_LAYOUT_OFF);
line2 = lv_line_create(scr, NULL); line2 = lv_line_create(scr, NULL);
lv_ex_line(line2, line_points[1]); lv_ex_line(line2, line_points[1]);
buttonBack = lv_imgbtn_create(scr, NULL); buttonBack = lv_imgbtn_create(scr, "F:/bmp_back70x40.bin", PARA_UI_BACL_POS_X, PARA_UI_BACL_POS_Y, event_handler, ID_EEPROM_RETURN);
lv_obj_set_event_cb_mks(buttonBack, event_handler, ID_EEPROM_RETURN, NULL, 0); label_Back = lv_label_create_empty(buttonBack);
lv_imgbtn_set_src(buttonBack, LV_BTN_STATE_REL, "F:/bmp_back70x40.bin");
lv_imgbtn_set_src(buttonBack, LV_BTN_STATE_PR, "F:/bmp_back70x40.bin");
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);
lv_obj_set_pos(buttonBack, PARA_UI_BACL_POS_X, PARA_UI_BACL_POS_Y);
lv_btn_set_layout(buttonBack, LV_LAYOUT_OFF);
label_Back = lv_label_create(buttonBack, NULL);
if (gCfgItems.multiple_language) { if (gCfgItems.multiple_language) {
lv_label_set_text(label_Back, common_menu.text_back); lv_label_set_text(label_Back, common_menu.text_back);

View File

@ -55,8 +55,7 @@ static void event_handler(lv_obj_t * obj, lv_event_t event) {
} }
else if (event == LV_EVENT_RELEASED) { else if (event == LV_EVENT_RELEASED) {
gCfgItems.encoder_enable ^= true; gCfgItems.encoder_enable ^= true;
lv_imgbtn_set_src(buttonEncoderState, LV_BTN_STATE_REL, gCfgItems.encoder_enable ? "F:/bmp_enable.bin" : "F:/bmp_disable.bin"); lv_imgbtn_set_src_both(buttonEncoderState, gCfgItems.encoder_enable ? "F:/bmp_enable.bin" : "F:/bmp_disable.bin");
lv_imgbtn_set_src(buttonEncoderState, LV_BTN_STATE_PR, gCfgItems.encoder_enable ? "F:/bmp_enable.bin" : "F:/bmp_disable.bin");
lv_label_set_text(labelEncoderState, machine_menu.enable); lv_label_set_text(labelEncoderState, machine_menu.enable);
update_spi_flash(); update_spi_flash();
} }
@ -82,43 +81,20 @@ void lv_draw_encoder_settings(void) {
lv_scr_load(scr); lv_scr_load(scr);
lv_obj_clean(scr); lv_obj_clean(scr);
lv_obj_t * title = lv_label_create(scr, NULL); (void)lv_label_create(scr, TITLE_XPOS, TITLE_YPOS, machine_menu.EncoderConfTitle);
lv_obj_set_style(title, &tft_style_label_rel);
lv_obj_set_pos(title, TITLE_XPOS, TITLE_YPOS);
lv_label_set_text(title, machine_menu.EncoderConfTitle);
lv_refr_now(lv_refr_get_disp_refreshing()); lv_refr_now(lv_refr_get_disp_refreshing());
labelEncoderTips = lv_label_create(scr, NULL); labelEncoderTips = lv_label_create(scr, PARA_UI_POS_X, PARA_UI_POS_Y + 10, machine_menu.EncoderConfText);
lv_obj_set_style(labelEncoderTips, &tft_style_label_rel);
lv_obj_set_pos(labelEncoderTips, PARA_UI_POS_X, PARA_UI_POS_Y + 10);
lv_label_set_text(labelEncoderTips, machine_menu.EncoderConfText);
buttonEncoderState = lv_imgbtn_create(scr, NULL); buttonEncoderState = lv_imgbtn_create(scr, gCfgItems.encoder_enable ? "F:/bmp_enable.bin" : "F:/bmp_disable.bin", PARA_UI_STATE_POS_X, PARA_UI_POS_Y + PARA_UI_STATE_V, event_handler, ID_ENCODER_STATE);
lv_obj_set_pos(buttonEncoderState, PARA_UI_STATE_POS_X, PARA_UI_POS_Y + PARA_UI_STATE_V); labelEncoderState = lv_label_create_empty(buttonEncoderState);
lv_imgbtn_set_src(buttonEncoderState, LV_BTN_STATE_REL, gCfgItems.encoder_enable ? "F:/bmp_enable.bin" : "F:/bmp_disable.bin");
lv_imgbtn_set_src(buttonEncoderState, LV_BTN_STATE_PR, gCfgItems.encoder_enable ? "F:/bmp_enable.bin" : "F:/bmp_disable.bin");
lv_obj_set_event_cb_mks(buttonEncoderState, event_handler, ID_ENCODER_STATE, NULL, 0);
lv_imgbtn_set_style(buttonEncoderState, LV_BTN_STATE_PR, &tft_style_label_pre);
lv_imgbtn_set_style(buttonEncoderState, LV_BTN_STATE_REL, &tft_style_label_rel);
lv_btn_set_layout(buttonEncoderState, LV_LAYOUT_OFF);
labelEncoderState = lv_label_create(buttonEncoderState, NULL);
line1 = lv_line_create(scr, NULL); line1 = lv_line_create(scr, NULL);
lv_ex_line(line1, line_points[0]); lv_ex_line(line1, line_points[0]);
buttonBack = lv_imgbtn_create(scr, NULL); buttonBack = lv_imgbtn_create(scr, "F:/bmp_back70x40.bin", PARA_UI_BACL_POS_X, PARA_UI_BACL_POS_Y, event_handler, ID_ENCODER_RETURN);
lv_obj_set_event_cb_mks(buttonBack, event_handler, ID_ENCODER_RETURN, NULL, 0); label_Back = lv_label_create_empty(buttonBack);
lv_imgbtn_set_src(buttonBack, LV_BTN_STATE_REL, "F:/bmp_back70x40.bin");
lv_imgbtn_set_src(buttonBack, LV_BTN_STATE_PR, "F:/bmp_back70x40.bin");
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);
lv_obj_set_pos(buttonBack, PARA_UI_BACL_POS_X, PARA_UI_BACL_POS_Y);
lv_btn_set_layout(buttonBack, LV_LAYOUT_OFF);
label_Back = lv_label_create(buttonBack, NULL);
lv_label_set_text(labelEncoderState, gCfgItems.encoder_enable ? machine_menu.enable : machine_menu.disable); lv_label_set_text(labelEncoderState, gCfgItems.encoder_enable ? machine_menu.enable : machine_menu.disable);
lv_obj_align(labelEncoderState, buttonEncoderState, LV_ALIGN_CENTER, 0, 0); lv_obj_align(labelEncoderState, buttonEncoderState, LV_ALIGN_CENTER, 0, 0);

View File

@ -56,20 +56,14 @@ void lv_draw_error_message(PGM_P const msg) {
lv_refr_now(lv_refr_get_disp_refreshing()); lv_refr_now(lv_refr_get_disp_refreshing());
if (msg) { if (msg) {
message = lv_label_create(scr, NULL); message = lv_label_create(scr, msg);
lv_obj_set_style(message, &tft_style_label_rel);
lv_label_set_text(message, msg);
lv_obj_align(message, NULL, LV_ALIGN_CENTER, 0, -50); lv_obj_align(message, NULL, LV_ALIGN_CENTER, 0, -50);
} }
kill_message = lv_label_create(scr, NULL); kill_message = lv_label_create(scr, "PRINTER HALTED");
lv_obj_set_style(kill_message, &tft_style_label_rel);
lv_label_set_text(kill_message, "PRINTER HALTED");
lv_obj_align(kill_message, NULL, LV_ALIGN_CENTER, 0, -10); lv_obj_align(kill_message, NULL, LV_ALIGN_CENTER, 0, -10);
reset_tips = lv_label_create(scr, NULL); reset_tips = lv_label_create(scr, "Please Reset");
lv_obj_set_style(reset_tips, &tft_style_label_rel);
lv_label_set_text(reset_tips, "Please Reset");
lv_obj_align(reset_tips, NULL, LV_ALIGN_CENTER, 0, 30); lv_obj_align(reset_tips, NULL, LV_ALIGN_CENTER, 0, 30);
lv_task_handler(); lv_task_handler();

View File

@ -34,14 +34,14 @@
#include "../../../../gcode/queue.h" #include "../../../../gcode/queue.h"
#include "../../../../inc/MarlinConfig.h" #include "../../../../inc/MarlinConfig.h"
static lv_obj_t * scr; static lv_obj_t *scr;
extern lv_group_t* g; extern lv_group_t *g;
static lv_obj_t * buttoType, *buttonStep, *buttonSpeed; static lv_obj_t *buttonType, *buttonStep, *buttonSpeed;
static lv_obj_t *labelType; static lv_obj_t *labelType;
static lv_obj_t *labelStep; static lv_obj_t *labelStep;
static lv_obj_t *labelSpeed; static lv_obj_t *labelSpeed;
static lv_obj_t * tempText; static lv_obj_t *tempText;
static lv_obj_t * ExtruText; static lv_obj_t *ExtruText;
#define ID_E_ADD 1 #define ID_E_ADD 1
#define ID_E_DEC 2 #define ID_E_DEC 2
@ -165,75 +165,27 @@ void lv_draw_extrusion(void) {
lv_scr_load(scr); lv_scr_load(scr);
lv_obj_clean(scr); lv_obj_clean(scr);
lv_obj_t * title = lv_label_create(scr, NULL); (void)lv_label_create(scr, TITLE_XPOS, TITLE_YPOS, creat_title_text());
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());
lv_refr_now(lv_refr_get_disp_refreshing()); lv_refr_now(lv_refr_get_disp_refreshing());
// Create image buttons // Create image buttons
buttonAdd = lv_imgbtn_create(scr, NULL); buttonAdd = lv_imgbtn_create(scr, "F:/bmp_in.bin", INTERVAL_V, titleHeight, event_handler, ID_E_ADD);
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);
lv_obj_set_event_cb_mks(buttonAdd, event_handler, ID_E_ADD, NULL, 0);
lv_imgbtn_set_src(buttonAdd, LV_BTN_STATE_REL, "F:/bmp_in.bin");
lv_imgbtn_set_src(buttonAdd, LV_BTN_STATE_PR, "F:/bmp_in.bin");
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); lv_obj_clear_protect(buttonAdd, LV_PROTECT_FOLLOW);
#if 1 buttonDec = lv_imgbtn_create(scr, "F:/bmp_out.bin", BTN_X_PIXEL * 3 + INTERVAL_V * 4, titleHeight, event_handler, ID_E_DEC);
lv_obj_set_event_cb_mks(buttonDec, event_handler, ID_E_DEC, NULL, 0); buttonType = lv_imgbtn_create(scr, NULL, INTERVAL_V, BTN_Y_PIXEL + INTERVAL_H + titleHeight, event_handler, ID_E_TYPE);
lv_imgbtn_set_src(buttonDec, LV_BTN_STATE_REL, "F:/bmp_out.bin"); buttonStep = lv_imgbtn_create(scr, NULL, BTN_X_PIXEL + INTERVAL_V * 2, BTN_Y_PIXEL + INTERVAL_H + titleHeight, event_handler, ID_E_STEP);
lv_imgbtn_set_src(buttonDec, LV_BTN_STATE_PR, "F:/bmp_out.bin"); buttonSpeed = lv_imgbtn_create(scr, NULL, BTN_X_PIXEL * 2 + INTERVAL_V * 3, BTN_Y_PIXEL + INTERVAL_H + titleHeight, event_handler, ID_E_SPEED);
lv_imgbtn_set_style(buttonDec, LV_BTN_STATE_PR, &tft_style_label_pre); buttonBack = lv_imgbtn_create(scr, "F:/bmp_return.bin", BTN_X_PIXEL * 3 + INTERVAL_V * 4, BTN_Y_PIXEL + INTERVAL_H + titleHeight, event_handler, ID_E_RETURN);
lv_imgbtn_set_style(buttonDec, LV_BTN_STATE_REL, &tft_style_label_rel);
lv_obj_set_event_cb_mks(buttoType, event_handler, ID_E_TYPE, NULL, 0);
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_obj_set_event_cb_mks(buttonStep, event_handler, ID_E_STEP, NULL, 0);
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_obj_set_event_cb_mks(buttonSpeed, event_handler, ID_E_SPEED, NULL, 0);
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, NULL, 0);
lv_imgbtn_set_src(buttonBack, LV_BTN_STATE_REL, "F:/bmp_return.bin");
lv_imgbtn_set_src(buttonBack, LV_BTN_STATE_PR, "F:/bmp_return.bin");
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(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);
// Create labels on the image buttons // Create labels on the image buttons
lv_btn_set_layout(buttonAdd, LV_LAYOUT_OFF); lv_obj_t *labelAdd = lv_label_create_empty(buttonAdd);
lv_btn_set_layout(buttonDec, LV_LAYOUT_OFF); lv_obj_t *labelDec = lv_label_create_empty(buttonDec);
lv_btn_set_layout(buttoType, LV_LAYOUT_OFF); labelType = lv_label_create_empty(buttonType);
lv_btn_set_layout(buttonStep, LV_LAYOUT_OFF); labelStep = lv_label_create_empty(buttonStep);
lv_btn_set_layout(buttonSpeed, LV_LAYOUT_OFF); labelSpeed = lv_label_create_empty(buttonSpeed);
lv_btn_set_layout(buttonBack, LV_LAYOUT_OFF); lv_obj_t *label_Back = lv_label_create_empty(buttonBack);
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);
labelSpeed = lv_label_create(buttonSpeed, NULL);
lv_obj_t *label_Back = lv_label_create(buttonBack, NULL);
if (gCfgItems.multiple_language) { if (gCfgItems.multiple_language) {
lv_label_set_text(labelAdd, extrude_menu.in); lv_label_set_text(labelAdd, extrude_menu.in);
@ -250,7 +202,7 @@ void lv_draw_extrusion(void) {
if (gCfgItems.encoder_enable) { if (gCfgItems.encoder_enable) {
lv_group_add_obj(g, buttonAdd); lv_group_add_obj(g, buttonAdd);
lv_group_add_obj(g, buttonDec); lv_group_add_obj(g, buttonDec);
lv_group_add_obj(g, buttoType); lv_group_add_obj(g, buttonType);
lv_group_add_obj(g, buttonStep); lv_group_add_obj(g, buttonStep);
lv_group_add_obj(g, buttonSpeed); lv_group_add_obj(g, buttonSpeed);
lv_group_add_obj(g, buttonBack); lv_group_add_obj(g, buttonBack);
@ -261,47 +213,39 @@ void lv_draw_extrusion(void) {
disp_ext_step(); disp_ext_step();
disp_ext_speed(); disp_ext_speed();
tempText = lv_label_create(scr, NULL); tempText = lv_label_create_empty(scr);
lv_obj_set_style(tempText, &tft_style_label_rel); lv_obj_set_style(tempText, &tft_style_label_rel);
disp_hotend_temp(); disp_hotend_temp();
ExtruText = lv_label_create(scr, NULL); ExtruText = lv_label_create_empty(scr);
lv_obj_set_style(ExtruText, &tft_style_label_rel); lv_obj_set_style(ExtruText, &tft_style_label_rel);
disp_extru_amount(); disp_extru_amount();
} }
void disp_ext_type() { void disp_ext_type() {
if (uiCfg.curSprayerChoose == 1) { if (uiCfg.curSprayerChoose == 1) {
lv_imgbtn_set_src(buttoType, LV_BTN_STATE_REL, "F:/bmp_extru2.bin"); lv_imgbtn_set_src_both(buttonType, "F:/bmp_extru2.bin");
lv_imgbtn_set_src(buttoType, LV_BTN_STATE_PR, "F:/bmp_extru2.bin");
if (gCfgItems.multiple_language) { if (gCfgItems.multiple_language) {
lv_label_set_text(labelType, extrude_menu.ext2); lv_label_set_text(labelType, extrude_menu.ext2);
lv_obj_align(labelType, buttoType, LV_ALIGN_IN_BOTTOM_MID, 0, BUTTON_TEXT_Y_OFFSET); lv_obj_align(labelType, buttonType, LV_ALIGN_IN_BOTTOM_MID, 0, BUTTON_TEXT_Y_OFFSET);
} }
} }
else { else {
lv_imgbtn_set_src(buttoType, LV_BTN_STATE_REL, "F:/bmp_extru1.bin"); lv_imgbtn_set_src_both(buttonType, "F:/bmp_extru1.bin");
lv_imgbtn_set_src(buttoType, LV_BTN_STATE_PR, "F:/bmp_extru1.bin");
if (gCfgItems.multiple_language) { if (gCfgItems.multiple_language) {
lv_label_set_text(labelType, extrude_menu.ext1); lv_label_set_text(labelType, extrude_menu.ext1);
lv_obj_align(labelType, buttoType, LV_ALIGN_IN_BOTTOM_MID, 0, BUTTON_TEXT_Y_OFFSET); lv_obj_align(labelType, buttonType, LV_ALIGN_IN_BOTTOM_MID, 0, BUTTON_TEXT_Y_OFFSET);
} }
} }
} }
void disp_ext_speed() { void disp_ext_speed() {
if (uiCfg.extruSpeed == 20) { if (uiCfg.extruSpeed == 20)
lv_imgbtn_set_src(buttonSpeed, LV_BTN_STATE_REL, "F:/bmp_speed_high.bin"); lv_imgbtn_set_src_both(buttonSpeed, "F:/bmp_speed_high.bin");
lv_imgbtn_set_src(buttonSpeed, LV_BTN_STATE_PR, "F:/bmp_speed_high.bin"); else if (uiCfg.extruSpeed == 1)
} lv_imgbtn_set_src_both(buttonSpeed, "F:/bmp_speed_slow.bin");
else if (uiCfg.extruSpeed == 1) { else
lv_imgbtn_set_src(buttonSpeed, LV_BTN_STATE_REL, "F:/bmp_speed_slow.bin"); lv_imgbtn_set_src_both(buttonSpeed, "F:/bmp_speed_normal.bin");
lv_imgbtn_set_src(buttonSpeed, LV_BTN_STATE_PR, "F:/bmp_speed_slow.bin");
}
else {
lv_imgbtn_set_src(buttonSpeed, LV_BTN_STATE_REL, "F:/bmp_speed_normal.bin");
lv_imgbtn_set_src(buttonSpeed, LV_BTN_STATE_PR, "F:/bmp_speed_normal.bin");
}
if (gCfgItems.multiple_language) { if (gCfgItems.multiple_language) {
if (uiCfg.extruSpeed == 20) { if (uiCfg.extruSpeed == 20) {
@ -323,7 +267,7 @@ void disp_hotend_temp() {
char buf[20] = {0}; char buf[20] = {0};
public_buf_l[0] = '\0'; public_buf_l[0] = '\0';
strcat(public_buf_l, extrude_menu.temper_text); strcat(public_buf_l, extrude_menu.temper_text);
sprintf(buf, extrude_menu.temp_value, (int)thermalManager.temp_hotend[uiCfg.curSprayerChoose].celsius, (int)thermalManager.temp_hotend[uiCfg.curSprayerChoose].target); sprintf(buf, extrude_menu.temp_value, (int)thermalManager.temp_hotend[uiCfg.curSprayerChoose].celsius, (int)thermalManager.temp_hotend[uiCfg.curSprayerChoose].target);
strcat(public_buf_l, buf); strcat(public_buf_l, buf);
lv_label_set_text(tempText, public_buf_l); lv_label_set_text(tempText, public_buf_l);
lv_obj_align(tempText, NULL, LV_ALIGN_CENTER, 0, -50); lv_obj_align(tempText, NULL, LV_ALIGN_CENTER, 0, -50);
@ -364,18 +308,12 @@ void disp_extru_amount() {
} }
void disp_ext_step() { void disp_ext_step() {
if (uiCfg.extruStep == 1) { if (uiCfg.extruStep == 1)
lv_imgbtn_set_src(buttonStep, LV_BTN_STATE_REL, "F:/bmp_step1_mm.bin"); lv_imgbtn_set_src_both(buttonStep, "F:/bmp_step1_mm.bin");
lv_imgbtn_set_src(buttonStep, LV_BTN_STATE_PR, "F:/bmp_step1_mm.bin"); else if (uiCfg.extruStep == 5)
} lv_imgbtn_set_src_both(buttonStep, "F:/bmp_step5_mm.bin");
else if (uiCfg.extruStep == 5) { else if (uiCfg.extruStep == 10)
lv_imgbtn_set_src(buttonStep, LV_BTN_STATE_REL, "F:/bmp_step5_mm.bin"); lv_imgbtn_set_src_both(buttonStep, "F:/bmp_step10_mm.bin");
lv_imgbtn_set_src(buttonStep, LV_BTN_STATE_PR, "F:/bmp_step5_mm.bin");
}
else if (uiCfg.extruStep == 10) {
lv_imgbtn_set_src(buttonStep, LV_BTN_STATE_REL, "F:/bmp_step10_mm.bin");
lv_imgbtn_set_src(buttonStep, LV_BTN_STATE_PR, "F:/bmp_step10_mm.bin");
}
if (gCfgItems.multiple_language) { if (gCfgItems.multiple_language) {
if (uiCfg.extruStep == 1) { if (uiCfg.extruStep == 1) {

View File

@ -132,82 +132,27 @@ void lv_draw_fan(void) {
lv_scr_load(scr); lv_scr_load(scr);
lv_obj_clean(scr); lv_obj_clean(scr);
lv_obj_t * title = lv_label_create(scr, NULL); (void)lv_label_create(scr, TITLE_XPOS, TITLE_YPOS, creat_title_text());
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());
lv_refr_now(lv_refr_get_disp_refreshing()); lv_refr_now(lv_refr_get_disp_refreshing());
// Create an Image button // Create an Image button
buttonAdd = lv_imgbtn_create(scr, NULL); buttonAdd = lv_imgbtn_create(scr, "F:/bmp_Add.bin", INTERVAL_V, titleHeight, event_handler, ID_F_ADD);
buttonDec = lv_imgbtn_create(scr, NULL);
buttonHigh = lv_imgbtn_create(scr, NULL);
buttonMid = lv_imgbtn_create(scr, NULL);
buttonOff = lv_imgbtn_create(scr, NULL);
buttonBack = lv_imgbtn_create(scr, NULL);
lv_obj_set_event_cb_mks(buttonAdd, event_handler, ID_F_ADD, NULL, 0);
lv_imgbtn_set_src(buttonAdd, LV_BTN_STATE_REL, "F:/bmp_Add.bin");
lv_imgbtn_set_src(buttonAdd, LV_BTN_STATE_PR, "F:/bmp_Add.bin");
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); lv_obj_clear_protect(buttonAdd, LV_PROTECT_FOLLOW);
#if 1 buttonDec = lv_imgbtn_create(scr, "F:/bmp_Dec.bin", BTN_X_PIXEL * 3 + INTERVAL_V * 4, titleHeight, event_handler, ID_F_DEC);
lv_obj_set_event_cb_mks(buttonDec, event_handler, ID_F_DEC, NULL, 0); buttonHigh = lv_imgbtn_create(scr, "F:/bmp_speed255.bin", INTERVAL_V, BTN_Y_PIXEL + INTERVAL_H + titleHeight, event_handler, ID_F_HIGH);
lv_imgbtn_set_src(buttonDec, LV_BTN_STATE_REL, "F:/bmp_Dec.bin"); buttonMid = lv_imgbtn_create(scr, "F:/bmp_speed127.bin", BTN_X_PIXEL + INTERVAL_V * 2, BTN_Y_PIXEL + INTERVAL_H + titleHeight, event_handler, ID_F_MID);
lv_imgbtn_set_src(buttonDec, LV_BTN_STATE_PR, "F:/bmp_Dec.bin"); buttonOff = lv_imgbtn_create(scr, "F:/bmp_speed0.bin", BTN_X_PIXEL * 2 + INTERVAL_V * 3, BTN_Y_PIXEL + INTERVAL_H + titleHeight, event_handler, ID_F_OFF);
lv_imgbtn_set_style(buttonDec, LV_BTN_STATE_PR, &tft_style_label_pre); buttonBack = lv_imgbtn_create(scr, "F:/bmp_return.bin", BTN_X_PIXEL * 3 + INTERVAL_V * 4, BTN_Y_PIXEL + INTERVAL_H + titleHeight, event_handler, ID_F_RETURN);
lv_imgbtn_set_style(buttonDec, LV_BTN_STATE_REL, &tft_style_label_rel);
lv_obj_set_event_cb_mks(buttonHigh, event_handler,ID_F_HIGH, NULL,0);
lv_imgbtn_set_src(buttonHigh, LV_BTN_STATE_REL, "F:/bmp_speed255.bin");
lv_imgbtn_set_src(buttonHigh, LV_BTN_STATE_PR, "F:/bmp_speed255.bin");
lv_imgbtn_set_style(buttonHigh, LV_BTN_STATE_PR, &tft_style_label_pre);
lv_imgbtn_set_style(buttonHigh, LV_BTN_STATE_REL, &tft_style_label_rel);
lv_obj_set_event_cb_mks(buttonMid, event_handler,ID_F_MID, NULL,0);
lv_imgbtn_set_src(buttonMid, LV_BTN_STATE_REL, "F:/bmp_speed127.bin");
lv_imgbtn_set_src(buttonMid, LV_BTN_STATE_PR, "F:/bmp_speed127.bin");
lv_imgbtn_set_style(buttonMid, LV_BTN_STATE_PR, &tft_style_label_pre);
lv_imgbtn_set_style(buttonMid, LV_BTN_STATE_REL, &tft_style_label_rel);
lv_obj_set_event_cb_mks(buttonOff, event_handler,ID_F_OFF, NULL,0);
lv_imgbtn_set_src(buttonOff, LV_BTN_STATE_REL, "F:/bmp_speed0.bin");
lv_imgbtn_set_src(buttonOff, LV_BTN_STATE_PR, "F:/bmp_speed0.bin");
lv_imgbtn_set_style(buttonOff, LV_BTN_STATE_PR, &tft_style_label_pre);
lv_imgbtn_set_style(buttonOff, LV_BTN_STATE_REL, &tft_style_label_rel);
lv_obj_set_event_cb_mks(buttonBack, event_handler,ID_F_RETURN, NULL,0);
lv_imgbtn_set_src(buttonBack, LV_BTN_STATE_REL, "F:/bmp_return.bin");
lv_imgbtn_set_src(buttonBack, LV_BTN_STATE_PR, "F:/bmp_return.bin");
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(buttonHigh, INTERVAL_V, BTN_Y_PIXEL + INTERVAL_H + titleHeight);
lv_obj_set_pos(buttonMid, BTN_X_PIXEL + INTERVAL_V * 2, BTN_Y_PIXEL + INTERVAL_H + titleHeight);
lv_obj_set_pos(buttonOff, 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 labels on the image buttons // Create labels on the image buttons
lv_btn_set_layout(buttonAdd, LV_LAYOUT_OFF); lv_obj_t *labelAdd = lv_label_create_empty(buttonAdd);
lv_btn_set_layout(buttonDec, LV_LAYOUT_OFF); lv_obj_t *labelDec = lv_label_create_empty(buttonDec);
lv_btn_set_layout(buttonHigh, LV_LAYOUT_OFF); lv_obj_t *labelHigh = lv_label_create_empty(buttonHigh);
lv_btn_set_layout(buttonMid, LV_LAYOUT_OFF); lv_obj_t *labelMid = lv_label_create_empty(buttonMid);
lv_btn_set_layout(buttonOff, LV_LAYOUT_OFF); lv_obj_t *labelOff = lv_label_create_empty(buttonOff);
lv_btn_set_layout(buttonBack, LV_LAYOUT_OFF); lv_obj_t *label_Back = lv_label_create_empty(buttonBack);
lv_obj_t *labelAdd = lv_label_create(buttonAdd, NULL);
lv_obj_t *labelDec = lv_label_create(buttonDec, NULL);
lv_obj_t *labelHigh = lv_label_create(buttonHigh, NULL);
lv_obj_t *labelMid = lv_label_create(buttonMid, NULL);
lv_obj_t *labelOff = lv_label_create(buttonOff, NULL);
lv_obj_t *label_Back = lv_label_create(buttonBack, NULL);
if (gCfgItems.multiple_language) { if (gCfgItems.multiple_language) {
lv_label_set_text(labelAdd, fan_menu.add); lv_label_set_text(labelAdd, fan_menu.add);
@ -239,7 +184,7 @@ void lv_draw_fan(void) {
} }
#endif #endif
fanText = lv_label_create(scr, NULL); fanText = lv_label_create_empty(scr);
lv_obj_set_style(fanText, &tft_style_label_rel); lv_obj_set_style(fanText, &tft_style_label_rel);
disp_fan_value(); disp_fan_value();
} }

View File

@ -32,11 +32,11 @@
#include "../../../../module/planner.h" #include "../../../../module/planner.h"
#include "../../../../inc/MarlinConfig.h" #include "../../../../inc/MarlinConfig.h"
extern lv_group_t * g; extern lv_group_t *g;
static lv_obj_t * scr; static lv_obj_t *scr;
static lv_obj_t *buttoType; static lv_obj_t *buttonType;
static lv_obj_t *labelType; static lv_obj_t *labelType;
static lv_obj_t * tempText1; static lv_obj_t *tempText1;
#define ID_FILAMNT_IN 1 #define ID_FILAMNT_IN 1
#define ID_FILAMNT_OUT 2 #define ID_FILAMNT_OUT 2
@ -144,57 +144,23 @@ void lv_draw_filament_change(void) {
lv_scr_load(scr); lv_scr_load(scr);
lv_obj_clean(scr); lv_obj_clean(scr);
lv_obj_t * title = lv_label_create(scr, NULL); (void)lv_label_create(scr, TITLE_XPOS, TITLE_YPOS, creat_title_text());
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());
lv_refr_now(lv_refr_get_disp_refreshing()); lv_refr_now(lv_refr_get_disp_refreshing());
// Create an Image button // Create an Image button
buttonIn = lv_imgbtn_create(scr, NULL); buttonIn = lv_imgbtn_create(scr, "F:/bmp_in.bin", INTERVAL_V, titleHeight, event_handler, ID_FILAMNT_IN);
buttonOut = lv_imgbtn_create(scr, NULL);
buttoType = lv_imgbtn_create(scr, NULL);
buttonBack = lv_imgbtn_create(scr, NULL);
lv_obj_set_event_cb_mks(buttonIn, event_handler, ID_FILAMNT_IN, NULL, 0);
lv_imgbtn_set_src(buttonIn, LV_BTN_STATE_REL, "F:/bmp_in.bin");
lv_imgbtn_set_src(buttonIn, LV_BTN_STATE_PR, "F:/bmp_in.bin");
lv_imgbtn_set_style(buttonIn, LV_BTN_STATE_PR, &tft_style_label_pre);
lv_imgbtn_set_style(buttonIn, LV_BTN_STATE_REL, &tft_style_label_rel);
lv_obj_clear_protect(buttonIn, LV_PROTECT_FOLLOW); lv_obj_clear_protect(buttonIn, LV_PROTECT_FOLLOW);
lv_obj_set_event_cb_mks(buttonOut, event_handler, ID_FILAMNT_OUT, NULL, 0); buttonOut = lv_imgbtn_create(scr, "F:/bmp_out.bin", BTN_X_PIXEL * 3 + INTERVAL_V * 4, titleHeight, event_handler, ID_FILAMNT_OUT);
lv_imgbtn_set_src(buttonOut, LV_BTN_STATE_REL, "F:/bmp_out.bin"); buttonType = lv_imgbtn_create(scr, NULL, INTERVAL_V, BTN_Y_PIXEL + INTERVAL_H + titleHeight, event_handler, ID_FILAMNT_TYPE);
lv_imgbtn_set_src(buttonOut, LV_BTN_STATE_PR, "F:/bmp_out.bin"); buttonBack = lv_imgbtn_create(scr, "F:/bmp_return.bin", BTN_X_PIXEL * 3 + INTERVAL_V * 4, BTN_Y_PIXEL + INTERVAL_H + titleHeight, event_handler, ID_FILAMNT_RETURN);
lv_imgbtn_set_style(buttonOut, LV_BTN_STATE_PR, &tft_style_label_pre);
lv_imgbtn_set_style(buttonOut, LV_BTN_STATE_REL, &tft_style_label_rel);
lv_obj_set_event_cb_mks(buttoType, event_handler, ID_FILAMNT_TYPE, NULL, 0);
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_obj_set_event_cb_mks(buttonBack, event_handler, ID_FILAMNT_RETURN, NULL, 0);
lv_imgbtn_set_src(buttonBack, LV_BTN_STATE_REL, "F:/bmp_return.bin");
lv_imgbtn_set_src(buttonBack, LV_BTN_STATE_PR, "F:/bmp_return.bin");
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);
lv_obj_set_pos(buttonIn, INTERVAL_V, titleHeight);
lv_obj_set_pos(buttonOut, 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(buttonBack, BTN_X_PIXEL * 3 + INTERVAL_V * 4, BTN_Y_PIXEL + INTERVAL_H + titleHeight);
// Create labels on the image buttons // Create labels on the image buttons
lv_btn_set_layout(buttonIn, LV_LAYOUT_OFF); lv_obj_t *labelIn = lv_label_create_empty(buttonIn);
lv_btn_set_layout(buttonOut, LV_LAYOUT_OFF); lv_obj_t *labelOut = lv_label_create_empty(buttonOut);
lv_btn_set_layout(buttoType, LV_LAYOUT_OFF); labelType = lv_label_create_empty(buttonType);
lv_btn_set_layout(buttonBack, LV_LAYOUT_OFF); lv_obj_t *label_Back = lv_label_create_empty(buttonBack);
lv_obj_t *labelIn = lv_label_create(buttonIn, NULL);
lv_obj_t *labelOut = lv_label_create(buttonOut, NULL);
labelType = lv_label_create(buttoType, NULL);
lv_obj_t *label_Back = lv_label_create(buttonBack, NULL);
if (gCfgItems.multiple_language) { if (gCfgItems.multiple_language) {
lv_label_set_text(labelIn, filament_menu.in); lv_label_set_text(labelIn, filament_menu.in);
@ -211,33 +177,31 @@ void lv_draw_filament_change(void) {
if (gCfgItems.encoder_enable) { if (gCfgItems.encoder_enable) {
lv_group_add_obj(g, buttonIn); lv_group_add_obj(g, buttonIn);
lv_group_add_obj(g, buttonOut); lv_group_add_obj(g, buttonOut);
lv_group_add_obj(g, buttoType); lv_group_add_obj(g, buttonType);
lv_group_add_obj(g, buttonBack); lv_group_add_obj(g, buttonBack);
} }
#endif #endif
disp_filament_type(); disp_filament_type();
tempText1 = lv_label_create(scr, NULL); tempText1 = lv_label_create_empty(scr);
lv_obj_set_style(tempText1, &tft_style_label_rel); lv_obj_set_style(tempText1, &tft_style_label_rel);
disp_filament_temp(); disp_filament_temp();
} }
void disp_filament_type() { void disp_filament_type() {
if (uiCfg.curSprayerChoose == 1) { if (uiCfg.curSprayerChoose == 1) {
lv_imgbtn_set_src(buttoType, LV_BTN_STATE_REL, "F:/bmp_extru2.bin"); lv_imgbtn_set_src_both(buttonType, "F:/bmp_extru2.bin");
lv_imgbtn_set_src(buttoType, LV_BTN_STATE_PR, "F:/bmp_extru2.bin");
if (gCfgItems.multiple_language) { if (gCfgItems.multiple_language) {
lv_label_set_text(labelType, preheat_menu.ext2); lv_label_set_text(labelType, preheat_menu.ext2);
lv_obj_align(labelType, buttoType, LV_ALIGN_IN_BOTTOM_MID, 0, BUTTON_TEXT_Y_OFFSET); lv_obj_align(labelType, buttonType, LV_ALIGN_IN_BOTTOM_MID, 0, BUTTON_TEXT_Y_OFFSET);
} }
} }
else { else {
lv_imgbtn_set_src(buttoType, LV_BTN_STATE_REL, "F:/bmp_extru1.bin"); lv_imgbtn_set_src_both(buttonType, "F:/bmp_extru1.bin");
lv_imgbtn_set_src(buttoType, LV_BTN_STATE_PR, "F:/bmp_extru1.bin");
if (gCfgItems.multiple_language) { if (gCfgItems.multiple_language) {
lv_label_set_text(labelType, preheat_menu.ext1); lv_label_set_text(labelType, preheat_menu.ext1);
lv_obj_align(labelType, buttoType, LV_ALIGN_IN_BOTTOM_MID, 0, BUTTON_TEXT_Y_OFFSET); lv_obj_align(labelType, buttonType, LV_ALIGN_IN_BOTTOM_MID, 0, BUTTON_TEXT_Y_OFFSET);
} }
} }
} }

View File

@ -127,12 +127,12 @@ static void event_handler(lv_obj_t * obj, lv_event_t event) {
void lv_draw_filament_settings(void) { void lv_draw_filament_settings(void) {
lv_obj_t *buttonBack = NULL, *label_Back = NULL, *buttonTurnPage = NULL, *labelTurnPage = NULL; lv_obj_t *buttonBack = NULL, *label_Back = NULL, *buttonTurnPage = NULL, *labelTurnPage = NULL;
lv_obj_t *labelInLengthText = NULL, *buttonInLengthValue = NULL, *labelInLengthValue = NULL; lv_obj_t *buttonInLengthValue = NULL, *labelInLengthValue = NULL;
lv_obj_t *labelInSpeedText = NULL, *buttonInSpeedValue = NULL, *labelInSpeedValue = NULL; lv_obj_t *buttonInSpeedValue = NULL, *labelInSpeedValue = NULL;
lv_obj_t *labelOutLengthText = NULL, *buttonOutLengthValue = NULL, *labelOutLengthValue = NULL; lv_obj_t *buttonOutLengthValue = NULL, *labelOutLengthValue = NULL;
lv_obj_t *labelOutSpeedText = NULL, *buttonOutSpeedValue = NULL, *labelOutSpeedValue = NULL; lv_obj_t *buttonOutSpeedValue = NULL, *labelOutSpeedValue = NULL;
lv_obj_t *labelTemperText = NULL, *buttonTemperValue = NULL, *labelTemperValue = NULL; lv_obj_t *buttonTemperValue = NULL, *labelTemperValue = NULL;
lv_obj_t * line1 = NULL, * line2 = NULL, * line3 = NULL, * line4 = NULL; lv_obj_t *line1 = NULL, *line2 = NULL, *line3 = NULL, *line4 = NULL;
if (disp_state_stack._disp_state[disp_state_stack._disp_index] != FILAMENT_SETTINGS_UI) { if (disp_state_stack._disp_state[disp_state_stack._disp_index] != FILAMENT_SETTINGS_UI) {
disp_state_stack._disp_index++; disp_state_stack._disp_index++;
disp_state_stack._disp_state[disp_state_stack._disp_index] = FILAMENT_SETTINGS_UI; disp_state_stack._disp_state[disp_state_stack._disp_index] = FILAMENT_SETTINGS_UI;
@ -145,82 +145,44 @@ void lv_draw_filament_settings(void) {
lv_scr_load(scr); lv_scr_load(scr);
lv_obj_clean(scr); lv_obj_clean(scr);
lv_obj_t * title = lv_label_create(scr, NULL); (void)lv_label_create(scr, TITLE_XPOS, TITLE_YPOS, machine_menu.FilamentConfTitle);
lv_obj_set_style(title, &tft_style_label_rel);
lv_obj_set_pos(title, TITLE_XPOS, TITLE_YPOS);
lv_label_set_text(title, machine_menu.FilamentConfTitle);
lv_refr_now(lv_refr_get_disp_refreshing()); lv_refr_now(lv_refr_get_disp_refreshing());
if (uiCfg.para_ui_page != 1) { if (uiCfg.para_ui_page != 1) {
labelInLengthText = lv_label_create(scr, NULL); (void)lv_label_create(scr, PARA_UI_POS_X, PARA_UI_POS_Y + 10, machine_menu.InLength);
lv_obj_set_style(labelInLengthText, &tft_style_label_rel);
lv_obj_set_pos(labelInLengthText, PARA_UI_POS_X, PARA_UI_POS_Y + 10);
lv_label_set_text(labelInLengthText, machine_menu.InLength);
buttonInLengthValue = lv_btn_create(scr, NULL); buttonInLengthValue = lv_btn_create(scr, PARA_UI_VALUE_POS_X, PARA_UI_POS_Y + PARA_UI_VALUE_V_2, PARA_UI_VALUE_BTN_X_SIZE, PARA_UI_VALUE_BTN_Y_SIZE, event_handler, ID_FILAMENT_SET_IN_LENGTH);
lv_obj_set_pos(buttonInLengthValue, PARA_UI_VALUE_POS_X, PARA_UI_POS_Y + PARA_UI_VALUE_V_2); labelInLengthValue = lv_label_create_empty(buttonInLengthValue);
lv_obj_set_size(buttonInLengthValue, PARA_UI_VALUE_BTN_X_SIZE, PARA_UI_VALUE_BTN_Y_SIZE);
lv_obj_set_event_cb_mks(buttonInLengthValue, event_handler, ID_FILAMENT_SET_IN_LENGTH, NULL, 0);
lv_btn_set_style(buttonInLengthValue, LV_BTN_STYLE_REL, &style_para_value);
lv_btn_set_style(buttonInLengthValue, LV_BTN_STYLE_PR, &style_para_value);
labelInLengthValue = lv_label_create(buttonInLengthValue, NULL);
line1 = lv_line_create(scr, NULL); line1 = lv_line_create(scr, NULL);
lv_ex_line(line1, line_points[0]); lv_ex_line(line1, line_points[0]);
labelInSpeedText = lv_label_create(scr, NULL); (void)lv_label_create(scr, PARA_UI_POS_X, PARA_UI_POS_Y * 2 + 10, machine_menu.InSpeed);
lv_obj_set_style(labelInSpeedText, &tft_style_label_rel);
lv_obj_set_pos(labelInSpeedText, PARA_UI_POS_X, PARA_UI_POS_Y * 2 + 10);
lv_label_set_text(labelInSpeedText, machine_menu.InSpeed);
buttonInSpeedValue = lv_btn_create(scr, NULL); buttonInSpeedValue = lv_btn_create(scr, PARA_UI_VALUE_POS_X, PARA_UI_POS_Y * 2 + PARA_UI_VALUE_V_2, PARA_UI_VALUE_BTN_X_SIZE, PARA_UI_VALUE_BTN_Y_SIZE, event_handler, ID_FILAMENT_SET_IN_SPEED);
lv_obj_set_pos(buttonInSpeedValue, PARA_UI_VALUE_POS_X, PARA_UI_POS_Y * 2 + PARA_UI_VALUE_V_2); labelInSpeedValue = lv_label_create_empty(buttonInSpeedValue);
lv_obj_set_size(buttonInSpeedValue, PARA_UI_VALUE_BTN_X_SIZE, PARA_UI_VALUE_BTN_Y_SIZE);
lv_obj_set_event_cb_mks(buttonInSpeedValue, event_handler, ID_FILAMENT_SET_IN_SPEED, NULL, 0);
lv_btn_set_style(buttonInSpeedValue, LV_BTN_STYLE_REL, &style_para_value);
lv_btn_set_style(buttonInSpeedValue, LV_BTN_STYLE_PR, &style_para_value);
labelInSpeedValue = lv_label_create(buttonInSpeedValue, NULL);
line2 = lv_line_create(scr, NULL); line2 = lv_line_create(scr, NULL);
lv_ex_line(line2, line_points[1]); lv_ex_line(line2, line_points[1]);
labelOutLengthText = lv_label_create(scr, NULL); (void)lv_label_create(scr, PARA_UI_POS_X, PARA_UI_POS_Y * 3 + 6, machine_menu.OutLength);
lv_obj_set_style(labelOutLengthText, &tft_style_label_rel);
lv_obj_set_pos(labelOutLengthText, PARA_UI_POS_X, PARA_UI_POS_Y * 3 + 6);
lv_label_set_text(labelOutLengthText, machine_menu.OutLength);
buttonOutLengthValue = lv_btn_create(scr, NULL); buttonOutLengthValue = lv_btn_create(scr, PARA_UI_VALUE_POS_X, PARA_UI_POS_Y * 3 + PARA_UI_VALUE_V_2, PARA_UI_VALUE_BTN_X_SIZE, PARA_UI_VALUE_BTN_Y_SIZE, event_handler, ID_FILAMENT_SET_OUT_LENGTH);
lv_obj_set_pos(buttonOutLengthValue, PARA_UI_VALUE_POS_X, PARA_UI_POS_Y * 3 + PARA_UI_VALUE_V_2); labelOutLengthValue = lv_label_create_empty(buttonOutLengthValue);
lv_obj_set_size(buttonOutLengthValue, PARA_UI_VALUE_BTN_X_SIZE, PARA_UI_VALUE_BTN_Y_SIZE);
lv_obj_set_event_cb_mks(buttonOutLengthValue, event_handler, ID_FILAMENT_SET_OUT_LENGTH, NULL, 0);
lv_btn_set_style(buttonOutLengthValue, LV_BTN_STYLE_REL, &style_para_value);
lv_btn_set_style(buttonOutLengthValue, LV_BTN_STYLE_PR, &style_para_value);
labelOutLengthValue = lv_label_create(buttonOutLengthValue, NULL);
line3 = lv_line_create(scr, NULL); line3 = lv_line_create(scr, NULL);
lv_ex_line(line3, line_points[2]); lv_ex_line(line3, line_points[2]);
labelOutSpeedText = lv_label_create(scr, NULL); (void)lv_label_create(scr, PARA_UI_POS_X, PARA_UI_POS_Y * 4 + 10, machine_menu.OutSpeed);
lv_obj_set_style(labelOutSpeedText, &tft_style_label_rel);
lv_obj_set_pos(labelOutSpeedText, PARA_UI_POS_X, PARA_UI_POS_Y * 4 + 10);
lv_label_set_text(labelOutSpeedText, machine_menu.OutSpeed);
buttonOutSpeedValue = lv_btn_create(scr, NULL); buttonOutSpeedValue = lv_btn_create(scr, PARA_UI_VALUE_POS_X, PARA_UI_POS_Y * 4 + PARA_UI_VALUE_V_2, PARA_UI_VALUE_BTN_X_SIZE, PARA_UI_VALUE_BTN_Y_SIZE, event_handler, ID_FILAMENT_SET_OUT_SPEED);
lv_obj_set_pos(buttonOutSpeedValue, PARA_UI_VALUE_POS_X, PARA_UI_POS_Y * 4 + PARA_UI_VALUE_V_2); labelOutSpeedValue = lv_label_create_empty(buttonOutSpeedValue);
lv_obj_set_size(buttonOutSpeedValue, PARA_UI_VALUE_BTN_X_SIZE, PARA_UI_VALUE_BTN_Y_SIZE);
lv_obj_set_event_cb_mks(buttonOutSpeedValue, event_handler, ID_FILAMENT_SET_OUT_SPEED, NULL, 0);
lv_btn_set_style(buttonOutSpeedValue, LV_BTN_STYLE_REL, &style_para_value);
lv_btn_set_style(buttonOutSpeedValue, LV_BTN_STYLE_PR, &style_para_value);
labelOutSpeedValue = lv_label_create(buttonOutSpeedValue, NULL);
line4 = lv_line_create(scr, NULL); line4 = lv_line_create(scr, NULL);
lv_ex_line(line4, line_points[3]); lv_ex_line(line4, line_points[3]);
buttonTurnPage = lv_btn_create(scr, NULL); buttonTurnPage = lv_btn_create_back(scr, event_handler, ID_FILAMENT_SET_DOWN);
lv_obj_set_event_cb_mks(buttonTurnPage, event_handler, ID_FILAMENT_SET_DOWN, NULL, 0);
lv_btn_set_style(buttonTurnPage, LV_BTN_STYLE_REL, &style_para_back);
lv_btn_set_style(buttonTurnPage, LV_BTN_STYLE_PR, &style_para_back);
#if HAS_ROTARY_ENCODER #if HAS_ROTARY_ENCODER
if (gCfgItems.encoder_enable) { if (gCfgItems.encoder_enable) {
@ -233,26 +195,15 @@ void lv_draw_filament_settings(void) {
#endif #endif
} }
else { else {
labelTemperText = lv_label_create(scr, NULL); (void)lv_label_create(scr, PARA_UI_POS_X, PARA_UI_POS_Y + 10, machine_menu.FilamentTemperature);
lv_obj_set_style(labelTemperText, &tft_style_label_rel);
lv_obj_set_pos(labelTemperText, PARA_UI_POS_X, PARA_UI_POS_Y + 10);
lv_label_set_text(labelTemperText, machine_menu.FilamentTemperature);
buttonTemperValue = lv_btn_create(scr, NULL); buttonTemperValue = lv_btn_create(scr, PARA_UI_VALUE_POS_X, PARA_UI_POS_Y + PARA_UI_VALUE_V_2, PARA_UI_VALUE_BTN_X_SIZE, PARA_UI_VALUE_BTN_Y_SIZE, event_handler, ID_FILAMENT_SET_TEMP);
lv_obj_set_pos(buttonTemperValue, PARA_UI_VALUE_POS_X, PARA_UI_POS_Y + PARA_UI_VALUE_V_2); labelTemperValue = lv_label_create_empty(buttonTemperValue);
lv_obj_set_size(buttonTemperValue, PARA_UI_VALUE_BTN_X_SIZE, PARA_UI_VALUE_BTN_Y_SIZE);
lv_obj_set_event_cb_mks(buttonTemperValue, event_handler, ID_FILAMENT_SET_TEMP, NULL, 0);
lv_btn_set_style(buttonTemperValue, LV_BTN_STYLE_REL, &style_para_value);
lv_btn_set_style(buttonTemperValue, LV_BTN_STYLE_PR, &style_para_value);
labelTemperValue = lv_label_create(buttonTemperValue, NULL);
line1 = lv_line_create(scr, NULL); line1 = lv_line_create(scr, NULL);
lv_ex_line(line1, line_points[0]); lv_ex_line(line1, line_points[0]);
buttonTurnPage = lv_btn_create(scr, NULL); buttonTurnPage = lv_btn_create_back(scr, PARA_UI_TURN_PAGE_POS_X, PARA_UI_TURN_PAGE_POS_Y, PARA_UI_BACK_BTN_X_SIZE, PARA_UI_BACK_BTN_Y_SIZE, event_handler, ID_FILAMENT_SET_UP);
lv_obj_set_event_cb_mks(buttonTurnPage, event_handler, ID_FILAMENT_SET_UP, NULL, 0);
lv_btn_set_style(buttonTurnPage, LV_BTN_STYLE_REL, &style_para_back);
lv_btn_set_style(buttonTurnPage, LV_BTN_STYLE_PR, &style_para_back);
#if HAS_ROTARY_ENCODER #if HAS_ROTARY_ENCODER
if (gCfgItems.encoder_enable) { if (gCfgItems.encoder_enable) {
@ -262,17 +213,10 @@ void lv_draw_filament_settings(void) {
#endif #endif
} }
lv_obj_set_pos(buttonTurnPage, PARA_UI_TURN_PAGE_POS_X, PARA_UI_TURN_PAGE_POS_Y); labelTurnPage = lv_label_create_empty(buttonTurnPage);
lv_obj_set_size(buttonTurnPage, PARA_UI_BACK_BTN_X_SIZE, PARA_UI_BACK_BTN_Y_SIZE);
labelTurnPage = lv_label_create(buttonTurnPage, NULL);
buttonBack = lv_btn_create(scr, NULL); buttonBack = lv_btn_create_back(scr, PARA_UI_BACL_POS_X, PARA_UI_BACL_POS_Y, PARA_UI_BACK_BTN_X_SIZE, PARA_UI_BACK_BTN_Y_SIZE, event_handler, ID_FILAMENT_SET_RETURN);
lv_obj_set_event_cb_mks(buttonBack, event_handler, ID_FILAMENT_SET_RETURN, NULL, 0); label_Back = lv_label_create_empty(buttonBack);
lv_btn_set_style(buttonBack, LV_BTN_STYLE_REL, &style_para_back);
lv_btn_set_style(buttonBack, LV_BTN_STYLE_PR, &style_para_back);
lv_obj_set_pos(buttonBack, PARA_UI_BACL_POS_X, PARA_UI_BACL_POS_Y);
lv_obj_set_size(buttonBack, PARA_UI_BACK_BTN_X_SIZE, PARA_UI_BACK_BTN_Y_SIZE);
label_Back = lv_label_create(buttonBack, NULL);
#if HAS_ROTARY_ENCODER #if HAS_ROTARY_ENCODER
if (gCfgItems.encoder_enable) lv_group_add_obj(g, buttonBack); if (gCfgItems.encoder_enable) lv_group_add_obj(g, buttonBack);
@ -280,22 +224,18 @@ void lv_draw_filament_settings(void) {
if (gCfgItems.multiple_language) { if (gCfgItems.multiple_language) {
if (uiCfg.para_ui_page != 1) { if (uiCfg.para_ui_page != 1) {
ZERO(public_buf_l);
sprintf_P(public_buf_l, PSTR("%d"), gCfgItems.filamentchange_load_length); sprintf_P(public_buf_l, PSTR("%d"), gCfgItems.filamentchange_load_length);
lv_label_set_text(labelInLengthValue, public_buf_l); lv_label_set_text(labelInLengthValue, public_buf_l);
lv_obj_align(labelInLengthValue, buttonInLengthValue, LV_ALIGN_CENTER, 0, 0); lv_obj_align(labelInLengthValue, buttonInLengthValue, LV_ALIGN_CENTER, 0, 0);
ZERO(public_buf_l);
sprintf_P(public_buf_l, PSTR("%d"), gCfgItems.filamentchange_load_speed); sprintf_P(public_buf_l, PSTR("%d"), gCfgItems.filamentchange_load_speed);
lv_label_set_text(labelInSpeedValue, public_buf_l); lv_label_set_text(labelInSpeedValue, public_buf_l);
lv_obj_align(labelInSpeedValue, buttonInSpeedValue, LV_ALIGN_CENTER, 0, 0); lv_obj_align(labelInSpeedValue, buttonInSpeedValue, LV_ALIGN_CENTER, 0, 0);
ZERO(public_buf_l);
sprintf_P(public_buf_l, PSTR("%d"), gCfgItems.filamentchange_unload_length); sprintf_P(public_buf_l, PSTR("%d"), gCfgItems.filamentchange_unload_length);
lv_label_set_text(labelOutLengthValue, public_buf_l); lv_label_set_text(labelOutLengthValue, public_buf_l);
lv_obj_align(labelOutLengthValue, buttonOutLengthValue, LV_ALIGN_CENTER, 0, 0); lv_obj_align(labelOutLengthValue, buttonOutLengthValue, LV_ALIGN_CENTER, 0, 0);
ZERO(public_buf_l);
sprintf_P(public_buf_l, PSTR("%d"), gCfgItems.filamentchange_unload_speed); sprintf_P(public_buf_l, PSTR("%d"), gCfgItems.filamentchange_unload_speed);
lv_label_set_text(labelOutSpeedValue, public_buf_l); lv_label_set_text(labelOutSpeedValue, public_buf_l);
lv_obj_align(labelOutSpeedValue, buttonOutSpeedValue, LV_ALIGN_CENTER, 0, 0); lv_obj_align(labelOutSpeedValue, buttonOutSpeedValue, LV_ALIGN_CENTER, 0, 0);
@ -304,7 +244,6 @@ void lv_draw_filament_settings(void) {
lv_obj_align(labelTurnPage, buttonTurnPage, LV_ALIGN_CENTER, 0, 0); lv_obj_align(labelTurnPage, buttonTurnPage, LV_ALIGN_CENTER, 0, 0);
} }
else { else {
ZERO(public_buf_l);
sprintf_P(public_buf_l, PSTR("%d"), gCfgItems.filament_limit_temper); sprintf_P(public_buf_l, PSTR("%d"), gCfgItems.filament_limit_temper);
lv_label_set_text(labelTemperValue, public_buf_l); lv_label_set_text(labelTemperValue, public_buf_l);
lv_obj_align(labelTemperValue, buttonTemperValue, LV_ALIGN_CENTER, 0, 0); lv_obj_align(labelTemperValue, buttonTemperValue, LV_ALIGN_CENTER, 0, 0);

View File

@ -120,92 +120,29 @@ void lv_draw_home(void) {
lv_scr_load(scr); lv_scr_load(scr);
lv_obj_clean(scr); lv_obj_clean(scr);
lv_obj_t * title = lv_label_create(scr, NULL); (void)lv_label_create(scr, TITLE_XPOS, TITLE_YPOS, creat_title_text());
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());
lv_refr_now(lv_refr_get_disp_refreshing()); lv_refr_now(lv_refr_get_disp_refreshing());
// Create image buttons // Create image buttons
//buttonWifi = lv_imgbtn_create(scr, NULL); //buttonWifi = lv_imgbtn_create(scr, NULL);
buttonHomeAll = lv_imgbtn_create(scr, NULL);
buttonHomeX = lv_imgbtn_create(scr, NULL);
//buttonContinue = lv_imgbtn_create(scr, NULL); //buttonContinue = lv_imgbtn_create(scr, NULL);
buttonHomeY = lv_imgbtn_create(scr, NULL); buttonHomeAll = lv_imgbtn_create(scr, "F:/bmp_zeroAll.bin", INTERVAL_V, titleHeight, event_handler, ID_H_ALL);
buttonHomeZ = lv_imgbtn_create(scr, NULL); buttonHomeX = lv_imgbtn_create(scr, "F:/bmp_zeroX.bin", BTN_X_PIXEL + INTERVAL_V * 2, titleHeight, event_handler, ID_H_X);
buttonOffAll = lv_imgbtn_create(scr, NULL); buttonHomeY = lv_imgbtn_create(scr, "F:/bmp_zeroY.bin", BTN_X_PIXEL * 2 + INTERVAL_V * 3, titleHeight, event_handler, ID_H_Y);
buttonOffXY = lv_imgbtn_create(scr, NULL); buttonHomeZ = lv_imgbtn_create(scr, "F:/bmp_zeroZ.bin", BTN_X_PIXEL * 3 + INTERVAL_V * 4, titleHeight, event_handler, ID_H_Z);
buttonBack = lv_imgbtn_create(scr, NULL); buttonOffAll = lv_imgbtn_create(scr, "F:/bmp_function1.bin", INTERVAL_V, BTN_Y_PIXEL + INTERVAL_H + titleHeight, event_handler, ID_H_OFF_ALL);
buttonOffXY = lv_imgbtn_create(scr, "F:/bmp_function1.bin", BTN_X_PIXEL + INTERVAL_V * 2, BTN_Y_PIXEL + INTERVAL_H + titleHeight, event_handler, ID_H_OFF_XY);
#if 1 buttonBack = lv_imgbtn_create(scr, "F:/bmp_return.bin", BTN_X_PIXEL * 3 + INTERVAL_V * 4, BTN_Y_PIXEL + INTERVAL_H + titleHeight, event_handler, ID_H_RETURN);
lv_obj_set_event_cb_mks(buttonHomeAll, event_handler,ID_H_ALL, NULL,0);
lv_imgbtn_set_src(buttonHomeAll, LV_BTN_STATE_REL, "F:/bmp_zeroAll.bin");
lv_imgbtn_set_src(buttonHomeAll, LV_BTN_STATE_PR, "F:/bmp_zeroAll.bin");
lv_imgbtn_set_style(buttonHomeAll, LV_BTN_STATE_PR, &tft_style_label_pre);
lv_imgbtn_set_style(buttonHomeAll, LV_BTN_STATE_REL, &tft_style_label_rel);
lv_obj_set_event_cb_mks(buttonHomeX, event_handler, ID_H_X, NULL, 0);
lv_imgbtn_set_src(buttonHomeX, LV_BTN_STATE_REL, "F:/bmp_zeroX.bin");
lv_imgbtn_set_src(buttonHomeX, LV_BTN_STATE_PR, "F:/bmp_zeroX.bin");
lv_imgbtn_set_style(buttonHomeX, LV_BTN_STATE_PR, &tft_style_label_pre);
lv_imgbtn_set_style(buttonHomeX, LV_BTN_STATE_REL, &tft_style_label_rel);
lv_obj_set_event_cb_mks(buttonHomeY, event_handler, ID_H_Y, NULL, 0);
lv_imgbtn_set_src(buttonHomeY, LV_BTN_STATE_REL, "F:/bmp_zeroY.bin");
lv_imgbtn_set_src(buttonHomeY, LV_BTN_STATE_PR, "F:/bmp_zeroY.bin");
lv_imgbtn_set_style(buttonHomeY, LV_BTN_STATE_PR, &tft_style_label_pre);
lv_imgbtn_set_style(buttonHomeY, LV_BTN_STATE_REL, &tft_style_label_rel);
lv_obj_set_event_cb_mks(buttonHomeZ, event_handler, ID_H_Z, NULL, 0);
lv_imgbtn_set_src(buttonHomeZ, LV_BTN_STATE_REL, "F:/bmp_zeroZ.bin");
lv_imgbtn_set_src(buttonHomeZ, LV_BTN_STATE_PR, "F:/bmp_zeroZ.bin");
lv_imgbtn_set_style(buttonHomeZ, LV_BTN_STATE_PR, &tft_style_label_pre);
lv_imgbtn_set_style(buttonHomeZ, LV_BTN_STATE_REL, &tft_style_label_rel);
lv_obj_set_event_cb_mks(buttonOffAll, event_handler,ID_H_OFF_ALL, NULL,0);
lv_imgbtn_set_src(buttonOffAll, LV_BTN_STATE_REL, "F:/bmp_function1.bin");
lv_imgbtn_set_src(buttonOffAll, LV_BTN_STATE_PR, "F:/bmp_function1.bin");
lv_imgbtn_set_style(buttonOffAll, LV_BTN_STATE_PR, &tft_style_label_pre);
lv_imgbtn_set_style(buttonOffAll, LV_BTN_STATE_REL, &tft_style_label_rel);
lv_obj_set_event_cb_mks(buttonOffXY, event_handler,ID_H_OFF_XY, NULL,0);
lv_imgbtn_set_src(buttonOffXY, LV_BTN_STATE_REL, "F:/bmp_function1.bin");
lv_imgbtn_set_src(buttonOffXY, LV_BTN_STATE_PR, "F:/bmp_function1.bin");
lv_imgbtn_set_style(buttonOffXY, LV_BTN_STATE_PR, &tft_style_label_pre);
lv_imgbtn_set_style(buttonOffXY, LV_BTN_STATE_REL, &tft_style_label_rel);
lv_obj_set_event_cb_mks(buttonBack, event_handler,ID_H_RETURN, NULL,0);
lv_imgbtn_set_src(buttonBack, LV_BTN_STATE_REL, "F:/bmp_return.bin");
lv_imgbtn_set_src(buttonBack, LV_BTN_STATE_PR, "F:/bmp_return.bin");
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(buttonHomeAll, INTERVAL_V, titleHeight);
lv_obj_set_pos(buttonHomeX, BTN_X_PIXEL + INTERVAL_V * 2, titleHeight);
lv_obj_set_pos(buttonHomeY, BTN_X_PIXEL * 2 + INTERVAL_V * 3, titleHeight);
lv_obj_set_pos(buttonHomeZ, BTN_X_PIXEL * 3 + INTERVAL_V * 4, titleHeight);
lv_obj_set_pos(buttonOffAll, INTERVAL_V, BTN_Y_PIXEL + INTERVAL_H + titleHeight);
lv_obj_set_pos(buttonOffXY, BTN_X_PIXEL + INTERVAL_V * 2, 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 labels on the image buttons // Create labels on the image buttons
lv_btn_set_layout(buttonHomeAll, LV_LAYOUT_OFF); lv_obj_t *labelHomeAll = lv_label_create_empty(buttonHomeAll);
lv_btn_set_layout(buttonHomeX, LV_LAYOUT_OFF); lv_obj_t *labelHomeX = lv_label_create_empty(buttonHomeX);
lv_btn_set_layout(buttonHomeY, LV_LAYOUT_OFF); lv_obj_t *labelHomeY = lv_label_create_empty(buttonHomeY);
lv_btn_set_layout(buttonHomeZ, LV_LAYOUT_OFF); lv_obj_t *labelHomeZ = lv_label_create_empty(buttonHomeZ);
lv_btn_set_layout(buttonOffAll, LV_LAYOUT_OFF); lv_obj_t *labelOffAll = lv_label_create_empty(buttonOffAll);
lv_btn_set_layout(buttonOffXY, LV_LAYOUT_OFF); lv_obj_t *labelOffXY = lv_label_create_empty(buttonOffXY);
lv_btn_set_layout(buttonBack, LV_LAYOUT_OFF); lv_obj_t *label_Back = lv_label_create_empty(buttonBack);
lv_obj_t *labelHomeAll = lv_label_create(buttonHomeAll, NULL);
lv_obj_t *labelHomeX = lv_label_create(buttonHomeX, NULL);
lv_obj_t *labelHomeY = lv_label_create(buttonHomeY, NULL);
lv_obj_t *labelHomeZ = lv_label_create(buttonHomeZ, NULL);
lv_obj_t *labelOffAll = lv_label_create(buttonOffAll, NULL);
lv_obj_t *labelOffXY = lv_label_create(buttonOffXY, NULL);
lv_obj_t *label_Back = lv_label_create(buttonBack, NULL);
if (gCfgItems.multiple_language) { if (gCfgItems.multiple_language) {
lv_label_set_text(labelHomeAll, home_menu.home_all); lv_label_set_text(labelHomeAll, home_menu.home_all);

View File

@ -98,13 +98,13 @@ static void event_handler(lv_obj_t * obj, lv_event_t event) {
void lv_draw_homing_sensitivity_settings(void) { void lv_draw_homing_sensitivity_settings(void) {
lv_obj_t *buttonBack = NULL, *label_Back = NULL; lv_obj_t *buttonBack = NULL, *label_Back = NULL;
lv_obj_t *labelXText = NULL, *buttonXValue = NULL, *labelXValue = NULL; lv_obj_t *buttonXValue = NULL, *labelXValue = NULL;
lv_obj_t *labelYText = NULL, *buttonYValue = NULL, *labelYValue = NULL; lv_obj_t *buttonYValue = NULL, *labelYValue = NULL;
lv_obj_t *labelZText = NULL, *buttonZValue = NULL, *labelZValue = NULL; lv_obj_t *buttonZValue = NULL, *labelZValue = NULL;
lv_obj_t * line1 = NULL, * line2 = NULL, * line3 = NULL; lv_obj_t * line1 = NULL, * line2 = NULL, * line3 = NULL;
#if Z2_SENSORLESS #if Z2_SENSORLESS
lv_obj_t *labelZ2Text = NULL, *buttonZ2Value = NULL, *labelZ2Value = NULL; lv_obj_t *buttonZ2Value = NULL, *labelZ2Value = NULL;
lv_obj_t * line4 = NULL; lv_obj_t *line4 = NULL;
#endif #endif
if (disp_state_stack._disp_state[disp_state_stack._disp_index] != HOMING_SENSITIVITY_UI) { if (disp_state_stack._disp_state[disp_state_stack._disp_index] != HOMING_SENSITIVITY_UI) {
disp_state_stack._disp_index++; disp_state_stack._disp_index++;
@ -118,25 +118,14 @@ void lv_draw_homing_sensitivity_settings(void) {
lv_scr_load(scr); lv_scr_load(scr);
lv_obj_clean(scr); lv_obj_clean(scr);
lv_obj_t * title = lv_label_create(scr, NULL); (void)lv_label_create(scr, TITLE_XPOS, TITLE_YPOS, machine_menu.HomingSensitivityConfTitle);
lv_obj_set_style(title, &tft_style_label_rel);
lv_obj_set_pos(title, TITLE_XPOS, TITLE_YPOS);
lv_label_set_text(title, machine_menu.HomingSensitivityConfTitle);
lv_refr_now(lv_refr_get_disp_refreshing()); lv_refr_now(lv_refr_get_disp_refreshing());
labelXText = lv_label_create(scr, NULL); (void)lv_label_create(scr, PARA_UI_POS_X, PARA_UI_POS_Y + 10, machine_menu.X_Sensitivity);
lv_obj_set_style(labelXText, &tft_style_label_rel);
lv_obj_set_pos(labelXText, PARA_UI_POS_X, PARA_UI_POS_Y + 10);
lv_label_set_text(labelXText, machine_menu.X_Sensitivity);
buttonXValue = lv_btn_create(scr, NULL); buttonXValue = lv_btn_create(scr, PARA_UI_VALUE_POS_X, PARA_UI_POS_Y + PARA_UI_VALUE_V_2, PARA_UI_VALUE_BTN_X_SIZE, PARA_UI_VALUE_BTN_Y_SIZE, event_handler, ID_SENSITIVITY_X);
lv_obj_set_pos(buttonXValue, PARA_UI_VALUE_POS_X, PARA_UI_POS_Y + PARA_UI_VALUE_V_2); labelXValue = lv_label_create_empty(buttonXValue);
lv_obj_set_size(buttonXValue, PARA_UI_VALUE_BTN_X_SIZE, PARA_UI_VALUE_BTN_Y_SIZE);
lv_obj_set_event_cb_mks(buttonXValue, event_handler, ID_SENSITIVITY_X, NULL, 0);
lv_btn_set_style(buttonXValue, LV_BTN_STYLE_REL, &style_para_value);
lv_btn_set_style(buttonXValue, LV_BTN_STYLE_PR, &style_para_value);
labelXValue = lv_label_create(buttonXValue, NULL);
#if HAS_ROTARY_ENCODER #if HAS_ROTARY_ENCODER
if (gCfgItems.encoder_enable) lv_group_add_obj(g, buttonXValue); if (gCfgItems.encoder_enable) lv_group_add_obj(g, buttonXValue);
@ -145,18 +134,10 @@ void lv_draw_homing_sensitivity_settings(void) {
line1 = lv_line_create(scr, NULL); line1 = lv_line_create(scr, NULL);
lv_ex_line(line1, line_points[0]); lv_ex_line(line1, line_points[0]);
labelYText = lv_label_create(scr, NULL); (void)lv_label_create(scr, PARA_UI_POS_X, PARA_UI_POS_Y * 2 + 10, machine_menu.Y_Sensitivity);
lv_obj_set_style(labelYText, &tft_style_label_rel);
lv_obj_set_pos(labelYText, PARA_UI_POS_X, PARA_UI_POS_Y * 2 + 10);
lv_label_set_text(labelYText, machine_menu.Y_Sensitivity);
buttonYValue = lv_btn_create(scr, NULL); buttonYValue = lv_btn_create(scr, PARA_UI_VALUE_POS_X, PARA_UI_POS_Y * 2 + PARA_UI_VALUE_V_2, PARA_UI_VALUE_BTN_X_SIZE, PARA_UI_VALUE_BTN_Y_SIZE, event_handler, ID_SENSITIVITY_Y);
lv_obj_set_pos(buttonYValue, PARA_UI_VALUE_POS_X, PARA_UI_POS_Y * 2 + PARA_UI_VALUE_V_2); labelYValue = lv_label_create_empty(buttonYValue);
lv_obj_set_size(buttonYValue, PARA_UI_VALUE_BTN_X_SIZE, PARA_UI_VALUE_BTN_Y_SIZE);
lv_obj_set_event_cb_mks(buttonYValue, event_handler, ID_SENSITIVITY_Y, NULL, 0);
lv_btn_set_style(buttonYValue, LV_BTN_STYLE_REL, &style_para_value);
lv_btn_set_style(buttonYValue, LV_BTN_STYLE_PR, &style_para_value);
labelYValue = lv_label_create(buttonYValue, NULL);
#if HAS_ROTARY_ENCODER #if HAS_ROTARY_ENCODER
if (gCfgItems.encoder_enable) lv_group_add_obj(g, buttonYValue); if (gCfgItems.encoder_enable) lv_group_add_obj(g, buttonYValue);
@ -165,18 +146,10 @@ void lv_draw_homing_sensitivity_settings(void) {
line2 = lv_line_create(scr, NULL); line2 = lv_line_create(scr, NULL);
lv_ex_line(line2, line_points[1]); lv_ex_line(line2, line_points[1]);
labelZText = lv_label_create(scr, NULL); (void)lv_label_create(scr, PARA_UI_POS_X, PARA_UI_POS_Y * 3 + 10, machine_menu.Z_Sensitivity);
lv_obj_set_style(labelZText, &tft_style_label_rel);
lv_obj_set_pos(labelZText, PARA_UI_POS_X, PARA_UI_POS_Y * 3 + 10);
lv_label_set_text(labelZText, machine_menu.Z_Sensitivity);
buttonZValue = lv_btn_create(scr, NULL); buttonZValue = lv_btn_create(scr, PARA_UI_VALUE_POS_X, PARA_UI_POS_Y * 3 + PARA_UI_VALUE_V_2, PARA_UI_VALUE_BTN_X_SIZE, PARA_UI_VALUE_BTN_Y_SIZE, event_handler, ID_SENSITIVITY_Z);
lv_obj_set_pos(buttonZValue, PARA_UI_VALUE_POS_X, PARA_UI_POS_Y * 3 + PARA_UI_VALUE_V_2); labelZValue = lv_label_create_empty(buttonZValue);
lv_obj_set_size(buttonZValue, PARA_UI_VALUE_BTN_X_SIZE, PARA_UI_VALUE_BTN_Y_SIZE);
lv_obj_set_event_cb_mks(buttonZValue, event_handler, ID_SENSITIVITY_Z, NULL, 0);
lv_btn_set_style(buttonZValue, LV_BTN_STYLE_REL, &style_para_value);
lv_btn_set_style(buttonZValue, LV_BTN_STYLE_PR, &style_para_value);
labelZValue = lv_label_create(buttonZValue, NULL);
#if HAS_ROTARY_ENCODER #if HAS_ROTARY_ENCODER
if (gCfgItems.encoder_enable == true) lv_group_add_obj(g, buttonZValue); if (gCfgItems.encoder_enable == true) lv_group_add_obj(g, buttonZValue);
@ -186,18 +159,10 @@ void lv_draw_homing_sensitivity_settings(void) {
lv_ex_line(line3, line_points[2]); lv_ex_line(line3, line_points[2]);
#if Z2_SENSORLESS #if Z2_SENSORLESS
labelZ2Text = lv_label_create(scr, NULL); (void)lv_label_create(scr, PARA_UI_POS_X, PARA_UI_POS_Y * 4 + 10, machine_menu.Z2_Sensitivity);
lv_obj_set_style(labelZ2Text, &tft_style_label_rel);
lv_obj_set_pos(labelZ2Text, PARA_UI_POS_X, PARA_UI_POS_Y * 4 + 10);
lv_label_set_text(labelZ2Text, machine_menu.Z2_Sensitivity);
buttonZ2Value = lv_btn_create(scr, NULL); buttonZ2Value = lv_btn_create(scr, PARA_UI_VALUE_POS_X, PARA_UI_POS_Y * 4 + PARA_UI_VALUE_V_2, PARA_UI_VALUE_BTN_X_SIZE, PARA_UI_VALUE_BTN_Y_SIZE, event_handler, ID_SENSITIVITY_Z2);
lv_obj_set_pos(buttonZ2Value, PARA_UI_VALUE_POS_X, PARA_UI_POS_Y * 4 + PARA_UI_VALUE_V_2); labelZ2Value = lv_label_create_empty(buttonZ2Value);
lv_obj_set_size(buttonZ2Value, PARA_UI_VALUE_BTN_X_SIZE, PARA_UI_VALUE_BTN_Y_SIZE);
lv_obj_set_event_cb_mks(buttonZ2Value, event_handler, ID_SENSITIVITY_Z2, NULL, 0);
lv_btn_set_style(buttonZ2Value, LV_BTN_STYLE_REL, &style_para_value);
lv_btn_set_style(buttonZ2Value, LV_BTN_STYLE_PR, &style_para_value);
labelZ2Value = lv_label_create(buttonZ2Value, NULL);
#if HAS_ROTARY_ENCODER #if HAS_ROTARY_ENCODER
if (gCfgItems.encoder_enable) lv_group_add_obj(g, buttonZ2Value); if (gCfgItems.encoder_enable) lv_group_add_obj(g, buttonZ2Value);
@ -207,13 +172,8 @@ void lv_draw_homing_sensitivity_settings(void) {
lv_ex_line(line4, line_points[3]); lv_ex_line(line4, line_points[3]);
#endif #endif
buttonBack = lv_btn_create(scr, NULL); buttonBack = lv_btn_create_back(scr, PARA_UI_BACL_POS_X, PARA_UI_BACL_POS_Y, PARA_UI_BACK_BTN_X_SIZE, PARA_UI_BACK_BTN_Y_SIZE, event_handler, ID_SENSITIVITY_RETURN);
lv_obj_set_event_cb_mks(buttonBack, event_handler, ID_SENSITIVITY_RETURN, NULL, 0); label_Back = lv_label_create_empty(buttonBack);
lv_btn_set_style(buttonBack, LV_BTN_STYLE_REL, &style_para_back);
lv_btn_set_style(buttonBack, LV_BTN_STYLE_PR, &style_para_back);
lv_obj_set_pos(buttonBack, PARA_UI_BACL_POS_X, PARA_UI_BACL_POS_Y);
lv_obj_set_size(buttonBack, PARA_UI_BACK_BTN_X_SIZE, PARA_UI_BACK_BTN_Y_SIZE);
label_Back = lv_label_create(buttonBack, NULL);
#if HAS_ROTARY_ENCODER #if HAS_ROTARY_ENCODER
if (gCfgItems.encoder_enable) lv_group_add_obj(g, buttonBack); if (gCfgItems.encoder_enable) lv_group_add_obj(g, buttonBack);

View File

@ -94,11 +94,11 @@ static void event_handler(lv_obj_t * obj, lv_event_t event) {
void lv_draw_jerk_settings(void) { void lv_draw_jerk_settings(void) {
lv_obj_t *buttonBack = NULL, *label_Back = NULL; lv_obj_t *buttonBack = NULL, *label_Back = NULL;
lv_obj_t *labelXText = NULL, *buttonXValue = NULL, *labelXValue = NULL; lv_obj_t *buttonXValue = NULL, *labelXValue = NULL;
lv_obj_t *labelYText = NULL, *buttonYValue = NULL, *labelYValue = NULL; lv_obj_t *buttonYValue = NULL, *labelYValue = NULL;
lv_obj_t *labelZText = NULL, *buttonZValue = NULL, *labelZValue = NULL; lv_obj_t *buttonZValue = NULL, *labelZValue = NULL;
lv_obj_t *labelEText = NULL, *buttonEValue = NULL, *labelEValue = NULL; lv_obj_t *buttonEValue = NULL, *labelEValue = NULL;
lv_obj_t * line1 = NULL, * line2 = NULL, * line3 = NULL, * line4 = NULL; lv_obj_t *line1 = NULL, *line2 = NULL, *line3 = NULL, *line4 = NULL;
if (disp_state_stack._disp_state[disp_state_stack._disp_index] != JERK_UI) { if (disp_state_stack._disp_state[disp_state_stack._disp_index] != JERK_UI) {
disp_state_stack._disp_index++; disp_state_stack._disp_index++;
disp_state_stack._disp_state[disp_state_stack._disp_index] = JERK_UI; disp_state_stack._disp_state[disp_state_stack._disp_index] = JERK_UI;
@ -111,85 +111,44 @@ void lv_draw_jerk_settings(void) {
lv_scr_load(scr); lv_scr_load(scr);
lv_obj_clean(scr); lv_obj_clean(scr);
lv_obj_t * title = lv_label_create(scr, NULL); (void)lv_label_create(scr, TITLE_XPOS, TITLE_YPOS, machine_menu.JerkConfTitle);
lv_obj_set_style(title, &tft_style_label_rel);
lv_obj_set_pos(title, TITLE_XPOS, TITLE_YPOS);
lv_label_set_text(title, machine_menu.JerkConfTitle);
lv_refr_now(lv_refr_get_disp_refreshing()); lv_refr_now(lv_refr_get_disp_refreshing());
labelXText = lv_label_create(scr, NULL); (void)lv_label_create(scr, PARA_UI_POS_X, PARA_UI_POS_Y + 10, machine_menu.X_Jerk);
lv_obj_set_style(labelXText, &tft_style_label_rel);
lv_obj_set_pos(labelXText, PARA_UI_POS_X, PARA_UI_POS_Y + 10);
lv_label_set_text(labelXText, machine_menu.X_Jerk);
buttonXValue = lv_btn_create(scr, NULL); buttonXValue = lv_btn_create(scr, PARA_UI_VALUE_POS_X, PARA_UI_POS_Y + PARA_UI_VALUE_V, PARA_UI_VALUE_BTN_X_SIZE, PARA_UI_VALUE_BTN_Y_SIZE, event_handler, ID_JERK_X);
lv_obj_set_pos(buttonXValue, PARA_UI_VALUE_POS_X, PARA_UI_POS_Y + PARA_UI_VALUE_V); labelXValue = lv_label_create_empty(buttonXValue);
lv_obj_set_size(buttonXValue, PARA_UI_VALUE_BTN_X_SIZE, PARA_UI_VALUE_BTN_Y_SIZE);
lv_obj_set_event_cb_mks(buttonXValue, event_handler, ID_JERK_X, NULL, 0);
lv_btn_set_style(buttonXValue, LV_BTN_STYLE_REL, &style_para_value);
lv_btn_set_style(buttonXValue, LV_BTN_STYLE_PR, &style_para_value);
labelXValue = lv_label_create(buttonXValue, NULL);
line1 = lv_line_create(scr, NULL); line1 = lv_line_create(scr, NULL);
lv_ex_line(line1, line_points[0]); lv_ex_line(line1, line_points[0]);
labelYText = lv_label_create(scr, NULL); (void)lv_label_create(scr, PARA_UI_POS_X, PARA_UI_POS_Y * 2 + 10, machine_menu.Y_Jerk);
lv_obj_set_style(labelYText, &tft_style_label_rel);
lv_obj_set_pos(labelYText, PARA_UI_POS_X, PARA_UI_POS_Y * 2 + 10);
lv_label_set_text(labelYText, machine_menu.Y_Jerk);
buttonYValue = lv_btn_create(scr, NULL); buttonYValue = lv_btn_create(scr, PARA_UI_VALUE_POS_X, PARA_UI_POS_Y * 2 + PARA_UI_VALUE_V, PARA_UI_VALUE_BTN_X_SIZE, PARA_UI_VALUE_BTN_Y_SIZE, event_handler, ID_JERK_Y);
lv_obj_set_pos(buttonYValue, PARA_UI_VALUE_POS_X, PARA_UI_POS_Y * 2 + PARA_UI_VALUE_V); labelYValue = lv_label_create_empty(buttonYValue);
lv_obj_set_size(buttonYValue, PARA_UI_VALUE_BTN_X_SIZE, PARA_UI_VALUE_BTN_Y_SIZE);
lv_obj_set_event_cb_mks(buttonYValue, event_handler, ID_JERK_Y, NULL, 0);
lv_btn_set_style(buttonYValue, LV_BTN_STYLE_REL, &style_para_value);
lv_btn_set_style(buttonYValue, LV_BTN_STYLE_PR, &style_para_value);
labelYValue = lv_label_create(buttonYValue, NULL);
line2 = lv_line_create(scr, NULL); line2 = lv_line_create(scr, NULL);
lv_ex_line(line2, line_points[1]); lv_ex_line(line2, line_points[1]);
labelZText = lv_label_create(scr, NULL); (void)lv_label_create(scr, PARA_UI_POS_X, PARA_UI_POS_Y * 3 + 10, machine_menu.Z_Jerk);
lv_obj_set_style(labelZText, &tft_style_label_rel);
lv_obj_set_pos(labelZText, PARA_UI_POS_X, PARA_UI_POS_Y * 3 + 10);
lv_label_set_text(labelZText, machine_menu.Z_Jerk);
buttonZValue = lv_btn_create(scr, NULL); buttonZValue = lv_btn_create(scr, PARA_UI_VALUE_POS_X, PARA_UI_POS_Y * 3 + PARA_UI_VALUE_V, PARA_UI_VALUE_BTN_X_SIZE, PARA_UI_VALUE_BTN_Y_SIZE, event_handler, ID_JERK_Z);
lv_obj_set_pos(buttonZValue, PARA_UI_VALUE_POS_X, PARA_UI_POS_Y * 3 + PARA_UI_VALUE_V); labelZValue = lv_label_create_empty(buttonZValue);
lv_obj_set_size(buttonZValue, PARA_UI_VALUE_BTN_X_SIZE, PARA_UI_VALUE_BTN_Y_SIZE);
lv_obj_set_event_cb_mks(buttonZValue, event_handler, ID_JERK_Z, NULL, 0);
lv_btn_set_style(buttonZValue, LV_BTN_STYLE_REL, &style_para_value);
lv_btn_set_style(buttonZValue, LV_BTN_STYLE_PR, &style_para_value);
labelZValue = lv_label_create(buttonZValue, NULL);
line3 = lv_line_create(scr, NULL); line3 = lv_line_create(scr, NULL);
lv_ex_line(line3, line_points[2]); lv_ex_line(line3, line_points[2]);
labelEText = lv_label_create(scr, NULL); (void)lv_label_create(scr, PARA_UI_POS_X, PARA_UI_POS_Y * 4 + 10, machine_menu.E_Jerk);
lv_obj_set_style(labelEText, &tft_style_label_rel);
lv_obj_set_pos(labelEText, PARA_UI_POS_X, PARA_UI_POS_Y * 4 + 10);
lv_label_set_text(labelEText, machine_menu.E_Jerk);
buttonEValue = lv_btn_create(scr, NULL); buttonEValue = lv_btn_create(scr, PARA_UI_VALUE_POS_X, PARA_UI_POS_Y * 4 + PARA_UI_VALUE_V, PARA_UI_VALUE_BTN_X_SIZE, PARA_UI_VALUE_BTN_Y_SIZE, event_handler, ID_JERK_E);
lv_obj_set_pos(buttonEValue, PARA_UI_VALUE_POS_X, PARA_UI_POS_Y * 4 + PARA_UI_VALUE_V); labelEValue = lv_label_create_empty(buttonEValue);
lv_obj_set_size(buttonEValue, PARA_UI_VALUE_BTN_X_SIZE, PARA_UI_VALUE_BTN_Y_SIZE);
lv_obj_set_event_cb_mks(buttonEValue, event_handler, ID_JERK_E, NULL, 0);
lv_btn_set_style(buttonEValue, LV_BTN_STYLE_REL, &style_para_value);
lv_btn_set_style(buttonEValue, LV_BTN_STYLE_PR, &style_para_value);
labelEValue = lv_label_create(buttonEValue, NULL);
line4 = lv_line_create(scr, NULL); line4 = lv_line_create(scr, NULL);
lv_ex_line(line4, line_points[3]); lv_ex_line(line4, line_points[3]);
buttonBack = lv_btn_create(scr, NULL); buttonBack = lv_btn_create_back(scr, PARA_UI_BACL_POS_X, PARA_UI_BACL_POS_Y, PARA_UI_BACK_BTN_X_SIZE, PARA_UI_BACK_BTN_Y_SIZE, event_handler, ID_JERK_RETURN);
lv_obj_set_event_cb_mks(buttonBack, event_handler, ID_JERK_RETURN, NULL, 0); label_Back = lv_label_create_empty(buttonBack);
lv_btn_set_style(buttonBack, LV_BTN_STYLE_REL, &style_para_back);
lv_btn_set_style(buttonBack, LV_BTN_STYLE_PR, &style_para_back);
lv_obj_set_pos(buttonBack, PARA_UI_BACL_POS_X, PARA_UI_BACL_POS_Y);
lv_obj_set_size(buttonBack, PARA_UI_BACK_BTN_X_SIZE, PARA_UI_BACK_BTN_Y_SIZE);
label_Back = lv_label_create(buttonBack, NULL);
#if HAS_ROTARY_ENCODER #if HAS_ROTARY_ENCODER
if (gCfgItems.encoder_enable == true) { if (gCfgItems.encoder_enable == true) {

View File

@ -62,8 +62,7 @@ static void event_handler(lv_obj_t * obj, lv_event_t event) {
} }
else if (event == LV_EVENT_RELEASED) { else if (event == LV_EVENT_RELEASED) {
disp_language(gCfgItems.language, UNSELECTED); disp_language(gCfgItems.language, UNSELECTED);
lv_imgbtn_set_src(buttonCN, LV_BTN_STATE_REL, "F:/bmp_simplified_cn_sel.bin"); lv_imgbtn_set_src_both(buttonCN, "F:/bmp_simplified_cn_sel.bin");
lv_imgbtn_set_src(buttonCN, LV_BTN_STATE_PR, "F:/bmp_simplified_cn_sel.bin");
lv_obj_refresh_ext_draw_pad(buttonCN); lv_obj_refresh_ext_draw_pad(buttonCN);
gCfgItems.language = LANG_SIMPLE_CHINESE; gCfgItems.language = LANG_SIMPLE_CHINESE;
update_spi_flash(); update_spi_flash();
@ -76,8 +75,7 @@ static void event_handler(lv_obj_t * obj, lv_event_t event) {
} }
else if (event == LV_EVENT_RELEASED) { else if (event == LV_EVENT_RELEASED) {
disp_language(gCfgItems.language, UNSELECTED); disp_language(gCfgItems.language, UNSELECTED);
lv_imgbtn_set_src(buttonT_CN, LV_BTN_STATE_REL, "F:/bmp_traditional_cn_sel.bin"); lv_imgbtn_set_src_both(buttonT_CN, "F:/bmp_traditional_cn_sel.bin");
lv_imgbtn_set_src(buttonT_CN, LV_BTN_STATE_PR, "F:/bmp_traditional_cn_sel.bin");
lv_obj_refresh_ext_draw_pad(buttonT_CN); lv_obj_refresh_ext_draw_pad(buttonT_CN);
gCfgItems.language = LANG_COMPLEX_CHINESE; gCfgItems.language = LANG_COMPLEX_CHINESE;
update_spi_flash(); update_spi_flash();
@ -90,8 +88,7 @@ static void event_handler(lv_obj_t * obj, lv_event_t event) {
} }
else if (event == LV_EVENT_RELEASED) { else if (event == LV_EVENT_RELEASED) {
disp_language(gCfgItems.language, UNSELECTED); disp_language(gCfgItems.language, UNSELECTED);
lv_imgbtn_set_src(buttonEN, LV_BTN_STATE_REL, "F:/bmp_english_sel.bin"); lv_imgbtn_set_src_both(buttonEN, "F:/bmp_english_sel.bin");
lv_imgbtn_set_src(buttonEN, LV_BTN_STATE_PR, "F:/bmp_english_sel.bin");
lv_obj_refresh_ext_draw_pad(buttonEN); lv_obj_refresh_ext_draw_pad(buttonEN);
gCfgItems.language = LANG_ENGLISH; gCfgItems.language = LANG_ENGLISH;
update_spi_flash(); update_spi_flash();
@ -104,8 +101,7 @@ static void event_handler(lv_obj_t * obj, lv_event_t event) {
} }
else if (event == LV_EVENT_RELEASED) { else if (event == LV_EVENT_RELEASED) {
disp_language(gCfgItems.language, UNSELECTED); disp_language(gCfgItems.language, UNSELECTED);
lv_imgbtn_set_src(buttonRU, LV_BTN_STATE_REL, "F:/bmp_russian_sel.bin"); lv_imgbtn_set_src_both(buttonRU, "F:/bmp_russian_sel.bin");
lv_imgbtn_set_src(buttonRU, LV_BTN_STATE_PR, "F:/bmp_russian_sel.bin");
lv_obj_refresh_ext_draw_pad(buttonRU); lv_obj_refresh_ext_draw_pad(buttonRU);
gCfgItems.language = LANG_RUSSIAN; gCfgItems.language = LANG_RUSSIAN;
update_spi_flash(); update_spi_flash();
@ -118,8 +114,7 @@ static void event_handler(lv_obj_t * obj, lv_event_t event) {
} }
else if (event == LV_EVENT_RELEASED) { else if (event == LV_EVENT_RELEASED) {
disp_language(gCfgItems.language, UNSELECTED); disp_language(gCfgItems.language, UNSELECTED);
lv_imgbtn_set_src(buttonES, LV_BTN_STATE_REL, "F:/bmp_spanish_sel.bin"); lv_imgbtn_set_src_both(buttonES, "F:/bmp_spanish_sel.bin");
lv_imgbtn_set_src(buttonES, LV_BTN_STATE_PR, "F:/bmp_spanish_sel.bin");
lv_obj_refresh_ext_draw_pad(buttonES); lv_obj_refresh_ext_draw_pad(buttonES);
gCfgItems.language = LANG_SPANISH; gCfgItems.language = LANG_SPANISH;
update_spi_flash(); update_spi_flash();
@ -132,8 +127,7 @@ static void event_handler(lv_obj_t * obj, lv_event_t event) {
} }
else if (event == LV_EVENT_RELEASED) { else if (event == LV_EVENT_RELEASED) {
disp_language(gCfgItems.language, UNSELECTED); disp_language(gCfgItems.language, UNSELECTED);
lv_imgbtn_set_src(buttonFR, LV_BTN_STATE_REL, "F:/bmp_french_sel.bin"); lv_imgbtn_set_src_both(buttonFR, "F:/bmp_french_sel.bin");
lv_imgbtn_set_src(buttonFR, LV_BTN_STATE_PR, "F:/bmp_french_sel.bin");
lv_obj_refresh_ext_draw_pad(buttonFR); lv_obj_refresh_ext_draw_pad(buttonFR);
gCfgItems.language = LANG_FRENCH; gCfgItems.language = LANG_FRENCH;
update_spi_flash(); update_spi_flash();
@ -146,8 +140,7 @@ static void event_handler(lv_obj_t * obj, lv_event_t event) {
} }
else if (event == LV_EVENT_RELEASED) { else if (event == LV_EVENT_RELEASED) {
disp_language(gCfgItems.language, UNSELECTED); disp_language(gCfgItems.language, UNSELECTED);
lv_imgbtn_set_src(buttonIT, LV_BTN_STATE_REL, "F:/bmp_italy_sel.bin"); lv_imgbtn_set_src_both(buttonIT, "F:/bmp_italy_sel.bin");
lv_imgbtn_set_src(buttonIT, LV_BTN_STATE_PR, "F:/bmp_italy_sel.bin");
lv_obj_refresh_ext_draw_pad(buttonIT); lv_obj_refresh_ext_draw_pad(buttonIT);
gCfgItems.language = LANG_ITALY; gCfgItems.language = LANG_ITALY;
update_spi_flash(); update_spi_flash();
@ -159,7 +152,6 @@ static void event_handler(lv_obj_t * obj, lv_event_t event) {
} }
else if (event == LV_EVENT_RELEASED) { else if (event == LV_EVENT_RELEASED) {
buttonCN = NULL; buttonCN = NULL;
buttonT_CN = NULL; buttonT_CN = NULL;
buttonEN = NULL; buttonEN = NULL;
@ -231,8 +223,7 @@ static void disp_language(uint8_t language, uint8_t state) {
strcat_P(public_buf_l, PSTR(".bin")); strcat_P(public_buf_l, PSTR(".bin"));
lv_obj_set_event_cb_mks(obj, event_handler, id, NULL, 0); lv_obj_set_event_cb_mks(obj, event_handler, id, NULL, 0);
lv_imgbtn_set_src(obj, LV_BTN_STATE_REL, public_buf_l); lv_imgbtn_set_src_both(obj, public_buf_l);
lv_imgbtn_set_src(obj, LV_BTN_STATE_PR, public_buf_l);
if (state == UNSELECTED) lv_obj_refresh_ext_draw_pad(obj); if (state == UNSELECTED) lv_obj_refresh_ext_draw_pad(obj);
} }
@ -253,102 +244,30 @@ void lv_draw_language(void) {
lv_scr_load(scr); lv_scr_load(scr);
lv_obj_clean(scr); lv_obj_clean(scr);
lv_obj_t * title = lv_label_create(scr, NULL); (void)lv_label_create(scr, TITLE_XPOS, TITLE_YPOS, creat_title_text());
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());
lv_refr_now(lv_refr_get_disp_refreshing()); lv_refr_now(lv_refr_get_disp_refreshing());
// Create image buttons // Create image buttons
buttonCN = lv_imgbtn_create(scr, NULL); buttonCN = lv_imgbtn_create(scr, "F:/bmp_simplified_cn.bin", INTERVAL_V, titleHeight, event_handler, ID_CN);
buttonT_CN = lv_imgbtn_create(scr, NULL);
buttonEN = lv_imgbtn_create(scr, NULL);
buttonRU = lv_imgbtn_create(scr, NULL);
buttonES = lv_imgbtn_create(scr, NULL);
buttonFR = lv_imgbtn_create(scr, NULL);
buttonIT = lv_imgbtn_create(scr, NULL);
buttonBack = lv_imgbtn_create(scr, NULL);
lv_obj_set_event_cb_mks(buttonCN, event_handler, ID_CN, NULL, 0);
lv_imgbtn_set_src(buttonCN, LV_BTN_STATE_REL, "F:/bmp_simplified_cn.bin");
lv_imgbtn_set_src(buttonCN, LV_BTN_STATE_PR, "F:/bmp_simplified_cn.bin");
lv_imgbtn_set_style(buttonCN, LV_BTN_STATE_PR, &tft_style_label_pre);
lv_imgbtn_set_style(buttonCN, LV_BTN_STATE_REL, &tft_style_label_rel);
lv_obj_clear_protect(buttonCN, LV_PROTECT_FOLLOW); lv_obj_clear_protect(buttonCN, LV_PROTECT_FOLLOW);
buttonT_CN = lv_imgbtn_create(scr, "F:/bmp_traditional_cn.bin", BTN_X_PIXEL + INTERVAL_V * 2, titleHeight, event_handler, ID_T_CN);
#if 1 buttonEN = lv_imgbtn_create(scr, "F:/bmp_english.bin", BTN_X_PIXEL * 2 + INTERVAL_V * 3, titleHeight, event_handler, ID_EN);
lv_obj_set_event_cb_mks(buttonT_CN, event_handler, ID_T_CN, NULL, 0); buttonRU = lv_imgbtn_create(scr, "F:/bmp_russian.bin", BTN_X_PIXEL * 3 + INTERVAL_V * 4, titleHeight, event_handler, ID_RU);
lv_imgbtn_set_src(buttonT_CN, LV_BTN_STATE_REL, "F:/bmp_traditional_cn.bin"); buttonES = lv_imgbtn_create(scr, "F:/bmp_spanish.bin", INTERVAL_V, BTN_Y_PIXEL + INTERVAL_H + titleHeight, event_handler, ID_ES);
lv_imgbtn_set_src(buttonT_CN, LV_BTN_STATE_PR, "F:/bmp_traditional_cn.bin"); buttonFR = lv_imgbtn_create(scr, "F:/bmp_french.bin", BTN_X_PIXEL + INTERVAL_V * 2, BTN_Y_PIXEL + INTERVAL_H + titleHeight, event_handler, ID_FR);
lv_imgbtn_set_style(buttonT_CN, LV_BTN_STATE_PR, &tft_style_label_pre); buttonIT = lv_imgbtn_create(scr, "F:/bmp_italy.bin", BTN_X_PIXEL * 2 + INTERVAL_V * 3, BTN_Y_PIXEL + INTERVAL_H + titleHeight, event_handler, ID_IT);
lv_imgbtn_set_style(buttonT_CN, LV_BTN_STATE_REL, &tft_style_label_rel); buttonBack = lv_imgbtn_create(scr, "F:/bmp_return.bin", BTN_X_PIXEL * 3 + INTERVAL_V * 4, BTN_Y_PIXEL + INTERVAL_H + titleHeight, event_handler, ID_L_RETURN);
lv_obj_set_event_cb_mks(buttonEN, event_handler, ID_EN, NULL, 0);
lv_imgbtn_set_src(buttonEN, LV_BTN_STATE_REL, "F:/bmp_english.bin");
lv_imgbtn_set_src(buttonEN, LV_BTN_STATE_PR, "F:/bmp_english.bin");
lv_imgbtn_set_style(buttonEN, LV_BTN_STATE_PR, &tft_style_label_pre);
lv_imgbtn_set_style(buttonEN, LV_BTN_STATE_REL, &tft_style_label_rel);
lv_obj_set_event_cb_mks(buttonRU, event_handler, ID_RU, NULL, 0);
lv_imgbtn_set_src(buttonRU, LV_BTN_STATE_REL, "F:/bmp_russian.bin");
lv_imgbtn_set_src(buttonRU, LV_BTN_STATE_PR, "F:/bmp_russian.bin");
lv_imgbtn_set_style(buttonRU, LV_BTN_STATE_PR, &tft_style_label_pre);
lv_imgbtn_set_style(buttonRU, LV_BTN_STATE_REL, &tft_style_label_rel);
lv_obj_set_event_cb_mks(buttonES, event_handler, ID_ES, NULL, 0);
lv_imgbtn_set_src(buttonES, LV_BTN_STATE_REL, "F:/bmp_spanish.bin");
lv_imgbtn_set_src(buttonES, LV_BTN_STATE_PR, "F:/bmp_spanish.bin");
lv_imgbtn_set_style(buttonES, LV_BTN_STATE_PR, &tft_style_label_pre);
lv_imgbtn_set_style(buttonES, LV_BTN_STATE_REL, &tft_style_label_rel);
lv_obj_set_event_cb_mks(buttonFR, event_handler, ID_FR, NULL, 0);
lv_imgbtn_set_src(buttonFR, LV_BTN_STATE_REL, "F:/bmp_french.bin");
lv_imgbtn_set_src(buttonFR, LV_BTN_STATE_PR, "F:/bmp_french.bin");
lv_imgbtn_set_style(buttonFR, LV_BTN_STATE_PR, &tft_style_label_pre);
lv_imgbtn_set_style(buttonFR, LV_BTN_STATE_REL, &tft_style_label_rel);
lv_obj_set_event_cb_mks(buttonIT, event_handler, ID_IT, NULL, 0);
lv_imgbtn_set_src(buttonIT, LV_BTN_STATE_REL, "F:/bmp_italy.bin");
lv_imgbtn_set_src(buttonIT, LV_BTN_STATE_PR, "F:/bmp_italy.bin");
lv_imgbtn_set_style(buttonIT, LV_BTN_STATE_PR, &tft_style_label_pre);
lv_imgbtn_set_style(buttonIT, LV_BTN_STATE_REL, &tft_style_label_rel);
lv_obj_set_event_cb_mks(buttonBack, event_handler, ID_L_RETURN, NULL, 0);
lv_imgbtn_set_src(buttonBack, LV_BTN_STATE_REL, "F:/bmp_return.bin");
lv_imgbtn_set_src(buttonBack, LV_BTN_STATE_PR, "F:/bmp_return.bin");
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 // if 1
lv_obj_set_pos(buttonCN, INTERVAL_V, titleHeight);
lv_obj_set_pos(buttonT_CN, BTN_X_PIXEL + INTERVAL_V * 2, titleHeight);
lv_obj_set_pos(buttonEN, BTN_X_PIXEL * 2 + INTERVAL_V * 3, titleHeight);
lv_obj_set_pos(buttonRU, BTN_X_PIXEL * 3 + INTERVAL_V * 4, titleHeight);
lv_obj_set_pos(buttonES, INTERVAL_V, BTN_Y_PIXEL + INTERVAL_H + titleHeight);
lv_obj_set_pos(buttonFR, BTN_X_PIXEL + INTERVAL_V * 2, BTN_Y_PIXEL + INTERVAL_H + titleHeight);
lv_obj_set_pos(buttonIT, 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 labels on the image buttons // Create labels on the image buttons
lv_btn_set_layout(buttonCN, LV_LAYOUT_OFF); lv_obj_t *label_CN = lv_label_create_empty(buttonCN);
lv_btn_set_layout(buttonT_CN, LV_LAYOUT_OFF); lv_obj_t *label_T_CN = lv_label_create_empty(buttonT_CN);
lv_btn_set_layout(buttonEN, LV_LAYOUT_OFF); lv_obj_t *label_EN = lv_label_create_empty(buttonEN);
lv_btn_set_layout(buttonRU, LV_LAYOUT_OFF); lv_obj_t *label_RU = lv_label_create_empty(buttonRU);
lv_btn_set_layout(buttonES, LV_LAYOUT_OFF); lv_obj_t *label_ES = lv_label_create_empty(buttonES);
lv_btn_set_layout(buttonFR, LV_LAYOUT_OFF); lv_obj_t *label_FR = lv_label_create_empty(buttonFR);
lv_btn_set_layout(buttonIT, LV_LAYOUT_OFF); lv_obj_t *label_IT = lv_label_create_empty(buttonIT);
lv_btn_set_layout(buttonBack, LV_LAYOUT_OFF); lv_obj_t *label_Back = lv_label_create_empty(buttonBack);
lv_obj_t *label_CN = lv_label_create(buttonCN, NULL);
lv_obj_t *label_T_CN = lv_label_create(buttonT_CN, NULL);
lv_obj_t *label_EN = lv_label_create(buttonEN, NULL);
lv_obj_t *label_RU = lv_label_create(buttonRU, NULL);
lv_obj_t *label_ES = lv_label_create(buttonES, NULL);
lv_obj_t *label_FR = lv_label_create(buttonFR, NULL);
lv_obj_t *label_IT = lv_label_create(buttonIT, NULL);
lv_obj_t *label_Back = lv_label_create(buttonBack, NULL);
disp_language(gCfgItems.language, SELECTED); disp_language(gCfgItems.language, SELECTED);

View File

@ -133,10 +133,7 @@ void lv_draw_level_settings(void) {
lv_scr_load(scr); lv_scr_load(scr);
lv_obj_clean(scr); lv_obj_clean(scr);
lv_obj_t * title = lv_label_create(scr, NULL); (void)lv_label_create(scr, TITLE_XPOS, TITLE_YPOS, machine_menu.LevelingParaConfTitle);
lv_obj_set_style(title, &tft_style_label_rel);
lv_obj_set_pos(title, TITLE_XPOS, TITLE_YPOS);
lv_label_set_text(title, machine_menu.LevelingParaConfTitle);
lv_refr_now(lv_refr_get_disp_refreshing()); lv_refr_now(lv_refr_get_disp_refreshing());
@ -145,22 +142,15 @@ void lv_draw_level_settings(void) {
lv_obj_set_pos(buttonPosition, PARA_UI_POS_X, PARA_UI_POS_Y); /*Set its position*/ lv_obj_set_pos(buttonPosition, PARA_UI_POS_X, PARA_UI_POS_Y); /*Set its position*/
lv_obj_set_size(buttonPosition, PARA_UI_SIZE_X, PARA_UI_SIZE_Y); /*Set its size*/ lv_obj_set_size(buttonPosition, PARA_UI_SIZE_X, PARA_UI_SIZE_Y); /*Set its size*/
lv_obj_set_event_cb_mks(buttonPosition, event_handler, ID_LEVEL_POSITION, NULL, 0); lv_obj_set_event_cb_mks(buttonPosition, event_handler, ID_LEVEL_POSITION, NULL, 0);
lv_btn_set_style(buttonPosition, LV_BTN_STYLE_REL, &tft_style_label_rel); /*Set the button's released style*/ lv_btn_use_label_style(buttonPosition);
lv_btn_set_style(buttonPosition, LV_BTN_STYLE_PR, &tft_style_label_pre); /*Set the button's pressed style*/
lv_btn_set_layout(buttonPosition, LV_LAYOUT_OFF); lv_btn_set_layout(buttonPosition, LV_LAYOUT_OFF);
labelPosition = lv_label_create(buttonPosition, NULL); /*Add a label to the button*/ labelPosition = lv_label_create_empty(buttonPosition); /*Add a label to the button*/
#if HAS_ROTARY_ENCODER #if HAS_ROTARY_ENCODER
if (gCfgItems.encoder_enable) lv_group_add_obj(g, buttonPosition); if (gCfgItems.encoder_enable) lv_group_add_obj(g, buttonPosition);
#endif #endif
buttonPositionNarrow = lv_imgbtn_create(scr, NULL); buttonPositionNarrow = lv_imgbtn_create(scr, "F:/bmp_arrow.bin", PARA_UI_POS_X + PARA_UI_SIZE_X, PARA_UI_POS_Y + PARA_UI_ARROW_V, event_handler, ID_LEVEL_POSITION_ARROW);
lv_obj_set_pos(buttonPositionNarrow, PARA_UI_POS_X + PARA_UI_SIZE_X, PARA_UI_POS_Y + PARA_UI_ARROW_V);
lv_obj_set_event_cb_mks(buttonPositionNarrow, event_handler, ID_LEVEL_POSITION_ARROW, NULL, 0);
lv_imgbtn_set_src(buttonPositionNarrow, LV_BTN_STATE_REL, "F:/bmp_arrow.bin");
lv_imgbtn_set_src(buttonPositionNarrow, LV_BTN_STATE_PR, "F:/bmp_arrow.bin");
lv_imgbtn_set_style(buttonPositionNarrow, LV_BTN_STATE_PR, &tft_style_label_pre);
lv_imgbtn_set_style(buttonPositionNarrow, LV_BTN_STATE_REL, &tft_style_label_rel);
lv_btn_set_layout(buttonPositionNarrow, LV_LAYOUT_OFF); lv_btn_set_layout(buttonPositionNarrow, LV_LAYOUT_OFF);
line1 = lv_line_create(scr, NULL); line1 = lv_line_create(scr, NULL);
@ -170,22 +160,15 @@ void lv_draw_level_settings(void) {
lv_obj_set_pos(buttonCommand, PARA_UI_POS_X, PARA_UI_POS_Y * 2); lv_obj_set_pos(buttonCommand, PARA_UI_POS_X, PARA_UI_POS_Y * 2);
lv_obj_set_size(buttonCommand, PARA_UI_SIZE_X, PARA_UI_SIZE_Y); lv_obj_set_size(buttonCommand, PARA_UI_SIZE_X, PARA_UI_SIZE_Y);
lv_obj_set_event_cb_mks(buttonCommand, event_handler, ID_LEVEL_COMMAND, NULL, 0); lv_obj_set_event_cb_mks(buttonCommand, event_handler, ID_LEVEL_COMMAND, NULL, 0);
lv_btn_set_style(buttonCommand, LV_BTN_STYLE_REL, &tft_style_label_rel); lv_btn_use_label_style(buttonCommand);
lv_btn_set_style(buttonCommand, LV_BTN_STYLE_PR, &tft_style_label_pre);
lv_btn_set_layout(buttonCommand, LV_LAYOUT_OFF); lv_btn_set_layout(buttonCommand, LV_LAYOUT_OFF);
labelCommand = lv_label_create(buttonCommand, NULL); labelCommand = lv_label_create_empty(buttonCommand);
#if HAS_ROTARY_ENCODER #if HAS_ROTARY_ENCODER
if (gCfgItems.encoder_enable) lv_group_add_obj(g, buttonCommand); if (gCfgItems.encoder_enable) lv_group_add_obj(g, buttonCommand);
#endif #endif
buttonCommandNarrow = lv_imgbtn_create(scr, NULL); buttonCommandNarrow = lv_imgbtn_create(scr, "F:/bmp_arrow.bin", PARA_UI_POS_X + PARA_UI_SIZE_X, PARA_UI_POS_Y * 2 + PARA_UI_ARROW_V, event_handler, ID_LEVEL_COMMAND_ARROW);
lv_obj_set_pos(buttonCommandNarrow, PARA_UI_POS_X + PARA_UI_SIZE_X, PARA_UI_POS_Y * 2 + PARA_UI_ARROW_V);
lv_obj_set_event_cb_mks(buttonCommandNarrow, event_handler, ID_LEVEL_COMMAND_ARROW, NULL, 0);
lv_imgbtn_set_src(buttonCommandNarrow, LV_BTN_STATE_REL, "F:/bmp_arrow.bin");
lv_imgbtn_set_src(buttonCommandNarrow, LV_BTN_STATE_PR, "F:/bmp_arrow.bin");
lv_imgbtn_set_style(buttonCommandNarrow, LV_BTN_STATE_PR, &tft_style_label_pre);
lv_imgbtn_set_style(buttonCommandNarrow, LV_BTN_STATE_REL, &tft_style_label_rel);
lv_btn_set_layout(buttonCommandNarrow, LV_LAYOUT_OFF); lv_btn_set_layout(buttonCommandNarrow, LV_LAYOUT_OFF);
line2 = lv_line_create(scr, NULL); line2 = lv_line_create(scr, NULL);
@ -193,26 +176,15 @@ void lv_draw_level_settings(void) {
#if HAS_BED_PROBE #if HAS_BED_PROBE
buttonZoffset = lv_btn_create(scr, NULL); /*Add a button the current screen*/ buttonZoffset = lv_btn_create(scr, PARA_UI_POS_X, PARA_UI_POS_Y * 3, PARA_UI_SIZE_X, PARA_UI_SIZE_Y, event_handler, ID_LEVEL_ZOFFSET);
lv_obj_set_pos(buttonZoffset, PARA_UI_POS_X, PARA_UI_POS_Y * 3); /*Set its position*/
lv_obj_set_size(buttonZoffset, PARA_UI_SIZE_X, PARA_UI_SIZE_Y); /*Set its size*/
lv_obj_set_event_cb_mks(buttonZoffset, event_handler, ID_LEVEL_ZOFFSET, NULL, 0);
lv_btn_set_style(buttonZoffset, LV_BTN_STYLE_REL, &tft_style_label_rel); /*Set the button's released style*/
lv_btn_set_style(buttonZoffset, LV_BTN_STYLE_PR, &tft_style_label_pre); /*Set the button's pressed style*/
lv_btn_set_layout(buttonZoffset, LV_LAYOUT_OFF); lv_btn_set_layout(buttonZoffset, LV_LAYOUT_OFF);
labelZoffset = lv_label_create(buttonZoffset, NULL); /*Add a label to the button*/ labelZoffset = lv_label_create_empty(buttonZoffset); /*Add a label to the button*/
#if HAS_ROTARY_ENCODER #if HAS_ROTARY_ENCODER
if (gCfgItems.encoder_enable) lv_group_add_obj(g, buttonZoffset); if (gCfgItems.encoder_enable) lv_group_add_obj(g, buttonZoffset);
#endif #endif
buttonZoffsetNarrow = lv_imgbtn_create(scr, NULL); buttonZoffsetNarrow = lv_imgbtn_create(scr, "F:/bmp_arrow.bin", PARA_UI_POS_X + PARA_UI_SIZE_X, PARA_UI_POS_Y * 3 + PARA_UI_ARROW_V, event_handler, ID_LEVEL_ZOFFSET_ARROW);
lv_obj_set_pos(buttonZoffsetNarrow, PARA_UI_POS_X + PARA_UI_SIZE_X, PARA_UI_POS_Y * 3 + PARA_UI_ARROW_V);
lv_obj_set_event_cb_mks(buttonZoffsetNarrow, event_handler, ID_LEVEL_ZOFFSET_ARROW, NULL, 0);
lv_imgbtn_set_src(buttonZoffsetNarrow, LV_BTN_STATE_REL, "F:/bmp_arrow.bin");
lv_imgbtn_set_src(buttonZoffsetNarrow, LV_BTN_STATE_PR, "F:/bmp_arrow.bin");
lv_imgbtn_set_style(buttonZoffsetNarrow, LV_BTN_STATE_PR, &tft_style_label_pre);
lv_imgbtn_set_style(buttonZoffsetNarrow, LV_BTN_STATE_REL, &tft_style_label_rel);
lv_btn_set_layout(buttonZoffsetNarrow, LV_LAYOUT_OFF); lv_btn_set_layout(buttonZoffsetNarrow, LV_LAYOUT_OFF);
line3 = lv_line_create(scr, NULL); line3 = lv_line_create(scr, NULL);
@ -220,19 +192,14 @@ void lv_draw_level_settings(void) {
#endif // HAS_BED_PROBE #endif // HAS_BED_PROBE
buttonBack = lv_imgbtn_create(scr, NULL); buttonBack = lv_imgbtn_create(scr, "F:/bmp_back70x40.bin", event_handler, ID_LEVEL_RETURN);
lv_obj_set_event_cb_mks(buttonBack, event_handler, ID_LEVEL_RETURN, NULL, 0);
lv_imgbtn_set_src(buttonBack, LV_BTN_STATE_REL, "F:/bmp_back70x40.bin");
lv_imgbtn_set_src(buttonBack, LV_BTN_STATE_PR, "F:/bmp_back70x40.bin");
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);
#if HAS_ROTARY_ENCODER #if HAS_ROTARY_ENCODER
if (gCfgItems.encoder_enable) lv_group_add_obj(g, buttonBack); if (gCfgItems.encoder_enable) lv_group_add_obj(g, buttonBack);
#endif #endif
lv_obj_set_pos(buttonBack, PARA_UI_BACL_POS_X, PARA_UI_BACL_POS_Y); lv_obj_set_pos(buttonBack, PARA_UI_BACL_POS_X, PARA_UI_BACL_POS_Y);
lv_btn_set_layout(buttonBack, LV_LAYOUT_OFF); lv_btn_set_layout(buttonBack, LV_LAYOUT_OFF);
label_Back = lv_label_create(buttonBack, NULL); label_Back = lv_label_create_empty(buttonBack);
if (gCfgItems.multiple_language) { if (gCfgItems.multiple_language) {
lv_label_set_text(label_Back, common_menu.text_back); lv_label_set_text(label_Back, common_menu.text_back);

View File

@ -146,10 +146,7 @@ void lv_draw_machine_para(void) {
lv_scr_load(scr); lv_scr_load(scr);
lv_obj_clean(scr); lv_obj_clean(scr);
lv_obj_t * title = lv_label_create(scr, NULL); (void)lv_label_create(scr, TITLE_XPOS, TITLE_YPOS, creat_title_text());
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());
lv_refr_now(lv_refr_get_disp_refreshing()); lv_refr_now(lv_refr_get_disp_refreshing());
@ -158,19 +155,11 @@ void lv_draw_machine_para(void) {
lv_obj_set_size(buttonMachine, PARA_UI_SIZE_X, PARA_UI_SIZE_Y); /*Set its size*/ lv_obj_set_size(buttonMachine, PARA_UI_SIZE_X, PARA_UI_SIZE_Y); /*Set its size*/
//lv_obj_set_event_cb(buttonMachine, event_handler); //lv_obj_set_event_cb(buttonMachine, event_handler);
lv_obj_set_event_cb_mks(buttonMachine, event_handler, ID_PARA_MACHINE, NULL, 0); lv_obj_set_event_cb_mks(buttonMachine, event_handler, ID_PARA_MACHINE, NULL, 0);
lv_btn_set_style(buttonMachine, LV_BTN_STYLE_REL, &tft_style_label_rel); /*Set the button's released style*/ lv_btn_use_label_style(buttonMachine);
lv_btn_set_style(buttonMachine, LV_BTN_STYLE_PR, &tft_style_label_pre); /*Set the button's pressed style*/
lv_btn_set_layout(buttonMachine, LV_LAYOUT_OFF); lv_btn_set_layout(buttonMachine, LV_LAYOUT_OFF);
labelMachine = lv_label_create(buttonMachine, NULL); /*Add a label to the button*/ labelMachine = lv_label_create_empty(buttonMachine); /*Add a label to the button*/
buttonMachineNarrow = lv_imgbtn_create(scr, NULL); buttonMachineNarrow = lv_imgbtn_create(scr, "F:/bmp_arrow.bin", PARA_UI_POS_X + PARA_UI_SIZE_X, PARA_UI_POS_Y + PARA_UI_ARROW_V, event_handler, ID_PARA_MACHINE_ARROW);
lv_obj_set_pos(buttonMachineNarrow, PARA_UI_POS_X + PARA_UI_SIZE_X, PARA_UI_POS_Y + PARA_UI_ARROW_V);
lv_obj_set_event_cb_mks(buttonMachineNarrow, event_handler, ID_PARA_MACHINE_ARROW, NULL, 0);
lv_imgbtn_set_src(buttonMachineNarrow, LV_BTN_STATE_REL, "F:/bmp_arrow.bin");
lv_imgbtn_set_src(buttonMachineNarrow, LV_BTN_STATE_PR, "F:/bmp_arrow.bin");
lv_imgbtn_set_style(buttonMachineNarrow, LV_BTN_STATE_PR, &tft_style_label_pre);
lv_imgbtn_set_style(buttonMachineNarrow, LV_BTN_STATE_REL, &tft_style_label_rel);
lv_btn_set_layout(buttonMachineNarrow, LV_LAYOUT_OFF);
line1 = lv_line_create(scr, NULL); line1 = lv_line_create(scr, NULL);
lv_ex_line(line1, line_points[0]); lv_ex_line(line1, line_points[0]);
@ -180,41 +169,21 @@ void lv_draw_machine_para(void) {
lv_obj_set_size(buttonMotor, PARA_UI_SIZE_X, PARA_UI_SIZE_Y); /*Set its size*/ lv_obj_set_size(buttonMotor, PARA_UI_SIZE_X, PARA_UI_SIZE_Y); /*Set its size*/
//lv_obj_set_event_cb(buttonMotor, event_handler); //lv_obj_set_event_cb(buttonMotor, event_handler);
lv_obj_set_event_cb_mks(buttonMotor, event_handler, ID_PARA_MOTOR, NULL, 0); lv_obj_set_event_cb_mks(buttonMotor, event_handler, ID_PARA_MOTOR, NULL, 0);
lv_btn_set_style(buttonMotor, LV_BTN_STYLE_REL, &tft_style_label_rel); /*Set the button's released style*/ lv_btn_use_label_style(buttonMotor);
lv_btn_set_style(buttonMotor, LV_BTN_STYLE_PR, &tft_style_label_pre); /*Set the button's pressed style*/
lv_btn_set_layout(buttonMotor, LV_LAYOUT_OFF); lv_btn_set_layout(buttonMotor, LV_LAYOUT_OFF);
labelMotor = lv_label_create(buttonMotor, NULL); /*Add a label to the button*/ labelMotor = lv_label_create_empty(buttonMotor); /*Add a label to the button*/
buttonMotorNarrow = lv_imgbtn_create(scr, NULL); buttonMotorNarrow = lv_imgbtn_create(scr, "F:/bmp_arrow.bin", PARA_UI_POS_X + PARA_UI_SIZE_X, PARA_UI_POS_Y * 2 + PARA_UI_ARROW_V, event_handler, ID_PARA_MOTOR_ARROW);
lv_obj_set_pos(buttonMotorNarrow, PARA_UI_POS_X + PARA_UI_SIZE_X, PARA_UI_POS_Y * 2 + PARA_UI_ARROW_V);
lv_obj_set_event_cb_mks(buttonMotorNarrow, event_handler, ID_PARA_MOTOR_ARROW, NULL, 0);
lv_imgbtn_set_src(buttonMotorNarrow, LV_BTN_STATE_REL, "F:/bmp_arrow.bin");
lv_imgbtn_set_src(buttonMotorNarrow, LV_BTN_STATE_PR, "F:/bmp_arrow.bin");
lv_imgbtn_set_style(buttonMotorNarrow, LV_BTN_STATE_PR, &tft_style_label_pre);
lv_imgbtn_set_style(buttonMotorNarrow, LV_BTN_STATE_REL, &tft_style_label_rel);
lv_btn_set_layout(buttonMotorNarrow, LV_LAYOUT_OFF);
line2 = lv_line_create(scr, NULL); line2 = lv_line_create(scr, NULL);
lv_ex_line(line2, line_points[1]); lv_ex_line(line2, line_points[1]);
buttonLevel = lv_btn_create(scr, NULL); /*Add a button the current screen*/ buttonLevel = lv_btn_create(scr, PARA_UI_POS_X, PARA_UI_POS_Y * 3, PARA_UI_SIZE_X, PARA_UI_SIZE_Y, event_handler, ID_PARA_LEVEL);
lv_obj_set_pos(buttonLevel, PARA_UI_POS_X, PARA_UI_POS_Y * 3); /*Set its position*/
lv_obj_set_size(buttonLevel, PARA_UI_SIZE_X, PARA_UI_SIZE_Y); /*Set its size*/
//lv_obj_set_event_cb(buttonMotor, event_handler); //lv_obj_set_event_cb(buttonMotor, event_handler);
lv_obj_set_event_cb_mks(buttonLevel, event_handler, ID_PARA_LEVEL, NULL, 0);
lv_btn_set_style(buttonLevel, LV_BTN_STYLE_REL, &tft_style_label_rel); /*Set the button's released style*/
lv_btn_set_style(buttonLevel, LV_BTN_STYLE_PR, &tft_style_label_pre); /*Set the button's pressed style*/
lv_btn_set_layout(buttonLevel, LV_LAYOUT_OFF); lv_btn_set_layout(buttonLevel, LV_LAYOUT_OFF);
labelLevel = lv_label_create(buttonLevel, NULL); /*Add a label to the button*/ labelLevel = lv_label_create_empty(buttonLevel); /*Add a label to the button*/
buttonLevelNarrow = lv_imgbtn_create(scr, NULL); buttonLevelNarrow = lv_imgbtn_create(scr, "F:/bmp_arrow.bin", PARA_UI_POS_X + PARA_UI_SIZE_X, PARA_UI_POS_Y * 3 + PARA_UI_ARROW_V, event_handler, ID_PARA_LEVEL_ARROW);
lv_obj_set_pos(buttonLevelNarrow, PARA_UI_POS_X + PARA_UI_SIZE_X, PARA_UI_POS_Y * 3 + PARA_UI_ARROW_V);
lv_obj_set_event_cb_mks(buttonLevelNarrow, event_handler, ID_PARA_LEVEL_ARROW, NULL, 0);
lv_imgbtn_set_src(buttonLevelNarrow, LV_BTN_STATE_REL, "F:/bmp_arrow.bin");
lv_imgbtn_set_src(buttonLevelNarrow, LV_BTN_STATE_PR, "F:/bmp_arrow.bin");
lv_imgbtn_set_style(buttonLevelNarrow, LV_BTN_STATE_PR, &tft_style_label_pre);
lv_imgbtn_set_style(buttonLevelNarrow, LV_BTN_STATE_REL, &tft_style_label_rel);
lv_btn_set_layout(buttonLevelNarrow, LV_LAYOUT_OFF);
line3 = lv_line_create(scr, NULL); line3 = lv_line_create(scr, NULL);
lv_ex_line(line3, line_points[2]); lv_ex_line(line3, line_points[2]);
@ -224,33 +193,18 @@ void lv_draw_machine_para(void) {
lv_obj_set_size(buttonAdvance, PARA_UI_SIZE_X, PARA_UI_SIZE_Y); /*Set its size*/ lv_obj_set_size(buttonAdvance, PARA_UI_SIZE_X, PARA_UI_SIZE_Y); /*Set its size*/
//lv_obj_set_event_cb(buttonMotor, event_handler); //lv_obj_set_event_cb(buttonMotor, event_handler);
lv_obj_set_event_cb_mks(buttonAdvance, event_handler, ID_PARA_ADVANCE, NULL, 0); lv_obj_set_event_cb_mks(buttonAdvance, event_handler, ID_PARA_ADVANCE, NULL, 0);
lv_btn_set_style(buttonAdvance, LV_BTN_STYLE_REL, &tft_style_label_rel); /*Set the button's released style*/ lv_btn_use_label_style(buttonAdvance);
lv_btn_set_style(buttonAdvance, LV_BTN_STYLE_PR, &tft_style_label_pre); /*Set the button's pressed style*/
lv_btn_set_layout(buttonAdvance, LV_LAYOUT_OFF); lv_btn_set_layout(buttonAdvance, LV_LAYOUT_OFF);
labelAdvance = lv_label_create(buttonAdvance, NULL); /*Add a label to the button*/ labelAdvance = lv_label_create_empty(buttonAdvance); /*Add a label to the button*/
buttonAdvanceNarrow = lv_imgbtn_create(scr, NULL); buttonAdvanceNarrow = lv_imgbtn_create(scr, "F:/bmp_arrow.bin", PARA_UI_POS_X + PARA_UI_SIZE_X, PARA_UI_POS_Y * 4 + PARA_UI_ARROW_V, event_handler, ID_PARA_ADVANCE_ARROW);
lv_obj_set_pos(buttonAdvanceNarrow, PARA_UI_POS_X + PARA_UI_SIZE_X, PARA_UI_POS_Y * 4 + PARA_UI_ARROW_V);
lv_obj_set_event_cb_mks(buttonAdvanceNarrow, event_handler, ID_PARA_ADVANCE_ARROW, NULL, 0);
lv_imgbtn_set_src(buttonAdvanceNarrow, LV_BTN_STATE_REL, "F:/bmp_arrow.bin");
lv_imgbtn_set_src(buttonAdvanceNarrow, LV_BTN_STATE_PR, "F:/bmp_arrow.bin");
lv_imgbtn_set_style(buttonAdvanceNarrow, LV_BTN_STATE_PR, &tft_style_label_pre);
lv_imgbtn_set_style(buttonAdvanceNarrow, LV_BTN_STATE_REL, &tft_style_label_rel);
lv_btn_set_layout(buttonAdvanceNarrow, LV_LAYOUT_OFF); lv_btn_set_layout(buttonAdvanceNarrow, LV_LAYOUT_OFF);
line4 = lv_line_create(scr, NULL); line4 = lv_line_create(scr, NULL);
lv_ex_line(line4, line_points[3]); lv_ex_line(line4, line_points[3]);
buttonBack = lv_imgbtn_create(scr, NULL); buttonBack = lv_imgbtn_create(scr, "F:/bmp_back70x40.bin", PARA_UI_BACL_POS_X + 10, PARA_UI_BACL_POS_Y, event_handler, ID_PARA_RETURN);
lv_obj_set_event_cb_mks(buttonBack, event_handler, ID_PARA_RETURN, NULL, 0); label_Back = lv_label_create_empty(buttonBack);
lv_imgbtn_set_src(buttonBack, LV_BTN_STATE_REL, "F:/bmp_back70x40.bin");
lv_imgbtn_set_src(buttonBack, LV_BTN_STATE_PR, "F:/bmp_back70x40.bin");
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);
lv_obj_set_pos(buttonBack, PARA_UI_BACL_POS_X + 10, PARA_UI_BACL_POS_Y);
lv_btn_set_layout(buttonBack, LV_LAYOUT_OFF);
label_Back = lv_label_create(buttonBack, NULL);
if (gCfgItems.multiple_language) { if (gCfgItems.multiple_language) {
lv_label_set_text(label_Back, common_menu.text_back); lv_label_set_text(label_Back, common_menu.text_back);
@ -277,7 +231,6 @@ void lv_draw_machine_para(void) {
lv_group_add_obj(g, buttonBack); lv_group_add_obj(g, buttonBack);
} }
#endif #endif
} }
void lv_clear_machine_para() { void lv_clear_machine_para() {

View File

@ -132,10 +132,7 @@ void lv_draw_machine_settings(void) {
lv_scr_load(scr); lv_scr_load(scr);
lv_obj_clean(scr); lv_obj_clean(scr);
lv_obj_t * title = lv_label_create(scr, NULL); (void)lv_label_create(scr, TITLE_XPOS, TITLE_YPOS, machine_menu.MachineConfigTitle);
lv_obj_set_style(title, &tft_style_label_rel);
lv_obj_set_pos(title, TITLE_XPOS, TITLE_YPOS);
lv_label_set_text(title, machine_menu.MachineConfigTitle);
lv_refr_now(lv_refr_get_disp_refreshing()); lv_refr_now(lv_refr_get_disp_refreshing());
@ -144,19 +141,11 @@ void lv_draw_machine_settings(void) {
lv_obj_set_size(buttonAcceleration, PARA_UI_SIZE_X, PARA_UI_SIZE_Y); // Set its size lv_obj_set_size(buttonAcceleration, PARA_UI_SIZE_X, PARA_UI_SIZE_Y); // Set its size
//lv_obj_set_event_cb(buttonMachine, event_handler); //lv_obj_set_event_cb(buttonMachine, event_handler);
lv_obj_set_event_cb_mks(buttonAcceleration, event_handler, ID_MACHINE_ACCELERATION, NULL, 0); lv_obj_set_event_cb_mks(buttonAcceleration, event_handler, ID_MACHINE_ACCELERATION, NULL, 0);
lv_btn_set_style(buttonAcceleration, LV_BTN_STYLE_REL, &tft_style_label_rel); // Set the button's released style lv_btn_use_label_style(buttonAcceleration);
lv_btn_set_style(buttonAcceleration, LV_BTN_STYLE_PR, &tft_style_label_pre); // Set the button's pressed style
lv_btn_set_layout(buttonAcceleration, LV_LAYOUT_OFF); lv_btn_set_layout(buttonAcceleration, LV_LAYOUT_OFF);
labelAcceleration = lv_label_create(buttonAcceleration, NULL); // Add a label to the button labelAcceleration = lv_label_create_empty(buttonAcceleration); // Add a label to the button
buttonAccelerationNarrow = lv_imgbtn_create(scr, NULL); buttonAccelerationNarrow = lv_imgbtn_create(scr, "F:/bmp_arrow.bin", PARA_UI_POS_X + PARA_UI_SIZE_X, PARA_UI_POS_Y + PARA_UI_ARROW_V, event_handler, ID_MACHINE_ACCELERATION_ARROW);
lv_obj_set_pos(buttonAccelerationNarrow, PARA_UI_POS_X + PARA_UI_SIZE_X, PARA_UI_POS_Y + PARA_UI_ARROW_V);
lv_obj_set_event_cb_mks(buttonAccelerationNarrow, event_handler, ID_MACHINE_ACCELERATION_ARROW, NULL, 0);
lv_imgbtn_set_src(buttonAccelerationNarrow, LV_BTN_STATE_REL, "F:/bmp_arrow.bin");
lv_imgbtn_set_src(buttonAccelerationNarrow, LV_BTN_STATE_PR, "F:/bmp_arrow.bin");
lv_imgbtn_set_style(buttonAccelerationNarrow, LV_BTN_STATE_PR, &tft_style_label_pre);
lv_imgbtn_set_style(buttonAccelerationNarrow, LV_BTN_STATE_REL, &tft_style_label_rel);
lv_btn_set_layout(buttonAccelerationNarrow, LV_LAYOUT_OFF);
line1 = lv_line_create(lv_scr_act(), NULL); line1 = lv_line_create(lv_scr_act(), NULL);
lv_ex_line(line1, line_points[0]); lv_ex_line(line1, line_points[0]);
@ -166,19 +155,11 @@ void lv_draw_machine_settings(void) {
lv_obj_set_size(buttonMaxFeedrate, PARA_UI_SIZE_X, PARA_UI_SIZE_Y); // Set its size lv_obj_set_size(buttonMaxFeedrate, PARA_UI_SIZE_X, PARA_UI_SIZE_Y); // Set its size
//lv_obj_set_event_cb(buttonMachine, event_handler); //lv_obj_set_event_cb(buttonMachine, event_handler);
lv_obj_set_event_cb_mks(buttonMaxFeedrate, event_handler, ID_MACHINE_FEEDRATE, NULL, 0); lv_obj_set_event_cb_mks(buttonMaxFeedrate, event_handler, ID_MACHINE_FEEDRATE, NULL, 0);
lv_btn_set_style(buttonMaxFeedrate, LV_BTN_STYLE_REL, &tft_style_label_rel); // Set the button's released style lv_btn_use_label_style(buttonMaxFeedrate);
lv_btn_set_style(buttonMaxFeedrate, LV_BTN_STYLE_PR, &tft_style_label_pre); // Set the button's pressed style
lv_btn_set_layout(buttonMaxFeedrate, LV_LAYOUT_OFF); lv_btn_set_layout(buttonMaxFeedrate, LV_LAYOUT_OFF);
labelMaxFeedrate = lv_label_create(buttonMaxFeedrate, NULL); // Add a label to the button labelMaxFeedrate = lv_label_create_empty(buttonMaxFeedrate); // Add a label to the button
buttonMaxFeedrateNarrow = lv_imgbtn_create(scr, NULL); buttonMaxFeedrateNarrow = lv_imgbtn_create(scr, "F:/bmp_arrow.bin", PARA_UI_POS_X + PARA_UI_SIZE_X, PARA_UI_POS_Y * 2 + PARA_UI_ARROW_V, event_handler, ID_MACHINE_FEEDRATE_ARROW);
lv_obj_set_pos(buttonMaxFeedrateNarrow, PARA_UI_POS_X + PARA_UI_SIZE_X, PARA_UI_POS_Y * 2 + PARA_UI_ARROW_V);
lv_obj_set_event_cb_mks(buttonMaxFeedrateNarrow, event_handler, ID_MACHINE_FEEDRATE_ARROW, NULL, 0);
lv_imgbtn_set_src(buttonMaxFeedrateNarrow, LV_BTN_STATE_REL, "F:/bmp_arrow.bin");
lv_imgbtn_set_src(buttonMaxFeedrateNarrow, LV_BTN_STATE_PR, "F:/bmp_arrow.bin");
lv_imgbtn_set_style(buttonMaxFeedrateNarrow, LV_BTN_STATE_PR, &tft_style_label_pre);
lv_imgbtn_set_style(buttonMaxFeedrateNarrow, LV_BTN_STATE_REL, &tft_style_label_rel);
lv_btn_set_layout(buttonMaxFeedrateNarrow, LV_LAYOUT_OFF);
line2 = lv_line_create(lv_scr_act(), NULL); line2 = lv_line_create(lv_scr_act(), NULL);
lv_ex_line(line2, line_points[1]); lv_ex_line(line2, line_points[1]);
@ -189,34 +170,21 @@ void lv_draw_machine_settings(void) {
lv_obj_set_size(buttonJerk, PARA_UI_SIZE_X, PARA_UI_SIZE_Y); // Set its size lv_obj_set_size(buttonJerk, PARA_UI_SIZE_X, PARA_UI_SIZE_Y); // Set its size
//lv_obj_set_event_cb(buttonMotor, event_handler); //lv_obj_set_event_cb(buttonMotor, event_handler);
lv_obj_set_event_cb_mks(buttonJerk, event_handler, ID_MACHINE_JERK, NULL, 0); lv_obj_set_event_cb_mks(buttonJerk, event_handler, ID_MACHINE_JERK, NULL, 0);
lv_btn_set_style(buttonJerk, LV_BTN_STYLE_REL, &tft_style_label_rel); // Set the button's released style lv_btn_use_label_style(buttonJerk);
lv_btn_set_style(buttonJerk, LV_BTN_STYLE_PR, &tft_style_label_pre); // Set the button's pressed style
lv_btn_set_layout(buttonJerk, LV_LAYOUT_OFF); lv_btn_set_layout(buttonJerk, LV_LAYOUT_OFF);
labelJerk = lv_label_create(buttonJerk, NULL); // Add a label to the button labelJerk = lv_label_create_empty(buttonJerk); // Add a label to the button
buttonJerkNarrow = lv_imgbtn_create(scr, NULL); buttonJerkNarrow = lv_imgbtn_create(scr, "F:/bmp_arrow.bin", PARA_UI_POS_X + PARA_UI_SIZE_X, PARA_UI_POS_Y * 3 + PARA_UI_ARROW_V, event_handler, ID_MACHINE_JERK_ARROW);
lv_obj_set_pos(buttonJerkNarrow, PARA_UI_POS_X + PARA_UI_SIZE_X, PARA_UI_POS_Y * 3 + PARA_UI_ARROW_V);
lv_obj_set_event_cb_mks(buttonJerkNarrow, event_handler, ID_MACHINE_JERK_ARROW, NULL, 0);
lv_imgbtn_set_src(buttonJerkNarrow, LV_BTN_STATE_REL, "F:/bmp_arrow.bin");
lv_imgbtn_set_src(buttonJerkNarrow, LV_BTN_STATE_PR, "F:/bmp_arrow.bin");
lv_imgbtn_set_style(buttonJerkNarrow, LV_BTN_STATE_PR, &tft_style_label_pre);
lv_imgbtn_set_style(buttonJerkNarrow, LV_BTN_STATE_REL, &tft_style_label_rel);
lv_btn_set_layout(buttonJerkNarrow, LV_LAYOUT_OFF);
line3 = lv_line_create(lv_scr_act(), NULL); line3 = lv_line_create(lv_scr_act(), NULL);
lv_ex_line(line3, line_points[2]); lv_ex_line(line3, line_points[2]);
#endif #endif
buttonBack = lv_imgbtn_create(scr, NULL); buttonBack = lv_imgbtn_create(scr, "F:/bmp_back70x40.bin", event_handler, ID_MACHINE_RETURN);
lv_obj_set_event_cb_mks(buttonBack, event_handler, ID_MACHINE_RETURN, NULL, 0);
lv_imgbtn_set_src(buttonBack, LV_BTN_STATE_REL, "F:/bmp_back70x40.bin");
lv_imgbtn_set_src(buttonBack, LV_BTN_STATE_PR, "F:/bmp_back70x40.bin");
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);
lv_obj_set_pos(buttonBack, PARA_UI_BACL_POS_X, PARA_UI_BACL_POS_Y); lv_obj_set_pos(buttonBack, PARA_UI_BACL_POS_X, PARA_UI_BACL_POS_Y);
lv_btn_set_layout(buttonBack, LV_LAYOUT_OFF); lv_btn_set_layout(buttonBack, LV_LAYOUT_OFF);
label_Back = lv_label_create(buttonBack, NULL); label_Back = lv_label_create_empty(buttonBack);
if (gCfgItems.multiple_language) { if (gCfgItems.multiple_language) {
lv_label_set_text(label_Back, common_menu.text_back); lv_label_set_text(label_Back, common_menu.text_back);

View File

@ -178,81 +178,26 @@ void lv_draw_manualLevel(void) {
lv_scr_load(scr); lv_scr_load(scr);
lv_obj_clean(scr); lv_obj_clean(scr);
lv_obj_t * title = lv_label_create(scr, NULL); (void)lv_label_create(scr, TITLE_XPOS, TITLE_YPOS, creat_title_text());
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());
lv_refr_now(lv_refr_get_disp_refreshing()); lv_refr_now(lv_refr_get_disp_refreshing());
// Create an Image button // Create an Image button
buttonPoint1 = lv_imgbtn_create(scr, NULL); buttonPoint1 = lv_imgbtn_create(scr, "F:/bmp_leveling1.bin", INTERVAL_V, titleHeight, event_handler, ID_M_POINT1);
buttonPoint2 = lv_imgbtn_create(scr, NULL);
buttonPoint3 = lv_imgbtn_create(scr, NULL);
buttonPoint4 = lv_imgbtn_create(scr, NULL);
buttonPoint5 = lv_imgbtn_create(scr, NULL);
buttonBack = lv_imgbtn_create(scr, NULL);
lv_obj_set_event_cb_mks(buttonPoint1, event_handler, ID_M_POINT1, NULL, 0);
lv_imgbtn_set_src(buttonPoint1, LV_BTN_STATE_REL, "F:/bmp_leveling1.bin");
lv_imgbtn_set_src(buttonPoint1, LV_BTN_STATE_PR, "F:/bmp_leveling1.bin");
lv_imgbtn_set_style(buttonPoint1, LV_BTN_STATE_PR, &tft_style_label_pre);
lv_imgbtn_set_style(buttonPoint1, LV_BTN_STATE_REL, &tft_style_label_rel);
lv_obj_clear_protect(buttonPoint1, LV_PROTECT_FOLLOW); lv_obj_clear_protect(buttonPoint1, LV_PROTECT_FOLLOW);
buttonPoint2 = lv_imgbtn_create(scr, "F:/bmp_leveling2.bin", BTN_X_PIXEL + INTERVAL_V * 2, titleHeight, event_handler, ID_M_POINT2);
#if 1 buttonPoint3 = lv_imgbtn_create(scr, "F:/bmp_leveling3.bin", BTN_X_PIXEL * 2 + INTERVAL_V * 3, titleHeight, event_handler, ID_M_POINT3);
lv_obj_set_event_cb_mks(buttonPoint2, event_handler, ID_M_POINT2, NULL, 0); buttonPoint4 = lv_imgbtn_create(scr, "F:/bmp_leveling4.bin", BTN_X_PIXEL * 3 + INTERVAL_V * 4, titleHeight, event_handler, ID_M_POINT4);
lv_imgbtn_set_src(buttonPoint2, LV_BTN_STATE_REL, "F:/bmp_leveling2.bin"); buttonPoint5 = lv_imgbtn_create(scr, "F:/bmp_leveling5.bin", INTERVAL_V, BTN_Y_PIXEL + INTERVAL_H + titleHeight, event_handler, ID_M_POINT5);
lv_imgbtn_set_src(buttonPoint2, LV_BTN_STATE_PR, "F:/bmp_leveling2.bin"); buttonBack = lv_imgbtn_create(scr, "F:/bmp_return.bin", BTN_X_PIXEL * 3 + INTERVAL_V * 4, BTN_Y_PIXEL + INTERVAL_H + titleHeight, event_handler, ID_MANUAL_RETURN);
lv_imgbtn_set_style(buttonPoint2, LV_BTN_STATE_PR, &tft_style_label_pre);
lv_imgbtn_set_style(buttonPoint2, LV_BTN_STATE_REL, &tft_style_label_rel);
lv_obj_set_event_cb_mks(buttonPoint3, event_handler, ID_M_POINT3, NULL, 0);
lv_imgbtn_set_src(buttonPoint3, LV_BTN_STATE_REL, "F:/bmp_leveling3.bin");
lv_imgbtn_set_src(buttonPoint3, LV_BTN_STATE_PR, "F:/bmp_leveling3.bin");
lv_imgbtn_set_style(buttonPoint3, LV_BTN_STATE_PR, &tft_style_label_pre);
lv_imgbtn_set_style(buttonPoint3, LV_BTN_STATE_REL, &tft_style_label_rel);
lv_obj_set_event_cb_mks(buttonPoint4, event_handler, ID_M_POINT4, NULL, 0);
lv_imgbtn_set_src(buttonPoint4, LV_BTN_STATE_REL, "F:/bmp_leveling4.bin");
lv_imgbtn_set_src(buttonPoint4, LV_BTN_STATE_PR, "F:/bmp_leveling4.bin");
lv_imgbtn_set_style(buttonPoint4, LV_BTN_STATE_PR, &tft_style_label_pre);
lv_imgbtn_set_style(buttonPoint4, LV_BTN_STATE_REL, &tft_style_label_rel);
lv_obj_set_event_cb_mks(buttonPoint5, event_handler, ID_M_POINT5, NULL, 0);
lv_imgbtn_set_src(buttonPoint5, LV_BTN_STATE_REL, "F:/bmp_leveling5.bin");
lv_imgbtn_set_src(buttonPoint5, LV_BTN_STATE_PR, "F:/bmp_leveling5.bin");
lv_imgbtn_set_style(buttonPoint5, LV_BTN_STATE_PR, &tft_style_label_pre);
lv_imgbtn_set_style(buttonPoint5, LV_BTN_STATE_REL, &tft_style_label_rel);
lv_obj_set_event_cb_mks(buttonBack, event_handler, ID_MANUAL_RETURN, NULL, 0);
lv_imgbtn_set_src(buttonBack, LV_BTN_STATE_REL, "F:/bmp_return.bin");
lv_imgbtn_set_src(buttonBack, LV_BTN_STATE_PR, "F:/bmp_return.bin");
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(buttonPoint1, INTERVAL_V, titleHeight);
lv_obj_set_pos(buttonPoint2, BTN_X_PIXEL + INTERVAL_V * 2, titleHeight);
lv_obj_set_pos(buttonPoint3, BTN_X_PIXEL * 2 + INTERVAL_V * 3, titleHeight);
lv_obj_set_pos(buttonPoint4, BTN_X_PIXEL * 3 + INTERVAL_V * 4, titleHeight);
lv_obj_set_pos(buttonPoint5, INTERVAL_V, 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 labels on the image buttons // Create labels on the image buttons
lv_btn_set_layout(buttonPoint1, LV_LAYOUT_OFF); lv_obj_t *label_Point1 = lv_label_create_empty(buttonPoint1);
lv_btn_set_layout(buttonPoint2, LV_LAYOUT_OFF); lv_obj_t *label_Point2 = lv_label_create_empty(buttonPoint2);
lv_btn_set_layout(buttonPoint3, LV_LAYOUT_OFF); lv_obj_t *label_Point3 = lv_label_create_empty(buttonPoint3);
lv_btn_set_layout(buttonPoint4, LV_LAYOUT_OFF); lv_obj_t *label_Point4 = lv_label_create_empty(buttonPoint4);
lv_btn_set_layout(buttonPoint5, LV_LAYOUT_OFF); lv_obj_t *label_Point5 = lv_label_create_empty(buttonPoint5);
lv_btn_set_layout(buttonBack, LV_LAYOUT_OFF); lv_obj_t *label_Back = lv_label_create_empty(buttonBack);
lv_obj_t *label_Point1 = lv_label_create(buttonPoint1, NULL);
lv_obj_t *label_Point2 = lv_label_create(buttonPoint2, NULL);
lv_obj_t *label_Point3 = lv_label_create(buttonPoint3, NULL);
lv_obj_t *label_Point4 = lv_label_create(buttonPoint4, NULL);
lv_obj_t *label_Point5 = lv_label_create(buttonPoint5, NULL);
lv_obj_t *label_Back = lv_label_create(buttonBack, NULL);
if (gCfgItems.multiple_language) { if (gCfgItems.multiple_language) {
lv_label_set_text(label_Point1, leveling_menu.position1); lv_label_set_text(label_Point1, leveling_menu.position1);

View File

@ -183,15 +183,15 @@ static void event_handler(lv_obj_t * obj, lv_event_t event) {
void lv_draw_manual_level_pos_settings(void) { void lv_draw_manual_level_pos_settings(void) {
lv_obj_t *buttonBack = NULL, *label_Back = NULL, *buttonTurnPage = NULL, *labelTurnPage = NULL; lv_obj_t *buttonBack = NULL, *label_Back = NULL, *buttonTurnPage = NULL, *labelTurnPage = NULL;
lv_obj_t *labelPoint1Text = NULL, *buttonX1Value = NULL, *labelX1Value = NULL; lv_obj_t *buttonX1Value = NULL, *labelX1Value = NULL;
lv_obj_t *buttonY1Value = NULL, *labelY1Value = NULL; lv_obj_t *buttonY1Value = NULL, *labelY1Value = NULL;
lv_obj_t *labelPoint2Text = NULL, *buttonX2Value = NULL, *labelX2Value = NULL; lv_obj_t *buttonX2Value = NULL, *labelX2Value = NULL;
lv_obj_t *buttonY2Value = NULL, *labelY2Value = NULL; lv_obj_t *buttonY2Value = NULL, *labelY2Value = NULL;
lv_obj_t *labelPoint3Text = NULL, *buttonX3Value = NULL, *labelX3Value = NULL; lv_obj_t *buttonX3Value = NULL, *labelX3Value = NULL;
lv_obj_t *buttonY3Value = NULL, *labelY3Value = NULL; lv_obj_t *buttonY3Value = NULL, *labelY3Value = NULL;
lv_obj_t *labelPoint4Text = NULL, *buttonX4Value = NULL, *labelX4Value = NULL; lv_obj_t *buttonX4Value = NULL, *labelX4Value = NULL;
lv_obj_t *buttonY4Value = NULL, *labelY4Value = NULL; lv_obj_t *buttonY4Value = NULL, *labelY4Value = NULL;
lv_obj_t *labelPoint5Text = NULL, *buttonX5Value = NULL, *labelX5Value = NULL; lv_obj_t *buttonX5Value = NULL, *labelX5Value = NULL;
lv_obj_t *buttonY5Value = NULL, *labelY5Value = NULL; lv_obj_t *buttonY5Value = NULL, *labelY5Value = NULL;
lv_obj_t * line1 = NULL, * line2 = NULL, * line3 = NULL, * line4 = NULL; lv_obj_t * line1 = NULL, * line2 = NULL, * line3 = NULL, * line4 = NULL;
if (disp_state_stack._disp_state[disp_state_stack._disp_index] != MANUAL_LEVELING_POSIGION_UI) { if (disp_state_stack._disp_state[disp_state_stack._disp_index] != MANUAL_LEVELING_POSIGION_UI) {
@ -206,114 +206,58 @@ void lv_draw_manual_level_pos_settings(void) {
lv_scr_load(scr); lv_scr_load(scr);
lv_obj_clean(scr); lv_obj_clean(scr);
lv_obj_t * title = lv_label_create(scr, NULL); (void)lv_label_create(scr, TITLE_XPOS, TITLE_YPOS, machine_menu.LevelingParaConfTitle);
lv_obj_set_style(title, &tft_style_label_rel);
lv_obj_set_pos(title, TITLE_XPOS, TITLE_YPOS);
lv_label_set_text(title, machine_menu.LevelingParaConfTitle);
lv_refr_now(lv_refr_get_disp_refreshing()); lv_refr_now(lv_refr_get_disp_refreshing());
if (uiCfg.para_ui_page != 1) { if (uiCfg.para_ui_page != 1) {
labelPoint1Text = lv_label_create(scr, NULL); (void)lv_label_create(scr, PARA_UI_POS_X, PARA_UI_POS_Y + 10, leveling_menu.position1);
lv_obj_set_style(labelPoint1Text, &tft_style_label_rel);
lv_obj_set_pos(labelPoint1Text, PARA_UI_POS_X, PARA_UI_POS_Y + 10);
lv_label_set_text(labelPoint1Text, leveling_menu.position1);
buttonX1Value = lv_btn_create(scr, NULL); buttonX1Value = lv_btn_create(scr, PARA_UI_VALUE_POS_X_2, PARA_UI_POS_Y + PARA_UI_VALUE_V_2, PARA_UI_VALUE_BTN_X_SIZE, PARA_UI_VALUE_BTN_Y_SIZE, event_handler, ID_MANUAL_POS_X1);
lv_obj_set_pos(buttonX1Value, PARA_UI_VALUE_POS_X_2, PARA_UI_POS_Y + PARA_UI_VALUE_V_2); labelX1Value = lv_label_create_empty(buttonX1Value);
lv_obj_set_size(buttonX1Value, PARA_UI_VALUE_BTN_X_SIZE, PARA_UI_VALUE_BTN_Y_SIZE);
lv_obj_set_event_cb_mks(buttonX1Value, event_handler, ID_MANUAL_POS_X1, NULL, 0);
lv_btn_set_style(buttonX1Value, LV_BTN_STYLE_REL, &style_para_value);
lv_btn_set_style(buttonX1Value, LV_BTN_STYLE_PR, &style_para_value);
labelX1Value = lv_label_create(buttonX1Value, NULL);
buttonY1Value = lv_btn_create(scr, NULL); buttonY1Value = lv_btn_create(scr, PARA_UI_VALUE_POS_X, PARA_UI_POS_Y + PARA_UI_VALUE_V_2, PARA_UI_VALUE_BTN_X_SIZE, PARA_UI_VALUE_BTN_Y_SIZE, event_handler, ID_MANUAL_POS_Y1);
lv_obj_set_pos(buttonY1Value, PARA_UI_VALUE_POS_X, PARA_UI_POS_Y + PARA_UI_VALUE_V_2); labelY1Value = lv_label_create_empty(buttonY1Value);
lv_obj_set_size(buttonY1Value, PARA_UI_VALUE_BTN_X_SIZE, PARA_UI_VALUE_BTN_Y_SIZE);
lv_obj_set_event_cb_mks(buttonY1Value, event_handler, ID_MANUAL_POS_Y1, NULL, 0);
lv_btn_set_style(buttonY1Value, LV_BTN_STYLE_REL, &style_para_value);
lv_btn_set_style(buttonY1Value, LV_BTN_STYLE_PR, &style_para_value);
labelY1Value = lv_label_create(buttonY1Value, NULL);
line1 = lv_line_create(scr, NULL); line1 = lv_line_create(scr, NULL);
lv_ex_line(line1, line_points[0]); lv_ex_line(line1, line_points[0]);
labelPoint2Text = lv_label_create(scr, NULL); (void)lv_label_create(scr, PARA_UI_POS_X, PARA_UI_POS_Y * 2 + 10, leveling_menu.position2);
lv_obj_set_style(labelPoint2Text, &tft_style_label_rel);
lv_obj_set_pos(labelPoint2Text, PARA_UI_POS_X, PARA_UI_POS_Y * 2 + 10);
lv_label_set_text(labelPoint2Text, leveling_menu.position2);
buttonX2Value = lv_btn_create(scr, NULL); buttonX2Value = lv_btn_create(scr, PARA_UI_VALUE_POS_X_2, PARA_UI_POS_Y * 2 + PARA_UI_VALUE_V_2, PARA_UI_VALUE_BTN_X_SIZE, PARA_UI_VALUE_BTN_Y_SIZE, event_handler, ID_MANUAL_POS_X2);
lv_obj_set_pos(buttonX2Value, PARA_UI_VALUE_POS_X_2, PARA_UI_POS_Y * 2 + PARA_UI_VALUE_V_2); labelX2Value = lv_label_create_empty(buttonX2Value);
lv_obj_set_size(buttonX2Value, PARA_UI_VALUE_BTN_X_SIZE, PARA_UI_VALUE_BTN_Y_SIZE);
lv_obj_set_event_cb_mks(buttonX2Value, event_handler, ID_MANUAL_POS_X2, NULL, 0);
lv_btn_set_style(buttonX2Value, LV_BTN_STYLE_REL, &style_para_value);
lv_btn_set_style(buttonX2Value, LV_BTN_STYLE_PR, &style_para_value);
labelX2Value = lv_label_create(buttonX2Value, NULL);
buttonY2Value = lv_btn_create(scr, NULL); buttonY2Value = lv_btn_create(scr, PARA_UI_VALUE_POS_X, PARA_UI_POS_Y * 2 + PARA_UI_VALUE_V_2, PARA_UI_VALUE_BTN_X_SIZE, PARA_UI_VALUE_BTN_Y_SIZE, event_handler, ID_MANUAL_POS_Y2);
lv_obj_set_pos(buttonY2Value, PARA_UI_VALUE_POS_X, PARA_UI_POS_Y * 2 + PARA_UI_VALUE_V_2); labelY2Value = lv_label_create_empty(buttonY2Value);
lv_obj_set_size(buttonY2Value, PARA_UI_VALUE_BTN_X_SIZE, PARA_UI_VALUE_BTN_Y_SIZE);
lv_obj_set_event_cb_mks(buttonY2Value, event_handler, ID_MANUAL_POS_Y2, NULL, 0);
lv_btn_set_style(buttonY2Value, LV_BTN_STYLE_REL, &style_para_value);
lv_btn_set_style(buttonY2Value, LV_BTN_STYLE_PR, &style_para_value);
labelY2Value = lv_label_create(buttonY2Value, NULL);
line2 = lv_line_create(scr, NULL); line2 = lv_line_create(scr, NULL);
lv_ex_line(line2, line_points[1]); lv_ex_line(line2, line_points[1]);
labelPoint3Text = lv_label_create(scr, NULL); (void)lv_label_create(scr, PARA_UI_POS_X, PARA_UI_POS_Y * 3 + 10, leveling_menu.position3);
lv_obj_set_style(labelPoint3Text, &tft_style_label_rel);
lv_obj_set_pos(labelPoint3Text, PARA_UI_POS_X, PARA_UI_POS_Y * 3 + 10);
lv_label_set_text(labelPoint3Text, leveling_menu.position3);
buttonX3Value = lv_btn_create(scr, NULL); buttonX3Value = lv_btn_create(scr, PARA_UI_VALUE_POS_X_2, PARA_UI_POS_Y * 3 + PARA_UI_VALUE_V_2, PARA_UI_VALUE_BTN_X_SIZE, PARA_UI_VALUE_BTN_Y_SIZE, event_handler, ID_MANUAL_POS_X3);
lv_obj_set_pos(buttonX3Value, PARA_UI_VALUE_POS_X_2, PARA_UI_POS_Y * 3 + PARA_UI_VALUE_V_2); labelX3Value = lv_label_create_empty(buttonX3Value);
lv_obj_set_size(buttonX3Value, PARA_UI_VALUE_BTN_X_SIZE, PARA_UI_VALUE_BTN_Y_SIZE);
lv_obj_set_event_cb_mks(buttonX3Value, event_handler, ID_MANUAL_POS_X3, NULL, 0);
lv_btn_set_style(buttonX3Value, LV_BTN_STYLE_REL, &style_para_value);
lv_btn_set_style(buttonX3Value, LV_BTN_STYLE_PR, &style_para_value);
labelX3Value = lv_label_create(buttonX3Value, NULL);
buttonY3Value = lv_btn_create(scr, NULL); buttonY3Value = lv_btn_create(scr, PARA_UI_VALUE_POS_X, PARA_UI_POS_Y * 3 + PARA_UI_VALUE_V_2, PARA_UI_VALUE_BTN_X_SIZE, PARA_UI_VALUE_BTN_Y_SIZE, event_handler, ID_MANUAL_POS_Y3);
lv_obj_set_pos(buttonY3Value, PARA_UI_VALUE_POS_X, PARA_UI_POS_Y * 3 + PARA_UI_VALUE_V_2); labelY3Value = lv_label_create_empty(buttonY3Value);
lv_obj_set_size(buttonY3Value, PARA_UI_VALUE_BTN_X_SIZE, PARA_UI_VALUE_BTN_Y_SIZE);
lv_obj_set_event_cb_mks(buttonY3Value, event_handler, ID_MANUAL_POS_Y3, NULL, 0);
lv_btn_set_style(buttonY3Value, LV_BTN_STYLE_REL, &style_para_value);
lv_btn_set_style(buttonY3Value, LV_BTN_STYLE_PR, &style_para_value);
labelY3Value = lv_label_create(buttonY3Value, NULL);
line3 = lv_line_create(scr, NULL); line3 = lv_line_create(scr, NULL);
lv_ex_line(line3, line_points[2]); lv_ex_line(line3, line_points[2]);
labelPoint4Text = lv_label_create(scr, NULL); (void)lv_label_create(scr, PARA_UI_POS_X, PARA_UI_POS_Y * 4 + 10, leveling_menu.position4);
lv_obj_set_style(labelPoint4Text, &tft_style_label_rel);
lv_obj_set_pos(labelPoint4Text, PARA_UI_POS_X, PARA_UI_POS_Y * 4 + 10);
lv_label_set_text(labelPoint4Text, leveling_menu.position4);
buttonX4Value = lv_btn_create(scr, NULL); buttonX4Value = lv_btn_create(scr, PARA_UI_VALUE_POS_X_2, PARA_UI_POS_Y * 4 + PARA_UI_VALUE_V_2, PARA_UI_VALUE_BTN_X_SIZE, PARA_UI_VALUE_BTN_Y_SIZE, event_handler, ID_MANUAL_POS_X4);
lv_obj_set_pos(buttonX4Value, PARA_UI_VALUE_POS_X_2, PARA_UI_POS_Y * 4 + PARA_UI_VALUE_V_2); labelX4Value = lv_label_create_empty(buttonX4Value);
lv_obj_set_size(buttonX4Value, PARA_UI_VALUE_BTN_X_SIZE, PARA_UI_VALUE_BTN_Y_SIZE);
lv_obj_set_event_cb_mks(buttonX4Value, event_handler, ID_MANUAL_POS_X4, NULL, 0);
lv_btn_set_style(buttonX4Value, LV_BTN_STYLE_REL, &style_para_value);
lv_btn_set_style(buttonX4Value, LV_BTN_STYLE_PR, &style_para_value);
labelX4Value = lv_label_create(buttonX4Value, NULL);
buttonY4Value = lv_btn_create(scr, NULL); buttonY4Value = lv_btn_create(scr, PARA_UI_VALUE_POS_X, PARA_UI_POS_Y * 4 + PARA_UI_VALUE_V_2, PARA_UI_VALUE_BTN_X_SIZE, PARA_UI_VALUE_BTN_Y_SIZE, event_handler, ID_MANUAL_POS_Y4);
lv_obj_set_pos(buttonY4Value, PARA_UI_VALUE_POS_X, PARA_UI_POS_Y * 4 + PARA_UI_VALUE_V_2); labelY4Value = lv_label_create_empty(buttonY4Value);
lv_obj_set_size(buttonY4Value, PARA_UI_VALUE_BTN_X_SIZE, PARA_UI_VALUE_BTN_Y_SIZE);
lv_obj_set_event_cb_mks(buttonY4Value, event_handler, ID_MANUAL_POS_Y4, NULL, 0);
lv_btn_set_style(buttonY4Value, LV_BTN_STYLE_REL, &style_para_value);
lv_btn_set_style(buttonY4Value, LV_BTN_STYLE_PR, &style_para_value);
labelY4Value = lv_label_create(buttonY4Value, NULL);
line4 = lv_line_create(scr, NULL); line4 = lv_line_create(scr, NULL);
lv_ex_line(line4, line_points[3]); lv_ex_line(line4, line_points[3]);
buttonTurnPage = lv_btn_create(scr, NULL); buttonTurnPage = lv_btn_create(scr, NULL);
lv_obj_set_event_cb_mks(buttonTurnPage, event_handler, ID_MANUAL_POS_DOWN, NULL, 0); lv_obj_set_event_cb_mks(buttonTurnPage, event_handler, ID_MANUAL_POS_DOWN, NULL, 0);
lv_btn_set_style(buttonTurnPage, LV_BTN_STYLE_REL, &style_para_back); lv_btn_set_style_both(buttonTurnPage, &style_para_back);
lv_btn_set_style(buttonTurnPage, LV_BTN_STYLE_PR, &style_para_back);
#if HAS_ROTARY_ENCODER #if HAS_ROTARY_ENCODER
if (gCfgItems.encoder_enable) { if (gCfgItems.encoder_enable) {
@ -330,34 +274,20 @@ void lv_draw_manual_level_pos_settings(void) {
#endif #endif
} }
else { else {
labelPoint5Text = lv_label_create(scr, NULL); (void)lv_label_create(scr, PARA_UI_POS_X, PARA_UI_POS_Y + 10, leveling_menu.position5);
lv_obj_set_style(labelPoint5Text, &tft_style_label_rel);
lv_obj_set_pos(labelPoint5Text, PARA_UI_POS_X, PARA_UI_POS_Y + 10);
lv_label_set_text(labelPoint5Text, leveling_menu.position5);
buttonX5Value = lv_btn_create(scr, NULL); buttonX5Value = lv_btn_create(scr, PARA_UI_VALUE_POS_X_2, PARA_UI_POS_Y + PARA_UI_VALUE_V_2, PARA_UI_VALUE_BTN_X_SIZE, PARA_UI_VALUE_BTN_Y_SIZE, event_handler, ID_MANUAL_POS_X5);
lv_obj_set_pos(buttonX5Value, PARA_UI_VALUE_POS_X_2, PARA_UI_POS_Y + PARA_UI_VALUE_V_2); labelX5Value = lv_label_create_empty(buttonX5Value);
lv_obj_set_size(buttonX5Value, PARA_UI_VALUE_BTN_X_SIZE, PARA_UI_VALUE_BTN_Y_SIZE);
lv_obj_set_event_cb_mks(buttonX5Value, event_handler, ID_MANUAL_POS_X5, NULL, 0);
lv_btn_set_style(buttonX5Value, LV_BTN_STYLE_REL, &style_para_value);
lv_btn_set_style(buttonX5Value, LV_BTN_STYLE_PR, &style_para_value);
labelX5Value = lv_label_create(buttonX5Value, NULL);
buttonY5Value = lv_btn_create(scr, NULL); buttonY5Value = lv_btn_create(scr, PARA_UI_VALUE_POS_X, PARA_UI_POS_Y + PARA_UI_VALUE_V_2, PARA_UI_VALUE_BTN_X_SIZE, PARA_UI_VALUE_BTN_Y_SIZE, event_handler, ID_MANUAL_POS_Y5);
lv_obj_set_pos(buttonY5Value, PARA_UI_VALUE_POS_X, PARA_UI_POS_Y + PARA_UI_VALUE_V_2); labelY5Value = lv_label_create_empty(buttonY5Value);
lv_obj_set_size(buttonY5Value, PARA_UI_VALUE_BTN_X_SIZE, PARA_UI_VALUE_BTN_Y_SIZE);
lv_obj_set_event_cb_mks(buttonY5Value, event_handler, ID_MANUAL_POS_Y5, NULL, 0);
lv_btn_set_style(buttonY5Value, LV_BTN_STYLE_REL, &style_para_value);
lv_btn_set_style(buttonY5Value, LV_BTN_STYLE_PR, &style_para_value);
labelY5Value = lv_label_create(buttonY5Value, NULL);
line1 = lv_line_create(scr, NULL); line1 = lv_line_create(scr, NULL);
lv_ex_line(line1, line_points[0]); lv_ex_line(line1, line_points[0]);
buttonTurnPage = lv_btn_create(scr, NULL); buttonTurnPage = lv_btn_create(scr, NULL);
lv_obj_set_event_cb_mks(buttonTurnPage, event_handler, ID_MANUAL_POS_UP, NULL, 0); lv_obj_set_event_cb_mks(buttonTurnPage, event_handler, ID_MANUAL_POS_UP, NULL, 0);
lv_btn_set_style(buttonTurnPage, LV_BTN_STYLE_REL, &style_para_back); lv_btn_set_style_both(buttonTurnPage, &style_para_back);
lv_btn_set_style(buttonTurnPage, LV_BTN_STYLE_PR, &style_para_back);
#if HAS_ROTARY_ENCODER #if HAS_ROTARY_ENCODER
if (gCfgItems.encoder_enable) { if (gCfgItems.encoder_enable) {
@ -370,15 +300,14 @@ void lv_draw_manual_level_pos_settings(void) {
lv_obj_set_pos(buttonTurnPage, PARA_UI_TURN_PAGE_POS_X, PARA_UI_TURN_PAGE_POS_Y); lv_obj_set_pos(buttonTurnPage, PARA_UI_TURN_PAGE_POS_X, PARA_UI_TURN_PAGE_POS_Y);
lv_obj_set_size(buttonTurnPage, PARA_UI_BACK_BTN_X_SIZE, PARA_UI_BACK_BTN_Y_SIZE); lv_obj_set_size(buttonTurnPage, PARA_UI_BACK_BTN_X_SIZE, PARA_UI_BACK_BTN_Y_SIZE);
labelTurnPage = lv_label_create(buttonTurnPage, NULL); labelTurnPage = lv_label_create_empty(buttonTurnPage);
buttonBack = lv_btn_create(scr, NULL); buttonBack = lv_btn_create(scr, NULL);
lv_obj_set_event_cb_mks(buttonBack, event_handler, ID_MANUAL_POS_RETURN, NULL, 0); lv_obj_set_event_cb_mks(buttonBack, event_handler, ID_MANUAL_POS_RETURN, NULL, 0);
lv_btn_set_style(buttonBack, LV_BTN_STYLE_REL, &style_para_back); lv_btn_set_style_both(buttonBack, &style_para_back);
lv_btn_set_style(buttonBack, LV_BTN_STYLE_PR, &style_para_back);
lv_obj_set_pos(buttonBack, PARA_UI_BACL_POS_X, PARA_UI_BACL_POS_Y); lv_obj_set_pos(buttonBack, PARA_UI_BACL_POS_X, PARA_UI_BACL_POS_Y);
lv_obj_set_size(buttonBack, PARA_UI_BACK_BTN_X_SIZE, PARA_UI_BACK_BTN_Y_SIZE); lv_obj_set_size(buttonBack, PARA_UI_BACK_BTN_X_SIZE, PARA_UI_BACK_BTN_Y_SIZE);
label_Back = lv_label_create(buttonBack, NULL); label_Back = lv_label_create_empty(buttonBack);
#if HAS_ROTARY_ENCODER #if HAS_ROTARY_ENCODER
if (gCfgItems.encoder_enable) lv_group_add_obj(g, buttonBack); if (gCfgItems.encoder_enable) lv_group_add_obj(g, buttonBack);

View File

@ -128,12 +128,12 @@ static void event_handler(lv_obj_t * obj, lv_event_t event) {
void lv_draw_max_feedrate_settings(void) { void lv_draw_max_feedrate_settings(void) {
lv_obj_t *buttonBack = NULL, *label_Back = NULL, *buttonTurnPage = NULL, *labelTurnPage = NULL; lv_obj_t *buttonBack = NULL, *label_Back = NULL, *buttonTurnPage = NULL, *labelTurnPage = NULL;
lv_obj_t *labelXText = NULL, *buttonXValue = NULL, *labelXValue = NULL; lv_obj_t *buttonXValue = NULL, *labelXValue = NULL;
lv_obj_t *labelYText = NULL, *buttonYValue = NULL, *labelYValue = NULL; lv_obj_t *buttonYValue = NULL, *labelYValue = NULL;
lv_obj_t *labelZText = NULL, *buttonZValue = NULL, *labelZValue = NULL; lv_obj_t *buttonZValue = NULL, *labelZValue = NULL;
lv_obj_t *labelE0Text = NULL, *buttonE0Value = NULL, *labelE0Value = NULL; lv_obj_t *buttonE0Value = NULL, *labelE0Value = NULL;
lv_obj_t *labelE1Text = NULL, *buttonE1Value = NULL, *labelE1Value = NULL; lv_obj_t *buttonE1Value = NULL, *labelE1Value = NULL;
lv_obj_t * line1 = NULL, * line2 = NULL, * line3 = NULL, * line4 = NULL; lv_obj_t *line1 = NULL, *line2 = NULL, *line3 = NULL, *line4 = NULL;
if (disp_state_stack._disp_state[disp_state_stack._disp_index] != MAXFEEDRATE_UI) { if (disp_state_stack._disp_state[disp_state_stack._disp_index] != MAXFEEDRATE_UI) {
disp_state_stack._disp_index++; disp_state_stack._disp_index++;
disp_state_stack._disp_state[disp_state_stack._disp_index] = MAXFEEDRATE_UI; disp_state_stack._disp_state[disp_state_stack._disp_index] = MAXFEEDRATE_UI;
@ -146,86 +146,50 @@ void lv_draw_max_feedrate_settings(void) {
lv_scr_load(scr); lv_scr_load(scr);
lv_obj_clean(scr); lv_obj_clean(scr);
lv_obj_t * title = lv_label_create(scr, NULL); (void)lv_label_create(scr, TITLE_XPOS, TITLE_YPOS, machine_menu.MaxFeedRateConfTitle);
lv_obj_set_style(title, &tft_style_label_rel);
lv_obj_set_pos(title, TITLE_XPOS, TITLE_YPOS);
lv_label_set_text(title, machine_menu.MaxFeedRateConfTitle);
lv_refr_now(lv_refr_get_disp_refreshing()); lv_refr_now(lv_refr_get_disp_refreshing());
if (uiCfg.para_ui_page != 1) { if (uiCfg.para_ui_page != 1) {
labelXText = lv_label_create(scr, NULL); (void)lv_label_create(scr, PARA_UI_POS_X, PARA_UI_POS_Y + 10, machine_menu.XMaxFeedRate);
lv_obj_set_style(labelXText, &tft_style_label_rel);
lv_obj_set_pos(labelXText, PARA_UI_POS_X, PARA_UI_POS_Y + 10);
lv_label_set_text(labelXText, machine_menu.XMaxFeedRate);
buttonXValue = lv_btn_create(scr, NULL); buttonXValue = lv_btn_create(scr, PARA_UI_VALUE_POS_X, PARA_UI_POS_Y + PARA_UI_VALUE_V, PARA_UI_VALUE_BTN_X_SIZE, PARA_UI_VALUE_BTN_Y_SIZE, event_handler, ID_FEED_X);
lv_obj_set_pos(buttonXValue, PARA_UI_VALUE_POS_X, PARA_UI_POS_Y + PARA_UI_VALUE_V);
lv_obj_set_size(buttonXValue, PARA_UI_VALUE_BTN_X_SIZE, PARA_UI_VALUE_BTN_Y_SIZE);
lv_obj_set_event_cb_mks(buttonXValue, event_handler, ID_FEED_X, NULL, 0);
lv_btn_set_style(buttonXValue, LV_BTN_STYLE_REL, &style_para_value);
lv_btn_set_style(buttonXValue, LV_BTN_STYLE_PR, &style_para_value);
lv_btn_set_layout(buttonXValue, LV_LAYOUT_OFF); lv_btn_set_layout(buttonXValue, LV_LAYOUT_OFF);
labelXValue = lv_label_create(buttonXValue, NULL); labelXValue = lv_label_create_empty(buttonXValue);
line1 = lv_line_create(scr, NULL); line1 = lv_line_create(scr, NULL);
lv_ex_line(line1, line_points[0]); lv_ex_line(line1, line_points[0]);
labelYText = lv_label_create(scr, NULL); (void)lv_label_create(scr, PARA_UI_POS_X, PARA_UI_POS_Y * 2 + 10, machine_menu.YMaxFeedRate);
lv_obj_set_style(labelYText, &tft_style_label_rel);
lv_obj_set_pos(labelYText, PARA_UI_POS_X, PARA_UI_POS_Y * 2 + 10);
lv_label_set_text(labelYText, machine_menu.YMaxFeedRate);
buttonYValue = lv_btn_create(scr, NULL); buttonYValue = lv_btn_create(scr, PARA_UI_VALUE_POS_X, PARA_UI_POS_Y * 2 + PARA_UI_VALUE_V, PARA_UI_VALUE_BTN_X_SIZE, PARA_UI_VALUE_BTN_Y_SIZE, event_handler, ID_FEED_Y);
lv_obj_set_pos(buttonYValue, PARA_UI_VALUE_POS_X, PARA_UI_POS_Y * 2 + PARA_UI_VALUE_V);
lv_obj_set_size(buttonYValue, PARA_UI_VALUE_BTN_X_SIZE, PARA_UI_VALUE_BTN_Y_SIZE);
lv_obj_set_event_cb_mks(buttonYValue, event_handler, ID_FEED_Y, NULL, 0);
lv_btn_set_style(buttonYValue, LV_BTN_STYLE_REL, &style_para_value);
lv_btn_set_style(buttonYValue, LV_BTN_STYLE_PR, &style_para_value);
lv_btn_set_layout(buttonYValue, LV_LAYOUT_OFF); lv_btn_set_layout(buttonYValue, LV_LAYOUT_OFF);
labelYValue = lv_label_create(buttonYValue, NULL); labelYValue = lv_label_create_empty(buttonYValue);
line2 = lv_line_create(scr, NULL); line2 = lv_line_create(scr, NULL);
lv_ex_line(line2, line_points[1]); lv_ex_line(line2, line_points[1]);
labelZText = lv_label_create(scr, NULL); (void)lv_label_create(scr, PARA_UI_POS_X, PARA_UI_POS_Y * 3 + 10, machine_menu.ZMaxFeedRate);
lv_obj_set_style(labelZText, &tft_style_label_rel);
lv_obj_set_pos(labelZText, PARA_UI_POS_X, PARA_UI_POS_Y * 3 + 10);
lv_label_set_text(labelZText, machine_menu.ZMaxFeedRate);
buttonZValue = lv_btn_create(scr, NULL); buttonZValue = lv_btn_create(scr, PARA_UI_VALUE_POS_X, PARA_UI_POS_Y * 3 + PARA_UI_VALUE_V, PARA_UI_VALUE_BTN_X_SIZE, PARA_UI_VALUE_BTN_Y_SIZE, event_handler, ID_FEED_Z);
lv_obj_set_pos(buttonZValue, PARA_UI_VALUE_POS_X, PARA_UI_POS_Y * 3 + PARA_UI_VALUE_V);
lv_obj_set_size(buttonZValue, PARA_UI_VALUE_BTN_X_SIZE, PARA_UI_VALUE_BTN_Y_SIZE);
lv_obj_set_event_cb_mks(buttonZValue, event_handler, ID_FEED_Z, NULL, 0);
lv_btn_set_style(buttonZValue, LV_BTN_STYLE_REL, &style_para_value);
lv_btn_set_style(buttonZValue, LV_BTN_STYLE_PR, &style_para_value);
lv_btn_set_layout(buttonZValue, LV_LAYOUT_OFF); lv_btn_set_layout(buttonZValue, LV_LAYOUT_OFF);
labelZValue = lv_label_create(buttonZValue, NULL); labelZValue = lv_label_create_empty(buttonZValue);
line3 = lv_line_create(scr, NULL); line3 = lv_line_create(scr, NULL);
lv_ex_line(line3, line_points[2]); lv_ex_line(line3, line_points[2]);
labelE0Text = lv_label_create(scr, NULL); (void)lv_label_create(scr, PARA_UI_POS_X, PARA_UI_POS_Y * 4 + 10, machine_menu.E0MaxFeedRate);
lv_obj_set_style(labelE0Text, &tft_style_label_rel);
lv_obj_set_pos(labelE0Text, PARA_UI_POS_X, PARA_UI_POS_Y * 4 + 10);
lv_label_set_text(labelE0Text, machine_menu.E0MaxFeedRate);
buttonE0Value = lv_btn_create(scr, NULL); buttonE0Value = lv_btn_create(scr, PARA_UI_VALUE_POS_X, PARA_UI_POS_Y * 4 + PARA_UI_VALUE_V, PARA_UI_VALUE_BTN_X_SIZE, PARA_UI_VALUE_BTN_Y_SIZE, event_handler, ID_FEED_E0);
lv_obj_set_pos(buttonE0Value, PARA_UI_VALUE_POS_X, PARA_UI_POS_Y * 4 + PARA_UI_VALUE_V);
lv_obj_set_size(buttonE0Value, PARA_UI_VALUE_BTN_X_SIZE, PARA_UI_VALUE_BTN_Y_SIZE);
lv_obj_set_event_cb_mks(buttonE0Value, event_handler, ID_FEED_E0, NULL, 0);
lv_btn_set_style(buttonE0Value, LV_BTN_STYLE_REL, &style_para_value);
lv_btn_set_style(buttonE0Value, LV_BTN_STYLE_PR, &style_para_value);
lv_btn_set_layout(buttonE0Value, LV_LAYOUT_OFF); lv_btn_set_layout(buttonE0Value, LV_LAYOUT_OFF);
labelE0Value = lv_label_create(buttonE0Value, NULL); labelE0Value = lv_label_create_empty(buttonE0Value);
line4 = lv_line_create(scr, NULL); line4 = lv_line_create(scr, NULL);
lv_ex_line(line4, line_points[3]); lv_ex_line(line4, line_points[3]);
buttonTurnPage = lv_btn_create(scr, NULL); buttonTurnPage = lv_btn_create(scr, NULL);
lv_obj_set_event_cb_mks(buttonTurnPage, event_handler, ID_FEED_DOWN, NULL, 0); lv_obj_set_event_cb_mks(buttonTurnPage, event_handler, ID_FEED_DOWN, NULL, 0);
lv_btn_set_style(buttonTurnPage, LV_BTN_STYLE_REL, &style_para_back); lv_btn_set_style_both(buttonTurnPage, &style_para_back);
lv_btn_set_style(buttonTurnPage, LV_BTN_STYLE_PR, &style_para_back);
#if HAS_ROTARY_ENCODER #if HAS_ROTARY_ENCODER
if (gCfgItems.encoder_enable) { if (gCfgItems.encoder_enable) {
@ -238,19 +202,11 @@ void lv_draw_max_feedrate_settings(void) {
#endif #endif
} }
else { else {
labelE1Text = lv_label_create(scr, NULL); (void)lv_label_create(scr, PARA_UI_POS_X, PARA_UI_POS_Y + 10, machine_menu.E1MaxFeedRate);
lv_obj_set_style(labelE1Text, &tft_style_label_rel);
lv_obj_set_pos(labelE1Text, PARA_UI_POS_X, PARA_UI_POS_Y + 10);
lv_label_set_text(labelE1Text, machine_menu.E1MaxFeedRate);
buttonE1Value = lv_btn_create(scr, NULL); buttonE1Value = lv_btn_create(scr, PARA_UI_VALUE_POS_X, PARA_UI_POS_Y + PARA_UI_VALUE_V, PARA_UI_VALUE_BTN_X_SIZE, PARA_UI_VALUE_BTN_Y_SIZE, event_handler, ID_FEED_E1);
lv_obj_set_pos(buttonE1Value, PARA_UI_VALUE_POS_X, PARA_UI_POS_Y + PARA_UI_VALUE_V);
lv_obj_set_size(buttonE1Value, PARA_UI_VALUE_BTN_X_SIZE, PARA_UI_VALUE_BTN_Y_SIZE);
lv_obj_set_event_cb_mks(buttonE1Value, event_handler, ID_FEED_E1, NULL, 0);
lv_btn_set_style(buttonE1Value, LV_BTN_STYLE_REL, &style_para_value);
lv_btn_set_style(buttonE1Value, LV_BTN_STYLE_PR, &style_para_value);
lv_btn_set_layout(buttonE1Value, LV_LAYOUT_OFF); lv_btn_set_layout(buttonE1Value, LV_LAYOUT_OFF);
labelE1Value = lv_label_create(buttonE1Value, NULL); labelE1Value = lv_label_create_empty(buttonE1Value);
line1 = lv_line_create(scr, NULL); line1 = lv_line_create(scr, NULL);
@ -258,8 +214,7 @@ void lv_draw_max_feedrate_settings(void) {
buttonTurnPage = lv_btn_create(scr, NULL); buttonTurnPage = lv_btn_create(scr, NULL);
lv_obj_set_event_cb_mks(buttonTurnPage, event_handler, ID_FEED_UP, NULL, 0); lv_obj_set_event_cb_mks(buttonTurnPage, event_handler, ID_FEED_UP, NULL, 0);
lv_btn_set_style(buttonTurnPage, LV_BTN_STYLE_REL, &style_para_back); lv_btn_set_style_both(buttonTurnPage, &style_para_back);
lv_btn_set_style(buttonTurnPage, LV_BTN_STYLE_PR, &style_para_back);
#if HAS_ROTARY_ENCODER #if HAS_ROTARY_ENCODER
if (gCfgItems.encoder_enable) { if (gCfgItems.encoder_enable) {
@ -271,15 +226,14 @@ void lv_draw_max_feedrate_settings(void) {
lv_obj_set_pos(buttonTurnPage, PARA_UI_TURN_PAGE_POS_X, PARA_UI_TURN_PAGE_POS_Y); lv_obj_set_pos(buttonTurnPage, PARA_UI_TURN_PAGE_POS_X, PARA_UI_TURN_PAGE_POS_Y);
lv_obj_set_size(buttonTurnPage, PARA_UI_BACK_BTN_X_SIZE, PARA_UI_BACK_BTN_Y_SIZE); lv_obj_set_size(buttonTurnPage, PARA_UI_BACK_BTN_X_SIZE, PARA_UI_BACK_BTN_Y_SIZE);
labelTurnPage = lv_label_create(buttonTurnPage, NULL); labelTurnPage = lv_label_create_empty(buttonTurnPage);
buttonBack = lv_btn_create(scr, NULL); buttonBack = lv_btn_create(scr, NULL);
lv_obj_set_event_cb_mks(buttonBack, event_handler, ID_FEED_RETURN, NULL, 0); lv_obj_set_event_cb_mks(buttonBack, event_handler, ID_FEED_RETURN, NULL, 0);
lv_obj_set_pos(buttonBack, PARA_UI_BACL_POS_X, PARA_UI_BACL_POS_Y); lv_obj_set_pos(buttonBack, PARA_UI_BACL_POS_X, PARA_UI_BACL_POS_Y);
lv_obj_set_size(buttonBack, PARA_UI_BACK_BTN_X_SIZE, PARA_UI_BACK_BTN_Y_SIZE); lv_obj_set_size(buttonBack, PARA_UI_BACK_BTN_X_SIZE, PARA_UI_BACK_BTN_Y_SIZE);
lv_btn_set_style(buttonBack, LV_BTN_STYLE_REL, &style_para_back); lv_btn_set_style_both(buttonBack, &style_para_back);
lv_btn_set_style(buttonBack, LV_BTN_STYLE_PR, &style_para_back); label_Back = lv_label_create_empty(buttonBack);
label_Back = lv_label_create(buttonBack, NULL);
#if HAS_ROTARY_ENCODER #if HAS_ROTARY_ENCODER
if (gCfgItems.encoder_enable) lv_group_add_obj(g, buttonBack); if (gCfgItems.encoder_enable) lv_group_add_obj(g, buttonBack);
#endif #endif

View File

@ -169,10 +169,7 @@ void lv_draw_motor_settings(void) {
lv_scr_load(scr); lv_scr_load(scr);
lv_obj_clean(scr); lv_obj_clean(scr);
lv_obj_t * title = lv_label_create(scr, NULL); (void)lv_label_create(scr, TITLE_XPOS, TITLE_YPOS, machine_menu.MotorConfTitle);
lv_obj_set_style(title, &tft_style_label_rel);
lv_obj_set_pos(title, TITLE_XPOS, TITLE_YPOS);
lv_label_set_text(title, machine_menu.MotorConfTitle);
lv_refr_now(lv_refr_get_disp_refreshing()); lv_refr_now(lv_refr_get_disp_refreshing());
@ -181,50 +178,29 @@ void lv_draw_motor_settings(void) {
lv_obj_set_size(buttonSteps, PARA_UI_SIZE_X, PARA_UI_SIZE_Y); /*Set its size*/ lv_obj_set_size(buttonSteps, PARA_UI_SIZE_X, PARA_UI_SIZE_Y); /*Set its size*/
//lv_obj_set_event_cb(buttonMachine, event_handler); //lv_obj_set_event_cb(buttonMachine, event_handler);
lv_obj_set_event_cb_mks(buttonSteps, event_handler, ID_MOTOR_STEPS, NULL, 0); lv_obj_set_event_cb_mks(buttonSteps, event_handler, ID_MOTOR_STEPS, NULL, 0);
lv_btn_set_style(buttonSteps, LV_BTN_STYLE_REL, &tft_style_label_rel); /*Set the button's released style*/ lv_btn_use_label_style(buttonSteps);
lv_btn_set_style(buttonSteps, LV_BTN_STYLE_PR, &tft_style_label_pre); /*Set the button's pressed style*/
lv_btn_set_layout(buttonSteps, LV_LAYOUT_OFF); lv_btn_set_layout(buttonSteps, LV_LAYOUT_OFF);
labelSteps = lv_label_create(buttonSteps, NULL); /*Add a label to the button*/ labelSteps = lv_label_create_empty(buttonSteps); /*Add a label to the button*/
#if HAS_ROTARY_ENCODER #if HAS_ROTARY_ENCODER
if (gCfgItems.encoder_enable) lv_group_add_obj(g, buttonSteps); if (gCfgItems.encoder_enable) lv_group_add_obj(g, buttonSteps);
#endif #endif
buttonStepsNarrow = lv_imgbtn_create(scr, NULL); buttonStepsNarrow = lv_imgbtn_create(scr, "F:/bmp_arrow.bin", PARA_UI_POS_X + PARA_UI_SIZE_X, PARA_UI_POS_Y + PARA_UI_ARROW_V, event_handler, ID_MOTOR_STEPS_ARROW);
lv_obj_set_pos(buttonStepsNarrow, PARA_UI_POS_X + PARA_UI_SIZE_X, PARA_UI_POS_Y + PARA_UI_ARROW_V);
lv_obj_set_event_cb_mks(buttonStepsNarrow, event_handler, ID_MOTOR_STEPS_ARROW, NULL, 0);
lv_imgbtn_set_src(buttonStepsNarrow, LV_BTN_STATE_REL, "F:/bmp_arrow.bin");
lv_imgbtn_set_src(buttonStepsNarrow, LV_BTN_STATE_PR, "F:/bmp_arrow.bin");
lv_imgbtn_set_style(buttonStepsNarrow, LV_BTN_STATE_PR, &tft_style_label_pre);
lv_imgbtn_set_style(buttonStepsNarrow, LV_BTN_STATE_REL, &tft_style_label_rel);
lv_btn_set_layout(buttonStepsNarrow, LV_LAYOUT_OFF);
line1 = lv_line_create(scr, NULL); line1 = lv_line_create(scr, NULL);
lv_ex_line(line1, line_points[0]); lv_ex_line(line1, line_points[0]);
#if USE_SENSORLESS #if USE_SENSORLESS
buttonSensitivity = lv_btn_create(scr, NULL); /*Add a button the current screen*/ buttonSensitivity = lv_btn_create(scr, PARA_UI_POS_X, PARA_UI_POS_Y * 2, PARA_UI_SIZE_X, PARA_UI_SIZE_Y, event_handler, ID_HOME_SENSE);
lv_obj_set_pos(buttonSensitivity, PARA_UI_POS_X, PARA_UI_POS_Y * 2); /*Set its position*/
lv_obj_set_size(buttonSensitivity, PARA_UI_SIZE_X, PARA_UI_SIZE_Y); /*Set its size*/
//lv_obj_set_event_cb(buttonMachine, event_handler); //lv_obj_set_event_cb(buttonMachine, event_handler);
lv_obj_set_event_cb_mks(buttonSensitivity, event_handler, ID_HOME_SENSE, NULL, 0); labelSensitivity = lv_label_create_empty(buttonSensitivity); /*Add a label to the button*/
lv_btn_set_style(buttonSensitivity, LV_BTN_STYLE_REL, &tft_style_label_rel); /*Set the button's released style*/
lv_btn_set_style(buttonSensitivity, LV_BTN_STYLE_PR, &tft_style_label_pre); /*Set the button's pressed style*/
lv_btn_set_layout(buttonSensitivity, LV_LAYOUT_OFF);
labelSensitivity = lv_label_create(buttonSensitivity, NULL); /*Add a label to the button*/
#if HAS_ROTARY_ENCODER #if HAS_ROTARY_ENCODER
if (gCfgItems.encoder_enable) lv_group_add_obj(g, buttonSensitivity); if (gCfgItems.encoder_enable) lv_group_add_obj(g, buttonSensitivity);
#endif #endif
buttonSensitivityNarrow = lv_imgbtn_create(scr, NULL); buttonSensitivityNarrow = lv_imgbtn_create(scr, "F:/bmp_arrow.bin", PARA_UI_POS_X + PARA_UI_SIZE_X, PARA_UI_POS_Y * 2 + PARA_UI_ARROW_V, event_handler, ID_HOME_SENSE_ARROW);
lv_obj_set_pos(buttonSensitivityNarrow, PARA_UI_POS_X + PARA_UI_SIZE_X, PARA_UI_POS_Y * 2 + PARA_UI_ARROW_V);
lv_obj_set_event_cb_mks(buttonSensitivityNarrow, event_handler, ID_HOME_SENSE_ARROW, NULL, 0);
lv_imgbtn_set_src(buttonSensitivityNarrow, LV_BTN_STATE_REL, "F:/bmp_arrow.bin");
lv_imgbtn_set_src(buttonSensitivityNarrow, LV_BTN_STATE_PR, "F:/bmp_arrow.bin");
lv_imgbtn_set_style(buttonSensitivityNarrow, LV_BTN_STATE_PR, &tft_style_label_pre);
lv_imgbtn_set_style(buttonSensitivityNarrow, LV_BTN_STATE_REL, &tft_style_label_rel);
lv_btn_set_layout(buttonSensitivityNarrow, LV_LAYOUT_OFF);
line2 = lv_line_create(scr, NULL); line2 = lv_line_create(scr, NULL);
lv_ex_line(line2, line_points[1]); lv_ex_line(line2, line_points[1]);
@ -237,22 +213,15 @@ void lv_draw_motor_settings(void) {
lv_obj_set_size(buttonTMCcurrent, PARA_UI_SIZE_X, PARA_UI_SIZE_Y); /*Set its size*/ lv_obj_set_size(buttonTMCcurrent, PARA_UI_SIZE_X, PARA_UI_SIZE_Y); /*Set its size*/
//lv_obj_set_event_cb(buttonMachine, event_handler); //lv_obj_set_event_cb(buttonMachine, event_handler);
lv_obj_set_event_cb_mks(buttonTMCcurrent, event_handler, ID_MOTOR_TMC_CURRENT, NULL, 0); lv_obj_set_event_cb_mks(buttonTMCcurrent, event_handler, ID_MOTOR_TMC_CURRENT, NULL, 0);
lv_btn_set_style(buttonTMCcurrent, LV_BTN_STYLE_REL, &tft_style_label_rel); /*Set the button's released style*/ lv_btn_use_label_style(buttonTMCcurrent);
lv_btn_set_style(buttonTMCcurrent, LV_BTN_STYLE_PR, &tft_style_label_pre); /*Set the button's pressed style*/
lv_btn_set_layout(buttonTMCcurrent, LV_LAYOUT_OFF); lv_btn_set_layout(buttonTMCcurrent, LV_LAYOUT_OFF);
labelTMCcurrent = lv_label_create(buttonTMCcurrent, NULL); /*Add a label to the button*/ labelTMCcurrent = lv_label_create_empty(buttonTMCcurrent); /*Add a label to the button*/
#if HAS_ROTARY_ENCODER #if HAS_ROTARY_ENCODER
if (gCfgItems.encoder_enable) lv_group_add_obj(g, buttonTMCcurrent); if (gCfgItems.encoder_enable) lv_group_add_obj(g, buttonTMCcurrent);
#endif #endif
buttonTMCcurrentNarrow = lv_imgbtn_create(scr, NULL); buttonTMCcurrentNarrow = lv_imgbtn_create(scr, "F:/bmp_arrow.bin", PARA_UI_POS_X + PARA_UI_SIZE_X, TERN(USE_SENSORLESS, PARA_UI_POS_Y * 3, PARA_UI_POS_Y * 2) + PARA_UI_ARROW_V, event_handler, ID_MOTOR_TMC_CURRENT_ARROW);
lv_obj_set_pos(buttonTMCcurrentNarrow, PARA_UI_POS_X + PARA_UI_SIZE_X, TERN(USE_SENSORLESS, PARA_UI_POS_Y * 3, PARA_UI_POS_Y * 2) + PARA_UI_ARROW_V);
lv_obj_set_event_cb_mks(buttonTMCcurrentNarrow, event_handler, ID_MOTOR_TMC_CURRENT_ARROW, NULL, 0);
lv_imgbtn_set_src(buttonTMCcurrentNarrow, LV_BTN_STATE_REL, "F:/bmp_arrow.bin");
lv_imgbtn_set_src(buttonTMCcurrentNarrow, LV_BTN_STATE_PR, "F:/bmp_arrow.bin");
lv_imgbtn_set_style(buttonTMCcurrentNarrow, LV_BTN_STATE_PR, &tft_style_label_pre);
lv_imgbtn_set_style(buttonTMCcurrentNarrow, LV_BTN_STATE_REL, &tft_style_label_rel);
lv_btn_set_layout(buttonTMCcurrentNarrow, LV_LAYOUT_OFF);
#if USE_SENSORLESS #if USE_SENSORLESS
line3 = lv_line_create(scr, NULL); line3 = lv_line_create(scr, NULL);
lv_ex_line(line3, line_points[2]); lv_ex_line(line3, line_points[2]);
@ -262,27 +231,14 @@ void lv_draw_motor_settings(void) {
#endif #endif
#if HAS_STEALTHCHOP #if HAS_STEALTHCHOP
buttonStepMode = lv_btn_create(scr, NULL); /*Add a button the current screen*/ buttonStepMode = lv_btn_create(scr, NULL, PARA_UI_POS_X, TERN(USE_SENSORLESS, PARA_UI_POS_Y * 4, PARA_UI_POS_Y * 3), PARA_UI_SIZE_X, PARA_UI_SIZE_Y, event_handler, ID_MOTOR_STEP_MODE);
lv_obj_set_pos(buttonStepMode, PARA_UI_POS_X, TERN(USE_SENSORLESS, PARA_UI_POS_Y * 4, PARA_UI_POS_Y * 3)); labelStepMode = lv_label_create_empty(buttonStepMode); /*Add a label to the button*/
lv_obj_set_size(buttonStepMode, PARA_UI_SIZE_X, PARA_UI_SIZE_Y); /*Set its size*/
lv_obj_set_event_cb_mks(buttonStepMode, event_handler, ID_MOTOR_STEP_MODE, NULL, 0);
lv_btn_set_style(buttonStepMode, LV_BTN_STYLE_REL, &tft_style_label_rel); /*Set the button's released style*/
lv_btn_set_style(buttonStepMode, LV_BTN_STYLE_PR, &tft_style_label_pre); /*Set the button's pressed style*/
lv_btn_set_layout(buttonStepMode, LV_LAYOUT_OFF);
labelStepMode = lv_label_create(buttonStepMode, NULL); /*Add a label to the button*/
#if HAS_ROTARY_ENCODER #if HAS_ROTARY_ENCODER
if (gCfgItems.encoder_enable) lv_group_add_obj(g, buttonStepMode); if (gCfgItems.encoder_enable) lv_group_add_obj(g, buttonStepMode);
#endif #endif
buttonStepModeNarrow = lv_imgbtn_create(scr, NULL); buttonStepModeNarrow = lv_imgbtn_create(scr, "F:/bmp_arrow.bin", PARA_UI_POS_X + PARA_UI_SIZE_X, TERN(USE_SENSORLESS, PARA_UI_POS_Y * 4, PARA_UI_POS_Y * 3) + PARA_UI_ARROW_V, event_handler, ID_MOTOR_STEP_MODE_ARROW);
lv_obj_set_pos(buttonStepModeNarrow, PARA_UI_POS_X + PARA_UI_SIZE_X, TERN(USE_SENSORLESS, PARA_UI_POS_Y * 4, PARA_UI_POS_Y * 3) + PARA_UI_ARROW_V);
lv_obj_set_event_cb_mks(buttonStepModeNarrow, event_handler, ID_MOTOR_STEP_MODE_ARROW, NULL, 0);
lv_imgbtn_set_src(buttonStepModeNarrow, LV_BTN_STATE_REL, "F:/bmp_arrow.bin");
lv_imgbtn_set_src(buttonStepModeNarrow, LV_BTN_STATE_PR, "F:/bmp_arrow.bin");
lv_imgbtn_set_style(buttonStepModeNarrow, LV_BTN_STATE_PR, &tft_style_label_pre);
lv_imgbtn_set_style(buttonStepModeNarrow, LV_BTN_STATE_REL, &tft_style_label_rel);
lv_btn_set_layout(buttonStepModeNarrow, LV_LAYOUT_OFF);
#if USE_SENSORLESS #if USE_SENSORLESS
line4 = lv_line_create(scr, NULL); line4 = lv_line_create(scr, NULL);
@ -296,15 +252,8 @@ void lv_draw_motor_settings(void) {
#endif // HAS_TRINAMIC_CONFIG #endif // HAS_TRINAMIC_CONFIG
buttonBack = lv_imgbtn_create(scr, NULL); buttonBack = lv_imgbtn_create(scr, "F:/bmp_back70x40.bin", PARA_UI_BACL_POS_X, PARA_UI_BACL_POS_Y, event_handler, ID_MOTOR_RETURN);
lv_obj_set_event_cb_mks(buttonBack, event_handler, ID_MOTOR_RETURN, NULL, 0); label_Back = lv_label_create_empty(buttonBack);
lv_imgbtn_set_src(buttonBack, LV_BTN_STATE_REL, "F:/bmp_back70x40.bin");
lv_imgbtn_set_src(buttonBack, LV_BTN_STATE_PR, "F:/bmp_back70x40.bin");
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);
lv_obj_set_pos(buttonBack, PARA_UI_BACL_POS_X, PARA_UI_BACL_POS_Y);
lv_btn_set_layout(buttonBack, LV_LAYOUT_OFF);
label_Back = lv_label_create(buttonBack, NULL);
#if HAS_ROTARY_ENCODER #if HAS_ROTARY_ENCODER
if (gCfgItems.encoder_enable) lv_group_add_obj(g, buttonBack); if (gCfgItems.encoder_enable) lv_group_add_obj(g, buttonBack);

View File

@ -174,100 +174,33 @@ void lv_draw_move_motor(void) {
lv_scr_load(scr); lv_scr_load(scr);
lv_obj_clean(scr); lv_obj_clean(scr);
lv_obj_t * title = lv_label_create(scr, NULL); (void)lv_label_create(scr, TITLE_XPOS, TITLE_YPOS, creat_title_text());
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());
lv_refr_now(lv_refr_get_disp_refreshing()); lv_refr_now(lv_refr_get_disp_refreshing());
// Create an Image button // Create an Image button
buttonXI = lv_imgbtn_create(scr, NULL); buttonXI = lv_imgbtn_create(scr, "F:/bmp_xAdd.bin", INTERVAL_V, titleHeight, event_handler, ID_M_X_P);
buttonXD = lv_imgbtn_create(scr, NULL);
buttonYI = lv_imgbtn_create(scr, NULL);
buttonYD = lv_imgbtn_create(scr, NULL);
buttonZI = lv_imgbtn_create(scr, NULL);
buttonZD = lv_imgbtn_create(scr, NULL);
buttonV = lv_imgbtn_create(scr, NULL);
buttonBack = lv_imgbtn_create(scr, NULL);
lv_obj_set_event_cb_mks(buttonXI, event_handler, ID_M_X_P, NULL, 0);
lv_imgbtn_set_src(buttonXI, LV_BTN_STATE_REL, "F:/bmp_xAdd.bin");
lv_imgbtn_set_src(buttonXI, LV_BTN_STATE_PR, "F:/bmp_xAdd.bin");
lv_imgbtn_set_style(buttonXI, LV_BTN_STATE_PR, &tft_style_label_pre);
lv_imgbtn_set_style(buttonXI, LV_BTN_STATE_REL, &tft_style_label_rel);
lv_obj_clear_protect(buttonXI, LV_PROTECT_FOLLOW); lv_obj_clear_protect(buttonXI, LV_PROTECT_FOLLOW);
buttonXD = lv_imgbtn_create(scr, "F:/bmp_xDec.bin", INTERVAL_V, BTN_Y_PIXEL + INTERVAL_H + titleHeight, event_handler, ID_M_X_N);
buttonYI = lv_imgbtn_create(scr, "F:/bmp_yAdd.bin", BTN_X_PIXEL + INTERVAL_V * 2, titleHeight, event_handler, ID_M_Y_P);
buttonYD = lv_imgbtn_create(scr, "F:/bmp_yDec.bin", BTN_X_PIXEL + INTERVAL_V * 2, BTN_Y_PIXEL + INTERVAL_H + titleHeight, event_handler, ID_M_Y_N);
buttonZI = lv_imgbtn_create(scr, "F:/bmp_zAdd.bin", BTN_X_PIXEL * 2 + INTERVAL_V * 3, titleHeight, event_handler, ID_M_Z_P);
buttonZD = lv_imgbtn_create(scr, "F:/bmp_zDec.bin", BTN_X_PIXEL * 2 + INTERVAL_V * 3, BTN_Y_PIXEL + INTERVAL_H + titleHeight, event_handler, ID_M_Z_N);
#if 1 buttonV = lv_imgbtn_create(scr, NULL, BTN_X_PIXEL * 3 + INTERVAL_V * 4, titleHeight, event_handler, ID_M_STEP);
lv_obj_set_event_cb_mks(buttonXD, event_handler, ID_M_X_N, NULL, 0); //lv_obj_set_event_cb_mks(buttonV, event_handler,ID_T_MORE,"bmp_More.bin",0);
lv_imgbtn_set_src(buttonXD, LV_BTN_STATE_REL, "F:/bmp_xDec.bin");
lv_imgbtn_set_src(buttonXD, LV_BTN_STATE_PR, "F:/bmp_xDec.bin");
lv_imgbtn_set_style(buttonXD, LV_BTN_STATE_PR, &tft_style_label_pre);
lv_imgbtn_set_style(buttonXD, LV_BTN_STATE_REL, &tft_style_label_rel);
lv_obj_set_event_cb_mks(buttonYI, event_handler, ID_M_Y_P, NULL, 0); buttonBack = lv_imgbtn_create(scr, "F:/bmp_return.bin", BTN_X_PIXEL * 3 + INTERVAL_V * 4, BTN_Y_PIXEL + INTERVAL_H + titleHeight, event_handler, ID_M_RETURN);
lv_imgbtn_set_src(buttonYI, LV_BTN_STATE_REL, "F:/bmp_yAdd.bin");
lv_imgbtn_set_src(buttonYI, LV_BTN_STATE_PR, "F:/bmp_yAdd.bin");
lv_imgbtn_set_style(buttonYI, LV_BTN_STATE_PR, &tft_style_label_pre);
lv_imgbtn_set_style(buttonYI, LV_BTN_STATE_REL, &tft_style_label_rel);
lv_obj_set_event_cb_mks(buttonYD, event_handler, ID_M_Y_N, NULL, 0);
lv_imgbtn_set_src(buttonYD, LV_BTN_STATE_REL, "F:/bmp_yDec.bin");
lv_imgbtn_set_src(buttonYD, LV_BTN_STATE_PR, "F:/bmp_yDec.bin");
lv_imgbtn_set_style(buttonYD, LV_BTN_STATE_PR, &tft_style_label_pre);
lv_imgbtn_set_style(buttonYD, LV_BTN_STATE_REL, &tft_style_label_rel);
lv_obj_set_event_cb_mks(buttonZI, event_handler, ID_M_Z_P, NULL, 0);
lv_imgbtn_set_src(buttonZI, LV_BTN_STATE_REL, "F:/bmp_zAdd.bin");
lv_imgbtn_set_src(buttonZI, LV_BTN_STATE_PR, "F:/bmp_zAdd.bin");
lv_imgbtn_set_style(buttonZI, LV_BTN_STATE_PR, &tft_style_label_pre);
lv_imgbtn_set_style(buttonZI, LV_BTN_STATE_REL, &tft_style_label_rel);
lv_obj_set_event_cb_mks(buttonZD, event_handler, ID_M_Z_N, NULL, 0);
lv_imgbtn_set_src(buttonZD, LV_BTN_STATE_REL, "F:/bmp_zDec.bin");
lv_imgbtn_set_src(buttonZD, LV_BTN_STATE_PR, "F:/bmp_zDec.bin");
lv_imgbtn_set_style(buttonZD, LV_BTN_STATE_PR, &tft_style_label_pre);
lv_imgbtn_set_style(buttonZD, LV_BTN_STATE_REL, &tft_style_label_rel);
//lv_obj_set_event_cb_mks(buttonV, event_handler,ID_T_MORE,"bmp_More.bin",0);
lv_obj_set_event_cb_mks(buttonV, event_handler, ID_M_STEP, NULL, 0);
lv_imgbtn_set_style(buttonV, LV_BTN_STATE_PR, &tft_style_label_pre);
lv_imgbtn_set_style(buttonV, LV_BTN_STATE_REL, &tft_style_label_rel);
lv_obj_set_event_cb_mks(buttonBack, event_handler, ID_M_RETURN, NULL, 0);
lv_imgbtn_set_src(buttonBack, LV_BTN_STATE_REL, "F:/bmp_return.bin");
lv_imgbtn_set_src(buttonBack, LV_BTN_STATE_PR, "F:/bmp_return.bin");
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 // if 1
lv_obj_set_pos(buttonXI, INTERVAL_V, titleHeight);
lv_obj_set_pos(buttonYI, BTN_X_PIXEL + INTERVAL_V * 2, titleHeight);
lv_obj_set_pos(buttonZI, BTN_X_PIXEL * 2 + INTERVAL_V * 3, titleHeight);
lv_obj_set_pos(buttonV, BTN_X_PIXEL * 3 + INTERVAL_V * 4, titleHeight);
lv_obj_set_pos(buttonXD, INTERVAL_V, BTN_Y_PIXEL + INTERVAL_H + titleHeight);
lv_obj_set_pos(buttonYD, BTN_X_PIXEL + INTERVAL_V * 2, BTN_Y_PIXEL + INTERVAL_H + titleHeight);
lv_obj_set_pos(buttonZD, 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 labels on the image buttons // Create labels on the image buttons
lv_btn_set_layout(buttonXI, LV_LAYOUT_OFF); lv_obj_t *labelXI = lv_label_create_empty(buttonXI);
lv_btn_set_layout(buttonXD, LV_LAYOUT_OFF); lv_obj_t *labelXD = lv_label_create_empty(buttonXD);
lv_btn_set_layout(buttonYI, LV_LAYOUT_OFF); lv_obj_t *labelYI = lv_label_create_empty(buttonYI);
lv_btn_set_layout(buttonYD, LV_LAYOUT_OFF); lv_obj_t *labelYD = lv_label_create_empty(buttonYD);
lv_btn_set_layout(buttonZI, LV_LAYOUT_OFF); lv_obj_t *labelZI = lv_label_create_empty(buttonZI);
lv_btn_set_layout(buttonZD, LV_LAYOUT_OFF); lv_obj_t *labelZD = lv_label_create_empty(buttonZD);
lv_btn_set_layout(buttonV, LV_LAYOUT_OFF); labelV = lv_label_create_empty(buttonV);
lv_btn_set_layout(buttonBack, LV_LAYOUT_OFF); lv_obj_t *label_Back = lv_label_create_empty(buttonBack);
lv_obj_t *labelXI = lv_label_create(buttonXI, NULL);
lv_obj_t *labelXD = lv_label_create(buttonXD, NULL);
lv_obj_t *labelYI = lv_label_create(buttonYI, NULL);
lv_obj_t *labelYD = lv_label_create(buttonYD, NULL);
lv_obj_t *labelZI = lv_label_create(buttonZI, NULL);
lv_obj_t *labelZD = lv_label_create(buttonZD, NULL);
labelV = lv_label_create(buttonV, NULL);
lv_obj_t *label_Back = lv_label_create(buttonBack, NULL);
if (gCfgItems.multiple_language) { if (gCfgItems.multiple_language) {
lv_label_set_text(labelXI, move_menu.x_add); lv_label_set_text(labelXI, move_menu.x_add);
@ -310,18 +243,13 @@ void lv_draw_move_motor(void) {
void disp_move_dist() { void disp_move_dist() {
// char buf[30] = {0}; // char buf[30] = {0};
if ((int)(10 * uiCfg.move_dist) == 1) { if ((int)(10 * uiCfg.move_dist) == 1)
lv_imgbtn_set_src(buttonV, LV_BTN_STATE_REL, "F:/bmp_step_move0_1.bin"); lv_imgbtn_set_src_both(buttonV, "F:/bmp_step_move0_1.bin");
lv_imgbtn_set_src(buttonV, LV_BTN_STATE_PR, "F:/bmp_step_move0_1.bin"); else if ((int)(10 * uiCfg.move_dist) == 10)
} lv_imgbtn_set_src_both(buttonV, "F:/bmp_step_move1.bin");
else if ((int)(10 * uiCfg.move_dist) == 10) { else if ((int)(10 * uiCfg.move_dist) == 100)
lv_imgbtn_set_src(buttonV, LV_BTN_STATE_REL, "F:/bmp_step_move1.bin"); lv_imgbtn_set_src_both(buttonV, "F:/bmp_step_move10.bin");
lv_imgbtn_set_src(buttonV, LV_BTN_STATE_PR, "F:/bmp_step_move1.bin");
}
else if ((int)(10 * uiCfg.move_dist) == 100) {
lv_imgbtn_set_src(buttonV, LV_BTN_STATE_REL, "F:/bmp_step_move10.bin");
lv_imgbtn_set_src(buttonV, LV_BTN_STATE_PR, "F:/bmp_step_move10.bin");
}
if (gCfgItems.multiple_language) { if (gCfgItems.multiple_language) {
if ((int)(10 * uiCfg.move_dist) == 1) { if ((int)(10 * uiCfg.move_dist) == 1) {
lv_label_set_text(labelV, move_menu.step_01mm); lv_label_set_text(labelV, move_menu.step_01mm);

View File

@ -765,10 +765,7 @@ void lv_draw_number_key(void) {
lv_scr_load(scr); lv_scr_load(scr);
lv_obj_clean(scr); lv_obj_clean(scr);
//lv_obj_t * title = lv_label_create(scr, NULL); //(void)lv_label_create(scr, TITLE_XPOS, TITLE_YPOS, creat_title_text());
//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());
lv_refr_now(lv_refr_get_disp_refreshing()); lv_refr_now(lv_refr_get_disp_refreshing());
@ -779,7 +776,7 @@ void lv_draw_number_key(void) {
lv_btn_set_style(buttonValue, LV_BTN_STYLE_REL, &style_num_text); /*Set the button's released style*/ lv_btn_set_style(buttonValue, LV_BTN_STYLE_REL, &style_num_text); /*Set the button's released style*/
lv_btn_set_style(buttonValue, LV_BTN_STYLE_PR, &style_num_text); /*Set the button's pressed style*/ lv_btn_set_style(buttonValue, LV_BTN_STYLE_PR, &style_num_text); /*Set the button's pressed style*/
//lv_btn_set_layout(buttonValue, LV_LAYOUT_OFF); //lv_btn_set_layout(buttonValue, LV_LAYOUT_OFF);
labelValue = lv_label_create(buttonValue, NULL); /*Add a label to the button*/ labelValue = lv_label_create_empty(buttonValue); /*Add a label to the button*/
NumberKey_1 = lv_btn_create(scr, NULL); /*Add a button the current screen*/ NumberKey_1 = lv_btn_create(scr, NULL); /*Add a button the current screen*/
lv_obj_set_pos(NumberKey_1, 92, 90); /*Set its position*/ lv_obj_set_pos(NumberKey_1, 92, 90); /*Set its position*/
@ -788,7 +785,7 @@ void lv_draw_number_key(void) {
lv_btn_set_style(NumberKey_1, LV_BTN_STYLE_REL, &style_num_key_pre); /*Set the button's released style*/ lv_btn_set_style(NumberKey_1, LV_BTN_STYLE_REL, &style_num_key_pre); /*Set the button's released style*/
lv_btn_set_style(NumberKey_1, LV_BTN_STYLE_PR, &style_num_key_rel); /*Set the button's pressed style*/ lv_btn_set_style(NumberKey_1, LV_BTN_STYLE_PR, &style_num_key_rel); /*Set the button's pressed style*/
//lv_btn_set_layout(NumberKey_1, LV_LAYOUT_OFF); //lv_btn_set_layout(NumberKey_1, LV_LAYOUT_OFF);
labelKey_1 = lv_label_create(NumberKey_1, NULL); /*Add a label to the button*/ labelKey_1 = lv_label_create_empty(NumberKey_1); /*Add a label to the button*/
lv_label_set_text(labelKey_1, machine_menu.key_1); lv_label_set_text(labelKey_1, machine_menu.key_1);
lv_obj_align(labelKey_1, NumberKey_1, LV_ALIGN_CENTER, 0, 0); lv_obj_align(labelKey_1, NumberKey_1, LV_ALIGN_CENTER, 0, 0);
@ -799,7 +796,7 @@ void lv_draw_number_key(void) {
lv_btn_set_style(NumberKey_2, LV_BTN_STYLE_REL, &style_num_key_pre); /*Set the button's released style*/ lv_btn_set_style(NumberKey_2, LV_BTN_STYLE_REL, &style_num_key_pre); /*Set the button's released style*/
lv_btn_set_style(NumberKey_2, LV_BTN_STYLE_PR, &style_num_key_rel); /*Set the button's pressed style*/ lv_btn_set_style(NumberKey_2, LV_BTN_STYLE_PR, &style_num_key_rel); /*Set the button's pressed style*/
//lv_btn_set_layout(NumberKey_2, LV_LAYOUT_OFF); //lv_btn_set_layout(NumberKey_2, LV_LAYOUT_OFF);
labelKey_2 = lv_label_create(NumberKey_2, NULL); /*Add a label to the button*/ labelKey_2 = lv_label_create_empty(NumberKey_2); /*Add a label to the button*/
lv_label_set_text(labelKey_2, machine_menu.key_2); lv_label_set_text(labelKey_2, machine_menu.key_2);
lv_obj_align(labelKey_2, NumberKey_2, LV_ALIGN_CENTER, 0, 0); lv_obj_align(labelKey_2, NumberKey_2, LV_ALIGN_CENTER, 0, 0);
@ -810,7 +807,7 @@ void lv_draw_number_key(void) {
lv_btn_set_style(NumberKey_3, LV_BTN_STYLE_REL, &style_num_key_pre); /*Set the button's released style*/ lv_btn_set_style(NumberKey_3, LV_BTN_STYLE_REL, &style_num_key_pre); /*Set the button's released style*/
lv_btn_set_style(NumberKey_3, LV_BTN_STYLE_PR, &style_num_key_rel); /*Set the button's pressed style*/ lv_btn_set_style(NumberKey_3, LV_BTN_STYLE_PR, &style_num_key_rel); /*Set the button's pressed style*/
//lv_btn_set_layout(NumberKey_3, LV_LAYOUT_OFF); //lv_btn_set_layout(NumberKey_3, LV_LAYOUT_OFF);
labelKey_3 = lv_label_create(NumberKey_3, NULL); /*Add a label to the button*/ labelKey_3 = lv_label_create_empty(NumberKey_3); /*Add a label to the button*/
lv_label_set_text(labelKey_3, machine_menu.key_3); lv_label_set_text(labelKey_3, machine_menu.key_3);
lv_obj_align(labelKey_3, NumberKey_3, LV_ALIGN_CENTER, 0, 0); lv_obj_align(labelKey_3, NumberKey_3, LV_ALIGN_CENTER, 0, 0);
@ -821,7 +818,7 @@ void lv_draw_number_key(void) {
lv_btn_set_style(NumberKey_4, LV_BTN_STYLE_REL, &style_num_key_pre); /*Set the button's released style*/ lv_btn_set_style(NumberKey_4, LV_BTN_STYLE_REL, &style_num_key_pre); /*Set the button's released style*/
lv_btn_set_style(NumberKey_4, LV_BTN_STYLE_PR, &style_num_key_rel); /*Set the button's pressed style*/ lv_btn_set_style(NumberKey_4, LV_BTN_STYLE_PR, &style_num_key_rel); /*Set the button's pressed style*/
//lv_btn_set_layout(NumberKey_4, LV_LAYOUT_OFF); //lv_btn_set_layout(NumberKey_4, LV_LAYOUT_OFF);
labelKey_4 = lv_label_create(NumberKey_4, NULL); /*Add a label to the button*/ labelKey_4 = lv_label_create_empty(NumberKey_4); /*Add a label to the button*/
lv_label_set_text(labelKey_4, machine_menu.key_4); lv_label_set_text(labelKey_4, machine_menu.key_4);
lv_obj_align(labelKey_4, NumberKey_4, LV_ALIGN_CENTER, 0, 0); lv_obj_align(labelKey_4, NumberKey_4, LV_ALIGN_CENTER, 0, 0);
@ -832,7 +829,7 @@ void lv_draw_number_key(void) {
lv_btn_set_style(NumberKey_5, LV_BTN_STYLE_REL, &style_num_key_pre); /*Set the button's released style*/ lv_btn_set_style(NumberKey_5, LV_BTN_STYLE_REL, &style_num_key_pre); /*Set the button's released style*/
lv_btn_set_style(NumberKey_5, LV_BTN_STYLE_PR, &style_num_key_rel); /*Set the button's pressed style*/ lv_btn_set_style(NumberKey_5, LV_BTN_STYLE_PR, &style_num_key_rel); /*Set the button's pressed style*/
//lv_btn_set_layout(NumberKey_5, LV_LAYOUT_OFF); //lv_btn_set_layout(NumberKey_5, LV_LAYOUT_OFF);
labelKey_5 = lv_label_create(NumberKey_5, NULL); /*Add a label to the button*/ labelKey_5 = lv_label_create_empty(NumberKey_5); /*Add a label to the button*/
lv_label_set_text(labelKey_5, machine_menu.key_5); lv_label_set_text(labelKey_5, machine_menu.key_5);
lv_obj_align(labelKey_5, NumberKey_5, LV_ALIGN_CENTER, 0, 0); lv_obj_align(labelKey_5, NumberKey_5, LV_ALIGN_CENTER, 0, 0);
@ -843,7 +840,7 @@ void lv_draw_number_key(void) {
lv_btn_set_style(NumberKey_6, LV_BTN_STYLE_REL, &style_num_key_pre); /*Set the button's released style*/ lv_btn_set_style(NumberKey_6, LV_BTN_STYLE_REL, &style_num_key_pre); /*Set the button's released style*/
lv_btn_set_style(NumberKey_6, LV_BTN_STYLE_PR, &style_num_key_rel); /*Set the button's pressed style*/ lv_btn_set_style(NumberKey_6, LV_BTN_STYLE_PR, &style_num_key_rel); /*Set the button's pressed style*/
//lv_btn_set_layout(NumberKey_6, LV_LAYOUT_OFF); //lv_btn_set_layout(NumberKey_6, LV_LAYOUT_OFF);
labelKey_6 = lv_label_create(NumberKey_6, NULL); /*Add a label to the button*/ labelKey_6 = lv_label_create_empty(NumberKey_6); /*Add a label to the button*/
lv_label_set_text(labelKey_6, machine_menu.key_6); lv_label_set_text(labelKey_6, machine_menu.key_6);
lv_obj_align(labelKey_6, NumberKey_6, LV_ALIGN_CENTER, 0, 0); lv_obj_align(labelKey_6, NumberKey_6, LV_ALIGN_CENTER, 0, 0);
@ -854,7 +851,7 @@ void lv_draw_number_key(void) {
lv_btn_set_style(NumberKey_7, LV_BTN_STYLE_REL, &style_num_key_pre); /*Set the button's released style*/ lv_btn_set_style(NumberKey_7, LV_BTN_STYLE_REL, &style_num_key_pre); /*Set the button's released style*/
lv_btn_set_style(NumberKey_7, LV_BTN_STYLE_PR, &style_num_key_rel); /*Set the button's pressed style*/ lv_btn_set_style(NumberKey_7, LV_BTN_STYLE_PR, &style_num_key_rel); /*Set the button's pressed style*/
//lv_btn_set_layout(NumberKey_7, LV_LAYOUT_OFF); //lv_btn_set_layout(NumberKey_7, LV_LAYOUT_OFF);
labelKey_7 = lv_label_create(NumberKey_7, NULL); /*Add a label to the button*/ labelKey_7 = lv_label_create_empty(NumberKey_7); /*Add a label to the button*/
lv_label_set_text(labelKey_7, machine_menu.key_7); lv_label_set_text(labelKey_7, machine_menu.key_7);
lv_obj_align(labelKey_7, NumberKey_7, LV_ALIGN_CENTER, 0, 0); lv_obj_align(labelKey_7, NumberKey_7, LV_ALIGN_CENTER, 0, 0);
@ -865,7 +862,7 @@ void lv_draw_number_key(void) {
lv_btn_set_style(NumberKey_8, LV_BTN_STYLE_REL, &style_num_key_pre); /*Set the button's released style*/ lv_btn_set_style(NumberKey_8, LV_BTN_STYLE_REL, &style_num_key_pre); /*Set the button's released style*/
lv_btn_set_style(NumberKey_8, LV_BTN_STYLE_PR, &style_num_key_rel); /*Set the button's pressed style*/ lv_btn_set_style(NumberKey_8, LV_BTN_STYLE_PR, &style_num_key_rel); /*Set the button's pressed style*/
//lv_btn_set_layout(NumberKey_8, LV_LAYOUT_OFF); //lv_btn_set_layout(NumberKey_8, LV_LAYOUT_OFF);
labelKey_8 = lv_label_create(NumberKey_8, NULL); /*Add a label to the button*/ labelKey_8 = lv_label_create_empty(NumberKey_8); /*Add a label to the button*/
lv_label_set_text(labelKey_8, machine_menu.key_8); lv_label_set_text(labelKey_8, machine_menu.key_8);
lv_obj_align(labelKey_8, NumberKey_8, LV_ALIGN_CENTER, 0, 0); lv_obj_align(labelKey_8, NumberKey_8, LV_ALIGN_CENTER, 0, 0);
@ -876,7 +873,7 @@ void lv_draw_number_key(void) {
lv_btn_set_style(NumberKey_9, LV_BTN_STYLE_REL, &style_num_key_pre); /*Set the button's released style*/ lv_btn_set_style(NumberKey_9, LV_BTN_STYLE_REL, &style_num_key_pre); /*Set the button's released style*/
lv_btn_set_style(NumberKey_9, LV_BTN_STYLE_PR, &style_num_key_rel); /*Set the button's pressed style*/ lv_btn_set_style(NumberKey_9, LV_BTN_STYLE_PR, &style_num_key_rel); /*Set the button's pressed style*/
//lv_btn_set_layout(NumberKey_9, LV_LAYOUT_OFF); //lv_btn_set_layout(NumberKey_9, LV_LAYOUT_OFF);
labelKey_9 = lv_label_create(NumberKey_9, NULL); /*Add a label to the button*/ labelKey_9 = lv_label_create_empty(NumberKey_9); /*Add a label to the button*/
lv_label_set_text(labelKey_9, machine_menu.key_9); lv_label_set_text(labelKey_9, machine_menu.key_9);
lv_obj_align(labelKey_9, NumberKey_9, LV_ALIGN_CENTER, 0, 0); lv_obj_align(labelKey_9, NumberKey_9, LV_ALIGN_CENTER, 0, 0);
@ -887,7 +884,7 @@ void lv_draw_number_key(void) {
lv_btn_set_style(NumberKey_0, LV_BTN_STYLE_REL, &style_num_key_pre); /*Set the button's released style*/ lv_btn_set_style(NumberKey_0, LV_BTN_STYLE_REL, &style_num_key_pre); /*Set the button's released style*/
lv_btn_set_style(NumberKey_0, LV_BTN_STYLE_PR, &style_num_key_rel); /*Set the button's pressed style*/ lv_btn_set_style(NumberKey_0, LV_BTN_STYLE_PR, &style_num_key_rel); /*Set the button's pressed style*/
//lv_btn_set_layout(NumberKey_0, LV_LAYOUT_OFF); //lv_btn_set_layout(NumberKey_0, LV_LAYOUT_OFF);
labelKey_0 = lv_label_create(NumberKey_0, NULL); /*Add a label to the button*/ labelKey_0 = lv_label_create_empty(NumberKey_0); /*Add a label to the button*/
lv_label_set_text(labelKey_0, machine_menu.key_0); lv_label_set_text(labelKey_0, machine_menu.key_0);
lv_obj_align(labelKey_0, NumberKey_0, LV_ALIGN_CENTER, 0, 0); lv_obj_align(labelKey_0, NumberKey_0, LV_ALIGN_CENTER, 0, 0);
@ -898,7 +895,7 @@ void lv_draw_number_key(void) {
lv_btn_set_style(KeyBack, LV_BTN_STYLE_REL, &style_num_key_pre); /*Set the button's released style*/ lv_btn_set_style(KeyBack, LV_BTN_STYLE_REL, &style_num_key_pre); /*Set the button's released style*/
lv_btn_set_style(KeyBack, LV_BTN_STYLE_PR, &style_num_key_rel); /*Set the button's pressed style*/ lv_btn_set_style(KeyBack, LV_BTN_STYLE_PR, &style_num_key_rel); /*Set the button's pressed style*/
//lv_btn_set_layout(KeyBack, LV_LAYOUT_OFF); //lv_btn_set_layout(KeyBack, LV_LAYOUT_OFF);
labelKeyBack = lv_label_create(KeyBack, NULL); /*Add a label to the button*/ labelKeyBack = lv_label_create_empty(KeyBack); /*Add a label to the button*/
lv_label_set_text(labelKeyBack, machine_menu.key_back); lv_label_set_text(labelKeyBack, machine_menu.key_back);
lv_obj_align(labelKeyBack, KeyBack, LV_ALIGN_CENTER, 0, 0); lv_obj_align(labelKeyBack, KeyBack, LV_ALIGN_CENTER, 0, 0);
@ -909,7 +906,7 @@ void lv_draw_number_key(void) {
lv_btn_set_style(KeyReset, LV_BTN_STYLE_REL, &style_num_key_pre); /*Set the button's released style*/ lv_btn_set_style(KeyReset, LV_BTN_STYLE_REL, &style_num_key_pre); /*Set the button's released style*/
lv_btn_set_style(KeyReset, LV_BTN_STYLE_PR, &style_num_key_rel); /*Set the button's pressed style*/ lv_btn_set_style(KeyReset, LV_BTN_STYLE_PR, &style_num_key_rel); /*Set the button's pressed style*/
//lv_btn_set_layout(KeyReset, LV_LAYOUT_OFF); //lv_btn_set_layout(KeyReset, LV_LAYOUT_OFF);
labelKeyReset = lv_label_create(KeyReset, NULL); /*Add a label to the button*/ labelKeyReset = lv_label_create_empty(KeyReset); /*Add a label to the button*/
lv_label_set_text(labelKeyReset, machine_menu.key_reset); lv_label_set_text(labelKeyReset, machine_menu.key_reset);
lv_obj_align(labelKeyReset, KeyReset, LV_ALIGN_CENTER, 0, 0); lv_obj_align(labelKeyReset, KeyReset, LV_ALIGN_CENTER, 0, 0);
@ -920,7 +917,7 @@ void lv_draw_number_key(void) {
lv_btn_set_style(KeyConfirm, LV_BTN_STYLE_REL, &style_num_key_pre); /*Set the button's released style*/ lv_btn_set_style(KeyConfirm, LV_BTN_STYLE_REL, &style_num_key_pre); /*Set the button's released style*/
lv_btn_set_style(KeyConfirm, LV_BTN_STYLE_PR, &style_num_key_rel); /*Set the button's pressed style*/ lv_btn_set_style(KeyConfirm, LV_BTN_STYLE_PR, &style_num_key_rel); /*Set the button's pressed style*/
//lv_btn_set_layout(KeyConfirm, LV_LAYOUT_OFF); //lv_btn_set_layout(KeyConfirm, LV_LAYOUT_OFF);
labelKeyConfirm = lv_label_create(KeyConfirm, NULL); /*Add a label to the button*/ labelKeyConfirm = lv_label_create_empty(KeyConfirm); /*Add a label to the button*/
lv_label_set_text(labelKeyConfirm, machine_menu.key_confirm); lv_label_set_text(labelKeyConfirm, machine_menu.key_confirm);
lv_obj_align(labelKeyConfirm, KeyConfirm, LV_ALIGN_CENTER, 0, 0); lv_obj_align(labelKeyConfirm, KeyConfirm, LV_ALIGN_CENTER, 0, 0);
@ -931,7 +928,7 @@ void lv_draw_number_key(void) {
lv_btn_set_style(KeyPoint, LV_BTN_STYLE_REL, &style_num_key_pre); /*Set the button's released style*/ lv_btn_set_style(KeyPoint, LV_BTN_STYLE_REL, &style_num_key_pre); /*Set the button's released style*/
lv_btn_set_style(KeyPoint, LV_BTN_STYLE_PR, &style_num_key_rel); /*Set the button's pressed style*/ lv_btn_set_style(KeyPoint, LV_BTN_STYLE_PR, &style_num_key_rel); /*Set the button's pressed style*/
//lv_btn_set_layout(KeyPoint, LV_LAYOUT_OFF); //lv_btn_set_layout(KeyPoint, LV_LAYOUT_OFF);
labelKeyPoint = lv_label_create(KeyPoint, NULL); /*Add a label to the button*/ labelKeyPoint = lv_label_create_empty(KeyPoint); /*Add a label to the button*/
lv_label_set_text(labelKeyPoint, machine_menu.key_point); lv_label_set_text(labelKeyPoint, machine_menu.key_point);
lv_obj_align(labelKeyPoint, KeyPoint, LV_ALIGN_CENTER, 0, 0); lv_obj_align(labelKeyPoint, KeyPoint, LV_ALIGN_CENTER, 0, 0);
@ -942,7 +939,7 @@ void lv_draw_number_key(void) {
lv_btn_set_style(Minus, LV_BTN_STYLE_REL, &style_num_key_pre); /*Set the button's released style*/ lv_btn_set_style(Minus, LV_BTN_STYLE_REL, &style_num_key_pre); /*Set the button's released style*/
lv_btn_set_style(Minus, LV_BTN_STYLE_PR, &style_num_key_rel); /*Set the button's pressed style*/ lv_btn_set_style(Minus, LV_BTN_STYLE_PR, &style_num_key_rel); /*Set the button's pressed style*/
//lv_btn_set_layout(Minus, LV_LAYOUT_OFF); //lv_btn_set_layout(Minus, LV_LAYOUT_OFF);
labelMinus = lv_label_create(Minus, NULL); /*Add a label to the button*/ labelMinus = lv_label_create_empty(Minus); /*Add a label to the button*/
lv_label_set_text(labelMinus, machine_menu.negative); lv_label_set_text(labelMinus, machine_menu.negative);
lv_obj_align(labelMinus, Minus, LV_ALIGN_CENTER, 0, 0); lv_obj_align(labelMinus, Minus, LV_ALIGN_CENTER, 0, 0);

View File

@ -137,14 +137,12 @@ static void event_handler(lv_obj_t * obj, lv_event_t event) {
else if (event == LV_EVENT_RELEASED) { else if (event == LV_EVENT_RELEASED) {
if (gCfgItems.finish_power_off) { if (gCfgItems.finish_power_off) {
gCfgItems.finish_power_off = false; gCfgItems.finish_power_off = false;
lv_imgbtn_set_src(buttonPowerOff, LV_BTN_STATE_REL, "F:/bmp_manual_off.bin"); lv_imgbtn_set_src_both(buttonPowerOff, "F:/bmp_manual_off.bin");
lv_imgbtn_set_src(buttonPowerOff, LV_BTN_STATE_PR, "F:/bmp_manual_off.bin");
lv_label_set_text(label_PowerOff, printing_more_menu.manual); lv_label_set_text(label_PowerOff, printing_more_menu.manual);
} }
else { else {
gCfgItems.finish_power_off = true; gCfgItems.finish_power_off = true;
lv_imgbtn_set_src(buttonPowerOff, LV_BTN_STATE_REL, "F:/bmp_auto_off.bin"); lv_imgbtn_set_src_both(buttonPowerOff, "F:/bmp_auto_off.bin");
lv_imgbtn_set_src(buttonPowerOff, LV_BTN_STATE_PR, "F:/bmp_auto_off.bin");
lv_label_set_text(label_PowerOff, printing_more_menu.auto_close); lv_label_set_text(label_PowerOff, printing_more_menu.auto_close);
} }
lv_obj_align(label_PowerOff, buttonPowerOff, LV_ALIGN_IN_BOTTOM_MID, 0, BUTTON_TEXT_Y_OFFSET); lv_obj_align(label_PowerOff, buttonPowerOff, LV_ALIGN_IN_BOTTOM_MID, 0, BUTTON_TEXT_Y_OFFSET);
@ -185,179 +183,71 @@ void lv_draw_operation(void) {
lv_scr_load(scr); lv_scr_load(scr);
lv_obj_clean(scr); lv_obj_clean(scr);
lv_obj_t * title = lv_label_create(scr, NULL); (void)lv_label_create(scr, TITLE_XPOS, TITLE_YPOS, creat_title_text());
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());
lv_refr_now(lv_refr_get_disp_refreshing()); lv_refr_now(lv_refr_get_disp_refreshing());
// Create image buttons // Create image buttons
buttonPreHeat = lv_imgbtn_create(scr, NULL); buttonPreHeat = lv_imgbtn_create(scr, "F:/bmp_temp.bin", INTERVAL_V, titleHeight, event_handler, ID_O_PRE_HEAT);
buttonFilament = lv_imgbtn_create(scr, NULL); buttonFilament = lv_imgbtn_create(scr, "F:/bmp_filamentchange.bin", BTN_X_PIXEL + INTERVAL_V * 2, titleHeight, event_handler, ID_O_FILAMENT);
buttonFan = lv_imgbtn_create(scr, NULL); buttonFan = lv_imgbtn_create(scr, "F:/bmp_fan.bin", BTN_X_PIXEL * 2 + INTERVAL_V * 3, titleHeight, event_handler, ID_O_FAN);
buttonPowerOff = lv_imgbtn_create(scr, NULL); buttonPowerOff = lv_imgbtn_create(scr, gCfgItems.finish_power_off ? "F:/bmp_auto_off.bin" : "F:/bmp_manual_off.bin", BTN_X_PIXEL * 3 + INTERVAL_V * 4, titleHeight, event_handler, ID_O_POWER_OFF);
#if HAS_ROTARY_ENCODER
if (gCfgItems.encoder_enable) {
lv_group_add_obj(g, buttonPreHeat);
lv_group_add_obj(g, buttonFilament);
lv_group_add_obj(g, buttonFan);
lv_group_add_obj(g, buttonPowerOff);
}
#endif
if (uiCfg.print_state != WORKING) { if (uiCfg.print_state != WORKING) {
buttonExtrusion = lv_imgbtn_create(scr, NULL); buttonExtrusion = lv_imgbtn_create(scr, "F:/bmp_extrude_opr.bin", INTERVAL_V, BTN_Y_PIXEL + INTERVAL_H + titleHeight, event_handler, ID_O_EXTRUCT);
buttonMove = lv_imgbtn_create(scr, NULL); buttonMove = lv_imgbtn_create(scr, "F:/bmp_move_opr.bin", BTN_X_PIXEL + INTERVAL_V * 2, BTN_Y_PIXEL + INTERVAL_H + titleHeight, event_handler, ID_O_MOV);
}
else {
buttonSpeed = lv_imgbtn_create(scr, NULL);
buttonBabyStep = lv_imgbtn_create(scr, NULL);
}
buttonBack = lv_imgbtn_create(scr, NULL);
lv_obj_set_event_cb_mks(buttonPreHeat, event_handler, ID_O_PRE_HEAT, NULL, 0);
lv_imgbtn_set_src(buttonPreHeat, LV_BTN_STATE_REL, "F:/bmp_temp.bin");
lv_imgbtn_set_src(buttonPreHeat, LV_BTN_STATE_PR, "F:/bmp_temp.bin");
lv_imgbtn_set_style(buttonPreHeat, LV_BTN_STATE_PR, &tft_style_label_pre);
lv_imgbtn_set_style(buttonPreHeat, LV_BTN_STATE_REL, &tft_style_label_rel);
lv_obj_set_event_cb_mks(buttonFilament, event_handler, ID_O_FILAMENT, NULL, 0);
lv_imgbtn_set_src(buttonFilament, LV_BTN_STATE_REL, "F:/bmp_filamentchange.bin");
lv_imgbtn_set_src(buttonFilament, LV_BTN_STATE_PR, "F:/bmp_filamentchange.bin");
lv_imgbtn_set_style(buttonFilament, LV_BTN_STATE_PR, &tft_style_label_pre);
lv_imgbtn_set_style(buttonFilament, LV_BTN_STATE_REL, &tft_style_label_rel);
#if 1
lv_obj_set_event_cb_mks(buttonFan, event_handler, ID_O_FAN, NULL, 0);
lv_imgbtn_set_src(buttonFan, LV_BTN_STATE_REL, "F:/bmp_fan.bin");
lv_imgbtn_set_src(buttonFan, LV_BTN_STATE_PR, "F:/bmp_fan.bin");
lv_imgbtn_set_style(buttonFan, LV_BTN_STATE_PR, &tft_style_label_pre);
lv_imgbtn_set_style(buttonFan, LV_BTN_STATE_REL, &tft_style_label_rel);
if (gCfgItems.finish_power_off) {
lv_imgbtn_set_src(buttonPowerOff, LV_BTN_STATE_REL, "F:/bmp_auto_off.bin");
lv_imgbtn_set_src(buttonPowerOff, LV_BTN_STATE_PR, "F:/bmp_auto_off.bin");
}
else {
lv_imgbtn_set_src(buttonPowerOff, LV_BTN_STATE_REL, "F:/bmp_manual_off.bin");
lv_imgbtn_set_src(buttonPowerOff, LV_BTN_STATE_PR, "F:/bmp_manual_off.bin");
}
lv_obj_set_event_cb_mks(buttonPowerOff, event_handler, ID_O_POWER_OFF, NULL, 0);
lv_imgbtn_set_style(buttonPowerOff, LV_BTN_STATE_PR, &tft_style_label_pre);
lv_imgbtn_set_style(buttonPowerOff, LV_BTN_STATE_REL, &tft_style_label_rel);
#if HAS_ROTARY_ENCODER #if HAS_ROTARY_ENCODER
if (gCfgItems.encoder_enable) { if (gCfgItems.encoder_enable) {
lv_group_add_obj(g, buttonPreHeat); lv_group_add_obj(g, buttonExtrusion);
lv_group_add_obj(g, buttonFilament); lv_group_add_obj(g, buttonMove);
lv_group_add_obj(g, buttonFan);
lv_group_add_obj(g, buttonPowerOff);
} }
#endif #endif
}
else {
buttonSpeed = lv_imgbtn_create(scr, "F:/bmp_speed.bin", INTERVAL_V, BTN_Y_PIXEL + INTERVAL_H + titleHeight, event_handler, ID_O_SPEED);
buttonBabyStep = lv_imgbtn_create(scr, "F:/bmp_mov.bin", BTN_X_PIXEL + INTERVAL_V * 2, BTN_Y_PIXEL + INTERVAL_H + titleHeight, event_handler, ID_O_BABY_STEP);
#if HAS_ROTARY_ENCODER
if (gCfgItems.encoder_enable) {
lv_group_add_obj(g, buttonSpeed);
lv_group_add_obj(g, buttonBabyStep);
}
#endif
}
if (uiCfg.print_state != WORKING) { buttonBack = lv_imgbtn_create(scr, "F:/bmp_return.bin", BTN_X_PIXEL * 3 + INTERVAL_V * 4, BTN_Y_PIXEL + INTERVAL_H + titleHeight, event_handler, ID_O_RETURN);
lv_obj_set_event_cb_mks(buttonExtrusion, event_handler, ID_O_EXTRUCT, NULL, 0);
lv_imgbtn_set_src(buttonExtrusion, LV_BTN_STATE_REL, "F:/bmp_extrude_opr.bin");
lv_imgbtn_set_src(buttonExtrusion, LV_BTN_STATE_PR, "F:/bmp_extrude_opr.bin");
lv_imgbtn_set_style(buttonExtrusion, LV_BTN_STATE_PR, &tft_style_label_pre);
lv_imgbtn_set_style(buttonExtrusion, LV_BTN_STATE_REL, &tft_style_label_rel);
lv_obj_set_event_cb_mks(buttonMove, event_handler, ID_O_MOV, NULL, 0);
lv_imgbtn_set_src(buttonMove, LV_BTN_STATE_REL, "F:/bmp_move_opr.bin");
lv_imgbtn_set_src(buttonMove, LV_BTN_STATE_PR, "F:/bmp_move_opr.bin");
lv_imgbtn_set_style(buttonMove, LV_BTN_STATE_PR, &tft_style_label_pre);
lv_imgbtn_set_style(buttonMove, LV_BTN_STATE_REL, &tft_style_label_rel);
#if HAS_ROTARY_ENCODER
if (gCfgItems.encoder_enable) {
lv_group_add_obj(g, buttonExtrusion);
lv_group_add_obj(g, buttonMove);
}
#endif
}
else {
lv_obj_set_event_cb_mks(buttonSpeed, event_handler, ID_O_SPEED, NULL, 0);
lv_imgbtn_set_src(buttonSpeed, LV_BTN_STATE_REL, "F:/bmp_speed.bin");
lv_imgbtn_set_src(buttonSpeed, LV_BTN_STATE_PR, "F:/bmp_speed.bin");
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(buttonBabyStep, event_handler, ID_O_BABY_STEP, NULL, 0);
lv_imgbtn_set_src(buttonBabyStep, LV_BTN_STATE_REL, "F:/bmp_mov.bin");
lv_imgbtn_set_src(buttonBabyStep, LV_BTN_STATE_PR, "F:/bmp_mov.bin");
lv_imgbtn_set_style(buttonBabyStep, LV_BTN_STATE_PR, &tft_style_label_pre);
lv_imgbtn_set_style(buttonBabyStep, LV_BTN_STATE_REL, &tft_style_label_rel);
#if HAS_ROTARY_ENCODER
if (gCfgItems.encoder_enable) {
lv_group_add_obj(g, buttonSpeed);
lv_group_add_obj(g, buttonBabyStep);
}
#endif
}
lv_obj_set_event_cb_mks(buttonBack, event_handler, ID_O_RETURN, NULL, 0);
lv_imgbtn_set_src(buttonBack, LV_BTN_STATE_REL, "F:/bmp_return.bin");
lv_imgbtn_set_src(buttonBack, LV_BTN_STATE_PR, "F:/bmp_return.bin");
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 // if 1
#if HAS_ROTARY_ENCODER #if HAS_ROTARY_ENCODER
if (gCfgItems.encoder_enable) lv_group_add_obj(g, buttonBack); if (gCfgItems.encoder_enable) lv_group_add_obj(g, buttonBack);
#endif #endif
lv_obj_set_pos(buttonPreHeat, INTERVAL_V, titleHeight);
lv_obj_set_pos(buttonFilament, BTN_X_PIXEL + INTERVAL_V * 2, titleHeight);
lv_obj_set_pos(buttonFan, BTN_X_PIXEL * 2 + INTERVAL_V * 3, titleHeight);
lv_obj_set_pos(buttonPowerOff, BTN_X_PIXEL * 3 + INTERVAL_V * 4, titleHeight);
if (uiCfg.print_state != WORKING) {
/*
lv_obj_set_pos(buttonFilament,INTERVAL_V,BTN_Y_PIXEL+INTERVAL_H+titleHeight);
} else {
*/
lv_obj_set_pos(buttonExtrusion, INTERVAL_V, BTN_Y_PIXEL + INTERVAL_H + titleHeight);
lv_obj_set_pos(buttonMove, BTN_X_PIXEL + INTERVAL_V * 2, BTN_Y_PIXEL + INTERVAL_H + titleHeight);
}
else {
lv_obj_set_pos(buttonSpeed, INTERVAL_V, BTN_Y_PIXEL + INTERVAL_H + titleHeight);
lv_obj_set_pos(buttonBabyStep, BTN_X_PIXEL + INTERVAL_V * 2, 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 labels on the image buttons // Create labels on the image buttons
lv_btn_set_layout(buttonPreHeat, LV_LAYOUT_OFF); labelPreHeat = lv_label_create_empty(buttonPreHeat);
lv_btn_set_layout(buttonFilament, LV_LAYOUT_OFF); label_Filament = lv_label_create_empty(buttonFilament);
lv_btn_set_layout(buttonFan, LV_LAYOUT_OFF); label_Fan = lv_label_create_empty(buttonFan);
lv_btn_set_layout(buttonPowerOff, LV_LAYOUT_OFF); label_PowerOff = lv_label_create_empty(buttonPowerOff);
if (uiCfg.print_state != WORKING) { if (uiCfg.print_state != WORKING) {
/* /*
lv_btn_set_layout(buttonFilament, LV_LAYOUT_OFF); label_Filament = lv_label_create_empty(buttonFilament);
} else { } else {
*/ */
lv_btn_set_layout(buttonExtrusion, LV_LAYOUT_OFF); labelExtrusion = lv_label_create_empty(buttonExtrusion);
lv_btn_set_layout(buttonMove, LV_LAYOUT_OFF); label_Move = lv_label_create_empty(buttonMove);
} }
else { else {
lv_btn_set_layout(buttonSpeed, LV_LAYOUT_OFF); label_Speed = lv_label_create_empty(buttonSpeed);
lv_btn_set_layout(buttonBabyStep, LV_LAYOUT_OFF); label_BabyStep = lv_label_create_empty(buttonBabyStep);
} }
label_Back = lv_label_create_empty(buttonBack);
lv_btn_set_layout(buttonBack, LV_LAYOUT_OFF);
labelPreHeat = lv_label_create(buttonPreHeat, NULL);
label_Filament = lv_label_create(buttonFilament, NULL);
label_Fan = lv_label_create(buttonFan, NULL);
label_PowerOff = lv_label_create(buttonPowerOff, NULL);
if (uiCfg.print_state != WORKING) {
/*
label_Filament = lv_label_create(buttonFilament, NULL);
} else {
*/
labelExtrusion = lv_label_create(buttonExtrusion, NULL);
label_Move = lv_label_create(buttonMove, NULL);
}
else {
label_Speed = lv_label_create(buttonSpeed, NULL);
label_BabyStep = lv_label_create(buttonBabyStep, NULL);
}
label_Back = lv_label_create(buttonBack, NULL);
if (gCfgItems.multiple_language) { if (gCfgItems.multiple_language) {
lv_label_set_text(labelPreHeat, operation_menu.temp); lv_label_set_text(labelPreHeat, operation_menu.temp);

View File

@ -83,9 +83,9 @@ static void event_handler(lv_obj_t * obj, lv_event_t event) {
void lv_draw_pause_position(void) { void lv_draw_pause_position(void) {
lv_obj_t *buttonBack = NULL, *label_Back = NULL; lv_obj_t *buttonBack = NULL, *label_Back = NULL;
lv_obj_t *labelXText = NULL, *buttonXValue = NULL, *labelXValue = NULL; lv_obj_t *buttonXValue = NULL, *labelXValue = NULL;
lv_obj_t *labelYText = NULL, *buttonYValue = NULL, *labelYValue = NULL; lv_obj_t *buttonYValue = NULL, *labelYValue = NULL;
lv_obj_t *labelZText = NULL, *buttonZValue = NULL, *labelZValue = NULL; lv_obj_t *buttonZValue = NULL, *labelZValue = NULL;
lv_obj_t * line1 = NULL, * line2 = NULL, * line3 = NULL; lv_obj_t * line1 = NULL, * line2 = NULL, * line3 = NULL;
if (disp_state_stack._disp_state[disp_state_stack._disp_index] != PAUSE_POS_UI) { if (disp_state_stack._disp_state[disp_state_stack._disp_index] != PAUSE_POS_UI) {
@ -100,81 +100,46 @@ void lv_draw_pause_position(void) {
lv_scr_load(scr); lv_scr_load(scr);
lv_obj_clean(scr); lv_obj_clean(scr);
lv_obj_t * title = lv_label_create(scr, NULL); (void)lv_label_create(scr, TITLE_XPOS, TITLE_YPOS, machine_menu.PausePosText);
lv_obj_set_style(title, &tft_style_label_rel);
lv_obj_set_pos(title, TITLE_XPOS, TITLE_YPOS);
lv_label_set_text(title, machine_menu.PausePosText);
lv_refr_now(lv_refr_get_disp_refreshing()); lv_refr_now(lv_refr_get_disp_refreshing());
labelXText = lv_label_create(scr, NULL); (void)lv_label_create(scr, PARA_UI_POS_X, PARA_UI_POS_Y + 10, machine_menu.xPos);
lv_obj_set_style(labelXText, &tft_style_label_rel);
lv_obj_set_pos(labelXText, PARA_UI_POS_X, PARA_UI_POS_Y + 10);
lv_label_set_text(labelXText, machine_menu.xPos);
buttonXValue = lv_btn_create(scr, NULL); buttonXValue = lv_btn_create(scr, PARA_UI_VALUE_POS_X, PARA_UI_POS_Y + PARA_UI_VALUE_V, PARA_UI_VALUE_BTN_X_SIZE, PARA_UI_VALUE_BTN_Y_SIZE, event_handler, ID_PAUSE_X);
lv_obj_set_pos(buttonXValue, PARA_UI_VALUE_POS_X, PARA_UI_POS_Y + PARA_UI_VALUE_V); labelXValue = lv_label_create_empty(buttonXValue);
lv_obj_set_size(buttonXValue, PARA_UI_VALUE_BTN_X_SIZE, PARA_UI_VALUE_BTN_Y_SIZE);
lv_btn_set_style(buttonXValue, LV_BTN_STYLE_REL, &style_para_value);
lv_btn_set_style(buttonXValue, LV_BTN_STYLE_PR, &style_para_value);
lv_obj_set_event_cb_mks(buttonXValue, event_handler, ID_PAUSE_X, NULL, 0);
labelXValue = lv_label_create(buttonXValue, NULL);
line1 = lv_line_create(scr, NULL); line1 = lv_line_create(scr, NULL);
lv_ex_line(line1, line_points[0]); lv_ex_line(line1, line_points[0]);
labelYText = lv_label_create(scr, NULL); (void)lv_label_create(scr, PARA_UI_POS_X, PARA_UI_POS_Y * 2 + 10, machine_menu.yPos);
lv_obj_set_style(labelYText, &tft_style_label_rel);
lv_obj_set_pos(labelYText, PARA_UI_POS_X, PARA_UI_POS_Y * 2 + 10);
lv_label_set_text(labelYText, machine_menu.yPos);
buttonYValue = lv_btn_create(scr, NULL); buttonYValue = lv_btn_create(scr, PARA_UI_VALUE_POS_X, PARA_UI_POS_Y * 2 + PARA_UI_VALUE_V, PARA_UI_VALUE_BTN_X_SIZE, PARA_UI_VALUE_BTN_Y_SIZE, event_handler, ID_PAUSE_Y);
lv_obj_set_pos(buttonYValue, PARA_UI_VALUE_POS_X, PARA_UI_POS_Y * 2 + PARA_UI_VALUE_V); labelYValue = lv_label_create_empty(buttonYValue);
lv_obj_set_size(buttonYValue, PARA_UI_VALUE_BTN_X_SIZE, PARA_UI_VALUE_BTN_Y_SIZE);
lv_obj_set_event_cb_mks(buttonYValue, event_handler, ID_PAUSE_Y, NULL, 0);
lv_btn_set_style(buttonYValue, LV_BTN_STYLE_REL, &style_para_value);
lv_btn_set_style(buttonYValue, LV_BTN_STYLE_PR, &style_para_value);
labelYValue = lv_label_create(buttonYValue, NULL);
line2 = lv_line_create(scr, NULL); line2 = lv_line_create(scr, NULL);
lv_ex_line(line2, line_points[1]); lv_ex_line(line2, line_points[1]);
labelZText = lv_label_create(scr, NULL); (void)lv_label_create(scr, PARA_UI_POS_X, PARA_UI_POS_Y * 3 + 10, machine_menu.zPos);
lv_obj_set_style(labelZText, &tft_style_label_rel);
lv_obj_set_pos(labelZText, PARA_UI_POS_X, PARA_UI_POS_Y * 3 + 10);
lv_label_set_text(labelZText, machine_menu.zPos);
buttonZValue = lv_btn_create(scr, NULL); buttonZValue = lv_btn_create(scr, PARA_UI_VALUE_POS_X, PARA_UI_POS_Y * 3 + PARA_UI_VALUE_V, PARA_UI_VALUE_BTN_X_SIZE, PARA_UI_VALUE_BTN_Y_SIZE, event_handler, ID_PAUSE_Z);
lv_obj_set_pos(buttonZValue, PARA_UI_VALUE_POS_X, PARA_UI_POS_Y * 3 + PARA_UI_VALUE_V); labelZValue = lv_label_create_empty(buttonZValue);
lv_obj_set_size(buttonZValue, PARA_UI_VALUE_BTN_X_SIZE, PARA_UI_VALUE_BTN_Y_SIZE);
lv_obj_set_event_cb_mks(buttonZValue, event_handler, ID_PAUSE_Z, NULL, 0);
lv_btn_set_style(buttonZValue, LV_BTN_STYLE_REL, &style_para_value);
lv_btn_set_style(buttonZValue, LV_BTN_STYLE_PR, &style_para_value);
labelZValue = lv_label_create(buttonZValue, NULL);
line3 = lv_line_create(scr, NULL); line3 = lv_line_create(scr, NULL);
lv_ex_line(line3, line_points[2]); lv_ex_line(line3, line_points[2]);
buttonBack = lv_btn_create(scr, NULL); buttonBack = lv_btn_create_back(scr, PARA_UI_BACL_POS_X, PARA_UI_BACL_POS_Y, PARA_UI_BACK_BTN_X_SIZE, PARA_UI_BACK_BTN_Y_SIZE, event_handler, ID_PAUSE_RETURN);
lv_obj_set_pos(buttonBack, PARA_UI_BACL_POS_X, PARA_UI_BACL_POS_Y); label_Back = lv_label_create_empty(buttonBack);
lv_obj_set_size(buttonBack, PARA_UI_BACK_BTN_X_SIZE, PARA_UI_BACK_BTN_Y_SIZE);
lv_obj_set_event_cb_mks(buttonBack, event_handler, ID_PAUSE_RETURN, NULL, 0);
lv_btn_set_style(buttonBack, LV_BTN_STYLE_REL, &style_para_back);
lv_btn_set_style(buttonBack, LV_BTN_STYLE_PR, &style_para_back);
label_Back = lv_label_create(buttonBack, NULL);
if (gCfgItems.multiple_language) { if (gCfgItems.multiple_language) {
ZERO(public_buf_l);
sprintf_P(public_buf_l, PSTR("%.1f"), gCfgItems.pausePosX); sprintf_P(public_buf_l, PSTR("%.1f"), gCfgItems.pausePosX);
lv_label_set_text(labelXValue, public_buf_l); lv_label_set_text(labelXValue, public_buf_l);
lv_obj_align(labelXValue, buttonXValue, LV_ALIGN_CENTER, 0, 0); lv_obj_align(labelXValue, buttonXValue, LV_ALIGN_CENTER, 0, 0);
ZERO(public_buf_l);
sprintf_P(public_buf_l, PSTR("%.1f"), gCfgItems.pausePosY); sprintf_P(public_buf_l, PSTR("%.1f"), gCfgItems.pausePosY);
lv_label_set_text(labelYValue, public_buf_l); lv_label_set_text(labelYValue, public_buf_l);
lv_obj_align(labelYValue, buttonYValue, LV_ALIGN_CENTER, 0, 0); lv_obj_align(labelYValue, buttonYValue, LV_ALIGN_CENTER, 0, 0);
ZERO(public_buf_l);
sprintf_P(public_buf_l, PSTR("%.1f"), gCfgItems.pausePosZ); sprintf_P(public_buf_l, PSTR("%.1f"), gCfgItems.pausePosZ);
lv_label_set_text(labelZValue, public_buf_l); lv_label_set_text(labelZValue, public_buf_l);
lv_obj_align(labelZValue, buttonZValue, LV_ALIGN_CENTER, 0, 0); lv_obj_align(labelZValue, buttonZValue, LV_ALIGN_CENTER, 0, 0);

View File

@ -35,7 +35,7 @@
static lv_obj_t * scr; static lv_obj_t * scr;
extern lv_group_t* g; extern lv_group_t* g;
static lv_obj_t *buttoType, *buttonStep; static lv_obj_t *buttonType, *buttonStep;
static lv_obj_t *labelType; static lv_obj_t *labelType;
static lv_obj_t *labelStep; static lv_obj_t *labelStep;
static lv_obj_t * tempText1; static lv_obj_t * tempText1;
@ -203,77 +203,26 @@ void lv_draw_preHeat(void) {
lv_scr_load(scr); lv_scr_load(scr);
lv_obj_clean(scr); lv_obj_clean(scr);
lv_obj_t * title = lv_label_create(scr, NULL); (void)lv_label_create(scr, TITLE_XPOS, TITLE_YPOS, creat_title_text());
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());
lv_refr_now(lv_refr_get_disp_refreshing()); lv_refr_now(lv_refr_get_disp_refreshing());
// Create image buttons // Create image buttons
buttonAdd = lv_imgbtn_create(scr, NULL); buttonAdd = lv_imgbtn_create(scr, "F:/bmp_Add.bin", INTERVAL_V, titleHeight, event_handler, ID_P_ADD);
buttonDec = lv_imgbtn_create(scr, NULL);
buttoType = lv_imgbtn_create(scr, NULL);
buttonStep = lv_imgbtn_create(scr, NULL);
buttonOff = lv_imgbtn_create(scr, NULL);
buttonBack = lv_imgbtn_create(scr, NULL);
lv_obj_set_event_cb_mks(buttonAdd, event_handler, ID_P_ADD, NULL, 0);
lv_imgbtn_set_src(buttonAdd, LV_BTN_STATE_REL, "F:/bmp_Add.bin");
lv_imgbtn_set_src(buttonAdd, LV_BTN_STATE_PR, "F:/bmp_Add.bin");
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); lv_obj_clear_protect(buttonAdd, LV_PROTECT_FOLLOW);
buttonDec = lv_imgbtn_create(scr, "F:/bmp_Dec.bin", BTN_X_PIXEL * 3 + INTERVAL_V * 4, titleHeight, event_handler, ID_P_DEC);
#if 1 buttonType = lv_imgbtn_create(scr, NULL, INTERVAL_V, BTN_Y_PIXEL + INTERVAL_H + titleHeight, event_handler, ID_P_TYPE);
lv_obj_set_event_cb_mks(buttonDec, event_handler, ID_P_DEC, NULL, 0); buttonStep = lv_imgbtn_create(scr, NULL, BTN_X_PIXEL + INTERVAL_V * 2, BTN_Y_PIXEL + INTERVAL_H + titleHeight, event_handler, ID_P_STEP);
lv_imgbtn_set_src(buttonDec, LV_BTN_STATE_REL, "F:/bmp_Dec.bin"); buttonOff = lv_imgbtn_create(scr, "F:/bmp_speed0.bin", BTN_X_PIXEL * 2 + INTERVAL_V * 3, BTN_Y_PIXEL + INTERVAL_H + titleHeight, event_handler, ID_P_OFF);
lv_imgbtn_set_src(buttonDec, LV_BTN_STATE_PR, "F:/bmp_Dec.bin"); buttonBack = lv_imgbtn_create(scr, "F:/bmp_return.bin", BTN_X_PIXEL * 3 + INTERVAL_V * 4, BTN_Y_PIXEL + INTERVAL_H + titleHeight, event_handler, ID_P_RETURN);
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_obj_set_event_cb_mks(buttoType, event_handler, ID_P_TYPE, NULL, 0);
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_obj_set_event_cb_mks(buttonStep, event_handler, ID_P_STEP, NULL, 0);
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_obj_set_event_cb_mks(buttonOff, event_handler, ID_P_OFF, NULL, 0);
lv_imgbtn_set_src(buttonOff, LV_BTN_STATE_REL, "F:/bmp_speed0.bin");
lv_imgbtn_set_src(buttonOff, LV_BTN_STATE_PR, "F:/bmp_speed0.bin");
lv_imgbtn_set_style(buttonOff, LV_BTN_STATE_PR, &tft_style_label_pre);
lv_imgbtn_set_style(buttonOff, LV_BTN_STATE_REL, &tft_style_label_rel);
lv_obj_set_event_cb_mks(buttonBack, event_handler, ID_P_RETURN, NULL, 0);
lv_imgbtn_set_src(buttonBack, LV_BTN_STATE_REL, "F:/bmp_return.bin");
lv_imgbtn_set_src(buttonBack, LV_BTN_STATE_PR, "F:/bmp_return.bin");
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(buttonStep, BTN_X_PIXEL + INTERVAL_V * 2, BTN_Y_PIXEL + INTERVAL_H + titleHeight);
lv_obj_set_pos(buttonOff, 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 labels on the image buttons // Create labels on the image buttons
lv_btn_set_layout(buttonAdd, LV_LAYOUT_OFF); lv_obj_t *labelAdd = lv_label_create_empty(buttonAdd);
lv_btn_set_layout(buttonDec, LV_LAYOUT_OFF); lv_obj_t *labelDec = lv_label_create_empty(buttonDec);
lv_btn_set_layout(buttoType, LV_LAYOUT_OFF); labelType = lv_label_create_empty(buttonType);
lv_btn_set_layout(buttonStep, LV_LAYOUT_OFF); labelStep = lv_label_create_empty(buttonStep);
lv_btn_set_layout(buttonOff, LV_LAYOUT_OFF); lv_obj_t *labelOff = lv_label_create_empty(buttonOff);
lv_btn_set_layout(buttonBack, LV_LAYOUT_OFF); lv_obj_t *label_Back = lv_label_create_empty(buttonBack);
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);
lv_obj_t *labelOff = lv_label_create(buttonOff, NULL);
lv_obj_t *label_Back = lv_label_create(buttonBack, NULL);
if (gCfgItems.multiple_language) { if (gCfgItems.multiple_language) {
lv_label_set_text(labelAdd, preheat_menu.add); lv_label_set_text(labelAdd, preheat_menu.add);
@ -292,7 +241,7 @@ void lv_draw_preHeat(void) {
if (gCfgItems.encoder_enable) { if (gCfgItems.encoder_enable) {
lv_group_add_obj(g, buttonAdd); lv_group_add_obj(g, buttonAdd);
lv_group_add_obj(g, buttonDec); lv_group_add_obj(g, buttonDec);
lv_group_add_obj(g, buttoType); lv_group_add_obj(g, buttonType);
lv_group_add_obj(g, buttonStep); lv_group_add_obj(g, buttonStep);
lv_group_add_obj(g, buttonOff); lv_group_add_obj(g, buttonOff);
lv_group_add_obj(g, buttonBack); lv_group_add_obj(g, buttonBack);
@ -302,7 +251,7 @@ void lv_draw_preHeat(void) {
disp_temp_type(); disp_temp_type();
disp_step_heat(); disp_step_heat();
tempText1 = lv_label_create(scr, NULL); tempText1 = lv_label_create_empty(scr);
lv_obj_set_style(tempText1, &tft_style_label_rel); lv_obj_set_style(tempText1, &tft_style_label_rel);
disp_desire_temp(); disp_desire_temp();
} }
@ -310,29 +259,26 @@ void lv_draw_preHeat(void) {
void disp_temp_type() { void disp_temp_type() {
if (uiCfg.curTempType == 0) { if (uiCfg.curTempType == 0) {
if (uiCfg.curSprayerChoose == 1) { if (uiCfg.curSprayerChoose == 1) {
lv_imgbtn_set_src(buttoType, LV_BTN_STATE_REL, "F:/bmp_extru2.bin"); lv_imgbtn_set_src_both(buttonType, "F:/bmp_extru2.bin");
lv_imgbtn_set_src(buttoType, LV_BTN_STATE_PR, "F:/bmp_extru2.bin");
if (gCfgItems.multiple_language) { if (gCfgItems.multiple_language) {
lv_label_set_text(labelType, preheat_menu.ext2); lv_label_set_text(labelType, preheat_menu.ext2);
lv_obj_align(labelType, buttoType, LV_ALIGN_IN_BOTTOM_MID, 0, BUTTON_TEXT_Y_OFFSET); lv_obj_align(labelType, buttonType, LV_ALIGN_IN_BOTTOM_MID, 0, BUTTON_TEXT_Y_OFFSET);
} }
} }
else { else {
lv_imgbtn_set_src(buttoType, LV_BTN_STATE_REL, "F:/bmp_extru1.bin"); lv_imgbtn_set_src_both(buttonType, "F:/bmp_extru1.bin");
lv_imgbtn_set_src(buttoType, LV_BTN_STATE_PR, "F:/bmp_extru1.bin");
if (gCfgItems.multiple_language) { if (gCfgItems.multiple_language) {
lv_label_set_text(labelType, preheat_menu.ext1); lv_label_set_text(labelType, preheat_menu.ext1);
lv_obj_align(labelType, buttoType, LV_ALIGN_IN_BOTTOM_MID, 0, BUTTON_TEXT_Y_OFFSET); lv_obj_align(labelType, buttonType, LV_ALIGN_IN_BOTTOM_MID, 0, BUTTON_TEXT_Y_OFFSET);
} }
} }
} }
else { else {
lv_imgbtn_set_src(buttoType, LV_BTN_STATE_REL, "F:/bmp_bed.bin"); lv_imgbtn_set_src_both(buttonType, "F:/bmp_bed.bin");
lv_imgbtn_set_src(buttoType, LV_BTN_STATE_PR, "F:/bmp_bed.bin");
if (gCfgItems.multiple_language) { if (gCfgItems.multiple_language) {
lv_label_set_text(labelType, preheat_menu.hotbed); lv_label_set_text(labelType, preheat_menu.hotbed);
lv_obj_align(labelType, buttoType, LV_ALIGN_IN_BOTTOM_MID, 0, BUTTON_TEXT_Y_OFFSET); lv_obj_align(labelType, buttonType, LV_ALIGN_IN_BOTTOM_MID, 0, BUTTON_TEXT_Y_OFFSET);
} }
} }
} }
@ -363,16 +309,13 @@ void disp_desire_temp() {
void disp_step_heat() { void disp_step_heat() {
if (uiCfg.stepHeat == 1) { if (uiCfg.stepHeat == 1) {
lv_imgbtn_set_src(buttonStep, LV_BTN_STATE_REL, "F:/bmp_step1_degree.bin"); lv_imgbtn_set_src_both(buttonStep, "F:/bmp_step1_degree.bin");
lv_imgbtn_set_src(buttonStep, LV_BTN_STATE_PR, "F:/bmp_step1_degree.bin");
} }
else if (uiCfg.stepHeat == 5) { else if (uiCfg.stepHeat == 5) {
lv_imgbtn_set_src(buttonStep, LV_BTN_STATE_REL, "F:/bmp_step5_degree.bin"); lv_imgbtn_set_src_both(buttonStep, "F:/bmp_step5_degree.bin");
lv_imgbtn_set_src(buttonStep, LV_BTN_STATE_PR, "F:/bmp_step5_degree.bin");
} }
else if (uiCfg.stepHeat == 10) { else if (uiCfg.stepHeat == 10) {
lv_imgbtn_set_src(buttonStep, LV_BTN_STATE_REL, "F:/bmp_step10_degree.bin"); lv_imgbtn_set_src_both(buttonStep, "F:/bmp_step10_degree.bin");
lv_imgbtn_set_src(buttonStep, LV_BTN_STATE_PR, "F:/bmp_step10_degree.bin");
} }
if (gCfgItems.multiple_language) { if (gCfgItems.multiple_language) {

View File

@ -266,9 +266,9 @@ void lv_draw_print_file(void) {
#endif #endif
disp_gcode_icon(file_count); disp_gcode_icon(file_count);
//lv_obj_t *labelPageUp = lv_label_create(buttonPageUp, NULL); //lv_obj_t *labelPageUp = lv_label_create_empty(buttonPageUp);
//lv_obj_t *labelPageDown = lv_label_create(buttonPageDown, NULL); //lv_obj_t *labelPageDown = lv_label_create_empty(buttonPageDown);
//lv_obj_t *label_Back = lv_label_create(buttonBack, NULL); //lv_obj_t *label_Back = lv_label_create_empty(buttonBack);
/* /*
if (gCfgItems.multiple_language) { if (gCfgItems.multiple_language) {
@ -295,47 +295,16 @@ void disp_gcode_icon(uint8_t file_num) {
lv_scr_load(scr); lv_scr_load(scr);
lv_obj_clean(scr); lv_obj_clean(scr);
lv_obj_t * title = lv_label_create(scr, NULL); (void)lv_label_create(scr, TITLE_XPOS, TITLE_YPOS, creat_title_text());
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());
lv_refr_now(lv_refr_get_disp_refreshing()); lv_refr_now(lv_refr_get_disp_refreshing());
// Create image buttons // Create image buttons
buttonPageUp = lv_imgbtn_create(scr, NULL); buttonPageUp = lv_imgbtn_create(scr, "F:/bmp_pageUp.bin", OTHER_BTN_XPIEL * 3 + INTERVAL_V * 4, titleHeight, event_handler, ID_P_UP);
buttonPageDown = lv_imgbtn_create(scr, NULL); buttonPageDown = lv_imgbtn_create(scr, "F:/bmp_pageDown.bin", OTHER_BTN_XPIEL * 3 + INTERVAL_V * 4, titleHeight + OTHER_BTN_YPIEL + INTERVAL_H, event_handler, ID_P_DOWN);
buttonBack = lv_imgbtn_create(scr, NULL); buttonBack = lv_imgbtn_create(scr, "F:/bmp_back.bin", OTHER_BTN_XPIEL * 3 + INTERVAL_V * 4, titleHeight + OTHER_BTN_YPIEL * 2 + INTERVAL_H * 2, event_handler, ID_P_RETURN);
lv_obj_set_event_cb_mks(buttonPageUp, event_handler, ID_P_UP, NULL, 0);
lv_imgbtn_set_src(buttonPageUp, LV_BTN_STATE_REL, "F:/bmp_pageUp.bin");
lv_imgbtn_set_src(buttonPageUp, LV_BTN_STATE_PR, "F:/bmp_pageUp.bin");
lv_imgbtn_set_style(buttonPageUp, LV_BTN_STATE_PR, &tft_style_label_pre);
lv_imgbtn_set_style(buttonPageUp, LV_BTN_STATE_REL, &tft_style_label_rel);
#if 1
lv_obj_set_event_cb_mks(buttonPageDown, event_handler, ID_P_DOWN, NULL, 0);
lv_imgbtn_set_src(buttonPageDown, LV_BTN_STATE_REL, "F:/bmp_pageDown.bin");
lv_imgbtn_set_src(buttonPageDown, LV_BTN_STATE_PR, "F:/bmp_pageDown.bin");
lv_imgbtn_set_style(buttonPageDown, LV_BTN_STATE_PR, &tft_style_label_pre);
lv_imgbtn_set_style(buttonPageDown, LV_BTN_STATE_REL, &tft_style_label_rel);
lv_obj_set_event_cb_mks(buttonBack, event_handler, ID_P_RETURN, NULL, 0);
lv_imgbtn_set_src(buttonBack, LV_BTN_STATE_REL, "F:/bmp_back.bin");
lv_imgbtn_set_src(buttonBack, LV_BTN_STATE_PR, "F:/bmp_back.bin");
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(buttonPageUp, OTHER_BTN_XPIEL * 3 + INTERVAL_V * 4, titleHeight);
lv_obj_set_pos(buttonPageDown, OTHER_BTN_XPIEL * 3 + INTERVAL_V * 4, titleHeight + OTHER_BTN_YPIEL + INTERVAL_H);
lv_obj_set_pos(buttonBack, OTHER_BTN_XPIEL * 3 + INTERVAL_V * 4, titleHeight + OTHER_BTN_YPIEL * 2 + INTERVAL_H * 2);
// Create labels on the image buttons // Create labels on the image buttons
lv_btn_set_layout(buttonPageUp, LV_LAYOUT_OFF);
lv_btn_set_layout(buttonPageDown, LV_LAYOUT_OFF);
lv_btn_set_layout(buttonBack, LV_LAYOUT_OFF);
for (i = 0; i < FILE_BTN_CNT; i++) { for (i = 0; i < FILE_BTN_CNT; i++) {
/* /*
if (seq) { if (seq) {
@ -352,8 +321,7 @@ void disp_gcode_icon(uint8_t file_num) {
#ifdef TFT35 #ifdef TFT35
buttonGcode[i] = lv_imgbtn_create(scr, NULL); buttonGcode[i] = lv_imgbtn_create(scr, NULL);
lv_imgbtn_set_style(buttonGcode[i], LV_BTN_STATE_PR, &tft_style_label_pre); lv_imgbtn_use_label_style(buttonGcode[i]);
lv_imgbtn_set_style(buttonGcode[i], LV_BTN_STATE_REL, &tft_style_label_rel);
lv_obj_clear_protect(buttonGcode[i], LV_PROTECT_FOLLOW); lv_obj_clear_protect(buttonGcode[i], LV_PROTECT_FOLLOW);
lv_btn_set_layout(buttonGcode[i], LV_LAYOUT_OFF); lv_btn_set_layout(buttonGcode[i], LV_LAYOUT_OFF);
@ -362,16 +330,13 @@ void disp_gcode_icon(uint8_t file_num) {
if (list_file.IsFolder[i] == 1) { if (list_file.IsFolder[i] == 1) {
lv_obj_set_event_cb_mks(buttonGcode[i], event_handler, (i + 1), NULL, 0); lv_obj_set_event_cb_mks(buttonGcode[i], event_handler, (i + 1), NULL, 0);
lv_imgbtn_set_src(buttonGcode[i], LV_BTN_STATE_REL, "F:/bmp_dir.bin"); lv_imgbtn_set_src_both(buttonGcode[i], "F:/bmp_dir.bin");
lv_imgbtn_set_src(buttonGcode[i], LV_BTN_STATE_PR, "F:/bmp_dir.bin");
if (i < 3) if (i < 3)
lv_obj_set_pos(buttonGcode[i], BTN_X_PIXEL * i + INTERVAL_V * (i + 1), titleHeight); lv_obj_set_pos(buttonGcode[i], BTN_X_PIXEL * i + INTERVAL_V * (i + 1), titleHeight);
else else
lv_obj_set_pos(buttonGcode[i], BTN_X_PIXEL * (i - 3) + INTERVAL_V * ((i - 3) + 1), BTN_Y_PIXEL + INTERVAL_H + titleHeight); lv_obj_set_pos(buttonGcode[i], BTN_X_PIXEL * (i - 3) + INTERVAL_V * ((i - 3) + 1), BTN_Y_PIXEL + INTERVAL_H + titleHeight);
labelPageUp[i] = lv_label_create(buttonGcode[i], NULL); labelPageUp[i] = lv_label_create(buttonGcode[i], public_buf_m);
lv_obj_set_style(labelPageUp[i], &tft_style_label_rel);
lv_label_set_text(labelPageUp[i], public_buf_m);
lv_obj_align(labelPageUp[i], buttonGcode[i], LV_ALIGN_IN_BOTTOM_MID, 0, -5); lv_obj_align(labelPageUp[i], buttonGcode[i], LV_ALIGN_IN_BOTTOM_MID, 0, -5);
} }
else { else {
@ -385,20 +350,16 @@ void disp_gcode_icon(uint8_t file_num) {
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), NULL, 0); lv_obj_set_event_cb_mks(buttonGcode[i], event_handler, (i + 1), NULL, 0);
lv_imgbtn_set_src(buttonGcode[i], LV_BTN_STATE_REL, test_public_buf_l); lv_imgbtn_set_src_both(buttonGcode[i], test_public_buf_l);
lv_imgbtn_set_src(buttonGcode[i], LV_BTN_STATE_PR, test_public_buf_l);
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, NULL); buttonText[i] = lv_btn_create(scr, NULL);
//lv_obj_set_event_cb(buttonText[i], event_handler); //lv_obj_set_event_cb(buttonText[i], event_handler);
lv_btn_set_style(buttonText[i], LV_BTN_STATE_PR, &tft_style_label_pre); lv_btn_use_label_style(buttonText[i]);
lv_btn_set_style(buttonText[i], LV_BTN_STATE_REL, &tft_style_label_rel);
//lv_obj_set_style(buttonText[i], &tft_style_label_pre);
//lv_obj_set_style(buttonText[i], &tft_style_label_rel);
lv_obj_clear_protect(buttonText[i], LV_PROTECT_FOLLOW); lv_obj_clear_protect(buttonText[i], LV_PROTECT_FOLLOW);
lv_btn_set_layout(buttonText[i], LV_LAYOUT_OFF); lv_btn_set_layout(buttonText[i], LV_LAYOUT_OFF);
//lv_obj_set_event_cb_mks(buttonText[i], event_handler,(i+10),NULL,0); //lv_obj_set_event_cb_mks(buttonText[i], event_handler,(i+10),NULL, 0);
lv_obj_set_pos(buttonText[i], BTN_X_PIXEL * i + INTERVAL_V * (i + 1) + FILE_PRE_PIC_X_OFFSET, titleHeight + FILE_PRE_PIC_Y_OFFSET + 100); lv_obj_set_pos(buttonText[i], BTN_X_PIXEL * i + INTERVAL_V * (i + 1) + FILE_PRE_PIC_X_OFFSET, titleHeight + FILE_PRE_PIC_Y_OFFSET + 100);
lv_obj_set_size(buttonText[i], 100, 40); lv_obj_set_size(buttonText[i], 100, 40);
} }
@ -407,33 +368,25 @@ void disp_gcode_icon(uint8_t file_num) {
buttonText[i] = lv_btn_create(scr, NULL); buttonText[i] = lv_btn_create(scr, NULL);
//lv_obj_set_event_cb(buttonText[i], event_handler); //lv_obj_set_event_cb(buttonText[i], event_handler);
lv_btn_set_style(buttonText[i], LV_BTN_STATE_PR, &tft_style_label_pre); lv_btn_use_label_style(buttonText[i]);
lv_btn_set_style(buttonText[i], LV_BTN_STATE_REL, &tft_style_label_rel);
//lv_imgbtn_set_style(buttonText[i], LV_BTN_STATE_REL, &tft_style_label_rel);
lv_obj_clear_protect(buttonText[i], LV_PROTECT_FOLLOW); lv_obj_clear_protect(buttonText[i], LV_PROTECT_FOLLOW);
lv_btn_set_layout(buttonText[i], LV_LAYOUT_OFF); lv_btn_set_layout(buttonText[i], LV_LAYOUT_OFF);
//lv_obj_set_event_cb_mks(buttonText[i], event_handler,(i+10),NULL,0); //lv_obj_set_event_cb_mks(buttonText[i], event_handler,(i+10),NULL, 0);
lv_obj_set_pos(buttonText[i], BTN_X_PIXEL * (i - 3) + INTERVAL_V * ((i - 3) + 1) + FILE_PRE_PIC_X_OFFSET, BTN_Y_PIXEL + INTERVAL_H + titleHeight + FILE_PRE_PIC_Y_OFFSET + 100); lv_obj_set_pos(buttonText[i], BTN_X_PIXEL * (i - 3) + INTERVAL_V * ((i - 3) + 1) + FILE_PRE_PIC_X_OFFSET, BTN_Y_PIXEL + INTERVAL_H + titleHeight + FILE_PRE_PIC_Y_OFFSET + 100);
lv_obj_set_size(buttonText[i], 100, 40); lv_obj_set_size(buttonText[i], 100, 40);
} }
labelPageUp[i] = lv_label_create(buttonText[i], NULL); labelPageUp[i] = lv_label_create(buttonText[i], public_buf_m);
lv_obj_set_style(labelPageUp[i], &tft_style_label_rel);
lv_label_set_text(labelPageUp[i], public_buf_m);
lv_obj_align(labelPageUp[i], buttonText[i], LV_ALIGN_IN_BOTTOM_MID, 0, 0); lv_obj_align(labelPageUp[i], buttonText[i], LV_ALIGN_IN_BOTTOM_MID, 0, 0);
} }
else { else {
lv_obj_set_event_cb_mks(buttonGcode[i], event_handler, (i + 1), NULL, 0); lv_obj_set_event_cb_mks(buttonGcode[i], event_handler, (i + 1), NULL, 0);
lv_imgbtn_set_src(buttonGcode[i], LV_BTN_STATE_REL, "F:/bmp_file.bin"); lv_imgbtn_set_src_both(buttonGcode[i], "F:/bmp_file.bin");
lv_imgbtn_set_src(buttonGcode[i], LV_BTN_STATE_PR, "F:/bmp_file.bin");
if (i < 3) if (i < 3)
lv_obj_set_pos(buttonGcode[i], BTN_X_PIXEL * i + INTERVAL_V * (i + 1), titleHeight); lv_obj_set_pos(buttonGcode[i], BTN_X_PIXEL * i + INTERVAL_V * (i + 1), titleHeight);
else else
lv_obj_set_pos(buttonGcode[i], BTN_X_PIXEL * (i - 3) + INTERVAL_V * ((i - 3) + 1), BTN_Y_PIXEL + INTERVAL_H + titleHeight); lv_obj_set_pos(buttonGcode[i], BTN_X_PIXEL * (i - 3) + INTERVAL_V * ((i - 3) + 1), BTN_Y_PIXEL + INTERVAL_H + titleHeight);
labelPageUp[i] = lv_label_create(buttonGcode[i], NULL); labelPageUp[i] = lv_label_create(buttonGcode[i], public_buf_m);
lv_obj_set_style(labelPageUp[i], &tft_style_label_rel);
lv_label_set_text(labelPageUp[i], public_buf_m);
lv_obj_align(labelPageUp[i], buttonGcode[i], LV_ALIGN_IN_BOTTOM_MID, 0, -5); lv_obj_align(labelPageUp[i], buttonGcode[i], LV_ALIGN_IN_BOTTOM_MID, 0, -5);
} }
} }

View File

@ -46,13 +46,14 @@
#include "../../../marlinui.h" #include "../../../marlinui.h"
#endif #endif
extern lv_group_t * g; extern lv_group_t *g;
static lv_obj_t * scr; static lv_obj_t *scr;
static lv_obj_t *labelExt1, * labelFan, * labelZpos, * labelTime; static lv_obj_t *labelExt1, *labelFan, *labelZpos, *labelTime;
TERN_(HAS_MULTI_EXTRUDER, static lv_obj_t *labelExt2;) static lv_obj_t *labelPause, *labelStop, *labelOperat;
static lv_obj_t *labelPause, * labelStop, * labelOperat; static lv_obj_t *bar1, *bar1ValueText;
static lv_obj_t * bar1, *bar1ValueText; static lv_obj_t *buttonPause, *buttonOperat, *buttonStop;
static lv_obj_t * buttonPause, *buttonOperat, *buttonStop;
TERN_(HAS_MULTI_EXTRUDER, static lv_obj_t *labelExt2);
#if HAS_HEATED_BED #if HAS_HEATED_BED
static lv_obj_t* labelBed; static lv_obj_t* labelBed;
@ -83,23 +84,20 @@ static void event_handler(lv_obj_t * obj, lv_event_t event) {
stop_print_time(); stop_print_time();
uiCfg.print_state = PAUSING; uiCfg.print_state = PAUSING;
#endif #endif
lv_imgbtn_set_src(buttonPause, LV_BTN_STATE_REL, "F:/bmp_resume.bin"); lv_imgbtn_set_src_both(buttonPause, "F:/bmp_resume.bin");
lv_imgbtn_set_src(buttonPause, LV_BTN_STATE_PR, "F:/bmp_resume.bin");
lv_label_set_text(labelPause, printing_menu.resume); lv_label_set_text(labelPause, printing_menu.resume);
lv_obj_align(labelPause, buttonPause, LV_ALIGN_CENTER, 30, 0); lv_obj_align(labelPause, buttonPause, LV_ALIGN_CENTER, 30, 0);
} }
else if (uiCfg.print_state == PAUSED) { else if (uiCfg.print_state == PAUSED) {
uiCfg.print_state = RESUMING; uiCfg.print_state = RESUMING;
lv_imgbtn_set_src(obj, LV_BTN_STATE_REL, "F:/bmp_pause.bin"); lv_imgbtn_set_src_both(obj, "F:/bmp_pause.bin");
lv_imgbtn_set_src(obj, LV_BTN_STATE_PR, "F:/bmp_pause.bin");
lv_label_set_text(labelPause, printing_menu.pause); lv_label_set_text(labelPause, printing_menu.pause);
lv_obj_align(labelPause, buttonPause, LV_ALIGN_CENTER, 30, 0); lv_obj_align(labelPause, buttonPause, LV_ALIGN_CENTER, 30, 0);
} }
#if ENABLED(POWER_LOSS_RECOVERY) #if ENABLED(POWER_LOSS_RECOVERY)
else if (uiCfg.print_state == REPRINTING) { else if (uiCfg.print_state == REPRINTING) {
uiCfg.print_state = REPRINTED; uiCfg.print_state = REPRINTED;
lv_imgbtn_set_src(obj, LV_BTN_STATE_REL, "F:/bmp_pause.bin"); lv_imgbtn_set_src_both(obj, "F:/bmp_pause.bin");
lv_imgbtn_set_src(obj, LV_BTN_STATE_PR, "F:/bmp_pause.bin");
lv_label_set_text(labelPause, printing_menu.pause); lv_label_set_text(labelPause, printing_menu.pause);
lv_obj_align(labelPause, buttonPause, LV_ALIGN_CENTER, 30, 0); lv_obj_align(labelPause, buttonPause, LV_ALIGN_CENTER, 30, 0);
// recovery.resume(); // recovery.resume();
@ -152,69 +150,42 @@ void lv_draw_printing(void) {
lv_scr_load(scr); lv_scr_load(scr);
lv_obj_clean(scr); lv_obj_clean(scr);
lv_obj_t * title = lv_label_create(scr, NULL); (void)lv_label_create(scr, TITLE_XPOS, TITLE_YPOS, creat_title_text());
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());
lv_refr_now(lv_refr_get_disp_refreshing()); lv_refr_now(lv_refr_get_disp_refreshing());
// Create image buttons // Create image buttons
lv_obj_t *buttonExt1 = lv_img_create(scr, NULL); lv_obj_t *buttonExt1 = lv_img_create(scr, NULL);
lv_img_set_src(buttonExt1, "F:/bmp_ext1_state.bin");
lv_obj_set_pos(buttonExt1, 205, 136);
#if HAS_MULTI_EXTRUDER #if HAS_MULTI_EXTRUDER
lv_obj_t *buttonExt2 = lv_img_create(scr, NULL); lv_obj_t *buttonExt2 = lv_img_create(scr, NULL);
lv_img_set_src(buttonExt2, "F:/bmp_ext2_state.bin");
lv_obj_set_pos(buttonExt2, 350, 136);
#endif #endif
#if HAS_HEATED_BED #if HAS_HEATED_BED
lv_obj_t *buttonBedstate = lv_img_create(scr, NULL); lv_obj_t *buttonBedstate = lv_img_create(scr, NULL);
lv_img_set_src(buttonBedstate, "F:/bmp_bed_state.bin");
lv_obj_set_pos(buttonBedstate, 205, 186);
#endif #endif
lv_obj_t *buttonFanstate = lv_img_create(scr, NULL); lv_obj_t *buttonFanstate = lv_img_create(scr, NULL);
lv_obj_t *buttonTime = lv_img_create(scr, NULL); lv_img_set_src(buttonFanstate, "F:/bmp_fan_state.bin");
lv_obj_t *buttonZpos = lv_img_create(scr, NULL); lv_obj_set_pos(buttonFanstate, 350, 186);
buttonPause = lv_imgbtn_create(scr, NULL);
buttonStop = lv_imgbtn_create(scr, NULL);
buttonOperat = lv_imgbtn_create(scr, NULL);
lv_img_set_src(buttonExt1, "F:/bmp_ext1_state.bin"); lv_obj_t *buttonTime = lv_img_create(scr, NULL);
#if 1 lv_img_set_src(buttonTime, "F:/bmp_time_state.bin");
#if HAS_MULTI_EXTRUDER lv_obj_set_pos(buttonTime, 205, 86);
lv_img_set_src(buttonExt2, "F:/bmp_ext2_state.bin");
#endif
#if HAS_HEATED_BED
lv_img_set_src(buttonBedstate, "F:/bmp_bed_state.bin");
#endif
lv_img_set_src(buttonFanstate, "F:/bmp_fan_state.bin"); lv_obj_t *buttonZpos = lv_img_create(scr, NULL);
lv_img_set_src(buttonZpos, "F:/bmp_zpos_state.bin");
lv_obj_set_pos(buttonZpos, 350, 86);
lv_img_set_src(buttonTime, "F:/bmp_time_state.bin"); buttonPause = lv_imgbtn_create(scr, uiCfg.print_state == WORKING ? "F:/bmp_pause.bin" : "F:/bmp_resume.bin", 5, 240, event_handler, ID_PAUSE);
buttonStop = lv_imgbtn_create(scr, "F:/bmp_stop.bin", 165, 240, event_handler, ID_STOP);
lv_img_set_src(buttonZpos, "F:/bmp_zpos_state.bin"); buttonOperat = lv_imgbtn_create(scr, "F:/bmp_operate.bin", 325, 240, event_handler, ID_OPTION);
if (uiCfg.print_state == WORKING) {
lv_imgbtn_set_src(buttonPause, LV_BTN_STATE_REL, "F:/bmp_pause.bin");
lv_imgbtn_set_src(buttonPause, LV_BTN_STATE_PR, "F:/bmp_pause.bin");
}
else {
lv_imgbtn_set_src(buttonPause, LV_BTN_STATE_REL, "F:/bmp_resume.bin");
lv_imgbtn_set_src(buttonPause, LV_BTN_STATE_PR, "F:/bmp_resume.bin");
}
lv_obj_set_event_cb_mks(buttonPause, event_handler, ID_PAUSE, NULL, 0);
lv_imgbtn_set_style(buttonPause, LV_BTN_STATE_PR, &tft_style_label_pre);
lv_imgbtn_set_style(buttonPause, LV_BTN_STATE_REL, &tft_style_label_rel);
lv_obj_set_event_cb_mks(buttonStop, event_handler, ID_STOP, NULL, 0);
lv_imgbtn_set_src(buttonStop, LV_BTN_STATE_REL, "F:/bmp_stop.bin");
lv_imgbtn_set_src(buttonStop, LV_BTN_STATE_PR, "F:/bmp_stop.bin");
lv_imgbtn_set_style(buttonStop, LV_BTN_STATE_PR, &tft_style_label_pre);
lv_imgbtn_set_style(buttonStop, LV_BTN_STATE_REL, &tft_style_label_rel);
lv_obj_set_event_cb_mks(buttonOperat, event_handler, ID_OPTION, NULL, 0);
lv_imgbtn_set_src(buttonOperat, LV_BTN_STATE_REL, "F:/bmp_operate.bin");
lv_imgbtn_set_src(buttonOperat, LV_BTN_STATE_PR, "F:/bmp_operate.bin");
lv_imgbtn_set_style(buttonOperat, LV_BTN_STATE_PR, &tft_style_label_pre);
lv_imgbtn_set_style(buttonOperat, LV_BTN_STATE_REL, &tft_style_label_rel);
#endif // if 1
#if HAS_ROTARY_ENCODER #if HAS_ROTARY_ENCODER
if (gCfgItems.encoder_enable) { if (gCfgItems.encoder_enable) {
@ -224,71 +195,37 @@ void lv_draw_printing(void) {
} }
#endif #endif
lv_obj_set_pos(buttonExt1, 205, 136);
#if HAS_MULTI_EXTRUDER
lv_obj_set_pos(buttonExt2, 350, 136);
#endif
#if HAS_HEATED_BED
lv_obj_set_pos(buttonBedstate, 205, 186);
#endif
lv_obj_set_pos(buttonFanstate, 350, 186);
lv_obj_set_pos(buttonTime, 205, 86);
lv_obj_set_pos(buttonZpos, 350, 86);
lv_obj_set_pos(buttonPause, 5, 240);
lv_obj_set_pos(buttonStop, 165, 240);
lv_obj_set_pos(buttonOperat, 325, 240);
// Create labels on the image buttons // Create labels on the image buttons
//lv_btn_set_layout(buttonExt1, LV_LAYOUT_OFF); //lv_btn_set_layout(buttonExt1, LV_LAYOUT_OFF);
//#if HAS_MULTI_EXTRUDER //#if HAS_MULTI_EXTRUDER
//lv_btn_set_layout(buttonExt2, LV_LAYOUT_OFF); // lv_btn_set_layout(buttonExt2, LV_LAYOUT_OFF);
//#endif //#endif
//#if HAS_HEATED_BED //#if HAS_HEATED_BED
//lv_btn_set_layout(buttonBedstate, LV_LAYOUT_OFF); // lv_btn_set_layout(buttonBedstate, LV_LAYOUT_OFF);
//#endif //#endif
//lv_btn_set_layout(buttonFanstate, LV_LAYOUT_OFF); //lv_btn_set_layout(buttonFanstate, LV_LAYOUT_OFF);
//lv_btn_set_layout(buttonTime, LV_LAYOUT_OFF); //lv_btn_set_layout(buttonTime, LV_LAYOUT_OFF);
//lv_btn_set_layout(buttonZpos, LV_LAYOUT_OFF); //lv_btn_set_layout(buttonZpos, LV_LAYOUT_OFF);
lv_btn_set_layout(buttonPause, LV_LAYOUT_OFF);
lv_btn_set_layout(buttonStop, LV_LAYOUT_OFF);
lv_btn_set_layout(buttonOperat, LV_LAYOUT_OFF);
labelExt1 = lv_label_create(scr, NULL); labelExt1 = lv_label_create(scr, 250, 146, NULL);
lv_obj_set_style(labelExt1, &tft_style_label_rel);
lv_obj_set_pos(labelExt1, 250, 146);
#if HAS_MULTI_EXTRUDER #if HAS_MULTI_EXTRUDER
labelExt2 = lv_label_create(scr, NULL); labelExt2 = lv_label_create(scr, 395, 146, NULL);
lv_obj_set_style(labelExt2, &tft_style_label_rel);
lv_obj_set_pos(labelExt2, 395, 146);
#endif #endif
#if HAS_HEATED_BED #if HAS_HEATED_BED
labelBed = lv_label_create(scr, NULL); labelBed = lv_label_create(scr, 250, 196, NULL);
lv_obj_set_style(labelBed, &tft_style_label_rel);
lv_obj_set_pos(labelBed, 250, 196);
#endif #endif
labelFan = lv_label_create(scr, NULL); labelFan = lv_label_create(scr, 395, 196, NULL);
lv_obj_set_style(labelFan, &tft_style_label_rel); labelTime = lv_label_create(scr, 250, 96, NULL);
lv_obj_set_pos(labelFan, 395, 196); labelZpos = lv_label_create(scr, 395, 96, NULL);
labelTime = lv_label_create(scr, NULL); labelPause = lv_label_create_empty(buttonPause);
lv_obj_set_style(labelTime, &tft_style_label_rel); labelStop = lv_label_create_empty(buttonStop);
lv_obj_set_pos(labelTime, 250, 96); labelOperat = lv_label_create_empty(buttonOperat);
labelZpos = lv_label_create(scr, NULL);
lv_obj_set_style(labelZpos, &tft_style_label_rel);
lv_obj_set_pos(labelZpos, 395, 96);
labelPause = lv_label_create(buttonPause, NULL);
labelStop = lv_label_create(buttonStop, NULL);
labelOperat = lv_label_create(buttonOperat, NULL);
if (gCfgItems.multiple_language) { if (gCfgItems.multiple_language) {
lv_label_set_text(labelPause, uiCfg.print_state == WORKING ? printing_menu.pause : printing_menu.resume); lv_label_set_text(labelPause, uiCfg.print_state == WORKING ? printing_menu.pause : printing_menu.resume);
@ -307,7 +244,7 @@ void lv_draw_printing(void) {
lv_bar_set_style(bar1, LV_BAR_STYLE_INDIC, &lv_bar_style_indic); lv_bar_set_style(bar1, LV_BAR_STYLE_INDIC, &lv_bar_style_indic);
lv_bar_set_anim_time(bar1, 1000); lv_bar_set_anim_time(bar1, 1000);
lv_bar_set_value(bar1, 0, LV_ANIM_ON); lv_bar_set_value(bar1, 0, LV_ANIM_ON);
bar1ValueText = lv_label_create(bar1, NULL); bar1ValueText = lv_label_create_empty(bar1);
lv_label_set_text(bar1ValueText,"0%"); lv_label_set_text(bar1ValueText,"0%");
lv_obj_align(bar1ValueText, bar1, LV_ALIGN_CENTER, 0, 0); lv_obj_align(bar1ValueText, bar1, LV_ALIGN_CENTER, 0, 0);

View File

@ -41,7 +41,7 @@
#include <stdio.h> #include <stdio.h>
//static lv_obj_t *buttonPrint,*buttonTool,*buttonSet; //static lv_obj_t *buttonPrint, *buttonTool, *buttonSet;
extern lv_group_t* g; extern lv_group_t* g;
static lv_obj_t * scr; static lv_obj_t * scr;
#if ENABLED(MKS_TEST) #if ENABLED(MKS_TEST)
@ -112,8 +112,8 @@ void disp_det_error() {
lv_obj_t *e1, *e2, *e3, *bed; lv_obj_t *e1, *e2, *e3, *bed;
void mks_disp_test() { void mks_disp_test() {
char buf[30] = {0}; char buf[30] = {0};
//lv_obj_t *label_tool2 = lv_label_create(scr, NULL); //lv_obj_t *label_tool2 = lv_label_create_empty(scr);
//lv_obj_set_pos(label_tool,20,50); //lv_obj_set_pos(label_tool, 20, 50);
ZERO(buf); ZERO(buf);
sprintf_P(buf, PSTR("e1:%d"), (int)thermalManager.temp_hotend[0].celsius); sprintf_P(buf, PSTR("e1:%d"), (int)thermalManager.temp_hotend[0].celsius);
lv_label_set_text(e1, buf); lv_label_set_text(e1, buf);
@ -148,82 +148,71 @@ void lv_draw_ready_print(void) {
lv_obj_set_style(scr, &tft_style_scr); lv_obj_set_style(scr, &tft_style_scr);
lv_scr_load(scr); lv_scr_load(scr);
lv_obj_clean(scr); lv_obj_clean(scr);
//lv_obj_set_hidden(scr,true); //lv_obj_set_hidden(scr, true);
lv_refr_now(lv_refr_get_disp_refreshing()); lv_refr_now(lv_refr_get_disp_refreshing());
if (mks_test_flag == 0x1E) { if (mks_test_flag == 0x1E) {
//lv_obj_t * title = lv_label_create(scr, NULL); //(void)lv_label_create(scr, TITLE_XPOS, TITLE_YPOS, creat_title_text());
//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());
// Create image buttons // Create image buttons
//buttonPrint = lv_imgbtn_create(scr, NULL); //buttonPrint = lv_imgbtn_create(scr, NULL);
buttonTool = lv_imgbtn_create(scr, NULL); buttonTool = lv_imgbtn_create(scr, "F:/bmp_tool.bin", event_handler, ID_TOOL);
//buttonSet = lv_imgbtn_create(scr, NULL);
#if 1
lv_obj_set_event_cb_mks(buttonTool, event_handler, ID_TOOL, NULL, 0);
lv_imgbtn_set_src(buttonTool, LV_BTN_STATE_REL, "F:/bmp_tool.bin");
lv_imgbtn_set_src(buttonTool, LV_BTN_STATE_PR, "F:/bmp_tool.bin");
lv_imgbtn_set_style(buttonTool, LV_BTN_STATE_PR, &tft_style_label_pre);
lv_imgbtn_set_style(buttonTool, LV_BTN_STATE_REL, &tft_style_label_rel);
#endif
lv_obj_set_pos(buttonTool, 360, 180); lv_obj_set_pos(buttonTool, 360, 180);
//lv_obj_set_pos(buttonSet,180,90);
//lv_obj_set_pos(buttonPrint,340,90);
//lv_obj_set_pos(buttonTool,SIMPLE_FIRST_PAGE_GRAP+1,(TFT_HEIGHT-BTN_Y_PIXEL)/2+2); //buttonSet = lv_imgbtn_create(scr, NULL);
//lv_obj_set_pos(buttonSet,BTN_X_PIXEL+SIMPLE_FIRST_PAGE_GRAP*2+1,(TFT_HEIGHT-BTN_Y_PIXEL)/2+2); //lv_obj_set_pos(buttonSet, 180, 90);
//lv_obj_set_pos(buttonPrint,BTN_X_PIXEL*2+SIMPLE_FIRST_PAGE_GRAP*3+1,(TFT_HEIGHT-BTN_Y_PIXEL)/2+2); //lv_obj_set_pos(buttonPrint, 340, 90);
//lv_obj_set_pos(buttonTool, SIMPLE_FIRST_PAGE_GRAP+1, (TFT_HEIGHT-BTN_Y_PIXEL)/2+2);
//lv_obj_set_pos(buttonSet, BTN_X_PIXEL+SIMPLE_FIRST_PAGE_GRAP*2+1, (TFT_HEIGHT-BTN_Y_PIXEL)/2+2);
//lv_obj_set_pos(buttonPrint, BTN_X_PIXEL*2+SIMPLE_FIRST_PAGE_GRAP*3+1, (TFT_HEIGHT-BTN_Y_PIXEL)/2+2);
// Create labels on the image buttons // Create labels on the image buttons
//lv_btn_set_layout(buttonPrint, LV_LAYOUT_OFF); //lv_btn_set_layout(buttonPrint, LV_LAYOUT_OFF);
//lv_btn_set_layout(buttonSet, LV_LAYOUT_OFF); //lv_btn_set_layout(buttonSet, LV_LAYOUT_OFF);
lv_btn_set_layout(buttonTool, LV_LAYOUT_OFF);
//lv_obj_t *label_print = lv_label_create(buttonPrint, NULL); //lv_obj_t *label_print = lv_label_create_empty(buttonPrint);
//lv_obj_t *label_set = lv_label_create(buttonSet, NULL); //lv_obj_t *label_set = lv_label_create_empty(buttonSet);
lv_obj_t *label_tool = lv_label_create(buttonTool, NULL); lv_obj_t *label_tool = lv_label_create_empty(buttonTool);
if (gCfgItems.multiple_language) { if (gCfgItems.multiple_language) {
//lv_label_set_text(label_print, main_menu.print); //lv_label_set_text(label_print, main_menu.print);
//lv_obj_align(label_print, buttonPrint, LV_ALIGN_IN_BOTTOM_MID,0, BUTTON_TEXT_Y_OFFSET); //lv_obj_align(label_print, buttonPrint, LV_ALIGN_IN_BOTTOM_MID, 0, BUTTON_TEXT_Y_OFFSET);
//lv_label_set_text(label_set, main_menu.set); //lv_label_set_text(label_set, main_menu.set);
//lv_obj_align(label_set, buttonSet, LV_ALIGN_IN_BOTTOM_MID,0, BUTTON_TEXT_Y_OFFSET); //lv_obj_align(label_set, buttonSet, LV_ALIGN_IN_BOTTOM_MID, 0, BUTTON_TEXT_Y_OFFSET);
//lv_label_set_style(label_tool,LV_BTN_STATE_PR,&tft_style_label_pre); //lv_label_set_style(label_tool, LV_BTN_STATE_PR, &tft_style_label_pre);
//lv_label_set_style(label_tool,LV_BTN_STATE_REL,&tft_style_label_rel); //lv_label_set_style(label_tool, LV_BTN_STATE_REL, &tft_style_label_rel);
lv_label_set_text(label_tool, main_menu.tool); lv_label_set_text(label_tool, main_menu.tool);
lv_obj_align(label_tool, buttonTool, LV_ALIGN_IN_BOTTOM_MID, 0, BUTTON_TEXT_Y_OFFSET); lv_obj_align(label_tool, buttonTool, LV_ALIGN_IN_BOTTOM_MID, 0, BUTTON_TEXT_Y_OFFSET);
} }
#if 1 #if 1
e1 = lv_label_create(scr, NULL); e1 = lv_label_create_empty(scr);
lv_obj_set_pos(e1, 20, 20); lv_obj_set_pos(e1, 20, 20);
sprintf_P(buf, PSTR("e1: %d"), (int)thermalManager.temp_hotend[0].celsius); sprintf_P(buf, PSTR("e1: %d"), (int)thermalManager.temp_hotend[0].celsius);
lv_label_set_text(e1, buf); lv_label_set_text(e1, buf);
#if HAS_MULTI_HOTEND #if HAS_MULTI_HOTEND
e2 = lv_label_create(scr, NULL); e2 = lv_label_create_empty(scr);
lv_obj_set_pos(e2, 20, 45); lv_obj_set_pos(e2, 20, 45);
sprintf_P(buf, PSTR("e1: %d"), (int)thermalManager.temp_hotend[1].celsius); sprintf_P(buf, PSTR("e1: %d"), (int)thermalManager.temp_hotend[1].celsius);
lv_label_set_text(e2, buf); lv_label_set_text(e2, buf);
#endif #endif
//e3 = lv_label_create(scr, NULL); //e3 = lv_label_create_empty(scr);
//lv_obj_set_pos(e3,20,70); //lv_obj_set_pos(e3, 20, 70);
//sprintf_P(buf, PSTR("e1: %d"), (int)thermalManager.temp_hotend[2].celsius); //sprintf_P(buf, PSTR("e1: %d"), (int)thermalManager.temp_hotend[2].celsius);
//lv_label_set_text(e3, buf); //lv_label_set_text(e3, buf);
#if HAS_HEATED_BED #if HAS_HEATED_BED
bed = lv_label_create(scr, NULL); bed = lv_label_create_empty(scr);
lv_obj_set_pos(bed, 20, 95); lv_obj_set_pos(bed, 20, 95);
sprintf_P(buf, PSTR("bed: %d"), (int)thermalManager.temp_bed.celsius); sprintf_P(buf, PSTR("bed: %d"), (int)thermalManager.temp_bed.celsius);
lv_label_set_text(bed, buf); lv_label_set_text(bed, buf);
#endif #endif
limit_info = lv_label_create(scr, NULL); limit_info = lv_label_create_empty(scr);
lv_style_copy(&limit_style, &lv_style_scr); lv_style_copy(&limit_style, &lv_style_scr);
limit_style.body.main_color.full = 0X0000; limit_style.body.main_color.full = 0X0000;
@ -234,7 +223,7 @@ void lv_draw_ready_print(void) {
lv_obj_set_pos(limit_info, 20, 120); lv_obj_set_pos(limit_info, 20, 120);
lv_label_set_text(limit_info, " "); lv_label_set_text(limit_info, " ");
det_info = lv_label_create(scr, NULL); det_info = lv_label_create_empty(scr);
lv_style_copy(&det_style, &lv_style_scr); lv_style_copy(&det_style, &lv_style_scr);
det_style.body.main_color.full = 0X0000; det_style.body.main_color.full = 0X0000;
@ -249,35 +238,14 @@ void lv_draw_ready_print(void) {
} }
else { else {
// Create an Image button // Create an Image button
buttonTool = lv_imgbtn_create(scr, NULL); buttonTool = lv_imgbtn_create(scr, "F:/bmp_tool.bin", 20, 90, event_handler, ID_TOOL);
lv_obj_set_pos(buttonTool, 20, 90); lv_obj_t *label_tool = lv_label_create_empty(buttonTool);
lv_obj_set_event_cb_mks(buttonTool, event_handler, ID_TOOL, NULL, 0);
lv_imgbtn_set_src(buttonTool, LV_BTN_STATE_REL, "F:/bmp_tool.bin");
lv_imgbtn_set_src(buttonTool, LV_BTN_STATE_PR, "F:/bmp_tool.bin");
lv_imgbtn_set_style(buttonTool, LV_BTN_STATE_PR, &tft_style_label_pre);
lv_imgbtn_set_style(buttonTool, LV_BTN_STATE_REL, &tft_style_label_rel);
lv_obj_t *label_tool = lv_label_create(buttonTool, NULL);
lv_btn_set_layout(buttonTool, LV_LAYOUT_OFF);
buttonSet = lv_imgbtn_create(scr, NULL); buttonSet = lv_imgbtn_create(scr, "F:/bmp_set.bin", 180, 90, event_handler, ID_SET);
lv_obj_set_pos(buttonSet, 180, 90); lv_obj_t *label_set = lv_label_create_empty(buttonSet);
lv_obj_set_event_cb_mks(buttonSet, event_handler, ID_SET, NULL, 0);
lv_imgbtn_set_src(buttonSet, LV_BTN_STATE_REL, "F:/bmp_set.bin");
lv_imgbtn_set_src(buttonSet, LV_BTN_STATE_PR, "F:/bmp_set.bin");
lv_imgbtn_set_style(buttonSet, LV_BTN_STATE_PR, &tft_style_label_pre);
lv_imgbtn_set_style(buttonSet, LV_BTN_STATE_REL, &tft_style_label_rel);
lv_obj_t *label_set = lv_label_create(buttonSet, NULL);
lv_btn_set_layout(buttonSet, LV_LAYOUT_OFF);
buttonPrint = lv_imgbtn_create(scr, NULL); buttonPrint = lv_imgbtn_create(scr, "F:/bmp_printing.bin", 340, 90, event_handler, ID_PRINT);
lv_obj_set_pos(buttonPrint, 340, 90); lv_obj_t *label_print = lv_label_create_empty(buttonPrint);
lv_obj_set_event_cb_mks(buttonPrint, event_handler, ID_PRINT, NULL, 0);
lv_imgbtn_set_src(buttonPrint, LV_BTN_STATE_REL, "F:/bmp_printing.bin");
lv_imgbtn_set_src(buttonPrint, LV_BTN_STATE_PR, "F:/bmp_printing.bin");
lv_imgbtn_set_style(buttonPrint, LV_BTN_STATE_PR, &tft_style_label_pre);
lv_imgbtn_set_style(buttonPrint, LV_BTN_STATE_REL, &tft_style_label_rel);
lv_obj_t *label_print = lv_label_create(buttonPrint, NULL);
lv_btn_set_layout(buttonPrint, LV_LAYOUT_OFF);
if (gCfgItems.multiple_language) { if (gCfgItems.multiple_language) {
lv_label_set_text(label_print, main_menu.print); lv_label_set_text(label_print, main_menu.print);

View File

@ -194,89 +194,25 @@ void lv_draw_set(void) {
lv_scr_load(scr); lv_scr_load(scr);
lv_obj_clean(scr); lv_obj_clean(scr);
lv_obj_t * title = lv_label_create(scr, NULL); (void)lv_label_create(scr, TITLE_XPOS, TITLE_YPOS, creat_title_text());
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());
lv_refr_now(lv_refr_get_disp_refreshing()); lv_refr_now(lv_refr_get_disp_refreshing());
// Create image buttons // Create image buttons
buttonEepromSet = lv_imgbtn_create(scr, NULL); buttonEepromSet = lv_imgbtn_create(scr, "F:/bmp_eeprom_settings.bin", INTERVAL_V, titleHeight, event_handler, ID_S_EEPROM_SET);
//buttonWifi = lv_imgbtn_create(scr, NULL); //buttonWifi = lv_imgbtn_create(scr, NULL);
buttonFan = lv_imgbtn_create(scr, NULL); buttonFan = lv_imgbtn_create(scr, "F:/bmp_fan.bin", BTN_X_PIXEL + INTERVAL_V * 2, titleHeight, event_handler, ID_S_FAN);
buttonAbout = lv_imgbtn_create(scr, NULL); buttonAbout = lv_imgbtn_create(scr, "F:/bmp_about.bin", BTN_X_PIXEL * 2 + INTERVAL_V * 3, titleHeight, event_handler, ID_S_ABOUT);
//buttonContinue = lv_imgbtn_create(scr, NULL); //buttonContinue = lv_imgbtn_create(scr, NULL);
buMotorOff = lv_imgbtn_create(scr, NULL); buMotorOff = lv_imgbtn_create(scr, ENABLED(HAS_SUICIDE) ? "F:/bmp_manual_off.bin" : "F:/bmp_function1.bin", BTN_X_PIXEL * 3 + INTERVAL_V * 4, titleHeight, event_handler, ID_S_MOTOR_OFF);
buttonMachinePara = lv_imgbtn_create(scr, NULL); buttonMachinePara = lv_imgbtn_create(scr, "F:/bmp_machine_para.bin", INTERVAL_V, BTN_Y_PIXEL + INTERVAL_H + titleHeight, event_handler, ID_S_MACHINE_PARA);
#if HAS_LANG_SELECT_SCREEN #if HAS_LANG_SELECT_SCREEN
buttonLanguage = lv_imgbtn_create(scr, NULL); buttonLanguage = lv_imgbtn_create(scr, "F:/bmp_language.bin", BTN_X_PIXEL + INTERVAL_V * 2, BTN_Y_PIXEL + INTERVAL_H + titleHeight, event_handler, ID_S_LANGUAGE);
#endif #endif
#if ENABLED(USE_WIFI_FUNCTION) #if ENABLED(USE_WIFI_FUNCTION)
buttonWifi = lv_imgbtn_create(scr, NULL); buttonWifi = lv_imgbtn_create(scr, "F:/bmp_wifi.bin", BTN_X_PIXEL * 2 + INTERVAL_V * 3, BTN_Y_PIXEL + INTERVAL_H + titleHeight, event_handler, ID_S_WIFI);
#endif #endif
buttonBack = lv_imgbtn_create(scr, NULL); buttonBack = lv_imgbtn_create(scr, "F:/bmp_return.bin", BTN_X_PIXEL * 3 + INTERVAL_V * 4, BTN_Y_PIXEL + INTERVAL_H + titleHeight, event_handler, ID_S_RETURN);
lv_obj_set_event_cb_mks(buttonEepromSet, event_handler, ID_S_EEPROM_SET, NULL, 0);
lv_imgbtn_set_src(buttonEepromSet, LV_BTN_STATE_REL, "F:/bmp_eeprom_settings.bin");
lv_imgbtn_set_src(buttonEepromSet, LV_BTN_STATE_PR, "F:/bmp_eeprom_settings.bin");
lv_imgbtn_set_style(buttonEepromSet, LV_BTN_STATE_PR, &tft_style_label_pre);
lv_imgbtn_set_style(buttonEepromSet, LV_BTN_STATE_REL, &tft_style_label_rel);
#if 1
lv_obj_set_event_cb_mks(buttonFan, event_handler, ID_S_FAN, NULL, 0);
lv_imgbtn_set_src(buttonFan, LV_BTN_STATE_REL, "F:/bmp_fan.bin");
lv_imgbtn_set_src(buttonFan, LV_BTN_STATE_PR, "F:/bmp_fan.bin");
lv_imgbtn_set_style(buttonFan, LV_BTN_STATE_PR, &tft_style_label_pre);
lv_imgbtn_set_style(buttonFan, LV_BTN_STATE_REL, &tft_style_label_rel);
lv_obj_set_event_cb_mks(buttonAbout, event_handler, ID_S_ABOUT, NULL, 0);
lv_imgbtn_set_src(buttonAbout, LV_BTN_STATE_REL, "F:/bmp_about.bin");
lv_imgbtn_set_src(buttonAbout, LV_BTN_STATE_PR, "F:/bmp_about.bin");
lv_imgbtn_set_style(buttonAbout, LV_BTN_STATE_PR, &tft_style_label_pre);
lv_imgbtn_set_style(buttonAbout, LV_BTN_STATE_REL, &tft_style_label_rel);
lv_obj_set_event_cb_mks(buMotorOff, event_handler, ID_S_MOTOR_OFF, NULL, 0);
#if HAS_SUICIDE
lv_imgbtn_set_src(buMotorOff, LV_BTN_STATE_REL, "F:/bmp_manual_off.bin");
lv_imgbtn_set_src(buMotorOff, LV_BTN_STATE_PR, "F:/bmp_manual_off.bin");
#else
lv_imgbtn_set_src(buMotorOff, LV_BTN_STATE_REL, "F:/bmp_function1.bin");
lv_imgbtn_set_src(buMotorOff, LV_BTN_STATE_PR, "F:/bmp_function1.bin");
#endif
lv_imgbtn_set_style(buMotorOff, LV_BTN_STATE_PR, &tft_style_label_pre);
lv_imgbtn_set_style(buMotorOff, LV_BTN_STATE_REL, &tft_style_label_rel);
lv_obj_set_event_cb_mks(buttonMachinePara, event_handler, ID_S_MACHINE_PARA, NULL, 0);
lv_imgbtn_set_src(buttonMachinePara, LV_BTN_STATE_REL, "F:/bmp_machine_para.bin");
lv_imgbtn_set_src(buttonMachinePara, LV_BTN_STATE_PR, "F:/bmp_machine_para.bin");
lv_imgbtn_set_style(buttonMachinePara, LV_BTN_STATE_PR, &tft_style_label_pre);
lv_imgbtn_set_style(buttonMachinePara, LV_BTN_STATE_REL, &tft_style_label_rel);
#if HAS_LANG_SELECT_SCREEN
lv_obj_set_event_cb_mks(buttonLanguage, event_handler, ID_S_LANGUAGE, NULL, 0);
lv_imgbtn_set_src(buttonLanguage, LV_BTN_STATE_REL, "F:/bmp_language.bin");
lv_imgbtn_set_src(buttonLanguage, LV_BTN_STATE_PR, "F:/bmp_language.bin");
lv_imgbtn_set_style(buttonLanguage, LV_BTN_STATE_PR, &tft_style_label_pre);
lv_imgbtn_set_style(buttonLanguage, LV_BTN_STATE_REL, &tft_style_label_rel);
#endif
#if ENABLED(USE_WIFI_FUNCTION)
lv_obj_set_event_cb_mks(buttonWifi, event_handler,ID_S_WIFI,NULL,0);
lv_imgbtn_set_src(buttonWifi, LV_BTN_STATE_REL, "F:/bmp_wifi.bin");
lv_imgbtn_set_src(buttonWifi, LV_BTN_STATE_PR, "F:/bmp_wifi.bin");
lv_imgbtn_set_style(buttonWifi, LV_BTN_STATE_PR, &tft_style_label_pre);
lv_imgbtn_set_style(buttonWifi, LV_BTN_STATE_REL, &tft_style_label_rel);
#endif
lv_obj_set_event_cb_mks(buttonBack, event_handler, ID_S_RETURN,NULL , 0);
lv_imgbtn_set_src(buttonBack, LV_BTN_STATE_REL, "F:/bmp_return.bin");
lv_imgbtn_set_src(buttonBack, LV_BTN_STATE_PR, "F:/bmp_return.bin");
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 // if 1
/*lv_obj_set_pos(buttonWifi,INTERVAL_V,titleHeight); /*lv_obj_set_pos(buttonWifi,INTERVAL_V,titleHeight);
lv_obj_set_pos(buttonFan,BTN_X_PIXEL+INTERVAL_V*2,titleHeight); lv_obj_set_pos(buttonFan,BTN_X_PIXEL+INTERVAL_V*2,titleHeight);
@ -287,51 +223,23 @@ void lv_draw_set(void) {
lv_obj_set_pos(buttonBack,BTN_X_PIXEL*3+INTERVAL_V*4, 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(buttonWifi,INTERVAL_V,titleHeight); //lv_obj_set_pos(buttonWifi,INTERVAL_V,titleHeight);
lv_obj_set_pos(buttonEepromSet, INTERVAL_V, titleHeight);
lv_obj_set_pos(buttonFan, BTN_X_PIXEL + INTERVAL_V * 2, titleHeight);
lv_obj_set_pos(buttonAbout, BTN_X_PIXEL * 2 + INTERVAL_V * 3, titleHeight);
//lv_obj_set_pos(buttonContinue,BTN_X_PIXEL*3+INTERVAL_V*4,titleHeight); //lv_obj_set_pos(buttonContinue,BTN_X_PIXEL*3+INTERVAL_V*4,titleHeight);
lv_obj_set_pos(buMotorOff, BTN_X_PIXEL * 3 + INTERVAL_V * 4, titleHeight);
lv_obj_set_pos(buttonMachinePara, INTERVAL_V, BTN_Y_PIXEL + INTERVAL_H + titleHeight);
#if HAS_LANG_SELECT_SCREEN
lv_obj_set_pos(buttonLanguage, BTN_X_PIXEL + INTERVAL_V * 2, BTN_Y_PIXEL + INTERVAL_H + titleHeight);
#endif
#if ENABLED(USE_WIFI_FUNCTION)
lv_obj_set_pos(buttonWifi,BTN_X_PIXEL*2+INTERVAL_V*3,BTN_Y_PIXEL+INTERVAL_H+titleHeight);
#endif
lv_obj_set_pos(buttonBack, BTN_X_PIXEL * 3 + INTERVAL_V * 4, BTN_Y_PIXEL + INTERVAL_H + titleHeight);
/// Create labels on the buttons /// Create labels on the buttons
//lv_btn_set_layout(buttonWifi, LV_LAYOUT_OFF); //lv_obj_t *labelWifi= lv_label_create_empty(buttonWifi);
lv_btn_set_layout(buttonEepromSet, LV_LAYOUT_OFF); lv_obj_t *label_EepromSet = lv_label_create_empty(buttonEepromSet);
lv_btn_set_layout(buttonFan, LV_LAYOUT_OFF); lv_obj_t *labelFan = lv_label_create_empty(buttonFan);
lv_btn_set_layout(buttonAbout, LV_LAYOUT_OFF); lv_obj_t *label_About = lv_label_create_empty(buttonAbout);
//lv_btn_set_layout(buttonContinue, LV_LAYOUT_OFF); //lv_obj_t *label_Continue = lv_label_create_empty(buttonContinue);
lv_btn_set_layout(buMotorOff, LV_LAYOUT_OFF); lv_obj_t *label_MotorOff = lv_label_create_empty(buMotorOff);
lv_btn_set_layout(buttonMachinePara, LV_LAYOUT_OFF); lv_obj_t *label_MachinePara = lv_label_create_empty(buttonMachinePara);
#if HAS_LANG_SELECT_SCREEN #if HAS_LANG_SELECT_SCREEN
lv_btn_set_layout(buttonLanguage, LV_LAYOUT_OFF); lv_obj_t *label_Language = lv_label_create_empty(buttonLanguage);
#endif #endif
#if ENABLED(USE_WIFI_FUNCTION) #if ENABLED(USE_WIFI_FUNCTION)
lv_btn_set_layout(buttonWifi, LV_LAYOUT_OFF); lv_obj_t *label_Wifi = lv_label_create_empty(buttonWifi);
#endif #endif
lv_btn_set_layout(buttonBack, LV_LAYOUT_OFF); lv_obj_t *label_Back = lv_label_create_empty(buttonBack);
//lv_obj_t *labelWifi= lv_label_create(buttonWifi, NULL);
lv_obj_t *label_EepromSet = lv_label_create(buttonEepromSet, NULL);
lv_obj_t *labelFan = lv_label_create(buttonFan, NULL);
lv_obj_t *label_About = lv_label_create(buttonAbout, NULL);
//lv_obj_t *label_Continue = lv_label_create(buttonContinue, NULL);
lv_obj_t *label_MotorOff = lv_label_create(buMotorOff, NULL);
lv_obj_t *label_MachinePara = lv_label_create(buttonMachinePara, NULL);
#if HAS_LANG_SELECT_SCREEN
lv_obj_t *label_Language = lv_label_create(buttonLanguage, NULL);
#endif
#if ENABLED(USE_WIFI_FUNCTION)
lv_obj_t *label_Wifi = lv_label_create(buttonWifi, NULL);
#endif
lv_obj_t *label_Back = lv_label_create(buttonBack, NULL);
if (gCfgItems.multiple_language) { if (gCfgItems.multiple_language) {

View File

@ -128,12 +128,12 @@ static void event_handler(lv_obj_t * obj, lv_event_t event) {
void lv_draw_step_settings(void) { void lv_draw_step_settings(void) {
lv_obj_t *buttonBack = NULL, *label_Back = NULL, *buttonTurnPage = NULL, *labelTurnPage = NULL; lv_obj_t *buttonBack = NULL, *label_Back = NULL, *buttonTurnPage = NULL, *labelTurnPage = NULL;
lv_obj_t *labelXText = NULL, *buttonXValue = NULL, *labelXValue = NULL; lv_obj_t *buttonXValue = NULL, *labelXValue = NULL;
lv_obj_t *labelYText = NULL, *buttonYValue = NULL, *labelYValue = NULL; lv_obj_t *buttonYValue = NULL, *labelYValue = NULL;
lv_obj_t *labelZText = NULL, *buttonZValue = NULL, *labelZValue = NULL; lv_obj_t *buttonZValue = NULL, *labelZValue = NULL;
lv_obj_t *labelE0Text = NULL, *buttonE0Value = NULL, *labelE0Value = NULL; lv_obj_t *buttonE0Value = NULL, *labelE0Value = NULL;
lv_obj_t *labelE1Text = NULL, *buttonE1Value = NULL, *labelE1Value = NULL; lv_obj_t *buttonE1Value = NULL, *labelE1Value = NULL;
lv_obj_t * line1 = NULL, * line2 = NULL, * line3 = NULL, * line4 = NULL; lv_obj_t *line1 = NULL, *line2 = NULL, *line3 = NULL, *line4 = NULL;
if (disp_state_stack._disp_state[disp_state_stack._disp_index] != STEPS_UI) { if (disp_state_stack._disp_state[disp_state_stack._disp_index] != STEPS_UI) {
disp_state_stack._disp_index++; disp_state_stack._disp_index++;
disp_state_stack._disp_state[disp_state_stack._disp_index] = STEPS_UI; disp_state_stack._disp_state[disp_state_stack._disp_index] = STEPS_UI;
@ -146,82 +146,44 @@ void lv_draw_step_settings(void) {
lv_scr_load(scr); lv_scr_load(scr);
lv_obj_clean(scr); lv_obj_clean(scr);
lv_obj_t * title = lv_label_create(scr, NULL); (void)lv_label_create(scr, TITLE_XPOS, TITLE_YPOS, machine_menu.StepsConfTitle);
lv_obj_set_style(title, &tft_style_label_rel);
lv_obj_set_pos(title, TITLE_XPOS, TITLE_YPOS);
lv_label_set_text(title, machine_menu.StepsConfTitle);
lv_refr_now(lv_refr_get_disp_refreshing()); lv_refr_now(lv_refr_get_disp_refreshing());
if (uiCfg.para_ui_page != 1) { if (uiCfg.para_ui_page != 1) {
labelXText = lv_label_create(scr, NULL); (void)lv_label_create(scr, PARA_UI_POS_X, PARA_UI_POS_Y + 10, machine_menu.X_Steps);
lv_obj_set_style(labelXText, &tft_style_label_rel);
lv_obj_set_pos(labelXText, PARA_UI_POS_X, PARA_UI_POS_Y + 10);
lv_label_set_text(labelXText, machine_menu.X_Steps);
buttonXValue = lv_btn_create(scr, NULL); buttonXValue = lv_btn_create(scr, PARA_UI_VALUE_POS_X, PARA_UI_POS_Y + PARA_UI_VALUE_V, PARA_UI_VALUE_BTN_X_SIZE, PARA_UI_VALUE_BTN_Y_SIZE, event_handler, ID_STEP_X);
lv_obj_set_pos(buttonXValue, PARA_UI_VALUE_POS_X, PARA_UI_POS_Y + PARA_UI_VALUE_V); labelXValue = lv_label_create_empty(buttonXValue);
lv_obj_set_size(buttonXValue, PARA_UI_VALUE_BTN_X_SIZE, PARA_UI_VALUE_BTN_Y_SIZE);
lv_obj_set_event_cb_mks(buttonXValue, event_handler, ID_STEP_X, NULL, 0);
lv_btn_set_style(buttonXValue, LV_BTN_STYLE_REL, &style_para_value);
lv_btn_set_style(buttonXValue, LV_BTN_STYLE_PR, &style_para_value);
labelXValue = lv_label_create(buttonXValue, NULL);
line1 = lv_line_create(scr, NULL); line1 = lv_line_create(scr, NULL);
lv_ex_line(line1, line_points[0]); lv_ex_line(line1, line_points[0]);
labelYText = lv_label_create(scr, NULL); (void)lv_label_create(scr, PARA_UI_POS_X, PARA_UI_POS_Y * 2 + 10, machine_menu.Y_Steps);
lv_obj_set_style(labelYText, &tft_style_label_rel);
lv_obj_set_pos(labelYText, PARA_UI_POS_X, PARA_UI_POS_Y * 2 + 10);
lv_label_set_text(labelYText, machine_menu.Y_Steps);
buttonYValue = lv_btn_create(scr, NULL); buttonYValue = lv_btn_create(scr, PARA_UI_VALUE_POS_X, PARA_UI_POS_Y * 2 + PARA_UI_VALUE_V, PARA_UI_VALUE_BTN_X_SIZE, PARA_UI_VALUE_BTN_Y_SIZE, event_handler, ID_STEP_Y);
lv_obj_set_pos(buttonYValue, PARA_UI_VALUE_POS_X, PARA_UI_POS_Y * 2 + PARA_UI_VALUE_V); labelYValue = lv_label_create_empty(buttonYValue);
lv_obj_set_size(buttonYValue, PARA_UI_VALUE_BTN_X_SIZE, PARA_UI_VALUE_BTN_Y_SIZE);
lv_obj_set_event_cb_mks(buttonYValue, event_handler, ID_STEP_Y, NULL, 0);
lv_btn_set_style(buttonYValue, LV_BTN_STYLE_REL, &style_para_value);
lv_btn_set_style(buttonYValue, LV_BTN_STYLE_PR, &style_para_value);
labelYValue = lv_label_create(buttonYValue, NULL);
line2 = lv_line_create(scr, NULL); line2 = lv_line_create(scr, NULL);
lv_ex_line(line2, line_points[1]); lv_ex_line(line2, line_points[1]);
labelZText = lv_label_create(scr, NULL); (void)lv_label_create(scr, PARA_UI_POS_X, PARA_UI_POS_Y * 3 + 10, machine_menu.Z_Steps);
lv_obj_set_style(labelZText, &tft_style_label_rel);
lv_obj_set_pos(labelZText, PARA_UI_POS_X, PARA_UI_POS_Y * 3 + 10);
lv_label_set_text(labelZText, machine_menu.Z_Steps);
buttonZValue = lv_btn_create(scr, NULL); buttonZValue = lv_btn_create(scr, PARA_UI_VALUE_POS_X, PARA_UI_POS_Y * 3 + PARA_UI_VALUE_V, PARA_UI_VALUE_BTN_X_SIZE, PARA_UI_VALUE_BTN_Y_SIZE, event_handler, ID_STEP_Z);
lv_obj_set_pos(buttonZValue, PARA_UI_VALUE_POS_X, PARA_UI_POS_Y * 3 + PARA_UI_VALUE_V); labelZValue = lv_label_create_empty(buttonZValue);
lv_obj_set_size(buttonZValue, PARA_UI_VALUE_BTN_X_SIZE, PARA_UI_VALUE_BTN_Y_SIZE);
lv_obj_set_event_cb_mks(buttonZValue, event_handler, ID_STEP_Z, NULL, 0);
lv_btn_set_style(buttonZValue, LV_BTN_STYLE_REL, &style_para_value);
lv_btn_set_style(buttonZValue, LV_BTN_STYLE_PR, &style_para_value);
labelZValue = lv_label_create(buttonZValue, NULL);
line3 = lv_line_create(scr, NULL); line3 = lv_line_create(scr, NULL);
lv_ex_line(line3, line_points[2]); lv_ex_line(line3, line_points[2]);
labelE0Text = lv_label_create(scr, NULL); (void)lv_label_create(scr, PARA_UI_POS_X, PARA_UI_POS_Y * 4 + 10, machine_menu.E0_Steps);
lv_obj_set_style(labelE0Text, &tft_style_label_rel);
lv_obj_set_pos(labelE0Text, PARA_UI_POS_X, PARA_UI_POS_Y * 4 + 10);
lv_label_set_text(labelE0Text, machine_menu.E0_Steps);
buttonE0Value = lv_btn_create(scr, NULL); buttonE0Value = lv_btn_create(scr, PARA_UI_VALUE_POS_X, PARA_UI_POS_Y * 4 + PARA_UI_VALUE_V, PARA_UI_VALUE_BTN_X_SIZE, PARA_UI_VALUE_BTN_Y_SIZE, event_handler, ID_STEP_E0);
lv_obj_set_pos(buttonE0Value, PARA_UI_VALUE_POS_X, PARA_UI_POS_Y * 4 + PARA_UI_VALUE_V); labelE0Value = lv_label_create_empty(buttonE0Value);
lv_obj_set_size(buttonE0Value, PARA_UI_VALUE_BTN_X_SIZE, PARA_UI_VALUE_BTN_Y_SIZE);
lv_obj_set_event_cb_mks(buttonE0Value, event_handler, ID_STEP_E0, NULL, 0);
lv_btn_set_style(buttonE0Value, LV_BTN_STYLE_REL, &style_para_value);
lv_btn_set_style(buttonE0Value, LV_BTN_STYLE_PR, &style_para_value);
labelE0Value = lv_label_create(buttonE0Value, NULL);
line4 = lv_line_create(scr, NULL); line4 = lv_line_create(scr, NULL);
lv_ex_line(line4, line_points[3]); lv_ex_line(line4, line_points[3]);
buttonTurnPage = lv_btn_create(scr, NULL); buttonTurnPage = lv_btn_create(scr, event_handler, ID_STEP_DOWN);
lv_obj_set_event_cb_mks(buttonTurnPage, event_handler, ID_STEP_DOWN, NULL, 0);
lv_btn_set_style(buttonTurnPage, LV_BTN_STYLE_REL, &style_para_back);
lv_btn_set_style(buttonTurnPage, LV_BTN_STYLE_PR, &style_para_back);
#if HAS_ROTARY_ENCODER #if HAS_ROTARY_ENCODER
if (gCfgItems.encoder_enable) { if (gCfgItems.encoder_enable) {
@ -234,26 +196,15 @@ void lv_draw_step_settings(void) {
#endif #endif
} }
else { else {
labelE1Text = lv_label_create(scr, NULL); (void)lv_label_create(scr, PARA_UI_POS_X, PARA_UI_POS_Y + 10, machine_menu.E1_Steps);
lv_obj_set_style(labelE1Text, &tft_style_label_rel);
lv_obj_set_pos(labelE1Text, PARA_UI_POS_X, PARA_UI_POS_Y + 10);
lv_label_set_text(labelE1Text, machine_menu.E1_Steps);
buttonE1Value = lv_btn_create(scr, NULL); buttonE1Value = lv_btn_create(scr, PARA_UI_VALUE_POS_X, PARA_UI_POS_Y + PARA_UI_VALUE_V, PARA_UI_VALUE_BTN_X_SIZE, PARA_UI_VALUE_BTN_Y_SIZE, event_handler, ID_STEP_E1);
lv_obj_set_pos(buttonE1Value, PARA_UI_VALUE_POS_X, PARA_UI_POS_Y + PARA_UI_VALUE_V); labelE1Value = lv_label_create_empty(buttonE1Value);
lv_obj_set_size(buttonE1Value, PARA_UI_VALUE_BTN_X_SIZE, PARA_UI_VALUE_BTN_Y_SIZE);
lv_obj_set_event_cb_mks(buttonE1Value, event_handler, ID_STEP_E1, NULL, 0);
lv_btn_set_style(buttonE1Value, LV_BTN_STYLE_REL, &style_para_value);
lv_btn_set_style(buttonE1Value, LV_BTN_STYLE_PR, &style_para_value);
labelE1Value = lv_label_create(buttonE1Value, NULL);
line1 = lv_line_create(scr, NULL); line1 = lv_line_create(scr, NULL);
lv_ex_line(line1, line_points[0]); lv_ex_line(line1, line_points[0]);
buttonTurnPage = lv_btn_create(scr, NULL); buttonTurnPage = lv_btn_create(scr, event_handler, ID_STEP_UP);
lv_obj_set_event_cb_mks(buttonTurnPage, event_handler, ID_STEP_UP, NULL, 0);
lv_btn_set_style(buttonTurnPage, LV_BTN_STYLE_REL, &style_para_back);
lv_btn_set_style(buttonTurnPage, LV_BTN_STYLE_PR, &style_para_back);
#if HAS_ROTARY_ENCODER #if HAS_ROTARY_ENCODER
if (gCfgItems.encoder_enable) { if (gCfgItems.encoder_enable) {
@ -265,15 +216,14 @@ void lv_draw_step_settings(void) {
lv_obj_set_pos(buttonTurnPage, PARA_UI_TURN_PAGE_POS_X, PARA_UI_TURN_PAGE_POS_Y); lv_obj_set_pos(buttonTurnPage, PARA_UI_TURN_PAGE_POS_X, PARA_UI_TURN_PAGE_POS_Y);
lv_obj_set_size(buttonTurnPage, PARA_UI_BACK_BTN_X_SIZE, PARA_UI_BACK_BTN_Y_SIZE); lv_obj_set_size(buttonTurnPage, PARA_UI_BACK_BTN_X_SIZE, PARA_UI_BACK_BTN_Y_SIZE);
labelTurnPage = lv_label_create(buttonTurnPage, NULL); labelTurnPage = lv_label_create_empty(buttonTurnPage);
buttonBack = lv_btn_create(scr, NULL); buttonBack = lv_btn_create(scr, NULL);
lv_btn_set_style(buttonBack, LV_BTN_STYLE_REL, &style_para_back); lv_btn_set_style_both(buttonBack, &style_para_back);
lv_btn_set_style(buttonBack, LV_BTN_STYLE_PR, &style_para_back);
lv_obj_set_pos(buttonBack, PARA_UI_BACL_POS_X, PARA_UI_BACL_POS_Y); lv_obj_set_pos(buttonBack, PARA_UI_BACL_POS_X, PARA_UI_BACL_POS_Y);
lv_obj_set_size(buttonBack, PARA_UI_BACK_BTN_X_SIZE, PARA_UI_BACK_BTN_Y_SIZE); lv_obj_set_size(buttonBack, PARA_UI_BACK_BTN_X_SIZE, PARA_UI_BACK_BTN_Y_SIZE);
lv_obj_set_event_cb_mks(buttonBack, event_handler, ID_STEP_RETURN, NULL, 0); lv_obj_set_event_cb_mks(buttonBack, event_handler, ID_STEP_RETURN, NULL, 0);
label_Back = lv_label_create(buttonBack, NULL); label_Back = lv_label_create_empty(buttonBack);
#if HAS_ROTARY_ENCODER #if HAS_ROTARY_ENCODER
if (gCfgItems.encoder_enable) lv_group_add_obj(g, buttonBack); if (gCfgItems.encoder_enable) lv_group_add_obj(g, buttonBack);
#endif #endif

View File

@ -143,10 +143,10 @@ static void event_handler(lv_obj_t * obj, lv_event_t event) {
void lv_draw_tmc_current_settings(void) { void lv_draw_tmc_current_settings(void) {
lv_obj_t *buttonBack = NULL, *label_Back = NULL; lv_obj_t *buttonBack = NULL, *label_Back = NULL;
lv_obj_t *labelXText = NULL, *buttonXValue = NULL, *labelXValue = NULL; lv_obj_t *buttonXValue = NULL, *labelXValue = NULL;
lv_obj_t *labelYText = NULL, *buttonYValue = NULL, *labelYValue = NULL; lv_obj_t *buttonYValue = NULL, *labelYValue = NULL;
lv_obj_t *labelZText = NULL, *buttonZValue = NULL, *labelZValue = NULL; lv_obj_t *buttonZValue = NULL, *labelZValue = NULL;
lv_obj_t *labelE0Text = NULL, *buttonE0Value = NULL, *labelE0Value = NULL; lv_obj_t *buttonE0Value = NULL, *labelE0Value = NULL;
lv_obj_t * line1 = NULL, * line2 = NULL, * line3 = NULL, * line4 = NULL; lv_obj_t * line1 = NULL, * line2 = NULL, * line3 = NULL, * line4 = NULL;
//#if AXIS_IS_TMC(E1) //#if AXIS_IS_TMC(E1)
@ -167,74 +167,39 @@ void lv_draw_tmc_current_settings(void) {
lv_scr_load(scr); lv_scr_load(scr);
lv_obj_clean(scr); lv_obj_clean(scr);
lv_obj_t * title = lv_label_create(scr, NULL); (void)lv_label_create(scr, TITLE_XPOS, TITLE_YPOS, machine_menu.TmcCurrentConfTitle);
lv_obj_set_style(title, &tft_style_label_rel);
lv_obj_set_pos(title, TITLE_XPOS, TITLE_YPOS);
lv_label_set_text(title, machine_menu.TmcCurrentConfTitle);
lv_refr_now(lv_refr_get_disp_refreshing()); lv_refr_now(lv_refr_get_disp_refreshing());
if (uiCfg.para_ui_page != 1) { if (uiCfg.para_ui_page != 1) {
labelXText = lv_label_create(scr, NULL); (void)lv_label_create(scr, PARA_UI_POS_X, PARA_UI_POS_Y + 10, machine_menu.X_Current);
lv_obj_set_style(labelXText, &tft_style_label_rel);
lv_obj_set_pos(labelXText, PARA_UI_POS_X, PARA_UI_POS_Y + 10);
lv_label_set_text(labelXText, machine_menu.X_Current);
buttonXValue = lv_btn_create(scr, NULL); buttonXValue = lv_btn_create(scr, PARA_UI_VALUE_POS_X, PARA_UI_POS_Y + PARA_UI_VALUE_V, PARA_UI_VALUE_BTN_X_SIZE, PARA_UI_VALUE_BTN_Y_SIZE, event_handler, ID_TMC_CURRENT_X);
lv_obj_set_pos(buttonXValue, PARA_UI_VALUE_POS_X, PARA_UI_POS_Y + PARA_UI_VALUE_V); labelXValue = lv_label_create_empty(buttonXValue);
lv_obj_set_size(buttonXValue, PARA_UI_VALUE_BTN_X_SIZE, PARA_UI_VALUE_BTN_Y_SIZE);
lv_obj_set_event_cb_mks(buttonXValue, event_handler, ID_TMC_CURRENT_X, NULL, 0);
lv_btn_set_style(buttonXValue, LV_BTN_STYLE_REL, &style_para_value);
lv_btn_set_style(buttonXValue, LV_BTN_STYLE_PR, &style_para_value);
labelXValue = lv_label_create(buttonXValue, NULL);
line1 = lv_line_create(scr, NULL); line1 = lv_line_create(scr, NULL);
lv_ex_line(line1, line_points[0]); lv_ex_line(line1, line_points[0]);
labelYText = lv_label_create(scr, NULL); (void)lv_label_create(scr, PARA_UI_POS_X, PARA_UI_POS_Y * 2 + 10, machine_menu.Y_Current);
lv_obj_set_style(labelYText, &tft_style_label_rel);
lv_obj_set_pos(labelYText, PARA_UI_POS_X, PARA_UI_POS_Y * 2 + 10);
lv_label_set_text(labelYText, machine_menu.Y_Current);
buttonYValue = lv_btn_create(scr, NULL); buttonYValue = lv_btn_create(scr, PARA_UI_VALUE_POS_X, PARA_UI_POS_Y * 2 + PARA_UI_VALUE_V, PARA_UI_VALUE_BTN_X_SIZE, PARA_UI_VALUE_BTN_Y_SIZE, event_handler, ID_TMC_CURRENT_Y);
lv_obj_set_pos(buttonYValue, PARA_UI_VALUE_POS_X, PARA_UI_POS_Y * 2 + PARA_UI_VALUE_V); labelYValue = lv_label_create_empty(buttonYValue);
lv_obj_set_size(buttonYValue, PARA_UI_VALUE_BTN_X_SIZE, PARA_UI_VALUE_BTN_Y_SIZE);
lv_obj_set_event_cb_mks(buttonYValue, event_handler, ID_TMC_CURRENT_Y, NULL, 0);
lv_btn_set_style(buttonYValue, LV_BTN_STYLE_REL, &style_para_value);
lv_btn_set_style(buttonYValue, LV_BTN_STYLE_PR, &style_para_value);
labelYValue = lv_label_create(buttonYValue, NULL);
line2 = lv_line_create(scr, NULL); line2 = lv_line_create(scr, NULL);
lv_ex_line(line2, line_points[1]); lv_ex_line(line2, line_points[1]);
labelZText = lv_label_create(scr, NULL); (void)lv_label_create(scr, PARA_UI_POS_X, PARA_UI_POS_Y * 3 + 10, machine_menu.Z_Current);
lv_obj_set_style(labelZText, &tft_style_label_rel);
lv_obj_set_pos(labelZText, PARA_UI_POS_X, PARA_UI_POS_Y * 3 + 10);
lv_label_set_text(labelZText, machine_menu.Z_Current);
buttonZValue = lv_btn_create(scr, NULL); buttonZValue = lv_btn_create(scr, PARA_UI_VALUE_POS_X, PARA_UI_POS_Y * 3 + PARA_UI_VALUE_V, PARA_UI_VALUE_BTN_X_SIZE, PARA_UI_VALUE_BTN_Y_SIZE, event_handler, ID_TMC_CURRENT_Z);
lv_obj_set_pos(buttonZValue, PARA_UI_VALUE_POS_X, PARA_UI_POS_Y * 3 + PARA_UI_VALUE_V); labelZValue = lv_label_create_empty(buttonZValue);
lv_obj_set_size(buttonZValue, PARA_UI_VALUE_BTN_X_SIZE, PARA_UI_VALUE_BTN_Y_SIZE);
lv_obj_set_event_cb_mks(buttonZValue, event_handler, ID_TMC_CURRENT_Z, NULL, 0);
lv_btn_set_style(buttonZValue, LV_BTN_STYLE_REL, &style_para_value);
lv_btn_set_style(buttonZValue, LV_BTN_STYLE_PR, &style_para_value);
labelZValue = lv_label_create(buttonZValue, NULL);
line3 = lv_line_create(scr, NULL); line3 = lv_line_create(scr, NULL);
lv_ex_line(line3, line_points[2]); lv_ex_line(line3, line_points[2]);
labelE0Text = lv_label_create(scr, NULL); (void)lv_label_create(scr, PARA_UI_POS_X, PARA_UI_POS_Y * 4 + 10, machine_menu.E0_Current);
lv_obj_set_style(labelE0Text, &tft_style_label_rel);
lv_obj_set_pos(labelE0Text, PARA_UI_POS_X, PARA_UI_POS_Y * 4 + 10);
lv_label_set_text(labelE0Text, machine_menu.E0_Current);
buttonE0Value = lv_btn_create(scr, NULL); buttonE0Value = lv_btn_create(scr, PARA_UI_VALUE_POS_X, PARA_UI_POS_Y * 4 + PARA_UI_VALUE_V, PARA_UI_VALUE_BTN_X_SIZE, PARA_UI_VALUE_BTN_Y_SIZE, event_handler, ID_TMC_CURRENT_E0);
lv_obj_set_pos(buttonE0Value, PARA_UI_VALUE_POS_X, PARA_UI_POS_Y * 4 + PARA_UI_VALUE_V); labelE0Value = lv_label_create_empty(buttonE0Value);
lv_obj_set_size(buttonE0Value, PARA_UI_VALUE_BTN_X_SIZE, PARA_UI_VALUE_BTN_Y_SIZE);
lv_obj_set_event_cb_mks(buttonE0Value, event_handler, ID_TMC_CURRENT_E0, NULL, 0);
lv_btn_set_style(buttonE0Value, LV_BTN_STYLE_REL, &style_para_value);
lv_btn_set_style(buttonE0Value, LV_BTN_STYLE_PR, &style_para_value);
labelE0Value = lv_label_create(buttonE0Value, NULL);
#if HAS_ROTARY_ENCODER #if HAS_ROTARY_ENCODER
if (gCfgItems.encoder_enable) { if (gCfgItems.encoder_enable) {
@ -251,8 +216,7 @@ void lv_draw_tmc_current_settings(void) {
//#if AXIS_IS_TMC(E1) //#if AXIS_IS_TMC(E1)
buttonTurnPage = lv_btn_create(scr, NULL); buttonTurnPage = lv_btn_create(scr, NULL);
lv_obj_set_event_cb_mks(buttonTurnPage, event_handler, ID_TMC_CURRENT_DOWN, NULL, 0); lv_obj_set_event_cb_mks(buttonTurnPage, event_handler, ID_TMC_CURRENT_DOWN, NULL, 0);
lv_btn_set_style(buttonTurnPage, LV_BTN_STYLE_REL, &style_para_back); lv_btn_set_style_both(buttonTurnPage, &style_para_back);
lv_btn_set_style(buttonTurnPage, LV_BTN_STYLE_PR, &style_para_back);
#if HAS_ROTARY_ENCODER #if HAS_ROTARY_ENCODER
if (gCfgItems.encoder_enable) lv_group_add_obj(g, buttonTurnPage); if (gCfgItems.encoder_enable) lv_group_add_obj(g, buttonTurnPage);
@ -261,26 +225,17 @@ void lv_draw_tmc_current_settings(void) {
} }
else { else {
//#if AXIS_IS_TMC(E1) //#if AXIS_IS_TMC(E1)
labelE1Text = lv_label_create(scr, NULL); labelE1Text = lv_label_create(scr, PARA_UI_POS_X, PARA_UI_POS_Y + 10, machine_menu.E1_Current);
lv_obj_set_style(labelE1Text, &tft_style_label_rel);
lv_obj_set_pos(labelE1Text, PARA_UI_POS_X, PARA_UI_POS_Y + 10);
lv_label_set_text(labelE1Text, machine_menu.E1_Current);
buttonE1Value = lv_btn_create(scr, NULL); buttonE1Value = lv_btn_create(scr, PARA_UI_VALUE_POS_X, PARA_UI_POS_Y + PARA_UI_VALUE_V, PARA_UI_VALUE_BTN_X_SIZE, PARA_UI_VALUE_BTN_Y_SIZE, event_handler, ID_TMC_CURRENT_E1);
lv_obj_set_pos(buttonE1Value, PARA_UI_VALUE_POS_X, PARA_UI_POS_Y + PARA_UI_VALUE_V); labelE1Value = lv_label_create_empty(buttonE1Value);
lv_obj_set_size(buttonE1Value, PARA_UI_VALUE_BTN_X_SIZE, PARA_UI_VALUE_BTN_Y_SIZE);
lv_obj_set_event_cb_mks(buttonE1Value, event_handler, ID_TMC_CURRENT_E1, NULL, 0);
lv_btn_set_style(buttonE1Value, LV_BTN_STYLE_REL, &style_para_value);
lv_btn_set_style(buttonE1Value, LV_BTN_STYLE_PR, &style_para_value);
labelE1Value = lv_label_create(buttonE1Value, NULL);
line1 = lv_line_create(scr, NULL); line1 = lv_line_create(scr, NULL);
lv_ex_line(line1, line_points[0]); lv_ex_line(line1, line_points[0]);
buttonTurnPage = lv_btn_create(scr, NULL); buttonTurnPage = lv_btn_create(scr, NULL);
lv_obj_set_event_cb_mks(buttonTurnPage, event_handler, ID_TMC_CURRENT_UP, NULL, 0); lv_obj_set_event_cb_mks(buttonTurnPage, event_handler, ID_TMC_CURRENT_UP, NULL, 0);
lv_btn_set_style(buttonTurnPage, LV_BTN_STYLE_REL, &style_para_back); lv_btn_set_style_both(buttonTurnPage, &style_para_back);
lv_btn_set_style(buttonTurnPage, LV_BTN_STYLE_PR, &style_para_back);
#if HAS_ROTARY_ENCODER #if HAS_ROTARY_ENCODER
if (gCfgItems.encoder_enable) { if (gCfgItems.encoder_enable) {
@ -293,13 +248,12 @@ void lv_draw_tmc_current_settings(void) {
//#if AXIS_IS_TMC(E1) //#if AXIS_IS_TMC(E1)
lv_obj_set_pos(buttonTurnPage, PARA_UI_TURN_PAGE_POS_X, PARA_UI_TURN_PAGE_POS_Y); lv_obj_set_pos(buttonTurnPage, PARA_UI_TURN_PAGE_POS_X, PARA_UI_TURN_PAGE_POS_Y);
lv_obj_set_size(buttonTurnPage, PARA_UI_BACK_BTN_X_SIZE, PARA_UI_BACK_BTN_Y_SIZE); lv_obj_set_size(buttonTurnPage, PARA_UI_BACK_BTN_X_SIZE, PARA_UI_BACK_BTN_Y_SIZE);
labelTurnPage = lv_label_create(buttonTurnPage, NULL); labelTurnPage = lv_label_create_empty(buttonTurnPage);
//#endif //#endif
buttonBack = lv_btn_create(scr, NULL); buttonBack = lv_btn_create(scr, NULL);
lv_obj_set_event_cb_mks(buttonBack, event_handler, ID_TMC_CURRENT_RETURN, NULL, 0); lv_obj_set_event_cb_mks(buttonBack, event_handler, ID_TMC_CURRENT_RETURN, NULL, 0);
lv_btn_set_style(buttonBack, LV_BTN_STYLE_REL, &style_para_back); lv_btn_set_style_both(buttonBack, &style_para_back);
lv_btn_set_style(buttonBack, LV_BTN_STYLE_PR, &style_para_back);
#if HAS_ROTARY_ENCODER #if HAS_ROTARY_ENCODER
if (gCfgItems.encoder_enable) lv_group_add_obj(g, buttonBack); if (gCfgItems.encoder_enable) lv_group_add_obj(g, buttonBack);
@ -307,7 +261,7 @@ void lv_draw_tmc_current_settings(void) {
lv_obj_set_pos(buttonBack, PARA_UI_BACL_POS_X, PARA_UI_BACL_POS_Y); lv_obj_set_pos(buttonBack, PARA_UI_BACL_POS_X, PARA_UI_BACL_POS_Y);
lv_obj_set_size(buttonBack, PARA_UI_BACK_BTN_X_SIZE, PARA_UI_BACK_BTN_Y_SIZE); lv_obj_set_size(buttonBack, PARA_UI_BACK_BTN_X_SIZE, PARA_UI_BACK_BTN_Y_SIZE);
label_Back = lv_label_create(buttonBack, NULL); label_Back = lv_label_create_empty(buttonBack);
if (gCfgItems.multiple_language) { if (gCfgItems.multiple_language) {
if (uiCfg.para_ui_page != 1) { if (uiCfg.para_ui_page != 1) {

View File

@ -28,9 +28,12 @@
#include "../../../../module/stepper/indirection.h" #include "../../../../module/stepper/indirection.h"
#include "../../../../feature/tmc_util.h" #include "../../../../feature/tmc_util.h"
#include "../../../../gcode/gcode.h"
#include "../../../../inc/MarlinConfig.h" #include "../../../../inc/MarlinConfig.h"
#if ENABLED(EEPROM_SETTINGS)
#include "../../../../module/settings.h"
#endif
extern lv_group_t * g; extern lv_group_t * g;
static lv_obj_t * scr; static lv_obj_t * scr;
@ -69,24 +72,16 @@ static void event_handler(lv_obj_t * obj, lv_event_t event) {
} }
else if (event == LV_EVENT_RELEASED) { else if (event == LV_EVENT_RELEASED) {
if (stepperX.stored.stealthChop_enabled) { if (stepperX.toggle_stepping_mode()) {
stepperX.stored.stealthChop_enabled = false; lv_imgbtn_set_src_both(buttonXState, "F:/bmp_enable.bin");
stepperX.refresh_stepping_mode(); lv_label_set_text(labelXState, machine_menu.enable);
lv_imgbtn_set_src(buttonXState, LV_BTN_STATE_REL, "F:/bmp_disable.bin");
lv_imgbtn_set_src(buttonXState, LV_BTN_STATE_PR, "F:/bmp_disable.bin");
lv_label_set_text(labelXState, machine_menu.disable);
//lv_obj_align(labelXState, buttonE1State, LV_ALIGN_IN_LEFT_MID,0, 0);
// gcode.process_subcommands_now_P(PSTR("M500"));
} }
else { else {
stepperX.stored.stealthChop_enabled = true; lv_imgbtn_set_src_both(buttonXState, "F:/bmp_disable.bin");
stepperX.refresh_stepping_mode(); lv_label_set_text(labelXState, machine_menu.disable);
lv_imgbtn_set_src(buttonXState, LV_BTN_STATE_REL, "F:/bmp_enable.bin"); //lv_obj_align(labelXState, buttonE1State, LV_ALIGN_IN_LEFT_MID,0, 0);
lv_imgbtn_set_src(buttonXState, LV_BTN_STATE_PR, "F:/bmp_enable.bin");
lv_label_set_text(labelXState, machine_menu.enable);
// gcode.process_subcommands_now_P(PSTR("M500"));
} }
gcode.process_subcommands_now_P(PSTR("M500")); TERN_(EEPROM_SETTINGS, (void)settings.save());
} }
break; break;
#endif // if AXIS_HAS_STEALTHCHOP(X) #endif // if AXIS_HAS_STEALTHCHOP(X)
@ -97,22 +92,16 @@ static void event_handler(lv_obj_t * obj, lv_event_t event) {
} }
else if (event == LV_EVENT_RELEASED) { else if (event == LV_EVENT_RELEASED) {
if (stepperY.stored.stealthChop_enabled) { if (stepperY.toggle_stepping_mode()) {
stepperY.stored.stealthChop_enabled = false; lv_imgbtn_set_src_both(buttonYState, "F:/bmp_enable.bin");
stepperY.refresh_stepping_mode(); lv_label_set_text(labelYState, machine_menu.enable);
lv_imgbtn_set_src(buttonYState, LV_BTN_STATE_REL, "F:/bmp_disable.bin"); }
lv_imgbtn_set_src(buttonYState, LV_BTN_STATE_PR, "F:/bmp_disable.bin"); else {
lv_imgbtn_set_src_both(buttonYState, "F:/bmp_disable.bin");
lv_label_set_text(labelYState, machine_menu.disable); lv_label_set_text(labelYState, machine_menu.disable);
//lv_obj_align(labelXState, buttonE1State, LV_ALIGN_IN_LEFT_MID,0, 0); //lv_obj_align(labelXState, buttonE1State, LV_ALIGN_IN_LEFT_MID,0, 0);
} }
else { TERN_(EEPROM_SETTINGS, (void)settings.save());
stepperY.stored.stealthChop_enabled = true;
stepperY.refresh_stepping_mode();
lv_imgbtn_set_src(buttonYState, LV_BTN_STATE_REL, "F:/bmp_enable.bin");
lv_imgbtn_set_src(buttonYState, LV_BTN_STATE_PR, "F:/bmp_enable.bin");
lv_label_set_text(labelYState, machine_menu.enable);
}
gcode.process_subcommands_now_P(PSTR("M500"));
} }
break; break;
#endif // if AXIS_HAS_STEALTHCHOP(Y) #endif // if AXIS_HAS_STEALTHCHOP(Y)
@ -123,22 +112,16 @@ static void event_handler(lv_obj_t * obj, lv_event_t event) {
} }
else if (event == LV_EVENT_RELEASED) { else if (event == LV_EVENT_RELEASED) {
if (stepperZ.stored.stealthChop_enabled) { if (stepperZ.toggle_stepping_mode()) {
stepperZ.stored.stealthChop_enabled = false; lv_imgbtn_set_src_both(buttonZState, "F:/bmp_enable.bin");
stepperZ.refresh_stepping_mode(); lv_label_set_text(labelZState, machine_menu.enable);
lv_imgbtn_set_src(buttonZState, LV_BTN_STATE_REL, "F:/bmp_disable.bin"); }
lv_imgbtn_set_src(buttonZState, LV_BTN_STATE_PR, "F:/bmp_disable.bin"); else {
lv_imgbtn_set_src_both(buttonZState, "F:/bmp_disable.bin");
lv_label_set_text(labelZState, machine_menu.disable); lv_label_set_text(labelZState, machine_menu.disable);
//lv_obj_align(labelXState, buttonE1State, LV_ALIGN_IN_LEFT_MID,0, 0); //lv_obj_align(labelXState, buttonE1State, LV_ALIGN_IN_LEFT_MID,0, 0);
} }
else { TERN_(EEPROM_SETTINGS, (void)settings.save());
stepperZ.stored.stealthChop_enabled = true;
stepperZ.refresh_stepping_mode();
lv_imgbtn_set_src(buttonZState, LV_BTN_STATE_REL, "F:/bmp_enable.bin");
lv_imgbtn_set_src(buttonZState, LV_BTN_STATE_PR, "F:/bmp_enable.bin");
lv_label_set_text(labelZState, machine_menu.enable);
}
gcode.process_subcommands_now_P(PSTR("M500"));
} }
break; break;
#endif // if AXIS_HAS_STEALTHCHOP(Z) #endif // if AXIS_HAS_STEALTHCHOP(Z)
@ -149,22 +132,16 @@ static void event_handler(lv_obj_t * obj, lv_event_t event) {
} }
else if (event == LV_EVENT_RELEASED) { else if (event == LV_EVENT_RELEASED) {
if (stepperE0.stored.stealthChop_enabled) { if (stepperE0.toggle_stepping_mode()) {
stepperE0.stored.stealthChop_enabled = false; lv_imgbtn_set_src_both(buttonE0State, "F:/bmp_enable.bin");
stepperE0.refresh_stepping_mode(); lv_label_set_text(labelE0State, machine_menu.enable);
lv_imgbtn_set_src(buttonE0State, LV_BTN_STATE_REL, "F:/bmp_disable.bin"); }
lv_imgbtn_set_src(buttonE0State, LV_BTN_STATE_PR, "F:/bmp_disable.bin"); else {
lv_imgbtn_set_src_both(buttonE0State, "F:/bmp_disable.bin");
lv_label_set_text(labelE0State, machine_menu.disable); lv_label_set_text(labelE0State, machine_menu.disable);
//lv_obj_align(labelXState, buttonE1State, LV_ALIGN_IN_LEFT_MID,0, 0); //lv_obj_align(labelXState, buttonE1State, LV_ALIGN_IN_LEFT_MID,0, 0);
} }
else { TERN_(EEPROM_SETTINGS, (void)settings.save());
stepperE0.stored.stealthChop_enabled = true;
stepperE0.refresh_stepping_mode();
lv_imgbtn_set_src(buttonE0State, LV_BTN_STATE_REL, "F:/bmp_enable.bin");
lv_imgbtn_set_src(buttonE0State, LV_BTN_STATE_PR, "F:/bmp_enable.bin");
lv_label_set_text(labelE0State, machine_menu.enable);
}
gcode.process_subcommands_now_P(PSTR("M500"));
} }
break; break;
#endif // if AXIS_HAS_STEALTHCHOP(E0) #endif // if AXIS_HAS_STEALTHCHOP(E0)
@ -175,22 +152,16 @@ static void event_handler(lv_obj_t * obj, lv_event_t event) {
} }
else if (event == LV_EVENT_RELEASED) { else if (event == LV_EVENT_RELEASED) {
if (stepperE1.stored.stealthChop_enabled) { if (stepperE1.toggle_stepping_mode()) {
stepperE1.stored.stealthChop_enabled = false; lv_imgbtn_set_src_both(buttonE1State, "F:/bmp_enable.bin");
stepperE1.refresh_stepping_mode(); lv_label_set_text(labelE1State, machine_menu.enable);
lv_imgbtn_set_src(buttonE1State, LV_BTN_STATE_REL, "F:/bmp_disable.bin"); }
lv_imgbtn_set_src(buttonE1State, LV_BTN_STATE_PR, "F:/bmp_disable.bin"); else {
lv_imgbtn_set_src_both(buttonE1State, "F:/bmp_disable.bin");
lv_label_set_text(labelE1State, machine_menu.disable); lv_label_set_text(labelE1State, machine_menu.disable);
//lv_obj_align(labelXState, buttonE1State, LV_ALIGN_IN_LEFT_MID,0, 0); //lv_obj_align(labelXState, buttonE1State, LV_ALIGN_IN_LEFT_MID,0, 0);
} }
else { TERN_(EEPROM_SETTINGS, (void)settings.save());
stepperE1.stored.stealthChop_enabled = true;
stepperE1.refresh_stepping_mode();
lv_imgbtn_set_src(buttonE1State, LV_BTN_STATE_REL, "F:/bmp_enable.bin");
lv_imgbtn_set_src(buttonE1State, LV_BTN_STATE_PR, "F:/bmp_enable.bin");
lv_label_set_text(labelE1State, machine_menu.enable);
}
gcode.process_subcommands_now_P(PSTR("M500"));
} }
break; break;
#endif // if AXIS_HAS_STEALTHCHOP(E1) #endif // if AXIS_HAS_STEALTHCHOP(E1)
@ -255,44 +226,33 @@ void lv_draw_tmc_step_mode_settings(void) {
lv_scr_load(scr); lv_scr_load(scr);
lv_obj_clean(scr); lv_obj_clean(scr);
lv_obj_t * title = lv_label_create(scr, NULL); (void)lv_label_create(scr, TITLE_XPOS, TITLE_YPOS, machine_menu.TmcStepModeConfTitle);
lv_obj_set_style(title, &tft_style_label_rel);
lv_obj_set_pos(title, TITLE_XPOS, TITLE_YPOS);
lv_label_set_text(title, machine_menu.TmcStepModeConfTitle);
lv_refr_now(lv_refr_get_disp_refreshing()); lv_refr_now(lv_refr_get_disp_refreshing());
bool stealth_X = false, stealth_Y = false, stealth_Z = false, stealth_E0 = false, stealth_E1 = false;
#if AXIS_HAS_STEALTHCHOP(X)
stealth_X = stepperX.get_stealthChop_status();
#endif
#if AXIS_HAS_STEALTHCHOP(Y)
stealth_Y = stepperY.get_stealthChop_status();
#endif
#if AXIS_HAS_STEALTHCHOP(Z)
stealth_Z = stepperZ.get_stealthChop_status();
#endif
#if AXIS_HAS_STEALTHCHOP(E0)
stealth_E0 = stepperE0.get_stealthChop_status();
#endif
#if AXIS_HAS_STEALTHCHOP(E1)
stealth_E1 = stepperE1.get_stealthChop_status();
#endif
if (uiCfg.para_ui_page != 1) { if (uiCfg.para_ui_page != 1) {
buttonXText = lv_btn_create(scr, NULL); /*Add a button the current screen*/ buttonXText = lv_btn_create(scr, PARA_UI_POS_X, PARA_UI_POS_Y, PARA_UI_VALUE_SIZE_X, PARA_UI_SIZE_Y, event_handler, 0);
lv_obj_set_pos(buttonXText, PARA_UI_POS_X, PARA_UI_POS_Y); /*Set its position*/ labelXText = lv_label_create_empty(buttonXText); /*Add a label to the button*/
lv_obj_set_size(buttonXText, PARA_UI_VALUE_SIZE_X, PARA_UI_SIZE_Y); /*Set its size*/
lv_obj_set_event_cb(buttonXText, event_handler);
lv_btn_set_style(buttonXText, LV_BTN_STYLE_REL, &tft_style_label_rel); /*Set the button's released style*/
lv_btn_set_style(buttonXText, LV_BTN_STYLE_PR, &tft_style_label_pre); /*Set the button's pressed style*/
lv_btn_set_layout(buttonXText, LV_LAYOUT_OFF);
labelXText = lv_label_create(buttonXText, NULL); /*Add a label to the button*/
buttonXState = lv_imgbtn_create(scr, NULL); buttonXState = lv_imgbtn_create(scr, stealth_X ? "F:/bmp_enable.bin" : "F:/bmp_disable.bin", PARA_UI_STATE_POS_X, PARA_UI_POS_Y + PARA_UI_STATE_V, event_handler, ID_TMC_MODE_X);
lv_obj_set_pos(buttonXState, PARA_UI_STATE_POS_X, PARA_UI_POS_Y + PARA_UI_STATE_V); labelXState = lv_label_create_empty(buttonXState);
#if AXIS_HAS_STEALTHCHOP(X)
if (stepperX.get_stealthChop_status()) {
lv_imgbtn_set_src(buttonXState, LV_BTN_STATE_REL, "F:/bmp_enable.bin");
lv_imgbtn_set_src(buttonXState, LV_BTN_STATE_PR, "F:/bmp_enable.bin");
}
else {
lv_imgbtn_set_src(buttonXState, LV_BTN_STATE_REL, "F:/bmp_disable.bin");
lv_imgbtn_set_src(buttonXState, LV_BTN_STATE_PR, "F:/bmp_disable.bin");
}
#else
lv_imgbtn_set_src(buttonXState, LV_BTN_STATE_REL, "F:/bmp_disable.bin");
lv_imgbtn_set_src(buttonXState, LV_BTN_STATE_PR, "F:/bmp_disable.bin");
#endif
lv_obj_set_event_cb_mks(buttonXState, event_handler, ID_TMC_MODE_X, NULL, 0);
lv_imgbtn_set_style(buttonXState, LV_BTN_STATE_PR, &tft_style_label_pre);
lv_imgbtn_set_style(buttonXState, LV_BTN_STATE_REL, &tft_style_label_rel);
lv_btn_set_layout(buttonXState, LV_LAYOUT_OFF);
labelXState = lv_label_create(buttonXState, NULL);
#if HAS_ROTARY_ENCODER #if HAS_ROTARY_ENCODER
if (gCfgItems.encoder_enable) lv_group_add_obj(g, buttonXState); if (gCfgItems.encoder_enable) lv_group_add_obj(g, buttonXState);
#endif #endif
@ -300,36 +260,11 @@ void lv_draw_tmc_step_mode_settings(void) {
line1 = lv_line_create(scr, NULL); line1 = lv_line_create(scr, NULL);
lv_ex_line(line1, line_points[0]); lv_ex_line(line1, line_points[0]);
buttonYText = lv_btn_create(scr, NULL); /*Add a button the current screen*/ buttonYText = lv_btn_create(scr, NULL, PARA_UI_POS_X, PARA_UI_POS_Y * 2, PARA_UI_VALUE_SIZE_X, PARA_UI_SIZE_Y, event_handler, 0);
lv_obj_set_pos(buttonYText, PARA_UI_POS_X, PARA_UI_POS_Y * 2); /*Set its position*/ labelYText = lv_label_create_empty(buttonYText); /*Add a label to the button*/
lv_obj_set_size(buttonYText, PARA_UI_VALUE_SIZE_X, PARA_UI_SIZE_Y); /*Set its size*/
lv_obj_set_event_cb(buttonYText, event_handler);
lv_btn_set_style(buttonYText, LV_BTN_STYLE_REL, &tft_style_label_rel); /*Set the button's released style*/
lv_btn_set_style(buttonYText, LV_BTN_STYLE_PR, &tft_style_label_pre); /*Set the button's pressed style*/
lv_btn_set_layout(buttonYText, LV_LAYOUT_OFF);
labelYText = lv_label_create(buttonYText, NULL); /*Add a label to the button*/
buttonYState = lv_imgbtn_create(scr, NULL); buttonYState = lv_imgbtn_create(scr, stealth_Y ? "F:/bmp_enable.bin" : "F:/bmp_disable.bin", PARA_UI_STATE_POS_X, PARA_UI_POS_Y * 2 + PARA_UI_STATE_V, event_handler, ID_TMC_MODE_Y);
lv_obj_set_pos(buttonYState, PARA_UI_STATE_POS_X, PARA_UI_POS_Y * 2 + PARA_UI_STATE_V); labelYState = lv_label_create_empty(buttonYState);
#if AXIS_HAS_STEALTHCHOP(Y)
if (stepperY.get_stealthChop_status()) {
lv_imgbtn_set_src(buttonYState, LV_BTN_STATE_REL, "F:/bmp_enable.bin");
lv_imgbtn_set_src(buttonYState, LV_BTN_STATE_PR, "F:/bmp_enable.bin");
}
else {
lv_imgbtn_set_src(buttonYState, LV_BTN_STATE_REL, "F:/bmp_disable.bin");
lv_imgbtn_set_src(buttonYState, LV_BTN_STATE_PR, "F:/bmp_disable.bin");
}
#else
lv_imgbtn_set_src(buttonYState, LV_BTN_STATE_REL, "F:/bmp_disable.bin");
lv_imgbtn_set_src(buttonYState, LV_BTN_STATE_PR, "F:/bmp_disable.bin");
#endif
lv_obj_set_event_cb_mks(buttonYState, event_handler, ID_TMC_MODE_Y, NULL, 0);
lv_imgbtn_set_style(buttonYState, LV_BTN_STATE_PR, &tft_style_label_pre);
lv_imgbtn_set_style(buttonYState, LV_BTN_STATE_REL, &tft_style_label_rel);
lv_btn_set_layout(buttonYState, LV_LAYOUT_OFF);
labelYState = lv_label_create(buttonYState, NULL);
#if HAS_ROTARY_ENCODER #if HAS_ROTARY_ENCODER
if (gCfgItems.encoder_enable) lv_group_add_obj(g, buttonYState); if (gCfgItems.encoder_enable) lv_group_add_obj(g, buttonYState);
#endif #endif
@ -337,35 +272,11 @@ void lv_draw_tmc_step_mode_settings(void) {
line2 = lv_line_create(scr, NULL); line2 = lv_line_create(scr, NULL);
lv_ex_line(line2, line_points[1]); lv_ex_line(line2, line_points[1]);
buttonZText = lv_btn_create(scr, NULL); /*Add a button the current screen*/ buttonZText = lv_btn_create(scr, PARA_UI_POS_X, PARA_UI_POS_Y * 3, PARA_UI_VALUE_SIZE_X, PARA_UI_SIZE_Y, event_handler, 0);
lv_obj_set_pos(buttonZText, PARA_UI_POS_X, PARA_UI_POS_Y * 3); /*Set its position*/ labelZText = lv_label_create_empty(buttonZText); /*Add a label to the button*/
lv_obj_set_size(buttonZText, PARA_UI_VALUE_SIZE_X, PARA_UI_SIZE_Y); /*Set its size*/
lv_obj_set_event_cb(buttonZText, event_handler);
lv_btn_set_style(buttonZText, LV_BTN_STYLE_REL, &tft_style_label_rel); /*Set the button's released style*/
lv_btn_set_style(buttonZText, LV_BTN_STYLE_PR, &tft_style_label_pre); /*Set the button's pressed style*/
lv_btn_set_layout(buttonZText, LV_LAYOUT_OFF);
labelZText = lv_label_create(buttonZText, NULL); /*Add a label to the button*/
buttonZState = lv_imgbtn_create(scr, NULL); buttonZState = lv_imgbtn_create(scr, stealth_Z ? "F:/bmp_enable.bin" : "F:/bmp_disable.bin", PARA_UI_STATE_POS_X, PARA_UI_POS_Y * 3 + PARA_UI_STATE_V, event_handler, ID_TMC_MODE_Z);
lv_obj_set_pos(buttonZState, PARA_UI_STATE_POS_X, PARA_UI_POS_Y * 3 + PARA_UI_STATE_V); labelZState = lv_label_create_empty(buttonZState);
#if AXIS_HAS_STEALTHCHOP(Z)
if (stepperZ.get_stealthChop_status()) {
lv_imgbtn_set_src(buttonZState, LV_BTN_STATE_REL, "F:/bmp_enable.bin");
lv_imgbtn_set_src(buttonZState, LV_BTN_STATE_PR, "F:/bmp_enable.bin");
}
else {
lv_imgbtn_set_src(buttonZState, LV_BTN_STATE_REL, "F:/bmp_disable.bin");
lv_imgbtn_set_src(buttonZState, LV_BTN_STATE_PR, "F:/bmp_disable.bin");
}
#else
lv_imgbtn_set_src(buttonZState, LV_BTN_STATE_REL, "F:/bmp_disable.bin");
lv_imgbtn_set_src(buttonZState, LV_BTN_STATE_PR, "F:/bmp_disable.bin");
#endif
lv_obj_set_event_cb_mks(buttonZState, event_handler, ID_TMC_MODE_Z, NULL, 0);
lv_imgbtn_set_style(buttonZState, LV_BTN_STATE_PR, &tft_style_label_pre);
lv_imgbtn_set_style(buttonZState, LV_BTN_STATE_REL, &tft_style_label_rel);
lv_btn_set_layout(buttonZState, LV_LAYOUT_OFF);
labelZState = lv_label_create(buttonZState, NULL);
#if HAS_ROTARY_ENCODER #if HAS_ROTARY_ENCODER
if (gCfgItems.encoder_enable) lv_group_add_obj(g, buttonZState); if (gCfgItems.encoder_enable) lv_group_add_obj(g, buttonZState);
#endif #endif
@ -373,52 +284,20 @@ void lv_draw_tmc_step_mode_settings(void) {
line3 = lv_line_create(scr, NULL); line3 = lv_line_create(scr, NULL);
lv_ex_line(line3, line_points[2]); lv_ex_line(line3, line_points[2]);
buttonE0Text = lv_btn_create(scr, NULL); /*Add a button the current screen*/ buttonE0Text = lv_btn_create(scr, PARA_UI_POS_X, PARA_UI_POS_Y * 4, PARA_UI_VALUE_SIZE_X, PARA_UI_SIZE_Y, event_handler, 0);
lv_obj_set_pos(buttonE0Text, PARA_UI_POS_X, PARA_UI_POS_Y * 4); /*Set its position*/ labelE0Text = lv_label_create_empty(buttonE0Text); /*Add a label to the button*/
lv_obj_set_size(buttonE0Text, PARA_UI_VALUE_SIZE_X, PARA_UI_SIZE_Y); /*Set its size*/
lv_obj_set_event_cb(buttonE0Text, event_handler);
lv_btn_set_style(buttonE0Text, LV_BTN_STYLE_REL, &tft_style_label_rel); /*Set the button's released style*/
lv_btn_set_style(buttonE0Text, LV_BTN_STYLE_PR, &tft_style_label_pre); /*Set the button's pressed style*/
lv_btn_set_layout(buttonE0Text, LV_LAYOUT_OFF);
labelE0Text = lv_label_create(buttonE0Text, NULL); /*Add a label to the button*/
buttonE0State = lv_imgbtn_create(scr, NULL); buttonE0State = lv_imgbtn_create(scr, stealth_E0 ? "F:/bmp_enable.bin" : "F:/bmp_disable.bin", PARA_UI_STATE_POS_X, PARA_UI_POS_Y * 4 + PARA_UI_STATE_V, event_handler, ID_TMC_MODE_E0);
lv_obj_set_pos(buttonE0State, PARA_UI_STATE_POS_X, PARA_UI_POS_Y * 4 + PARA_UI_STATE_V); labelE0State = lv_label_create_empty(buttonE0State);
#if AXIS_HAS_STEALTHCHOP(E0)
if (stepperE0.get_stealthChop_status()) {
lv_imgbtn_set_src(buttonE0State, LV_BTN_STATE_REL, "F:/bmp_enable.bin");
lv_imgbtn_set_src(buttonE0State, LV_BTN_STATE_PR, "F:/bmp_enable.bin");
}
else {
lv_imgbtn_set_src(buttonE0State, LV_BTN_STATE_REL, "F:/bmp_disable.bin");
lv_imgbtn_set_src(buttonE0State, LV_BTN_STATE_PR, "F:/bmp_disable.bin");
}
#else
lv_imgbtn_set_src(buttonE0State, LV_BTN_STATE_REL, "F:/bmp_disable.bin");
lv_imgbtn_set_src(buttonE0State, LV_BTN_STATE_PR, "F:/bmp_disable.bin");
#endif
lv_obj_set_event_cb_mks(buttonE0State, event_handler, ID_TMC_MODE_E0, NULL, 0);
lv_imgbtn_set_style(buttonE0State, LV_BTN_STATE_PR, &tft_style_label_pre);
lv_imgbtn_set_style(buttonE0State, LV_BTN_STATE_REL, &tft_style_label_rel);
lv_btn_set_layout(buttonE0State, LV_LAYOUT_OFF);
labelE0State = lv_label_create(buttonE0State, NULL);
#if HAS_ROTARY_ENCODER #if HAS_ROTARY_ENCODER
if (gCfgItems.encoder_enable) lv_group_add_obj(g, buttonE0State); if (gCfgItems.encoder_enable) lv_group_add_obj(g, buttonE0State);
#endif #endif
line4 = lv_line_create(scr, NULL); line4 = lv_line_create(scr, NULL);
lv_ex_line(line4, line_points[3]); lv_ex_line(line4, line_points[3]);
//#if AXIS_HAS_STEALTHCHOP(E1) //#if AXIS_HAS_STEALTHCHOP(E1)
buttonTurnPage = lv_imgbtn_create(scr, NULL); buttonTurnPage = lv_imgbtn_create(scr, "F:/bmp_back70x40.bin", event_handler, ID_TMC_MODE_DOWN);
lv_obj_set_event_cb_mks(buttonTurnPage, event_handler, ID_TMC_MODE_DOWN, NULL, 0);
lv_imgbtn_set_src(buttonTurnPage, LV_BTN_STATE_REL, "F:/bmp_back70x40.bin");
lv_imgbtn_set_src(buttonTurnPage, LV_BTN_STATE_PR, "F:/bmp_back70x40.bin");
lv_imgbtn_set_style(buttonTurnPage, LV_BTN_STATE_PR, &tft_style_label_pre);
lv_imgbtn_set_style(buttonTurnPage, LV_BTN_STATE_REL, &tft_style_label_rel);
#if HAS_ROTARY_ENCODER #if HAS_ROTARY_ENCODER
if (gCfgItems.encoder_enable) lv_group_add_obj(g, buttonTurnPage); if (gCfgItems.encoder_enable) lv_group_add_obj(g, buttonTurnPage);
#endif #endif
@ -426,35 +305,11 @@ void lv_draw_tmc_step_mode_settings(void) {
} }
else { else {
//#if AXIS_HAS_STEALTHCHOP(E1) //#if AXIS_HAS_STEALTHCHOP(E1)
buttonE1Text = lv_btn_create(scr, NULL); /*Add a button the current screen*/ buttonE1Text = lv_btn_create(scr, PARA_UI_POS_X, PARA_UI_POS_Y, PARA_UI_VALUE_SIZE_X, PARA_UI_SIZE_Y, event_handler, 0);
lv_obj_set_pos(buttonE1Text, PARA_UI_POS_X, PARA_UI_POS_Y); /*Set its position*/ labelE1Text = lv_label_create_empty(buttonE1Text); /*Add a label to the button*/
lv_obj_set_size(buttonE1Text, PARA_UI_VALUE_SIZE_X, PARA_UI_SIZE_Y); /*Set its size*/
lv_obj_set_event_cb(buttonE1Text, event_handler);
lv_btn_set_style(buttonE1Text, LV_BTN_STYLE_REL, &tft_style_label_rel); /*Set the button's released style*/
lv_btn_set_style(buttonE1Text, LV_BTN_STYLE_PR, &tft_style_label_pre); /*Set the button's pressed style*/
lv_btn_set_layout(buttonE1Text, LV_LAYOUT_OFF);
labelE1Text = lv_label_create(buttonE1Text, NULL); /*Add a label to the button*/
buttonE1State = lv_imgbtn_create(scr, NULL); buttonE1State = lv_imgbtn_create(scr, stealth_E1 ? "F:/bmp_enable.bin" : "F:/bmp_disable.bin", PARA_UI_STATE_POS_X, PARA_UI_POS_Y + PARA_UI_STATE_V, event_handler, ID_TMC_MODE_E1);
lv_obj_set_pos(buttonE1State, PARA_UI_STATE_POS_X, PARA_UI_POS_Y + PARA_UI_STATE_V); labelE1State = lv_label_create_empty(buttonE1State);
#if AXIS_HAS_STEALTHCHOP(E1)
if (stepperE1.get_stealthChop_status()) {
lv_imgbtn_set_src(buttonE1State, LV_BTN_STATE_REL, "F:/bmp_enable.bin");
lv_imgbtn_set_src(buttonE1State, LV_BTN_STATE_PR, "F:/bmp_enable.bin");
}
else {
lv_imgbtn_set_src(buttonE1State, LV_BTN_STATE_REL, "F:/bmp_disable.bin");
lv_imgbtn_set_src(buttonE1State, LV_BTN_STATE_PR, "F:/bmp_disable.bin");
}
#else
lv_imgbtn_set_src(buttonE1State, LV_BTN_STATE_REL, "F:/bmp_disable.bin");
lv_imgbtn_set_src(buttonE1State, LV_BTN_STATE_PR, "F:/bmp_disable.bin");
#endif
lv_obj_set_event_cb_mks(buttonE1State, event_handler, ID_TMC_MODE_E1, NULL, 0);
lv_imgbtn_set_style(buttonE1State, LV_BTN_STATE_PR, &tft_style_label_pre);
lv_imgbtn_set_style(buttonE1State, LV_BTN_STATE_REL, &tft_style_label_rel);
lv_btn_set_layout(buttonE1State, LV_LAYOUT_OFF);
labelE1State = lv_label_create(buttonE1State, NULL);
#if HAS_ROTARY_ENCODER #if HAS_ROTARY_ENCODER
if (gCfgItems.encoder_enable) lv_group_add_obj(g, buttonE1State); if (gCfgItems.encoder_enable) lv_group_add_obj(g, buttonE1State);
#endif #endif
@ -462,33 +317,20 @@ void lv_draw_tmc_step_mode_settings(void) {
line1 = lv_line_create(scr, NULL); line1 = lv_line_create(scr, NULL);
lv_ex_line(line1, line_points[0]); lv_ex_line(line1, line_points[0]);
buttonTurnPage = lv_imgbtn_create(scr, NULL); buttonTurnPage = lv_imgbtn_create(scr, "F:/bmp_back70x40.bin", event_handler, ID_TMC_MODE_UP);
lv_obj_set_event_cb_mks(buttonTurnPage, event_handler, ID_TMC_MODE_UP, NULL, 0);
lv_imgbtn_set_src(buttonTurnPage, LV_BTN_STATE_REL, "F:/bmp_back70x40.bin");
lv_imgbtn_set_src(buttonTurnPage, LV_BTN_STATE_PR, "F:/bmp_back70x40.bin");
lv_imgbtn_set_style(buttonTurnPage, LV_BTN_STATE_PR, &tft_style_label_pre);
lv_imgbtn_set_style(buttonTurnPage, LV_BTN_STATE_REL, &tft_style_label_rel);
//#endif //#endif
} }
//#if AXIS_HAS_STEALTHCHOP(E1) //#if AXIS_HAS_STEALTHCHOP(E1)
lv_obj_set_pos(buttonTurnPage, PARA_UI_TURN_PAGE_POS_X, PARA_UI_TURN_PAGE_POS_Y); lv_obj_set_pos(buttonTurnPage, PARA_UI_TURN_PAGE_POS_X, PARA_UI_TURN_PAGE_POS_Y);
lv_btn_set_layout(buttonTurnPage, LV_LAYOUT_OFF); lv_btn_set_layout(buttonTurnPage, LV_LAYOUT_OFF);
labelTurnPage = lv_label_create(buttonTurnPage, NULL); labelTurnPage = lv_label_create_empty(buttonTurnPage);
//#endif //#endif
buttonBack = lv_imgbtn_create(scr, NULL); buttonBack = lv_imgbtn_create(scr, "F:/bmp_back70x40.bin", PARA_UI_BACL_POS_X, PARA_UI_BACL_POS_Y, event_handler, ID_TMC_MODE_RETURN);
lv_obj_set_event_cb_mks(buttonBack, event_handler, ID_TMC_MODE_RETURN, NULL, 0);
lv_imgbtn_set_src(buttonBack, LV_BTN_STATE_REL, "F:/bmp_back70x40.bin");
lv_imgbtn_set_src(buttonBack, LV_BTN_STATE_PR, "F:/bmp_back70x40.bin");
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);
#if HAS_ROTARY_ENCODER #if HAS_ROTARY_ENCODER
if (gCfgItems.encoder_enable) lv_group_add_obj(g, buttonBack); if (gCfgItems.encoder_enable) lv_group_add_obj(g, buttonBack);
#endif #endif
label_Back = lv_label_create_empty(buttonBack);
lv_obj_set_pos(buttonBack, PARA_UI_BACL_POS_X, PARA_UI_BACL_POS_Y);
lv_btn_set_layout(buttonBack, LV_LAYOUT_OFF);
label_Back = lv_label_create(buttonBack, NULL);
if (gCfgItems.multiple_language) { if (gCfgItems.multiple_language) {
if (uiCfg.para_ui_page != 1) { if (uiCfg.para_ui_page != 1) {
@ -504,44 +346,16 @@ void lv_draw_tmc_step_mode_settings(void) {
lv_label_set_text(labelE0Text, machine_menu.E0_StepMode); lv_label_set_text(labelE0Text, machine_menu.E0_StepMode);
lv_obj_align(labelE0Text, buttonE0Text, LV_ALIGN_IN_LEFT_MID, 0, 0); lv_obj_align(labelE0Text, buttonE0Text, LV_ALIGN_IN_LEFT_MID, 0, 0);
#if AXIS_HAS_STEALTHCHOP(X) lv_label_set_text(labelXState, stealth_X ? machine_menu.enable : machine_menu.disable);
if (stepperX.get_stealthChop_status())
lv_label_set_text(labelXState, machine_menu.enable);
else
lv_label_set_text(labelXState, machine_menu.disable);
#else
lv_label_set_text(labelXState, machine_menu.disable);
#endif
lv_obj_align(labelXState, buttonXState, LV_ALIGN_CENTER, 0, 0); lv_obj_align(labelXState, buttonXState, LV_ALIGN_CENTER, 0, 0);
#if AXIS_HAS_STEALTHCHOP(Y) lv_label_set_text(labelYState, stealth_Y ? machine_menu.enable : machine_menu.disable);
if (stepperY.get_stealthChop_status())
lv_label_set_text(labelYState, machine_menu.enable);
else
lv_label_set_text(labelYState, machine_menu.disable);
#else
lv_label_set_text(labelYState, machine_menu.disable);
#endif
lv_obj_align(labelYState, buttonYState, LV_ALIGN_CENTER, 0, 0); lv_obj_align(labelYState, buttonYState, LV_ALIGN_CENTER, 0, 0);
#if AXIS_HAS_STEALTHCHOP(Z) lv_label_set_text(labelZState, stealth_Z ? machine_menu.enable : machine_menu.disable);
if (stepperZ.get_stealthChop_status())
lv_label_set_text(labelZState, machine_menu.enable);
else
lv_label_set_text(labelZState, machine_menu.disable);
#else
lv_label_set_text(labelZState, machine_menu.disable);
#endif
lv_obj_align(labelZState, buttonZState, LV_ALIGN_CENTER, 0, 0); lv_obj_align(labelZState, buttonZState, LV_ALIGN_CENTER, 0, 0);
#if AXIS_HAS_STEALTHCHOP(E0) lv_label_set_text(labelE0State, stealth_E0 ? machine_menu.enable : machine_menu.disable);
if (stepperE0.get_stealthChop_status())
lv_label_set_text(labelE0State, machine_menu.enable);
else
lv_label_set_text(labelE0State, machine_menu.disable);
#else
lv_label_set_text(labelE0State, machine_menu.disable);
#endif
lv_obj_align(labelE0State, buttonE0State, LV_ALIGN_CENTER, 0, 0); lv_obj_align(labelE0State, buttonE0State, LV_ALIGN_CENTER, 0, 0);
//#if AXIS_HAS_STEALTHCHOP(E1) //#if AXIS_HAS_STEALTHCHOP(E1)
@ -553,14 +367,7 @@ void lv_draw_tmc_step_mode_settings(void) {
//#if AXIS_HAS_STEALTHCHOP(E1) //#if AXIS_HAS_STEALTHCHOP(E1)
lv_label_set_text(labelE1Text, machine_menu.E1_StepMode); lv_label_set_text(labelE1Text, machine_menu.E1_StepMode);
lv_obj_align(labelE1Text, buttonE1Text, LV_ALIGN_IN_LEFT_MID, 0, 0); lv_obj_align(labelE1Text, buttonE1Text, LV_ALIGN_IN_LEFT_MID, 0, 0);
#if AXIS_HAS_STEALTHCHOP(E1) lv_label_set_text(labelE1State, stealth_E1 ? machine_menu.enable : machine_menu.disable);
if (stepperE1.get_stealthChop_status())
lv_label_set_text(labelE1State, machine_menu.enable);
else
lv_label_set_text(labelE1State, machine_menu.disable);
#else
lv_label_set_text(labelE1State, machine_menu.disable);
#endif
lv_obj_align(labelE1State, buttonE1State, LV_ALIGN_CENTER, 0, 0); lv_obj_align(labelE1State, buttonE1State, LV_ALIGN_CENTER, 0, 0);
lv_label_set_text(labelTurnPage, machine_menu.previous); lv_label_set_text(labelTurnPage, machine_menu.previous);

View File

@ -149,92 +149,30 @@ void lv_draw_tool(void) {
lv_scr_load(scr); lv_scr_load(scr);
lv_obj_clean(scr); lv_obj_clean(scr);
lv_obj_t * title = lv_label_create(scr, NULL); (void)lv_label_create(scr, TITLE_XPOS, TITLE_YPOS, creat_title_text());
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());
lv_refr_now(lv_refr_get_disp_refreshing()); lv_refr_now(lv_refr_get_disp_refreshing());
// Create image buttons // Create image buttons
buttonPreHeat = lv_imgbtn_create(scr, NULL); buttonPreHeat = lv_imgbtn_create(scr, "F:/bmp_preHeat.bin", INTERVAL_V, titleHeight, event_handler, ID_T_PRE_HEAT);
buttonExtrusion = lv_imgbtn_create(scr, NULL); buttonExtrusion = lv_imgbtn_create(scr, "F:/bmp_extruct.bin", BTN_X_PIXEL + INTERVAL_V * 2, titleHeight, event_handler, ID_T_EXTRUCT);
buttonMove = lv_imgbtn_create(scr, NULL); buttonMove = lv_imgbtn_create(scr, "F:/bmp_mov.bin", BTN_X_PIXEL * 2 + INTERVAL_V * 3, titleHeight, event_handler, ID_T_MOV);
buttonHome = lv_imgbtn_create(scr, NULL); buttonHome = lv_imgbtn_create(scr, "F:/bmp_zero.bin", BTN_X_PIXEL * 3 + INTERVAL_V * 4, titleHeight, event_handler, ID_T_HOME);
buttonLevel = lv_imgbtn_create(scr, NULL); buttonLevel = lv_imgbtn_create(scr, "F:/bmp_leveling.bin", INTERVAL_V, BTN_Y_PIXEL + INTERVAL_H + titleHeight, event_handler, ID_T_LEVELING);
buttonFilament = lv_imgbtn_create(scr, NULL); buttonFilament = lv_imgbtn_create(scr, "F:/bmp_filamentchange.bin",BTN_X_PIXEL+INTERVAL_V*2,BTN_Y_PIXEL+INTERVAL_H+titleHeight, event_handler,ID_T_FILAMENT);
//buttonMore = lv_imgbtn_create(scr, NULL); //buttonMore = lv_imgbtn_createx(scr, NULL);
buttonBack = lv_imgbtn_create(scr, NULL);
lv_obj_set_event_cb_mks(buttonPreHeat, event_handler, ID_T_PRE_HEAT, NULL, 0);
lv_imgbtn_set_src(buttonPreHeat, LV_BTN_STATE_REL, "F:/bmp_preHeat.bin");
lv_imgbtn_set_src(buttonPreHeat, LV_BTN_STATE_PR, "F:/bmp_preHeat.bin");
lv_imgbtn_set_style(buttonPreHeat, LV_BTN_STATE_PR, &tft_style_label_pre);
lv_imgbtn_set_style(buttonPreHeat, LV_BTN_STATE_REL, &tft_style_label_rel);
lv_obj_set_event_cb_mks(buttonExtrusion, event_handler, ID_T_EXTRUCT, NULL, 0);
lv_imgbtn_set_src(buttonExtrusion, LV_BTN_STATE_REL, "F:/bmp_extruct.bin");
lv_imgbtn_set_src(buttonExtrusion, LV_BTN_STATE_PR, "F:/bmp_extruct.bin");
lv_imgbtn_set_style(buttonExtrusion, LV_BTN_STATE_PR, &tft_style_label_pre);
lv_imgbtn_set_style(buttonExtrusion, LV_BTN_STATE_REL, &tft_style_label_rel);
lv_obj_set_event_cb_mks(buttonMove, event_handler, ID_T_MOV, NULL, 0);
lv_imgbtn_set_src(buttonMove, LV_BTN_STATE_REL, "F:/bmp_mov.bin");
lv_imgbtn_set_src(buttonMove, LV_BTN_STATE_PR, "F:/bmp_mov.bin");
lv_imgbtn_set_style(buttonMove, LV_BTN_STATE_PR, &tft_style_label_pre);
lv_imgbtn_set_style(buttonMove, LV_BTN_STATE_REL, &tft_style_label_rel);
lv_obj_set_event_cb_mks(buttonHome, event_handler, ID_T_HOME, NULL, 0);
lv_imgbtn_set_src(buttonHome, LV_BTN_STATE_REL, "F:/bmp_zero.bin");
lv_imgbtn_set_src(buttonHome, LV_BTN_STATE_PR, "F:/bmp_zero.bin");
lv_imgbtn_set_style(buttonHome, LV_BTN_STATE_PR, &tft_style_label_pre);
lv_imgbtn_set_style(buttonHome, LV_BTN_STATE_REL, &tft_style_label_rel);
lv_obj_set_event_cb_mks(buttonLevel, event_handler, ID_T_LEVELING, NULL, 0);
lv_imgbtn_set_src(buttonLevel, LV_BTN_STATE_REL, "F:/bmp_leveling.bin");
lv_imgbtn_set_src(buttonLevel, LV_BTN_STATE_PR, "F:/bmp_leveling.bin");
lv_imgbtn_set_style(buttonLevel, LV_BTN_STATE_PR, &tft_style_label_pre);
lv_imgbtn_set_style(buttonLevel, LV_BTN_STATE_REL, &tft_style_label_rel);
lv_obj_set_event_cb_mks(buttonFilament, event_handler,ID_T_FILAMENT,NULL,0);
lv_imgbtn_set_src(buttonFilament, LV_BTN_STATE_REL, "F:/bmp_filamentchange.bin");
lv_imgbtn_set_src(buttonFilament, LV_BTN_STATE_PR, "F:/bmp_filamentchange.bin");
lv_imgbtn_set_style(buttonFilament, LV_BTN_STATE_PR, &tft_style_label_pre);
lv_imgbtn_set_style(buttonFilament, LV_BTN_STATE_REL, &tft_style_label_rel);
lv_obj_set_event_cb_mks(buttonBack, event_handler, ID_T_RETURN, NULL, 0);
lv_imgbtn_set_src(buttonBack, LV_BTN_STATE_REL, "F:/bmp_return.bin");
lv_imgbtn_set_src(buttonBack, LV_BTN_STATE_PR, "F:/bmp_return.bin");
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);
lv_obj_set_pos(buttonPreHeat, INTERVAL_V, titleHeight);
lv_obj_set_pos(buttonExtrusion, BTN_X_PIXEL + INTERVAL_V * 2, titleHeight);
lv_obj_set_pos(buttonMove, BTN_X_PIXEL * 2 + INTERVAL_V * 3, titleHeight);
lv_obj_set_pos(buttonHome, BTN_X_PIXEL * 3 + INTERVAL_V * 4, titleHeight);
lv_obj_set_pos(buttonLevel, INTERVAL_V, BTN_Y_PIXEL + INTERVAL_H + titleHeight);
lv_obj_set_pos(buttonFilament,BTN_X_PIXEL+INTERVAL_V*2,BTN_Y_PIXEL+INTERVAL_H+titleHeight);
//lv_obj_set_pos(buttonMore,BTN_X_PIXEL*2+INTERVAL_V*3, BTN_Y_PIXEL+INTERVAL_H+titleHeight); //lv_obj_set_pos(buttonMore,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); buttonBack = lv_imgbtn_create(scr, "F:/bmp_return.bin", BTN_X_PIXEL * 3 + INTERVAL_V * 4, BTN_Y_PIXEL + INTERVAL_H + titleHeight, event_handler, ID_T_RETURN);
// Create labels on the image buttons // Create labels on the image buttons
lv_btn_set_layout(buttonPreHeat, LV_LAYOUT_OFF); lv_obj_t *labelPreHeat = lv_label_create_empty(buttonPreHeat);
lv_btn_set_layout(buttonExtrusion, LV_LAYOUT_OFF); lv_obj_t *labelExtrusion = lv_label_create_empty(buttonExtrusion);
lv_btn_set_layout(buttonMove, LV_LAYOUT_OFF); lv_obj_t *label_Move = lv_label_create_empty(buttonMove);
lv_btn_set_layout(buttonHome, LV_LAYOUT_OFF); lv_obj_t *label_Home = lv_label_create_empty(buttonHome);
lv_btn_set_layout(buttonLevel, LV_LAYOUT_OFF); lv_obj_t *label_Level = lv_label_create_empty(buttonLevel);
lv_btn_set_layout(buttonFilament, LV_LAYOUT_OFF); lv_obj_t *label_Filament = lv_label_create_empty(buttonFilament);
//lv_btn_set_layout(buttonMore, LV_LAYOUT_OFF); //lv_obj_t *label_More = lv_label_create_empty(buttonMore);
lv_btn_set_layout(buttonBack, LV_LAYOUT_OFF); lv_obj_t *label_Back = lv_label_create_empty(buttonBack);
lv_obj_t *labelPreHeat = lv_label_create(buttonPreHeat, NULL);
lv_obj_t *labelExtrusion = lv_label_create(buttonExtrusion, NULL);
lv_obj_t *label_Move = lv_label_create(buttonMove, NULL);
lv_obj_t *label_Home = lv_label_create(buttonHome, NULL);
lv_obj_t *label_Level = lv_label_create(buttonLevel, NULL);
lv_obj_t *label_Filament = lv_label_create(buttonFilament, NULL);
//lv_obj_t *label_More = lv_label_create(buttonMore, NULL);
lv_obj_t *label_Back = lv_label_create(buttonBack, NULL);
if (gCfgItems.multiple_language) { if (gCfgItems.multiple_language) {
lv_label_set_text(labelPreHeat, tool_menu.preheat); lv_label_set_text(labelPreHeat, tool_menu.preheat);

View File

@ -1577,6 +1577,105 @@ void draw_return_ui() {
} }
} }
// Set the same image for both Released and Pressed
void lv_imgbtn_set_src_both(lv_obj_t *imgbtn, const void *src) {
lv_imgbtn_set_src(imgbtn, LV_BTN_STATE_REL, src);
lv_imgbtn_set_src(imgbtn, LV_BTN_STATE_PR, src);
}
// Use label style for the image button
void lv_imgbtn_use_label_style(lv_obj_t *imgbtn) {
lv_imgbtn_set_style(imgbtn, LV_BTN_STATE_REL, &tft_style_label_rel);
lv_imgbtn_set_style(imgbtn, LV_BTN_STATE_PR, &tft_style_label_pre);
}
// Use label style for the image button
void lv_btn_use_label_style(lv_obj_t *btn) {
lv_btn_set_style(btn, LV_BTN_STYLE_REL, &tft_style_label_rel);
lv_btn_set_style(btn, LV_BTN_STYLE_PR, &tft_style_label_pre);
}
// Use a single style for both Released and Pressed
void lv_btn_set_style_both(lv_obj_t *btn, lv_style_t *style) {
lv_btn_set_style(btn, LV_BTN_STYLE_REL, style);
lv_btn_set_style(btn, LV_BTN_STYLE_PR, style);
}
// Create an empty label
lv_obj_t* lv_label_create_empty(lv_obj_t *par) {
return lv_label_create(par, (lv_obj_t*)NULL);
}
// Create a label with style and text
lv_obj_t* lv_label_create(lv_obj_t *par, const char *text) {
lv_obj_t *label = lv_label_create_empty(par);
if (text) lv_label_set_text(label, text);
return label;
}
// Create a label with style, position, and text
lv_obj_t* lv_label_create(lv_obj_t *par, lv_coord_t x, lv_coord_t y, const char *text) {
lv_obj_t *label = lv_label_create(par, text);
lv_obj_set_pos(label, x, y);
return label;
}
// Create a button with callback, ID, and Style.
lv_obj_t* lv_btn_create(lv_obj_t *par, lv_event_cb_t cb, const int id, lv_style_t *style) {
lv_obj_t *btn = lv_btn_create(par, NULL);
if (id)
lv_obj_set_event_cb_mks(btn, cb, id, NULL, 0);
else
lv_obj_set_event_cb(btn, cb);
lv_btn_set_style_both(btn, style);
return btn;
}
// Create a button with callback and ID. Style set to style_para_value.
lv_obj_t* lv_btn_create(lv_obj_t *par, lv_event_cb_t cb, const int id) {
return lv_btn_create(par, cb, id, &style_para_value);
}
// Create a button with position, size, callback, and ID. Style set to style_para_value.
lv_obj_t* lv_btn_create(lv_obj_t *par, lv_coord_t x, lv_coord_t y, lv_coord_t w, lv_coord_t h, lv_event_cb_t cb, const int id) {
lv_obj_t *btn = lv_btn_create(par, cb, id);
lv_obj_set_pos(btn, x, y);
lv_obj_set_size(btn, w, h);
return btn;
}
// Create a button with callback and ID. Style set to style_para_back.
lv_obj_t* lv_btn_create_back(lv_obj_t *par, lv_event_cb_t cb, const int id) {
return lv_btn_create(par, cb, id, &style_para_back);
}
// Create a button with position, size, callback, and ID. Style set to style_para_back.
lv_obj_t* lv_btn_create_back(lv_obj_t *par, lv_coord_t x, lv_coord_t y, lv_coord_t w, lv_coord_t h, lv_event_cb_t cb, const int id) {
lv_obj_t *btn = lv_btn_create_back(par, cb, id);
lv_obj_set_pos(btn, x, y);
lv_obj_set_size(btn, w, h);
return btn;
}
// Create an image button with image, callback, and ID. Use label style.
lv_obj_t* lv_imgbtn_create(lv_obj_t *par, const char *img, lv_event_cb_t cb, const int id) {
lv_obj_t *btn = lv_imgbtn_create(par, NULL);
if (img) lv_imgbtn_set_src_both(btn, img);
if (id)
lv_obj_set_event_cb_mks(btn, cb, id, NULL, 0);
else
lv_obj_set_event_cb(btn, cb);
lv_imgbtn_use_label_style(btn);
lv_btn_set_layout(btn, LV_LAYOUT_OFF);
return btn;
}
// Create an image button with image, position, callback, and ID. Use label style.
lv_obj_t* lv_imgbtn_create(lv_obj_t *par, const char *img, lv_coord_t x, lv_coord_t y, lv_event_cb_t cb, const int id) {
lv_obj_t *btn = lv_imgbtn_create(par, img, cb, id);
lv_obj_set_pos(btn, x, y);
return btn;
}
#if ENABLED(SDSUPPORT) #if ENABLED(SDSUPPORT)
void sd_detection() { void sd_detection() {

View File

@ -164,6 +164,48 @@
#endif // ifdef TFT35 #endif // ifdef TFT35
// Set the same image for both Released and Pressed
void lv_imgbtn_set_src_both(lv_obj_t *imgbtn, const void *src);
// Set label styles for Released and Pressed
void lv_imgbtn_use_label_style(lv_obj_t *imgbtn);
// Set label styles for Released and Pressed
void lv_btn_use_label_style(lv_obj_t *btn);
// Set the same style for both Released and Pressed
void lv_btn_set_style_both(lv_obj_t *btn, lv_style_t *style);
// Create an empty label
lv_obj_t* lv_label_create_empty(lv_obj_t *par);
// Create a label with style and text
lv_obj_t* lv_label_create(lv_obj_t *par, const char *text);
// Create a label with style, position, and text
lv_obj_t* lv_label_create(lv_obj_t *par, lv_coord_t x, lv_coord_t y, const char *text);
// Create a button with callback, ID, and Style.
lv_obj_t* lv_btn_create(lv_obj_t *par, lv_event_cb_t cb, const int id, lv_style_t *style);
// Create a button with callback and ID. Style set to style_para_value.
lv_obj_t* lv_btn_create(lv_obj_t *par, lv_event_cb_t cb, const int id);
// Create a button with position, size, callback, and ID. Style set to style_para_value.
lv_obj_t* lv_btn_create(lv_obj_t *par, lv_coord_t x, lv_coord_t y, lv_coord_t w, lv_coord_t h, lv_event_cb_t cb, const int id);
// Create a button with callback and ID. Style set to style_para_back.
lv_obj_t* lv_btn_create_back(lv_obj_t *par, lv_event_cb_t cb, const int id);
// Create a button with position, size, callback, and ID. Style set to style_para_back.
lv_obj_t* lv_btn_create_back(lv_obj_t *par, lv_coord_t x, lv_coord_t y, lv_coord_t w, lv_coord_t h, lv_event_cb_t cb, const int id);
// Create an image button with image, callback, and ID. Use label style.
lv_obj_t* lv_imgbtn_create(lv_obj_t *par, const char *img, lv_event_cb_t cb, const int id);
// Create an image button with image, position, callback, and ID. Use label style.
lv_obj_t* lv_imgbtn_create(lv_obj_t *par, const char *img, lv_coord_t x, lv_coord_t y, lv_event_cb_t cb, const int id);
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { /* C-declarations for C++ */ extern "C" { /* C-declarations for C++ */
#endif #endif

View File

@ -70,9 +70,9 @@ static void event_handler(lv_obj_t * obj, lv_event_t event) {
} }
void lv_draw_wifi(void) { void lv_draw_wifi(void) {
lv_obj_t *buttonBack=NULL,*label_Back=NULL; lv_obj_t *buttonBack = NULL, *label_Back = NULL;
lv_obj_t *buttonCloud=NULL,*label_Cloud=NULL; lv_obj_t *buttonCloud = NULL, *label_Cloud = NULL;
lv_obj_t *buttonReconnect=NULL,*label_Reconnect=NULL; lv_obj_t *buttonReconnect = NULL, *label_Reconnect=NULL;
if (disp_state_stack._disp_state[disp_state_stack._disp_index] != WIFI_UI) { if (disp_state_stack._disp_state[disp_state_stack._disp_index] != WIFI_UI) {
disp_state_stack._disp_index++; disp_state_stack._disp_index++;
disp_state_stack._disp_state[disp_state_stack._disp_index] = WIFI_UI; disp_state_stack._disp_state[disp_state_stack._disp_index] = WIFI_UI;
@ -85,78 +85,63 @@ void lv_draw_wifi(void) {
lv_scr_load(scr); lv_scr_load(scr);
lv_obj_clean(scr); lv_obj_clean(scr);
lv_obj_t * title = lv_label_create(scr, NULL); (void)lv_label_create(scr, TITLE_XPOS, TITLE_YPOS, creat_title_text());
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());
lv_refr_now(lv_refr_get_disp_refreshing()); lv_refr_now(lv_refr_get_disp_refreshing());
// Create an Image button // Create an Image button
buttonBack = lv_imgbtn_create(scr, NULL); buttonBack = lv_imgbtn_create(scr, "F:/bmp_return.bin", BTN_X_PIXEL * 3 + INTERVAL_V * 4, BTN_Y_PIXEL + INTERVAL_H + titleHeight, event_handler, ID_W_RETURN);
#if HAS_ROTARY_ENCODER
if (gCfgItems.encoder_enable) lv_group_add_obj(g, buttonBack);
#endif
if (gCfgItems.wifi_mode_sel == STA_MODEL) { if (gCfgItems.wifi_mode_sel == STA_MODEL) {
//buttonCloud = lv_imgbtn_create(scr, NULL); //buttonCloud = lv_imgbtn_create(scr, NULL);
buttonReconnect = lv_imgbtn_create(scr, NULL); buttonReconnect = lv_imgbtn_create(scr, NULL);
} }
lv_obj_set_event_cb_mks(buttonBack, event_handler,ID_W_RETURN, NULL,0);
lv_imgbtn_set_src(buttonBack, LV_BTN_STATE_REL, "F:/bmp_return.bin");
lv_imgbtn_set_src(buttonBack, LV_BTN_STATE_PR, "F:/bmp_return.bin");
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);
#if HAS_ROTARY_ENCODER
if (gCfgItems.encoder_enable) lv_group_add_obj(g, buttonBack);
#endif
lv_obj_set_pos(buttonBack,BTN_X_PIXEL*3+INTERVAL_V*4, BTN_Y_PIXEL+INTERVAL_H+titleHeight);
lv_btn_set_layout(buttonBack, LV_LAYOUT_OFF);
if (gCfgItems.wifi_mode_sel == STA_MODEL) { if (gCfgItems.wifi_mode_sel == STA_MODEL) {
lv_obj_set_event_cb_mks(buttonReconnect, event_handler,ID_W_RECONNECT, NULL,0); lv_obj_set_event_cb_mks(buttonReconnect, event_handler,ID_W_RECONNECT, NULL, 0);
lv_imgbtn_set_src(buttonReconnect, LV_BTN_STATE_REL, "F:/bmp_wifi.bin"); lv_imgbtn_set_src_both(buttonReconnect, "F:/bmp_wifi.bin");
lv_imgbtn_set_src(buttonReconnect, LV_BTN_STATE_PR, "F:/bmp_wifi.bin"); lv_imgbtn_use_label_style(buttonReconnect);
lv_imgbtn_set_style(buttonReconnect, LV_BTN_STATE_PR, &tft_style_label_pre);
lv_imgbtn_set_style(buttonReconnect, LV_BTN_STATE_REL, &tft_style_label_rel);
#if HAS_ROTARY_ENCODER #if HAS_ROTARY_ENCODER
if (gCfgItems.encoder_enable) lv_group_add_obj(g, buttonReconnect); if (gCfgItems.encoder_enable) lv_group_add_obj(g, buttonReconnect);
#endif #endif
lv_obj_set_pos(buttonReconnect,BTN_X_PIXEL*2+INTERVAL_V*3, BTN_Y_PIXEL+INTERVAL_H+titleHeight); lv_obj_set_pos(buttonReconnect, BTN_X_PIXEL * 2 + INTERVAL_V * 3, BTN_Y_PIXEL + INTERVAL_H + titleHeight);
lv_btn_set_layout(buttonReconnect, LV_LAYOUT_OFF); lv_btn_set_layout(buttonReconnect, LV_LAYOUT_OFF);
} }
label_Back = lv_label_create(buttonBack, NULL); label_Back = lv_label_create_empty(buttonBack);
if (gCfgItems.wifi_mode_sel == STA_MODEL) { if (gCfgItems.wifi_mode_sel == STA_MODEL) {
//label_Cloud = lv_label_create(buttonCloud, NULL); //label_Cloud = lv_label_create_empty(buttonCloud);
label_Reconnect = lv_label_create(buttonReconnect, NULL); label_Reconnect = lv_label_create_empty(buttonReconnect);
} }
if (gCfgItems.multiple_language) { if (gCfgItems.multiple_language) {
lv_label_set_text(label_Back, common_menu.text_back); lv_label_set_text(label_Back, common_menu.text_back);
lv_obj_align(label_Back, buttonBack, LV_ALIGN_IN_BOTTOM_MID,0, BUTTON_TEXT_Y_OFFSET); lv_obj_align(label_Back, buttonBack, LV_ALIGN_IN_BOTTOM_MID, 0, BUTTON_TEXT_Y_OFFSET);
if (gCfgItems.wifi_mode_sel == STA_MODEL) { if (gCfgItems.wifi_mode_sel == STA_MODEL) {
//lv_label_set_text(label_Cloud, common_menu.text_back); //lv_label_set_text(label_Cloud, common_menu.text_back);
//lv_obj_align(label_Cloud, buttonCloud, LV_ALIGN_IN_BOTTOM_MID,0, BUTTON_TEXT_Y_OFFSET); //lv_obj_align(label_Cloud, buttonCloud, LV_ALIGN_IN_BOTTOM_MID, 0, BUTTON_TEXT_Y_OFFSET);
lv_label_set_text(label_Reconnect, wifi_menu.reconnect); lv_label_set_text(label_Reconnect, wifi_menu.reconnect);
lv_obj_align(label_Reconnect, buttonReconnect, LV_ALIGN_IN_BOTTOM_MID,0, BUTTON_TEXT_Y_OFFSET); lv_obj_align(label_Reconnect, buttonReconnect, LV_ALIGN_IN_BOTTOM_MID, 0, BUTTON_TEXT_Y_OFFSET);
} }
} }
wifi_ip_text = lv_label_create(scr, NULL); wifi_ip_text = lv_label_create_empty(scr);
lv_obj_set_style(wifi_ip_text, &tft_style_label_rel); lv_obj_set_style(wifi_ip_text, &tft_style_label_rel);
wifi_name_text = lv_label_create_empty(scr);
wifi_name_text = lv_label_create(scr, NULL);
lv_obj_set_style(wifi_name_text, &tft_style_label_rel); lv_obj_set_style(wifi_name_text, &tft_style_label_rel);
wifi_key_text = lv_label_create_empty(scr);
wifi_key_text = lv_label_create(scr, NULL);
lv_obj_set_style(wifi_key_text, &tft_style_label_rel); lv_obj_set_style(wifi_key_text, &tft_style_label_rel);
wifi_state_text = lv_label_create_empty(scr);
wifi_state_text = lv_label_create(scr, NULL);
lv_obj_set_style(wifi_state_text, &tft_style_label_rel); lv_obj_set_style(wifi_state_text, &tft_style_label_rel);
disp_wifi_state(); disp_wifi_state();
@ -167,20 +152,20 @@ void disp_wifi_state() {
strcpy(public_buf_m,wifi_menu.ip); strcpy(public_buf_m,wifi_menu.ip);
strcat(public_buf_m,ipPara.ip_addr); strcat(public_buf_m,ipPara.ip_addr);
lv_label_set_text(wifi_ip_text, public_buf_m); lv_label_set_text(wifi_ip_text, public_buf_m);
lv_obj_align(wifi_ip_text, NULL, LV_ALIGN_CENTER,0, -100); lv_obj_align(wifi_ip_text, NULL, LV_ALIGN_CENTER, 0, -100);
memset(public_buf_m, 0, sizeof(public_buf_m)); memset(public_buf_m, 0, sizeof(public_buf_m));
strcpy(public_buf_m,wifi_menu.wifi); strcpy(public_buf_m,wifi_menu.wifi);
strcat(public_buf_m,wifiPara.ap_name); strcat(public_buf_m,wifiPara.ap_name);
lv_label_set_text(wifi_name_text, public_buf_m); lv_label_set_text(wifi_name_text, public_buf_m);
lv_obj_align(wifi_name_text, NULL, LV_ALIGN_CENTER,0, -70); lv_obj_align(wifi_name_text, NULL, LV_ALIGN_CENTER, 0, -70);
if (wifiPara.mode == AP_MODEL) { if (wifiPara.mode == AP_MODEL) {
memset(public_buf_m, 0, sizeof(public_buf_m)); memset(public_buf_m, 0, sizeof(public_buf_m));
strcpy(public_buf_m,wifi_menu.key); strcpy(public_buf_m,wifi_menu.key);
strcat(public_buf_m,wifiPara.keyCode); strcat(public_buf_m,wifiPara.keyCode);
lv_label_set_text(wifi_key_text, public_buf_m); lv_label_set_text(wifi_key_text, public_buf_m);
lv_obj_align(wifi_key_text, NULL, LV_ALIGN_CENTER,0, -40); lv_obj_align(wifi_key_text, NULL, LV_ALIGN_CENTER, 0, -40);
memset(public_buf_m, 0, sizeof(public_buf_m)); memset(public_buf_m, 0, sizeof(public_buf_m));
strcpy(public_buf_m,wifi_menu.state_ap); strcpy(public_buf_m,wifi_menu.state_ap);
@ -191,7 +176,7 @@ void disp_wifi_state() {
else else
strcat(public_buf_m,wifi_menu.exception); strcat(public_buf_m,wifi_menu.exception);
lv_label_set_text(wifi_state_text, public_buf_m); lv_label_set_text(wifi_state_text, public_buf_m);
lv_obj_align(wifi_state_text, NULL, LV_ALIGN_CENTER,0, -10); lv_obj_align(wifi_state_text, NULL, LV_ALIGN_CENTER, 0, -10);
} }
else { else {
ZERO(public_buf_m); ZERO(public_buf_m);
@ -203,10 +188,10 @@ void disp_wifi_state() {
else else
strcat(public_buf_m, wifi_menu.exception); strcat(public_buf_m, wifi_menu.exception);
lv_label_set_text(wifi_state_text, public_buf_m); lv_label_set_text(wifi_state_text, public_buf_m);
lv_obj_align(wifi_state_text, NULL, LV_ALIGN_CENTER,0, -40); lv_obj_align(wifi_state_text, NULL, LV_ALIGN_CENTER, 0, -40);
lv_label_set_text(wifi_key_text, ""); lv_label_set_text(wifi_key_text, "");
lv_obj_align(wifi_key_text, NULL, LV_ALIGN_CENTER,0, -10); lv_obj_align(wifi_key_text, NULL, LV_ALIGN_CENTER, 0, -10);
} }
} }

View File

@ -42,8 +42,8 @@ list_menu_def list_menu;
extern lv_group_t * g; extern lv_group_t * g;
static lv_obj_t * scr; static lv_obj_t * scr;
static lv_obj_t *buttonWifiN[NUMBER_OF_PAGE]; static lv_obj_t *buttonWifiN[NUMBER_OF_PAGE];
static lv_obj_t *lableWifiText[NUMBER_OF_PAGE]; static lv_obj_t *labelWifiText[NUMBER_OF_PAGE];
static lv_obj_t *lablePageText; static lv_obj_t *labelPageText;
#define ID_WL_RETURN 11 #define ID_WL_RETURN 11
#define ID_WL_DOWN 12 #define ID_WL_DOWN 12
@ -116,43 +116,21 @@ void lv_draw_wifi_list(void) {
lv_scr_load(scr); lv_scr_load(scr);
lv_obj_clean(scr); lv_obj_clean(scr);
lv_obj_t * title = lv_label_create(scr, NULL); (void)lv_label_create(scr, TITLE_XPOS, TITLE_YPOS, creat_title_text());
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());
lv_refr_now(lv_refr_get_disp_refreshing()); lv_refr_now(lv_refr_get_disp_refreshing());
buttonDown = lv_imgbtn_create(scr, NULL); buttonDown = lv_imgbtn_create(scr, "F:/bmp_pageDown.bin", OTHER_BTN_XPIEL * 3 + INTERVAL_V * 4, titleHeight + OTHER_BTN_YPIEL + INTERVAL_H, event_handler, ID_WL_DOWN);
buttonBack = lv_imgbtn_create(scr, NULL); buttonBack = lv_imgbtn_create(scr, "F:/bmp_back.bin", OTHER_BTN_XPIEL * 3 + INTERVAL_V * 4, titleHeight + (OTHER_BTN_YPIEL + INTERVAL_H) * 2, event_handler, ID_WL_RETURN);
lv_obj_set_event_cb_mks(buttonDown, event_handler,ID_WL_DOWN,NULL,0);
lv_imgbtn_set_src(buttonDown, LV_BTN_STATE_REL, "F:/bmp_pageDown.bin");
lv_imgbtn_set_src(buttonDown, LV_BTN_STATE_PR, "F:/bmp_pageDown.bin");
lv_imgbtn_set_style(buttonDown, LV_BTN_STATE_PR, &tft_style_label_pre);
lv_imgbtn_set_style(buttonDown, LV_BTN_STATE_REL, &tft_style_label_rel);
lv_obj_set_event_cb_mks(buttonBack, event_handler,ID_WL_RETURN,NULL,0);
lv_imgbtn_set_src(buttonBack, LV_BTN_STATE_REL, "F:/bmp_back.bin");
lv_imgbtn_set_src(buttonBack, LV_BTN_STATE_PR, "F:/bmp_back.bin");
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);
lv_obj_set_pos(buttonDown,OTHER_BTN_XPIEL*3+INTERVAL_V*4,titleHeight+OTHER_BTN_YPIEL+INTERVAL_H);
lv_obj_set_pos(buttonBack,OTHER_BTN_XPIEL*3+INTERVAL_V*4,titleHeight+OTHER_BTN_YPIEL*2+INTERVAL_H*2);
lv_btn_set_layout(buttonDown, LV_LAYOUT_OFF);
lv_btn_set_layout(buttonBack, LV_LAYOUT_OFF);
for (uint8_t i = 0; i < NUMBER_OF_PAGE; i++) { for (uint8_t i = 0; i < NUMBER_OF_PAGE; i++) {
buttonWifiN[i] = lv_btn_create(scr, NULL); /*Add a button the current screen*/ buttonWifiN[i] = lv_btn_create(scr, NULL); /*Add a button the current screen*/
lv_obj_set_pos(buttonWifiN[i], 0,NAME_BTN_Y*i+10+titleHeight); /*Set its position*/ lv_obj_set_pos(buttonWifiN[i], 0, NAME_BTN_Y*i+10+titleHeight); /*Set its position*/
lv_obj_set_size(buttonWifiN[i], NAME_BTN_X,NAME_BTN_Y); /*Set its size*/ lv_obj_set_size(buttonWifiN[i], NAME_BTN_X, NAME_BTN_Y); /*Set its size*/
lv_obj_set_event_cb_mks(buttonWifiN[i], event_handler,(i+1),NULL,0); lv_obj_set_event_cb_mks(buttonWifiN[i], event_handler, (i+1), NULL, 0);
lv_btn_set_style(buttonWifiN[i], LV_BTN_STYLE_REL, &tft_style_label_rel); /*Set the button's released style*/ lv_btn_use_label_style(buttonWifiN[i]);
lv_btn_set_style(buttonWifiN[i], LV_BTN_STYLE_PR, &tft_style_label_pre); /*Set the button's pressed style*/
lv_btn_set_layout(buttonWifiN[i], LV_LAYOUT_OFF); lv_btn_set_layout(buttonWifiN[i], LV_LAYOUT_OFF);
lableWifiText[i] = lv_label_create(buttonWifiN[i], NULL); labelWifiText[i] = lv_label_create_empty(buttonWifiN[i]);
#if HAS_ROTARY_ENCODER #if HAS_ROTARY_ENCODER
uint8_t j = 0; uint8_t j = 0;
if (gCfgItems.encoder_enable) { if (gCfgItems.encoder_enable) {
@ -162,8 +140,8 @@ void lv_draw_wifi_list(void) {
#endif #endif
} }
lablePageText = lv_label_create(scr, NULL); labelPageText = lv_label_create_empty(scr);
lv_obj_set_style(lablePageText, &tft_style_label_rel); lv_obj_set_style(labelPageText, &tft_style_label_rel);
wifi_list.nameIndex = 0; wifi_list.nameIndex = 0;
wifi_list.currentWifipage = 1; wifi_list.currentWifipage = 1;
@ -187,27 +165,23 @@ void disp_wifi_list(void) {
uint8_t i, j; uint8_t i, j;
sprintf((char *)tmpStr, list_menu.file_pages, wifi_list.currentWifipage, wifi_list.getPage); sprintf((char *)tmpStr, list_menu.file_pages, wifi_list.currentWifipage, wifi_list.getPage);
lv_label_set_text(lablePageText, (const char *)tmpStr); lv_label_set_text(labelPageText, (const char *)tmpStr);
lv_obj_align(lablePageText, NULL, LV_ALIGN_CENTER, 50, -100); lv_obj_align(labelPageText, NULL, LV_ALIGN_CENTER, 50, -100);
for (i = 0; i < NUMBER_OF_PAGE; i++) { for (i = 0; i < NUMBER_OF_PAGE; i++) {
memset(tmpStr, 0, sizeof(tmpStr)); memset(tmpStr, 0, sizeof(tmpStr));
j = wifi_list.nameIndex + i; j = wifi_list.nameIndex + i;
if (j >= wifi_list.getNameNum) { if (j >= wifi_list.getNameNum) {
lv_label_set_text(lableWifiText[i], (const char *)tmpStr); lv_label_set_text(labelWifiText[i], (const char *)tmpStr);
lv_obj_align(lableWifiText[i], buttonWifiN[i], LV_ALIGN_IN_LEFT_MID, 20, 0); lv_obj_align(labelWifiText[i], buttonWifiN[i], LV_ALIGN_IN_LEFT_MID, 20, 0);
} }
else { else {
lv_label_set_text(lableWifiText[i], (char const *)wifi_list.wifiName[j]); lv_label_set_text(labelWifiText[i], (char const *)wifi_list.wifiName[j]);
lv_obj_align(lableWifiText[i], buttonWifiN[i], LV_ALIGN_IN_LEFT_MID, 20, 0); lv_obj_align(labelWifiText[i], buttonWifiN[i], LV_ALIGN_IN_LEFT_MID, 20, 0);
if (wifi_link_state == WIFI_CONNECTED && strcmp((const char *)wifi_list.wifiConnectedName, (const char *)wifi_list.wifiName[j]) == 0) { const bool btext = (wifi_link_state == WIFI_CONNECTED && strcmp((const char *)wifi_list.wifiConnectedName, (const char *)wifi_list.wifiName[j]) == 0);
lv_btn_set_style(buttonWifiN[i], LV_BTN_STYLE_REL, &style_sel_text); lv_btn_set_style(buttonWifiN[i], LV_BTN_STYLE_REL, btext ? &style_sel_text : &tft_style_label_rel);
}
else {
lv_btn_set_style(buttonWifiN[i], LV_BTN_STYLE_REL, &tft_style_label_rel);
}
} }
} }
} }

View File

@ -59,13 +59,13 @@ static void event_handler(lv_obj_t * obj, lv_event_t event) {
if (gCfgItems.wifi_mode_sel == AP_MODEL) { if (gCfgItems.wifi_mode_sel == AP_MODEL) {
gCfgItems.wifi_mode_sel = STA_MODEL; gCfgItems.wifi_mode_sel = STA_MODEL;
lv_label_set_text(labelModelValue, WIFI_STA_TEXT); lv_label_set_text(labelModelValue, WIFI_STA_TEXT);
lv_obj_align(labelModelValue, buttonModelValue, LV_ALIGN_CENTER,0, 0); lv_obj_align(labelModelValue, buttonModelValue, LV_ALIGN_CENTER, 0, 0);
update_spi_flash(); update_spi_flash();
} }
else { else {
gCfgItems.wifi_mode_sel = AP_MODEL; gCfgItems.wifi_mode_sel = AP_MODEL;
lv_label_set_text(labelModelValue, WIFI_AP_TEXT); lv_label_set_text(labelModelValue, WIFI_AP_TEXT);
lv_obj_align(labelModelValue, buttonModelValue, LV_ALIGN_CENTER,0, 0); lv_obj_align(labelModelValue, buttonModelValue, LV_ALIGN_CENTER, 0, 0);
update_spi_flash(); update_spi_flash();
} }
} }
@ -85,7 +85,7 @@ static void event_handler(lv_obj_t * obj, lv_event_t event) {
} }
else if (event == LV_EVENT_RELEASED) { else if (event == LV_EVENT_RELEASED) {
keyboard_value=wifiPassWord; keyboard_value = wifiPassWord;
lv_clear_wifi_settings(); lv_clear_wifi_settings();
lv_draw_keyboard(); lv_draw_keyboard();
} }
@ -95,19 +95,18 @@ static void event_handler(lv_obj_t * obj, lv_event_t event) {
} }
else if (event == LV_EVENT_RELEASED) { else if (event == LV_EVENT_RELEASED) {
if (gCfgItems.cloud_enable) { if (gCfgItems.cloud_enable) {
gCfgItems.cloud_enable = false; gCfgItems.cloud_enable = false;
lv_obj_set_event_cb_mks(obj, event_handler,ID_WIFI_CLOUD,"bmp_disable.bin",0); lv_obj_set_event_cb_mks(obj, event_handler, ID_WIFI_CLOUD, "bmp_disable.bin", 0);
lv_label_set_text(labelCloudValue, machine_menu.disable); lv_label_set_text(labelCloudValue, machine_menu.disable);
}
else {
gCfgItems.cloud_enable = true;
lv_obj_set_event_cb_mks(obj, event_handler, ID_WIFI_CLOUD, "bmp_enable.bin", 0);
lv_label_set_text(labelCloudValue, machine_menu.enable);
}
update_spi_flash(); update_spi_flash();
} }
else {
gCfgItems.cloud_enable = true;
lv_obj_set_event_cb_mks(obj, event_handler,ID_WIFI_CLOUD,"bmp_enable.bin",0);
lv_label_set_text(labelCloudValue, machine_menu.enable);
update_spi_flash();
}
}
break; break;
case ID_WIFI_CONFIG: case ID_WIFI_CONFIG:
if (event == LV_EVENT_CLICKED) { if (event == LV_EVENT_CLICKED) {
@ -140,113 +139,61 @@ void lv_draw_wifi_settings(void) {
lv_scr_load(scr); lv_scr_load(scr);
lv_obj_clean(scr); lv_obj_clean(scr);
lv_obj_t * title = lv_label_create(scr, NULL); (void)lv_label_create(scr, TITLE_XPOS, TITLE_YPOS, machine_menu.WifiConfTitle);
lv_obj_set_style(title, &tft_style_label_rel);
lv_obj_set_pos(title,TITLE_XPOS,TITLE_YPOS);
lv_label_set_text(title, machine_menu.WifiConfTitle);
lv_refr_now(lv_refr_get_disp_refreshing()); lv_refr_now(lv_refr_get_disp_refreshing());
labelModelText = lv_label_create(scr, NULL); labelModelText = lv_label_create(scr, PARA_UI_POS_X, PARA_UI_POS_Y + 10, machine_menu.wifiMode);
lv_obj_set_style(labelModelText, &tft_style_label_rel);
lv_obj_set_pos(labelModelText, PARA_UI_POS_X, PARA_UI_POS_Y + 10);
lv_label_set_text(labelModelText, machine_menu.wifiMode);
buttonModelValue = lv_imgbtn_create(scr, NULL); buttonModelValue = lv_imgbtn_create(scr, NULL);
lv_obj_set_pos(buttonModelValue,PARA_UI_VALUE_POS_X,PARA_UI_POS_Y+PARA_UI_VALUE_V); lv_imgbtn_set_src_both(buttonModelValue, "F:/bmp_blank_sel.bin");
lv_obj_set_event_cb_mks(buttonModelValue, event_handler,ID_WIFI_MODEL, NULL,0); lv_obj_set_pos(buttonModelValue, PARA_UI_VALUE_POS_X, PARA_UI_POS_Y + PARA_UI_VALUE_V);
lv_imgbtn_set_src(buttonModelValue, LV_BTN_STATE_REL, "F:/bmp_blank_sel.bin"); lv_obj_set_event_cb_mks(buttonModelValue, event_handler, ID_WIFI_MODEL, NULL, 0);
lv_imgbtn_set_src(buttonModelValue, LV_BTN_STATE_PR, "F:/bmp_blank_sel.bin"); lv_btn_set_style_both(buttonModelValue, &style_para_value_pre);
lv_imgbtn_set_style(buttonModelValue, LV_BTN_STATE_PR, &style_para_value_pre);
lv_imgbtn_set_style(buttonModelValue, LV_BTN_STATE_REL, &style_para_value_pre);
lv_btn_set_layout(buttonModelValue, LV_LAYOUT_OFF); lv_btn_set_layout(buttonModelValue, LV_LAYOUT_OFF);
labelModelValue = lv_label_create(buttonModelValue, NULL); labelModelValue = lv_label_create_empty(buttonModelValue);
line1 = lv_line_create(scr, NULL); line1 = lv_line_create(scr, NULL);
lv_ex_line(line1,line_points[0]); lv_ex_line(line1,line_points[0]);
labelNameText = lv_label_create(scr, NULL); labelNameText = lv_label_create(scr, PARA_UI_POS_X, PARA_UI_POS_Y * 2 + 10, NULL);
lv_obj_set_style(labelNameText, &tft_style_label_rel);
lv_obj_set_pos(labelNameText, PARA_UI_POS_X, PARA_UI_POS_Y * 2 + 10);
buttonNameValue = lv_btn_create(scr, NULL); buttonNameValue = lv_btn_create(scr, PARA_UI_VALUE_POS_X, PARA_UI_POS_Y * 2 + PARA_UI_VALUE_V, PARA_UI_VALUE_BTN_X_SIZE, PARA_UI_VALUE_BTN_Y_SIZE, event_handler, ID_WIFI_NAME);
lv_obj_set_pos(buttonNameValue,PARA_UI_VALUE_POS_X,PARA_UI_POS_Y*2+PARA_UI_VALUE_V); labelNameValue = lv_label_create_empty(buttonNameValue);
lv_obj_set_size(buttonNameValue, PARA_UI_VALUE_BTN_X_SIZE, PARA_UI_VALUE_BTN_Y_SIZE);
lv_obj_set_event_cb_mks(buttonNameValue, event_handler,ID_WIFI_NAME, NULL,0);
lv_btn_set_style(buttonNameValue, LV_BTN_STYLE_REL, &style_para_value);
lv_btn_set_style(buttonNameValue, LV_BTN_STYLE_PR, &style_para_value);
labelNameValue = lv_label_create(buttonNameValue, NULL);
line2 = lv_line_create(scr, NULL); line2 = lv_line_create(scr, NULL);
lv_ex_line(line2,line_points[1]); lv_ex_line(line2,line_points[1]);
labelPassWordText = lv_label_create(scr, NULL); labelPassWordText = lv_label_create(scr, PARA_UI_POS_X, PARA_UI_POS_Y * 3 + 10, NULL);
lv_obj_set_style(labelPassWordText, &tft_style_label_rel);
lv_obj_set_pos(labelPassWordText, PARA_UI_POS_X, PARA_UI_POS_Y * 3 + 10);
buttonPassWordValue = lv_btn_create(scr, NULL); buttonPassWordValue = lv_btn_create(scr, PARA_UI_VALUE_POS_X, PARA_UI_POS_Y * 3 + PARA_UI_VALUE_V, PARA_UI_VALUE_BTN_X_SIZE, PARA_UI_VALUE_BTN_Y_SIZE, event_handler, ID_WIFI_PASSWORD);
lv_obj_set_pos(buttonPassWordValue,PARA_UI_VALUE_POS_X,PARA_UI_POS_Y*3+PARA_UI_VALUE_V); labelPassWordValue = lv_label_create_empty(buttonPassWordValue);
lv_obj_set_size(buttonPassWordValue, PARA_UI_VALUE_BTN_X_SIZE, PARA_UI_VALUE_BTN_Y_SIZE);
lv_obj_set_event_cb_mks(buttonPassWordValue, event_handler,ID_WIFI_PASSWORD, NULL,0);
lv_btn_set_style(buttonPassWordValue, LV_BTN_STYLE_REL, &style_para_value);
lv_btn_set_style(buttonPassWordValue, LV_BTN_STYLE_PR, &style_para_value);
labelPassWordValue = lv_label_create(buttonPassWordValue, NULL);
line3 = lv_line_create(scr, NULL); line3 = lv_line_create(scr, NULL);
lv_ex_line(line3,line_points[2]); lv_ex_line(line3,line_points[2]);
labelCloudText = lv_label_create(scr, NULL); labelCloudText = lv_label_create(scr, PARA_UI_POS_X, PARA_UI_POS_Y * 4 + 10, machine_menu.wifiCloud);
lv_obj_set_style(labelCloudText, &tft_style_label_rel);
lv_obj_set_pos(labelCloudText, PARA_UI_POS_X, PARA_UI_POS_Y * 4 + 10);
lv_label_set_text(labelCloudText, machine_menu.wifiCloud);
buttonCloudValue = lv_imgbtn_create(scr, NULL); buttonCloudValue = lv_imgbtn_create(scr, gCfgItems.cloud_enable ? "F:/bmp_enable.bin" : "F:/bmp_disable.bin", PARA_UI_STATE_POS_X, PARA_UI_POS_Y * 4 + PARA_UI_STATE_V, event_handler, ID_WIFI_CLOUD);
lv_obj_set_pos(buttonCloudValue,PARA_UI_STATE_POS_X,PARA_UI_POS_Y*4+PARA_UI_STATE_V); labelCloudValue = lv_label_create_empty(buttonCloudValue);
if (gCfgItems.cloud_enable) {
lv_imgbtn_set_src(buttonCloudValue, LV_BTN_STATE_REL, "F:/bmp_enable.bin");
lv_imgbtn_set_src(buttonCloudValue, LV_BTN_STATE_PR, "F:/bmp_enable.bin");
}
else {
lv_imgbtn_set_src(buttonCloudValue, LV_BTN_STATE_REL, "F:/bmp_disable.bin");
lv_imgbtn_set_src(buttonCloudValue, LV_BTN_STATE_PR, "F:/bmp_disable.bin");
}
lv_obj_set_event_cb_mks(buttonCloudValue, event_handler,ID_WIFI_CLOUD, NULL,0);
lv_imgbtn_set_style(buttonCloudValue, LV_BTN_STATE_PR, &tft_style_label_pre);
lv_imgbtn_set_style(buttonCloudValue, LV_BTN_STATE_REL, &tft_style_label_rel);
lv_btn_set_layout(buttonCloudValue, LV_LAYOUT_OFF);
labelCloudValue = lv_label_create(buttonCloudValue, NULL);
line4 = lv_line_create(scr, NULL); line4 = lv_line_create(scr, NULL);
lv_ex_line(line4,line_points[3]); lv_ex_line(line4,line_points[3]);
buttonConfig = lv_imgbtn_create(scr, NULL); buttonConfig = lv_imgbtn_create(scr, "F:/bmp_back70x40.bin", PARA_UI_TURN_PAGE_POS_X, PARA_UI_TURN_PAGE_POS_Y, event_handler, ID_WIFI_CONFIG);
lv_obj_set_event_cb_mks(buttonConfig, event_handler,ID_WIFI_CONFIG, NULL,0); labelConfig = lv_label_create_empty(buttonConfig);
lv_imgbtn_set_src(buttonConfig, LV_BTN_STATE_REL, "F:/bmp_back70x40.bin");
lv_imgbtn_set_src(buttonConfig, LV_BTN_STATE_PR, "F:/bmp_back70x40.bin");
lv_imgbtn_set_style(buttonConfig, LV_BTN_STATE_PR, &tft_style_label_pre);
lv_imgbtn_set_style(buttonConfig, LV_BTN_STATE_REL, &tft_style_label_rel);
lv_obj_set_pos(buttonConfig, PARA_UI_TURN_PAGE_POS_X, PARA_UI_TURN_PAGE_POS_Y);
lv_btn_set_layout(buttonConfig, LV_LAYOUT_OFF);
labelConfig = lv_label_create(buttonConfig, NULL);
buttonBack = lv_imgbtn_create(scr, NULL); buttonBack = lv_imgbtn_create(scr, "F:/bmp_back70x40.bin", PARA_UI_BACL_POS_X, PARA_UI_BACL_POS_Y, event_handler, ID_WIFI_RETURN);
lv_obj_set_event_cb_mks(buttonBack, event_handler, ID_WIFI_RETURN, NULL, 0); label_Back = lv_label_create_empty(buttonBack);
lv_imgbtn_set_src(buttonBack, LV_BTN_STATE_REL, "F:/bmp_back70x40.bin");
lv_imgbtn_set_src(buttonBack, LV_BTN_STATE_PR, "F:/bmp_back70x40.bin");
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);
lv_obj_set_pos(buttonBack, PARA_UI_BACL_POS_X, PARA_UI_BACL_POS_Y);
lv_btn_set_layout(buttonBack, LV_LAYOUT_OFF);
label_Back = lv_label_create(buttonBack, NULL);
if (gCfgItems.multiple_language) { if (gCfgItems.multiple_language) {
if (gCfgItems.wifi_mode_sel == AP_MODEL) { if (gCfgItems.wifi_mode_sel == AP_MODEL) {
lv_label_set_text(labelModelValue, WIFI_AP_TEXT); lv_label_set_text(labelModelValue, WIFI_AP_TEXT);
lv_obj_align(labelModelValue, buttonModelValue, LV_ALIGN_CENTER,0, 0); lv_obj_align(labelModelValue, buttonModelValue, LV_ALIGN_CENTER, 0, 0);
} }
else { else {
lv_label_set_text(labelModelValue, WIFI_STA_TEXT); lv_label_set_text(labelModelValue, WIFI_STA_TEXT);
lv_obj_align(labelModelValue, buttonModelValue, LV_ALIGN_CENTER,0, 0); lv_obj_align(labelModelValue, buttonModelValue, LV_ALIGN_CENTER, 0, 0);
} }
memset(public_buf_m,0,sizeof(public_buf_m)); memset(public_buf_m,0,sizeof(public_buf_m));
strcat(public_buf_m,machine_menu.wifiName); strcat(public_buf_m,machine_menu.wifiName);
@ -254,7 +201,7 @@ void lv_draw_wifi_settings(void) {
lv_label_set_text(labelNameText,public_buf_m); lv_label_set_text(labelNameText,public_buf_m);
lv_label_set_text(labelNameValue,machine_menu.wifiEdit); lv_label_set_text(labelNameValue,machine_menu.wifiEdit);
lv_obj_align(labelNameValue, buttonNameValue, LV_ALIGN_CENTER,0, 0); lv_obj_align(labelNameValue, buttonNameValue, LV_ALIGN_CENTER, 0, 0);
memset(public_buf_m,0,sizeof(public_buf_m)); memset(public_buf_m,0,sizeof(public_buf_m));
strcat(public_buf_m,machine_menu.wifiPassWord); strcat(public_buf_m,machine_menu.wifiPassWord);
@ -262,16 +209,16 @@ void lv_draw_wifi_settings(void) {
lv_label_set_text(labelPassWordText,public_buf_m); lv_label_set_text(labelPassWordText,public_buf_m);
lv_label_set_text(labelPassWordValue,machine_menu.wifiEdit); lv_label_set_text(labelPassWordValue,machine_menu.wifiEdit);
lv_obj_align(labelPassWordValue, buttonPassWordValue, LV_ALIGN_CENTER,0, 0); lv_obj_align(labelPassWordValue, buttonPassWordValue, LV_ALIGN_CENTER, 0, 0);
lv_label_set_text(labelCloudValue, gCfgItems.cloud_enable ? machine_menu.enable : machine_menu.disable); lv_label_set_text(labelCloudValue, gCfgItems.cloud_enable ? machine_menu.enable : machine_menu.disable);
lv_obj_align(labelCloudValue, buttonCloudValue, LV_ALIGN_CENTER,0, 0); lv_obj_align(labelCloudValue, buttonCloudValue, LV_ALIGN_CENTER, 0, 0);
lv_label_set_text(labelConfig,machine_menu.wifiConfig); lv_label_set_text(labelConfig,machine_menu.wifiConfig);
lv_obj_align(labelConfig, buttonConfig, LV_ALIGN_CENTER,0, 0); lv_obj_align(labelConfig, buttonConfig, LV_ALIGN_CENTER, 0, 0);
lv_label_set_text(label_Back, common_menu.text_back); lv_label_set_text(label_Back, common_menu.text_back);
lv_obj_align(label_Back, buttonBack, LV_ALIGN_CENTER,0, 0); lv_obj_align(label_Back, buttonBack, LV_ALIGN_CENTER, 0, 0);
} }
#if HAS_ROTARY_ENCODER #if HAS_ROTARY_ENCODER

View File

@ -52,28 +52,23 @@ void lv_draw_wifi_tips(void) {
lv_obj_clean(scr); lv_obj_clean(scr);
lv_refr_now(lv_refr_get_disp_refreshing()); lv_refr_now(lv_refr_get_disp_refreshing());
text_tips = lv_label_create(scr, NULL); wifi_name = lv_label_create(scr, (const char *)wifi_list.wifiName[wifi_list.nameIndex]);
lv_obj_set_style(text_tips, &tft_style_label_rel); lv_obj_align(wifi_name, NULL, LV_ALIGN_CENTER, 0, -20);
wifi_name = lv_label_create(scr, NULL);
lv_obj_set_style(wifi_name, &tft_style_label_rel);
text_tips = lv_label_create_empty(scr);
if (wifi_tips_type == TIPS_TYPE_JOINING) { if (wifi_tips_type == TIPS_TYPE_JOINING) {
lv_label_set_text(text_tips, tips_menu.joining); lv_label_set_text(text_tips, tips_menu.joining);
lv_obj_align(text_tips, NULL, LV_ALIGN_CENTER,0, -60); lv_obj_align(text_tips, NULL, LV_ALIGN_CENTER, 0, -60);
} }
else if (wifi_tips_type == TIPS_TYPE_TAILED_JOIN) { else if (wifi_tips_type == TIPS_TYPE_TAILED_JOIN) {
lv_label_set_text(text_tips, tips_menu.failedJoin); lv_label_set_text(text_tips, tips_menu.failedJoin);
lv_obj_align(text_tips, NULL, LV_ALIGN_CENTER,0, -60); lv_obj_align(text_tips, NULL, LV_ALIGN_CENTER, 0, -60);
} }
else if (wifi_tips_type == TIPS_TYPE_WIFI_CONECTED) { else if (wifi_tips_type == TIPS_TYPE_WIFI_CONECTED) {
lv_label_set_text(text_tips, tips_menu.wifiConected); lv_label_set_text(text_tips, tips_menu.wifiConected);
lv_obj_align(text_tips, NULL, LV_ALIGN_CENTER,0, -60); lv_obj_align(text_tips, NULL, LV_ALIGN_CENTER, 0, -60);
} }
lv_label_set_text(wifi_name, (const char *)wifi_list.wifiName[wifi_list.nameIndex]);
lv_obj_align(wifi_name, NULL, LV_ALIGN_CENTER,0, -20);
tips_disp.timer = TIPS_TIMER_START; tips_disp.timer = TIPS_TIMER_START;
tips_disp.timer_count = 0; tips_disp.timer_count = 0;
} }