MKS-Sean
4 years ago
committed by
Scott Lahteine
90 changed files with 11716 additions and 4179 deletions
@ -0,0 +1,483 @@ |
|||
/**
|
|||
* Marlin 3D Printer Firmware |
|||
* Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
|||
* |
|||
* Based on Sprinter and grbl. |
|||
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm |
|||
* |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|||
* |
|||
*/ |
|||
#include "../../../../inc/MarlinConfigPre.h" |
|||
|
|||
#if HAS_TFT_LVGL_UI |
|||
|
|||
#include "lv_conf.h" |
|||
#include "draw_ui.h" |
|||
|
|||
#include "../../../../MarlinCore.h" |
|||
#include "../../../../module/planner.h" |
|||
|
|||
static lv_obj_t * scr; |
|||
|
|||
#define ID_ACCE_RETURN 1 |
|||
#define ID_ACCE_PRINT 2 |
|||
#define ID_ACCE_RETRA 3 |
|||
#define ID_ACCE_TRAVEL 4 |
|||
#define ID_ACCE_X 5 |
|||
#define ID_ACCE_Y 6 |
|||
#define ID_ACCE_Z 7 |
|||
#define ID_ACCE_E0 8 |
|||
#define ID_ACCE_E1 9 |
|||
#define ID_ACCE_UP 10 |
|||
#define ID_ACCE_DOWN 11 |
|||
|
|||
static void event_handler(lv_obj_t * obj, lv_event_t event) { |
|||
switch (obj->mks_obj_id) { |
|||
case ID_ACCE_RETURN: |
|||
if (event == LV_EVENT_CLICKED) { |
|||
|
|||
} |
|||
else if (event == LV_EVENT_RELEASED) { |
|||
uiCfg.para_ui_page = 0; |
|||
lv_clear_acceleration_settings(); |
|||
draw_return_ui(); |
|||
} |
|||
break; |
|||
case ID_ACCE_PRINT: |
|||
if (event == LV_EVENT_CLICKED) { |
|||
|
|||
} |
|||
else if (event == LV_EVENT_RELEASED) { |
|||
value = PrintAcceleration; |
|||
lv_clear_acceleration_settings(); |
|||
lv_draw_number_key(); |
|||
} |
|||
break; |
|||
case ID_ACCE_RETRA: |
|||
if (event == LV_EVENT_CLICKED) { |
|||
|
|||
} |
|||
else if (event == LV_EVENT_RELEASED) { |
|||
value = RetractAcceleration; |
|||
lv_clear_acceleration_settings(); |
|||
lv_draw_number_key(); |
|||
} |
|||
break; |
|||
case ID_ACCE_TRAVEL: |
|||
if (event == LV_EVENT_CLICKED) { |
|||
|
|||
} |
|||
else if (event == LV_EVENT_RELEASED) { |
|||
value = TravelAcceleration; |
|||
lv_clear_acceleration_settings(); |
|||
lv_draw_number_key(); |
|||
} |
|||
break; |
|||
case ID_ACCE_X: |
|||
if (event == LV_EVENT_CLICKED) { |
|||
|
|||
} |
|||
else if (event == LV_EVENT_RELEASED) { |
|||
value = XAcceleration; |
|||
lv_clear_acceleration_settings(); |
|||
lv_draw_number_key(); |
|||
} |
|||
break; |
|||
case ID_ACCE_Y: |
|||
if (event == LV_EVENT_CLICKED) { |
|||
|
|||
} |
|||
else if (event == LV_EVENT_RELEASED) { |
|||
value = YAcceleration; |
|||
lv_clear_acceleration_settings(); |
|||
lv_draw_number_key(); |
|||
} |
|||
break; |
|||
case ID_ACCE_Z: |
|||
if (event == LV_EVENT_CLICKED) { |
|||
|
|||
} |
|||
else if (event == LV_EVENT_RELEASED) { |
|||
value = ZAcceleration; |
|||
lv_clear_acceleration_settings(); |
|||
lv_draw_number_key(); |
|||
} |
|||
break; |
|||
case ID_ACCE_E0: |
|||
if (event == LV_EVENT_CLICKED) { |
|||
|
|||
} |
|||
else if (event == LV_EVENT_RELEASED) { |
|||
value = E0Acceleration; |
|||
lv_clear_acceleration_settings(); |
|||
lv_draw_number_key(); |
|||
} |
|||
break; |
|||
case ID_ACCE_E1: |
|||
if (event == LV_EVENT_CLICKED) { |
|||
|
|||
} |
|||
else if (event == LV_EVENT_RELEASED) { |
|||
value = E1Acceleration; |
|||
lv_clear_acceleration_settings(); |
|||
lv_draw_number_key(); |
|||
} |
|||
break; |
|||
case ID_ACCE_UP: |
|||
if (event == LV_EVENT_CLICKED) { |
|||
|
|||
} |
|||
else if (event == LV_EVENT_RELEASED) { |
|||
uiCfg.para_ui_page = 0; |
|||
lv_clear_acceleration_settings(); |
|||
lv_draw_acceleration_settings(); |
|||
} |
|||
break; |
|||
case ID_ACCE_DOWN: |
|||
if (event == LV_EVENT_CLICKED) { |
|||
|
|||
} |
|||
else if (event == LV_EVENT_RELEASED) { |
|||
uiCfg.para_ui_page = 1; |
|||
lv_clear_acceleration_settings(); |
|||
lv_draw_acceleration_settings(); |
|||
} |
|||
break; |
|||
} |
|||
} |
|||
|
|||
void lv_draw_acceleration_settings(void) { |
|||
lv_obj_t *buttonBack = NULL, *label_Back = NULL, *buttonTurnPage = NULL, *labelTurnPage = NULL; |
|||
lv_obj_t *buttonPrintText = NULL, *labelPrintText = NULL, *buttonPrintValue = NULL, *labelPrintValue = NULL; |
|||
lv_obj_t *buttonRetraText = NULL, *labelRetraText = NULL, *buttonRetraValue = NULL, *labelRetraValue = NULL; |
|||
lv_obj_t *buttonTravelText = NULL, *labelTravelText = NULL, *buttonTravelValue = NULL, *labelTravelValue = NULL; |
|||
lv_obj_t *buttonXText = NULL, *labelXText = NULL, *buttonXValue = NULL, *labelXValue = NULL; |
|||
lv_obj_t *buttonYText = NULL, *labelYText = NULL, *buttonYValue = NULL, *labelYValue = NULL; |
|||
lv_obj_t *buttonZText = NULL, *labelZText = NULL, *buttonZValue = NULL, *labelZValue = NULL; |
|||
lv_obj_t *buttonE0Text = NULL, *labelE0Text = NULL, *buttonE0Value = NULL, *labelE0Value = NULL; |
|||
lv_obj_t *buttonE1Text = NULL, *labelE1Text = NULL, *buttonE1Value = NULL, *labelE1Value = 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) { |
|||
disp_state_stack._disp_index++; |
|||
disp_state_stack._disp_state[disp_state_stack._disp_index] = ACCELERATION_UI; |
|||
} |
|||
disp_state = ACCELERATION_UI; |
|||
|
|||
scr = lv_obj_create(NULL, NULL); |
|||
|
|||
lv_obj_set_style(scr, &tft_style_scr); |
|||
lv_scr_load(scr); |
|||
lv_obj_clean(scr); |
|||
|
|||
lv_obj_t * title = lv_label_create(scr, NULL); |
|||
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_IMG_DECLARE(bmp_para_back); |
|||
// LV_IMG_DECLARE(bmp_para_arrow);
|
|||
LV_IMG_DECLARE(bmp_para_bank); |
|||
|
|||
if (uiCfg.para_ui_page != 1) { |
|||
buttonPrintText = lv_btn_create(scr, NULL); /*Add a button the current screen*/ |
|||
lv_obj_set_pos(buttonPrintText, PARA_UI_POS_X, PARA_UI_POS_Y); /*Set its position*/ |
|||
lv_obj_set_size(buttonPrintText, PARA_UI_VALUE_SIZE_X, PARA_UI_SIZE_Y); /*Set its size*/ |
|||
lv_obj_set_event_cb(buttonPrintText, event_handler); |
|||
lv_btn_set_style(buttonPrintText, LV_BTN_STYLE_REL, &tft_style_label_rel); /*Set the button's released style*/ |
|||
lv_btn_set_style(buttonPrintText, LV_BTN_STYLE_PR, &tft_style_label_pre); /*Set the button's pressed style*/ |
|||
lv_btn_set_layout(buttonPrintText, LV_LAYOUT_OFF); |
|||
labelPrintText = lv_label_create(buttonPrintText, NULL); /*Add a label to the button*/ |
|||
|
|||
buttonPrintValue = lv_imgbtn_create(scr, NULL); |
|||
lv_obj_set_pos(buttonPrintValue, PARA_UI_VALUE_POS_X, PARA_UI_POS_Y + PARA_UI_VALUE_V); |
|||
lv_obj_set_event_cb_mks(buttonPrintValue, event_handler, ID_ACCE_PRINT, "bmp_value_blank.bin", 0); |
|||
lv_imgbtn_set_src(buttonPrintValue, LV_BTN_STATE_REL, &bmp_para_bank); |
|||
lv_imgbtn_set_src(buttonPrintValue, LV_BTN_STATE_PR, &bmp_para_bank); |
|||
lv_imgbtn_set_style(buttonPrintValue, LV_BTN_STATE_PR, &style_para_value_pre); |
|||
lv_imgbtn_set_style(buttonPrintValue, LV_BTN_STATE_REL, &style_para_value_rel); |
|||
lv_btn_set_layout(buttonPrintValue, LV_LAYOUT_OFF); |
|||
labelPrintValue = lv_label_create(buttonPrintValue, NULL); |
|||
|
|||
line1 = lv_line_create(scr, NULL); |
|||
lv_ex_line(line1, line_points[0]); |
|||
|
|||
buttonRetraText = lv_btn_create(scr, NULL); /*Add a button the current screen*/ |
|||
lv_obj_set_pos(buttonRetraText, PARA_UI_POS_X, PARA_UI_POS_Y * 2); /*Set its position*/ |
|||
lv_obj_set_size(buttonRetraText, PARA_UI_VALUE_SIZE_X, PARA_UI_SIZE_Y); /*Set its size*/ |
|||
lv_obj_set_event_cb(buttonRetraText, event_handler); |
|||
lv_btn_set_style(buttonRetraText, LV_BTN_STYLE_REL, &tft_style_label_rel); /*Set the button's released style*/ |
|||
lv_btn_set_style(buttonRetraText, LV_BTN_STYLE_PR, &tft_style_label_pre); /*Set the button's pressed style*/ |
|||
lv_btn_set_layout(buttonRetraText, LV_LAYOUT_OFF); |
|||
labelRetraText = lv_label_create(buttonRetraText, NULL); /*Add a label to the button*/ |
|||
|
|||
buttonRetraValue = lv_imgbtn_create(scr, NULL); |
|||
lv_obj_set_pos(buttonRetraValue, PARA_UI_VALUE_POS_X, PARA_UI_POS_Y * 2 + PARA_UI_VALUE_V); |
|||
lv_obj_set_event_cb_mks(buttonRetraValue, event_handler, ID_ACCE_RETRA, "bmp_value_blank.bin", 0); |
|||
lv_imgbtn_set_src(buttonRetraValue, LV_BTN_STATE_REL, &bmp_para_bank); |
|||
lv_imgbtn_set_src(buttonRetraValue, LV_BTN_STATE_PR, &bmp_para_bank); |
|||
lv_imgbtn_set_style(buttonRetraValue, LV_BTN_STATE_PR, &style_para_value_pre); |
|||
lv_imgbtn_set_style(buttonRetraValue, LV_BTN_STATE_REL, &style_para_value_rel); |
|||
lv_btn_set_layout(buttonRetraValue, LV_LAYOUT_OFF); |
|||
labelRetraValue = lv_label_create(buttonRetraValue, NULL); |
|||
|
|||
line2 = lv_line_create(scr, NULL); |
|||
lv_ex_line(line2, line_points[1]); |
|||
|
|||
buttonTravelText = lv_btn_create(scr, NULL); /*Add a button the current screen*/ |
|||
lv_obj_set_pos(buttonTravelText, PARA_UI_POS_X, PARA_UI_POS_Y * 3); /*Set its position*/ |
|||
lv_obj_set_size(buttonTravelText, PARA_UI_VALUE_SIZE_X, PARA_UI_SIZE_Y); /*Set its size*/ |
|||
lv_obj_set_event_cb(buttonTravelText, event_handler); |
|||
lv_btn_set_style(buttonTravelText, LV_BTN_STYLE_REL, &tft_style_label_rel); /*Set the button's released style*/ |
|||
lv_btn_set_style(buttonTravelText, LV_BTN_STYLE_PR, &tft_style_label_pre); /*Set the button's pressed style*/ |
|||
lv_btn_set_layout(buttonTravelText, LV_LAYOUT_OFF); |
|||
labelTravelText = lv_label_create(buttonTravelText, NULL); /*Add a label to the button*/ |
|||
|
|||
buttonTravelValue = lv_imgbtn_create(scr, NULL); |
|||
lv_obj_set_pos(buttonTravelValue, PARA_UI_VALUE_POS_X, PARA_UI_POS_Y * 3 + PARA_UI_VALUE_V); |
|||
lv_obj_set_event_cb_mks(buttonTravelValue, event_handler, ID_ACCE_TRAVEL, "bmp_value_blank.bin", 0); |
|||
lv_imgbtn_set_src(buttonTravelValue, LV_BTN_STATE_REL, &bmp_para_bank); |
|||
lv_imgbtn_set_src(buttonTravelValue, LV_BTN_STATE_PR, &bmp_para_bank); |
|||
lv_imgbtn_set_style(buttonTravelValue, LV_BTN_STATE_PR, &style_para_value_pre); |
|||
lv_imgbtn_set_style(buttonTravelValue, LV_BTN_STATE_REL, &style_para_value_rel); |
|||
lv_btn_set_layout(buttonTravelValue, LV_LAYOUT_OFF); |
|||
labelTravelValue = lv_label_create(buttonTravelValue, NULL); |
|||
|
|||
line3 = lv_line_create(scr, NULL); |
|||
lv_ex_line(line3, line_points[2]); |
|||
|
|||
buttonXText = lv_btn_create(scr, NULL); /*Add a button the current screen*/ |
|||
lv_obj_set_pos(buttonXText, PARA_UI_POS_X, PARA_UI_POS_Y * 4); /*Set its position*/ |
|||
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*/ |
|||
|
|||
buttonXValue = lv_imgbtn_create(scr, NULL); |
|||
lv_obj_set_pos(buttonXValue, PARA_UI_VALUE_POS_X, PARA_UI_POS_Y * 4 + PARA_UI_VALUE_V); |
|||
lv_obj_set_event_cb_mks(buttonXValue, event_handler, ID_ACCE_X, "bmp_value_blank.bin", 0); |
|||
lv_imgbtn_set_src(buttonXValue, LV_BTN_STATE_REL, &bmp_para_bank); |
|||
lv_imgbtn_set_src(buttonXValue, LV_BTN_STATE_PR, &bmp_para_bank); |
|||
lv_imgbtn_set_style(buttonXValue, LV_BTN_STATE_PR, &style_para_value_pre); |
|||
lv_imgbtn_set_style(buttonXValue, LV_BTN_STATE_REL, &style_para_value_rel); |
|||
lv_btn_set_layout(buttonXValue, LV_LAYOUT_OFF); |
|||
labelXValue = lv_label_create(buttonXValue, NULL); |
|||
|
|||
line4 = lv_line_create(scr, NULL); |
|||
lv_ex_line(line4, line_points[3]); |
|||
|
|||
buttonTurnPage = lv_imgbtn_create(scr, NULL); |
|||
lv_obj_set_event_cb_mks(buttonTurnPage, event_handler, ID_ACCE_DOWN, "bmp_back70x40.bin", 0); |
|||
lv_imgbtn_set_src(buttonTurnPage, LV_BTN_STATE_REL, &bmp_para_back); |
|||
lv_imgbtn_set_src(buttonTurnPage, LV_BTN_STATE_PR, &bmp_para_back); |
|||
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); |
|||
} |
|||
else { |
|||
buttonYText = lv_btn_create(scr, NULL); /*Add a button the current screen*/ |
|||
lv_obj_set_pos(buttonYText, PARA_UI_POS_X, PARA_UI_POS_Y); /*Set its position*/ |
|||
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*/ |
|||
|
|||
buttonYValue = lv_imgbtn_create(scr, NULL); |
|||
lv_obj_set_pos(buttonYValue, PARA_UI_VALUE_POS_X, PARA_UI_POS_Y + PARA_UI_VALUE_V); |
|||
lv_obj_set_event_cb_mks(buttonYValue, event_handler, ID_ACCE_Y, "bmp_value_blank.bin", 0); |
|||
lv_imgbtn_set_src(buttonYValue, LV_BTN_STATE_REL, &bmp_para_bank); |
|||
lv_imgbtn_set_src(buttonYValue, LV_BTN_STATE_PR, &bmp_para_bank); |
|||
lv_imgbtn_set_style(buttonYValue, LV_BTN_STATE_PR, &style_para_value_pre); |
|||
lv_imgbtn_set_style(buttonYValue, LV_BTN_STATE_REL, &style_para_value_rel); |
|||
lv_btn_set_layout(buttonYValue, LV_LAYOUT_OFF); |
|||
labelYValue = lv_label_create(buttonYValue, NULL); |
|||
|
|||
line1 = lv_line_create(scr, NULL); |
|||
lv_ex_line(line1, line_points[0]); |
|||
|
|||
buttonZText = lv_btn_create(scr, NULL); /*Add a button the current screen*/ |
|||
lv_obj_set_pos(buttonZText, PARA_UI_POS_X, PARA_UI_POS_Y * 2); /*Set its position*/ |
|||
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*/ |
|||
|
|||
buttonZValue = lv_imgbtn_create(scr, NULL); |
|||
lv_obj_set_pos(buttonZValue, PARA_UI_VALUE_POS_X, PARA_UI_POS_Y * 2 + PARA_UI_VALUE_V); |
|||
lv_obj_set_event_cb_mks(buttonZValue, event_handler, ID_ACCE_Z, "bmp_value_blank.bin", 0); |
|||
lv_imgbtn_set_src(buttonZValue, LV_BTN_STATE_REL, &bmp_para_bank); |
|||
lv_imgbtn_set_src(buttonZValue, LV_BTN_STATE_PR, &bmp_para_bank); |
|||
lv_imgbtn_set_style(buttonZValue, LV_BTN_STATE_PR, &style_para_value_pre); |
|||
lv_imgbtn_set_style(buttonZValue, LV_BTN_STATE_REL, &style_para_value_rel); |
|||
lv_btn_set_layout(buttonZValue, LV_LAYOUT_OFF); |
|||
labelZValue = lv_label_create(buttonZValue, NULL); |
|||
|
|||
line2 = lv_line_create(scr, NULL); |
|||
lv_ex_line(line2, line_points[1]); |
|||
|
|||
buttonE0Text = lv_btn_create(scr, NULL); /*Add a button the current screen*/ |
|||
lv_obj_set_pos(buttonE0Text, PARA_UI_POS_X, PARA_UI_POS_Y * 3); /*Set its position*/ |
|||
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*/ |
|||
|
|||
buttonE0Value = lv_imgbtn_create(scr, NULL); |
|||
lv_obj_set_pos(buttonE0Value, PARA_UI_VALUE_POS_X, PARA_UI_POS_Y * 3 + PARA_UI_VALUE_V); |
|||
lv_obj_set_event_cb_mks(buttonE0Value, event_handler, ID_ACCE_E0, "bmp_value_blank.bin", 0); |
|||
lv_imgbtn_set_src(buttonE0Value, LV_BTN_STATE_REL, &bmp_para_bank); |
|||
lv_imgbtn_set_src(buttonE0Value, LV_BTN_STATE_PR, &bmp_para_bank); |
|||
lv_imgbtn_set_style(buttonE0Value, LV_BTN_STATE_PR, &style_para_value_pre); |
|||
lv_imgbtn_set_style(buttonE0Value, LV_BTN_STATE_REL, &style_para_value_rel); |
|||
lv_btn_set_layout(buttonE0Value, LV_LAYOUT_OFF); |
|||
labelE0Value = lv_label_create(buttonE0Value, NULL); |
|||
|
|||
line3 = lv_line_create(scr, NULL); |
|||
lv_ex_line(line3, line_points[2]); |
|||
|
|||
buttonE1Text = lv_btn_create(scr, NULL); /*Add a button the current screen*/ |
|||
lv_obj_set_pos(buttonE1Text, PARA_UI_POS_X, PARA_UI_POS_Y * 4); /*Set its position*/ |
|||
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*/ |
|||
|
|||
buttonE1Value = lv_imgbtn_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_event_cb_mks(buttonE1Value, event_handler, ID_ACCE_E1, "bmp_value_blank.bin", 0); |
|||
lv_imgbtn_set_src(buttonE1Value, LV_BTN_STATE_REL, &bmp_para_bank); |
|||
lv_imgbtn_set_src(buttonE1Value, LV_BTN_STATE_PR, &bmp_para_bank); |
|||
lv_imgbtn_set_style(buttonE1Value, LV_BTN_STATE_PR, &style_para_value_pre); |
|||
lv_imgbtn_set_style(buttonE1Value, LV_BTN_STATE_REL, &style_para_value_rel); |
|||
lv_btn_set_layout(buttonE1Value, LV_LAYOUT_OFF); |
|||
labelE1Value = lv_label_create(buttonE1Value, NULL); |
|||
|
|||
line4 = lv_line_create(scr, NULL); |
|||
lv_ex_line(line4, line_points[3]); |
|||
|
|||
buttonTurnPage = lv_imgbtn_create(scr, NULL); |
|||
lv_obj_set_event_cb_mks(buttonTurnPage, event_handler, ID_ACCE_UP, "bmp_back70x40.bin", 0); |
|||
lv_imgbtn_set_src(buttonTurnPage, LV_BTN_STATE_REL, &bmp_para_back); |
|||
lv_imgbtn_set_src(buttonTurnPage, LV_BTN_STATE_PR, &bmp_para_back); |
|||
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_obj_set_pos(buttonTurnPage, PARA_UI_TURN_PAGE_POS_X, PARA_UI_TURN_PAGE_POS_Y); |
|||
lv_btn_set_layout(buttonTurnPage, LV_LAYOUT_OFF); |
|||
labelTurnPage = lv_label_create(buttonTurnPage, NULL); |
|||
|
|||
buttonBack = lv_imgbtn_create(scr, NULL); |
|||
lv_obj_set_event_cb_mks(buttonBack, event_handler, ID_ACCE_RETURN, "bmp_back70x40.bin", 0); |
|||
lv_imgbtn_set_src(buttonBack, LV_BTN_STATE_REL, &bmp_para_back); |
|||
lv_imgbtn_set_src(buttonBack, LV_BTN_STATE_PR, &bmp_para_back); |
|||
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 != 0) { |
|||
if (uiCfg.para_ui_page != 1) { |
|||
lv_label_set_text(labelPrintText, machine_menu.PrintAcceleration); |
|||
lv_obj_align(labelPrintText, buttonPrintText, LV_ALIGN_IN_LEFT_MID, 0, 0); |
|||
|
|||
lv_label_set_text(labelRetraText, machine_menu.RetractAcceleration); |
|||
lv_obj_align(labelRetraText, buttonRetraText, LV_ALIGN_IN_LEFT_MID, 0, 0); |
|||
|
|||
lv_label_set_text(labelTravelText, machine_menu.TravelAcceleration); |
|||
lv_obj_align(labelTravelText, buttonTravelText, LV_ALIGN_IN_LEFT_MID, 0, 0); |
|||
|
|||
lv_label_set_text(labelXText, machine_menu.X_Acceleration); |
|||
lv_obj_align(labelXText, buttonXText, LV_ALIGN_IN_LEFT_MID, 0, 0); |
|||
|
|||
lv_label_set_text(labelTurnPage, machine_menu.next); |
|||
lv_obj_align(labelTurnPage, buttonTurnPage, LV_ALIGN_CENTER, 0, 0); |
|||
|
|||
ZERO(public_buf_l); |
|||
sprintf_P(public_buf_l, PSTR("%.1f"), planner.settings.acceleration); |
|||
lv_label_set_text(labelPrintValue, public_buf_l); |
|||
lv_obj_align(labelPrintValue, buttonPrintValue, LV_ALIGN_CENTER, 0, 0); |
|||
|
|||
ZERO(public_buf_l); |
|||
sprintf_P(public_buf_l, PSTR("%.1f"), planner.settings.retract_acceleration); |
|||
lv_label_set_text(labelRetraValue, public_buf_l); |
|||
lv_obj_align(labelRetraValue, buttonRetraValue, LV_ALIGN_CENTER, 0, 0); |
|||
|
|||
ZERO(public_buf_l); |
|||
sprintf_P(public_buf_l, PSTR("%.1f"), planner.settings.travel_acceleration); |
|||
lv_label_set_text(labelTravelValue, public_buf_l); |
|||
lv_obj_align(labelTravelValue, buttonTravelValue, LV_ALIGN_CENTER, 0, 0); |
|||
|
|||
ZERO(public_buf_l); |
|||
sprintf_P(public_buf_l, PSTR("%d"), (int)planner.settings.max_acceleration_mm_per_s2[X_AXIS]); |
|||
lv_label_set_text(labelXValue, public_buf_l); |
|||
lv_obj_align(labelXValue, buttonXValue, LV_ALIGN_CENTER, 0, 0); |
|||
} |
|||
else { |
|||
lv_label_set_text(labelYText, machine_menu.Y_Acceleration); |
|||
lv_obj_align(labelYText, buttonYText, LV_ALIGN_IN_LEFT_MID, 0, 0); |
|||
|
|||
lv_label_set_text(labelZText, machine_menu.Z_Acceleration); |
|||
lv_obj_align(labelZText, buttonZText, LV_ALIGN_IN_LEFT_MID, 0, 0); |
|||
|
|||
lv_label_set_text(labelE0Text, machine_menu.E0_Acceleration); |
|||
lv_obj_align(labelE0Text, buttonE0Text, LV_ALIGN_IN_LEFT_MID, 0, 0); |
|||
|
|||
lv_label_set_text(labelE1Text, machine_menu.E1_Acceleration); |
|||
lv_obj_align(labelE1Text, buttonE1Text, LV_ALIGN_IN_LEFT_MID, 0, 0); |
|||
|
|||
lv_label_set_text(labelTurnPage, machine_menu.previous); |
|||
lv_obj_align(labelTurnPage, buttonTurnPage, LV_ALIGN_CENTER, 0, 0); |
|||
ZERO(public_buf_l); |
|||
sprintf_P(public_buf_l, PSTR("%d"), (int)planner.settings.max_acceleration_mm_per_s2[Y_AXIS]); |
|||
lv_label_set_text(labelYValue, public_buf_l); |
|||
lv_obj_align(labelYValue, buttonYValue, LV_ALIGN_CENTER, 0, 0); |
|||
|
|||
ZERO(public_buf_l); |
|||
sprintf_P(public_buf_l, PSTR("%d"), (int)planner.settings.max_acceleration_mm_per_s2[Z_AXIS]); |
|||
lv_label_set_text(labelZValue, public_buf_l); |
|||
lv_obj_align(labelZValue, buttonZValue, LV_ALIGN_CENTER, 0, 0); |
|||
|
|||
ZERO(public_buf_l); |
|||
sprintf_P(public_buf_l, PSTR("%d"), (int)planner.settings.max_acceleration_mm_per_s2[E_AXIS]); |
|||
lv_label_set_text(labelE0Value, public_buf_l); |
|||
lv_obj_align(labelE0Value, buttonE0Value, LV_ALIGN_CENTER, 0, 0); |
|||
|
|||
ZERO(public_buf_l); |
|||
sprintf_P(public_buf_l, PSTR("%d"), (int)planner.settings.max_acceleration_mm_per_s2[E_AXIS_N(1)]); |
|||
lv_label_set_text(labelE1Value, public_buf_l); |
|||
lv_obj_align(labelE1Value, buttonE1Value, LV_ALIGN_CENTER, 0, 0); |
|||
} |
|||
|
|||
lv_label_set_text(label_Back, common_menu.text_back); |
|||
lv_obj_align(label_Back, buttonBack, LV_ALIGN_CENTER, 0, 0); |
|||
} |
|||
} |
|||
|
|||
void lv_clear_acceleration_settings() { lv_obj_del(scr); } |
|||
|
|||
#endif // HAS_TFT_LVGL_UI
|
@ -0,0 +1,33 @@ |
|||
/**
|
|||
* Marlin 3D Printer Firmware |
|||
* Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
|||
* |
|||
* Based on Sprinter and grbl. |
|||
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm |
|||
* |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|||
* |
|||
*/ |
|||
#pragma once |
|||
|
|||
#ifdef __cplusplus |
|||
extern "C" { /* C-declarations for C++ */ |
|||
#endif |
|||
|
|||
extern void lv_draw_acceleration_settings(void); |
|||
extern void lv_clear_acceleration_settings(); |
|||
|
|||
#ifdef __cplusplus |
|||
} /* C-declarations for C++ */ |
|||
#endif |
@ -0,0 +1,140 @@ |
|||
/**
|
|||
* Marlin 3D Printer Firmware |
|||
* Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
|||
* |
|||
* Based on Sprinter and grbl. |
|||
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm |
|||
* |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|||
* |
|||
*/ |
|||
#include "../../../../inc/MarlinConfigPre.h" |
|||
|
|||
#if HAS_TFT_LVGL_UI |
|||
|
|||
#include "lv_conf.h" |
|||
#include "draw_ui.h" |
|||
|
|||
#include "../../../../MarlinCore.h" |
|||
|
|||
static lv_obj_t * scr; |
|||
|
|||
#define ID_ADVANCE_RETURN 1 |
|||
#define ID_PAUSE_POS 2 |
|||
#define ID_PAUSE_POS_ARROW 3 |
|||
|
|||
static void event_handler(lv_obj_t * obj, lv_event_t event) { |
|||
switch (obj->mks_obj_id) { |
|||
case ID_ADVANCE_RETURN: |
|||
if (event == LV_EVENT_CLICKED) { |
|||
|
|||
} |
|||
else if (event == LV_EVENT_RELEASED) { |
|||
lv_clear_advance_settings(); |
|||
draw_return_ui(); |
|||
} |
|||
break; |
|||
case ID_PAUSE_POS: |
|||
if (event == LV_EVENT_CLICKED) { |
|||
|
|||
} |
|||
else if (event == LV_EVENT_RELEASED) { |
|||
lv_clear_advance_settings(); |
|||
lv_draw_pause_position(); |
|||
} |
|||
break; |
|||
case ID_PAUSE_POS_ARROW: |
|||
if (event == LV_EVENT_CLICKED) { |
|||
|
|||
} |
|||
else if (event == LV_EVENT_RELEASED) { |
|||
lv_clear_advance_settings(); |
|||
lv_draw_pause_position(); |
|||
} |
|||
break; |
|||
} |
|||
} |
|||
|
|||
void lv_draw_advance_settings(void) { |
|||
lv_obj_t *buttonBack, *label_Back; |
|||
lv_obj_t *buttonPausePos, *labelPausePos, *buttonPausePosNarrow; |
|||
lv_obj_t * line1; |
|||
if (disp_state_stack._disp_state[disp_state_stack._disp_index] != ADVANCED_UI) { |
|||
disp_state_stack._disp_index++; |
|||
disp_state_stack._disp_state[disp_state_stack._disp_index] = ADVANCED_UI; |
|||
} |
|||
disp_state = ADVANCED_UI; |
|||
|
|||
scr = lv_obj_create(NULL, NULL); |
|||
|
|||
lv_obj_set_style(scr, &tft_style_scr); |
|||
lv_scr_load(scr); |
|||
lv_obj_clean(scr); |
|||
|
|||
lv_obj_t * title = lv_label_create(scr, NULL); |
|||
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_IMG_DECLARE(bmp_para_back); |
|||
LV_IMG_DECLARE(bmp_para_arrow); |
|||
|
|||
buttonPausePos = lv_btn_create(scr, NULL); /*Add a button the current screen*/ |
|||
lv_obj_set_pos(buttonPausePos, PARA_UI_POS_X, PARA_UI_POS_Y); /*Set its position*/ |
|||
lv_obj_set_size(buttonPausePos, PARA_UI_SIZE_X, PARA_UI_SIZE_Y); /*Set its size*/ |
|||
// lv_obj_set_event_cb(buttonMachine, event_handler);
|
|||
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); /*Set the button's released style*/ |
|||
lv_btn_set_style(buttonPausePos, LV_BTN_STYLE_PR, &tft_style_label_pre); /*Set the button's pressed style*/ |
|||
lv_btn_set_layout(buttonPausePos, LV_LAYOUT_OFF); |
|||
labelPausePos = lv_label_create(buttonPausePos, NULL); /*Add a label to the button*/ |
|||
|
|||
buttonPausePosNarrow = lv_imgbtn_create(scr, NULL); |
|||
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, "bmp_arrow.bin", 0); |
|||
lv_imgbtn_set_src(buttonPausePosNarrow, LV_BTN_STATE_REL, &bmp_para_arrow); |
|||
lv_imgbtn_set_src(buttonPausePosNarrow, LV_BTN_STATE_PR, &bmp_para_arrow); |
|||
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); |
|||
lv_ex_line(line1, line_points[0]); |
|||
|
|||
buttonBack = lv_imgbtn_create(scr, NULL); |
|||
lv_obj_set_event_cb_mks(buttonBack, event_handler, ID_ADVANCE_RETURN, "bmp_back70x40.bin", 0); |
|||
lv_imgbtn_set_src(buttonBack, LV_BTN_STATE_REL, &bmp_para_back); |
|||
lv_imgbtn_set_src(buttonBack, LV_BTN_STATE_PR, &bmp_para_back); |
|||
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 != 0) { |
|||
lv_label_set_text(label_Back, common_menu.text_back); |
|||
lv_obj_align(label_Back, buttonBack, LV_ALIGN_CENTER, 0, 0); |
|||
|
|||
lv_label_set_text(labelPausePos, machine_menu.PausePosition); |
|||
lv_obj_align(labelPausePos, buttonPausePos, LV_ALIGN_IN_LEFT_MID, 0, 0); |
|||
} |
|||
|
|||
} |
|||
|
|||
void lv_clear_advance_settings() { lv_obj_del(scr); } |
|||
|
|||
#endif // HAS_TFT_LVGL_UI
|
@ -0,0 +1,33 @@ |
|||
/**
|
|||
* Marlin 3D Printer Firmware |
|||
* Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
|||
* |
|||
* Based on Sprinter and grbl. |
|||
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm |
|||
* |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|||
* |
|||
*/ |
|||
#pragma once |
|||
|
|||
#ifdef __cplusplus |
|||
extern "C" { /* C-declarations for C++ */ |
|||
#endif |
|||
|
|||
extern void lv_draw_advance_settings(void); |
|||
extern void lv_clear_advance_settings(); |
|||
|
|||
#ifdef __cplusplus |
|||
} /* C-declarations for C++ */ |
|||
#endif |
@ -0,0 +1,237 @@ |
|||
/**
|
|||
* Marlin 3D Printer Firmware |
|||
* Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
|||
* |
|||
* Based on Sprinter and grbl. |
|||
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm |
|||
* |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|||
* |
|||
*/ |
|||
#include "../../../../inc/MarlinConfigPre.h" |
|||
|
|||
#if HAS_TFT_LVGL_UI |
|||
|
|||
#include "lv_conf.h" |
|||
#include "draw_ui.h" |
|||
|
|||
#include "../../../../MarlinCore.h" |
|||
|
|||
static lv_obj_t * scr; |
|||
|
|||
#define ID_EEPROM_RETURN 1 |
|||
#define ID_EEPROM_STORE 2 |
|||
#define ID_EEPROM_STORE_ARROW 3 |
|||
#define ID_EEPROM_READ 4 |
|||
#define ID_EEPROM_READ_ARROW 5 |
|||
#define ID_EEPROM_REVERT 6 |
|||
#define ID_EEPROM_REVERT_ARROW 7 |
|||
|
|||
static void event_handler(lv_obj_t * obj, lv_event_t event) { |
|||
switch (obj->mks_obj_id) { |
|||
case ID_EEPROM_RETURN: |
|||
if (event == LV_EVENT_CLICKED) { |
|||
} |
|||
else if (event == LV_EVENT_RELEASED) { |
|||
lv_clear_eeprom_settings(); |
|||
draw_return_ui(); |
|||
} |
|||
break; |
|||
|
|||
#if 0 |
|||
case ID_EEPROM_STORE: |
|||
if (event == LV_EVENT_CLICKED) { |
|||
|
|||
} |
|||
else if (event == LV_EVENT_RELEASED) { |
|||
lv_clear_eeprom_settings(); |
|||
lv_draw_dialog(DIALOG_STORE_EEPROM_TIPS); |
|||
} |
|||
break; |
|||
case ID_EEPROM_STORE_ARROW: |
|||
if (event == LV_EVENT_CLICKED) { |
|||
|
|||
} |
|||
else if (event == LV_EVENT_RELEASED) { |
|||
lv_clear_eeprom_settings(); |
|||
lv_draw_dialog(DIALOG_STORE_EEPROM_TIPS); |
|||
} |
|||
break; |
|||
case ID_EEPROM_READ: |
|||
if (event == LV_EVENT_CLICKED) { |
|||
|
|||
} |
|||
else if (event == LV_EVENT_RELEASED) { |
|||
lv_clear_eeprom_settings(); |
|||
lv_draw_dialog(DIALOG_READ_EEPROM_TIPS); |
|||
} |
|||
break; |
|||
case ID_EEPROM_READ_ARROW: |
|||
if (event == LV_EVENT_CLICKED) { |
|||
|
|||
} |
|||
else if (event == LV_EVENT_RELEASED) { |
|||
lv_clear_eeprom_settings(); |
|||
lv_draw_dialog(DIALOG_READ_EEPROM_TIPS); |
|||
} |
|||
break; |
|||
#endif |
|||
|
|||
case ID_EEPROM_REVERT: |
|||
if (event == LV_EVENT_CLICKED) { |
|||
|
|||
} |
|||
else if (event == LV_EVENT_RELEASED) { |
|||
lv_clear_eeprom_settings(); |
|||
lv_draw_dialog(DIALOG_REVERT_EEPROM_TIPS); |
|||
} |
|||
break; |
|||
case ID_EEPROM_REVERT_ARROW: |
|||
if (event == LV_EVENT_CLICKED) { |
|||
|
|||
} |
|||
else if (event == LV_EVENT_RELEASED) { |
|||
lv_clear_eeprom_settings(); |
|||
lv_draw_dialog(DIALOG_REVERT_EEPROM_TIPS); |
|||
} |
|||
break; |
|||
} |
|||
} |
|||
|
|||
void lv_draw_eeprom_settings(void) { |
|||
lv_obj_t *buttonBack, *label_Back; |
|||
//lv_obj_t *buttonStore,*labelStore,*buttonStoreNarrow;
|
|||
//lv_obj_t *buttonRead,*labelRead,*buttonReadNarrow;
|
|||
lv_obj_t *buttonRevert, *labelRevert, *buttonRevertNarrow; |
|||
lv_obj_t * line1; // * line2,* line3;
|
|||
if (disp_state_stack._disp_state[disp_state_stack._disp_index] != EEPROM_SETTINGS_UI) { |
|||
disp_state_stack._disp_index++; |
|||
disp_state_stack._disp_state[disp_state_stack._disp_index] = EEPROM_SETTINGS_UI; |
|||
} |
|||
disp_state = EEPROM_SETTINGS_UI; |
|||
|
|||
scr = lv_obj_create(NULL, NULL); |
|||
|
|||
lv_obj_set_style(scr, &tft_style_scr); |
|||
lv_scr_load(scr); |
|||
lv_obj_clean(scr); |
|||
|
|||
lv_obj_t * title = lv_label_create(scr, NULL); |
|||
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_IMG_DECLARE(bmp_para_back); |
|||
LV_IMG_DECLARE(bmp_para_arrow); |
|||
#if 0 |
|||
buttonStore = lv_btn_create(scr, NULL); /*Add a button the current screen*/ |
|||
lv_obj_set_pos(buttonStore, PARA_UI_POS_X, PARA_UI_POS_Y); /*Set its position*/ |
|||
lv_obj_set_size(buttonStore, PARA_UI_SIZE_X, PARA_UI_SIZE_Y); /*Set its size*/ |
|||
//lv_obj_set_event_cb(buttonMachine, event_handler);
|
|||
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_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); |
|||
labelStore = lv_label_create(buttonStore, NULL); /*Add a label to the button*/ |
|||
|
|||
buttonStoreNarrow = lv_imgbtn_create(scr, NULL); |
|||
lv_obj_set_pos(buttonStoreNarrow, PARA_UI_POS_X + PARA_UI_SIZE_X, PARA_UI_POS_Y + PARA_UI_ARROW_V); |
|||
lv_obj_set_event_cb_mks(buttonStoreNarrow, event_handler, ID_EEPROM_STORE_ARROW, "bmp_arrow.bin", 0); |
|||
lv_imgbtn_set_src(buttonStoreNarrow, LV_BTN_STATE_REL, &bmp_para_arrow); |
|||
lv_imgbtn_set_src(buttonStoreNarrow, LV_BTN_STATE_PR, &bmp_para_arrow); |
|||
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); |
|||
|
|||
line1 = lv_line_create(scr, NULL); |
|||
lv_ex_line(line1, line_points[0]); |
|||
|
|||
buttonRead = lv_btn_create(scr, NULL); /*Add a button the current screen*/ |
|||
lv_obj_set_pos(buttonRead, PARA_UI_POS_X, PARA_UI_POS_Y * 2); /*Set its position*/ |
|||
lv_obj_set_size(buttonRead, PARA_UI_SIZE_X, PARA_UI_SIZE_Y); /*Set its size*/ |
|||
//lv_obj_set_event_cb(buttonMotor, event_handler);
|
|||
lv_obj_set_event_cb_mks(buttonRead, event_handler, ID_EEPROM_READ, NULL, 0); |
|||
lv_btn_set_style(buttonRead, LV_BTN_STYLE_REL, &tft_style_label_rel); /*Set the button's released style*/ |
|||
lv_btn_set_style(buttonRead, LV_BTN_STYLE_PR, &tft_style_label_pre); /*Set the button's pressed style*/ |
|||
lv_btn_set_layout(buttonRead, LV_LAYOUT_OFF); |
|||
labelRead = lv_label_create(buttonRead, NULL); /*Add a label to the button*/ |
|||
|
|||
buttonReadNarrow = lv_imgbtn_create(scr, NULL); |
|||
lv_obj_set_pos(buttonReadNarrow, PARA_UI_POS_X + PARA_UI_SIZE_X, PARA_UI_POS_Y * 2 + PARA_UI_ARROW_V); |
|||
lv_obj_set_event_cb_mks(buttonReadNarrow, event_handler, ID_EEPROM_READ_ARROW, "bmp_arrow.bin", 0); |
|||
lv_imgbtn_set_src(buttonReadNarrow, LV_BTN_STATE_REL, &bmp_para_arrow); |
|||
lv_imgbtn_set_src(buttonReadNarrow, LV_BTN_STATE_PR, &bmp_para_arrow); |
|||
lv_imgbtn_set_style(buttonReadNarrow, LV_BTN_STATE_PR, &tft_style_label_pre); |
|||
lv_imgbtn_set_style(buttonReadNarrow, LV_BTN_STATE_REL, &tft_style_label_rel); |
|||
lv_btn_set_layout(buttonReadNarrow, LV_LAYOUT_OFF); |
|||
|
|||
line2 = lv_line_create(scr, NULL); |
|||
lv_ex_line(line2, line_points[1]); |
|||
#endif // if 0
|
|||
buttonRevert = lv_btn_create(scr, NULL); /*Add a button the current screen*/ |
|||
lv_obj_set_pos(buttonRevert, PARA_UI_POS_X, PARA_UI_POS_Y); /*Set its position*/ |
|||
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_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_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); |
|||
labelRevert = lv_label_create(buttonRevert, NULL); /*Add a label to the button*/ |
|||
|
|||
buttonRevertNarrow = lv_imgbtn_create(scr, NULL); |
|||
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, "bmp_arrow.bin", 0); |
|||
lv_imgbtn_set_src(buttonRevertNarrow, LV_BTN_STATE_REL, &bmp_para_arrow); |
|||
lv_imgbtn_set_src(buttonRevertNarrow, LV_BTN_STATE_PR, &bmp_para_arrow); |
|||
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);
|
|||
//lv_ex_line(line3,line_points[2]);
|
|||
line1 = lv_line_create(scr, NULL); |
|||
lv_ex_line(line1, line_points[0]); |
|||
|
|||
buttonBack = lv_imgbtn_create(scr, NULL); |
|||
lv_obj_set_event_cb_mks(buttonBack, event_handler, ID_EEPROM_RETURN, "bmp_back70x40.bin", 0); |
|||
lv_imgbtn_set_src(buttonBack, LV_BTN_STATE_REL, &bmp_para_back); |
|||
lv_imgbtn_set_src(buttonBack, LV_BTN_STATE_PR, &bmp_para_back); |
|||
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 != 0) { |
|||
lv_label_set_text(label_Back, common_menu.text_back); |
|||
lv_obj_align(label_Back, buttonBack, LV_ALIGN_CENTER, 0, 0); |
|||
|
|||
//lv_label_set_text(labelStore, eeprom_menu.store);
|
|||
//lv_obj_align(labelStore, buttonStore, LV_ALIGN_IN_LEFT_MID,0, 0);
|
|||
|
|||
//lv_label_set_text(labelRead, eeprom_menu.read);
|
|||
//lv_obj_align(labelRead, buttonRead, LV_ALIGN_IN_LEFT_MID,0, 0);
|
|||
|
|||
lv_label_set_text(labelRevert, eeprom_menu.revert); |
|||
lv_obj_align(labelRevert, buttonRevert, LV_ALIGN_IN_LEFT_MID, 0, 0); |
|||
} |
|||
|
|||
} |
|||
|
|||
void lv_clear_eeprom_settings() { lv_obj_del(scr); } |
|||
|
|||
#endif // HAS_TFT_LVGL_UI
|
@ -0,0 +1,33 @@ |
|||
/**
|
|||
* Marlin 3D Printer Firmware |
|||
* Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
|||
* |
|||
* Based on Sprinter and grbl. |
|||
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm |
|||
* |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|||
* |
|||
*/ |
|||
#pragma once |
|||
|
|||
#ifdef __cplusplus |
|||
extern "C" { /* C-declarations for C++ */ |
|||
#endif |
|||
|
|||
extern void lv_draw_eeprom_settings(void); |
|||
extern void lv_clear_eeprom_settings(); |
|||
|
|||
#ifdef __cplusplus |
|||
} /* C-declarations for C++ */ |
|||
#endif |
@ -0,0 +1,263 @@ |
|||
/**
|
|||
* Marlin 3D Printer Firmware |
|||
* Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
|||
* |
|||
* Based on Sprinter and grbl. |
|||
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm |
|||
* |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|||
* |
|||
*/ |
|||
#include "../../../../inc/MarlinConfigPre.h" |
|||
|
|||
#if BOTH(HAS_TFT_LVGL_UI, HAS_CLASSIC_JERK) |
|||
|
|||
#include "lv_conf.h" |
|||
#include "draw_ui.h" |
|||
|
|||
#include "../../../../MarlinCore.h" |
|||
#include "../../../../module/planner.h" |
|||
|
|||
static lv_obj_t * scr; |
|||
|
|||
#define ID_JERK_RETURN 1 |
|||
#define ID_JERK_X 2 |
|||
#define ID_JERK_Y 3 |
|||
#define ID_JERK_Z 4 |
|||
#define ID_JERK_E 5 |
|||
|
|||
static void event_handler(lv_obj_t * obj, lv_event_t event) { |
|||
switch (obj->mks_obj_id) { |
|||
case ID_JERK_RETURN: |
|||
if (event == LV_EVENT_CLICKED) { |
|||
|
|||
} |
|||
else if (event == LV_EVENT_RELEASED) { |
|||
lv_clear_jerk_settings(); |
|||
draw_return_ui(); |
|||
} |
|||
break; |
|||
case ID_JERK_X: |
|||
if (event == LV_EVENT_CLICKED) { |
|||
|
|||
} |
|||
else if (event == LV_EVENT_RELEASED) { |
|||
value = XJerk; |
|||
lv_clear_jerk_settings(); |
|||
lv_draw_number_key(); |
|||
} |
|||
break; |
|||
case ID_JERK_Y: |
|||
if (event == LV_EVENT_CLICKED) { |
|||
|
|||
} |
|||
else if (event == LV_EVENT_RELEASED) { |
|||
value = YJerk; |
|||
lv_clear_jerk_settings(); |
|||
lv_draw_number_key(); |
|||
} |
|||
break; |
|||
case ID_JERK_Z: |
|||
if (event == LV_EVENT_CLICKED) { |
|||
|
|||
} |
|||
else if (event == LV_EVENT_RELEASED) { |
|||
value = ZJerk; |
|||
lv_clear_jerk_settings(); |
|||
lv_draw_number_key(); |
|||
} |
|||
break; |
|||
case ID_JERK_E: |
|||
if (event == LV_EVENT_CLICKED) { |
|||
|
|||
} |
|||
else if (event == LV_EVENT_RELEASED) { |
|||
value = EJerk; |
|||
lv_clear_jerk_settings(); |
|||
lv_draw_number_key(); |
|||
} |
|||
break; |
|||
} |
|||
} |
|||
|
|||
void lv_draw_jerk_settings(void) { |
|||
lv_obj_t *buttonBack = NULL, *label_Back = NULL; |
|||
lv_obj_t *buttonXText = NULL, *labelXText = NULL, *buttonXValue = NULL, *labelXValue = NULL; |
|||
lv_obj_t *buttonYText = NULL, *labelYText = NULL, *buttonYValue = NULL, *labelYValue = NULL; |
|||
lv_obj_t *buttonZText = NULL, *labelZText = NULL, *buttonZValue = NULL, *labelZValue = NULL; |
|||
lv_obj_t *buttonEText = NULL, *labelEText = NULL, *buttonEValue = NULL, *labelEValue = 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) { |
|||
disp_state_stack._disp_index++; |
|||
disp_state_stack._disp_state[disp_state_stack._disp_index] = JERK_UI; |
|||
} |
|||
disp_state = JERK_UI; |
|||
|
|||
scr = lv_obj_create(NULL, NULL); |
|||
|
|||
lv_obj_set_style(scr, &tft_style_scr); |
|||
lv_scr_load(scr); |
|||
lv_obj_clean(scr); |
|||
|
|||
lv_obj_t * title = lv_label_create(scr, NULL); |
|||
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_IMG_DECLARE(bmp_para_back); |
|||
// LV_IMG_DECLARE(bmp_para_arrow);
|
|||
LV_IMG_DECLARE(bmp_para_bank); |
|||
|
|||
buttonXText = lv_btn_create(scr, NULL); /*Add a button the current screen*/ |
|||
lv_obj_set_pos(buttonXText, PARA_UI_POS_X, PARA_UI_POS_Y); /*Set its position*/ |
|||
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*/ |
|||
|
|||
buttonXValue = lv_imgbtn_create(scr, NULL); |
|||
lv_obj_set_pos(buttonXValue, PARA_UI_VALUE_POS_X, PARA_UI_POS_Y + PARA_UI_VALUE_V); |
|||
lv_obj_set_event_cb_mks(buttonXValue, event_handler, ID_JERK_X, "bmp_value_blank.bin", 0); |
|||
lv_imgbtn_set_src(buttonXValue, LV_BTN_STATE_REL, &bmp_para_bank); |
|||
lv_imgbtn_set_src(buttonXValue, LV_BTN_STATE_PR, &bmp_para_bank); |
|||
lv_imgbtn_set_style(buttonXValue, LV_BTN_STATE_PR, &style_para_value_pre); |
|||
lv_imgbtn_set_style(buttonXValue, LV_BTN_STATE_REL, &style_para_value_rel); |
|||
lv_btn_set_layout(buttonXValue, LV_LAYOUT_OFF); |
|||
labelXValue = lv_label_create(buttonXValue, NULL); |
|||
|
|||
line1 = lv_line_create(scr, NULL); |
|||
lv_ex_line(line1, line_points[0]); |
|||
|
|||
buttonYText = lv_btn_create(scr, NULL); /*Add a button the current screen*/ |
|||
lv_obj_set_pos(buttonYText, PARA_UI_POS_X, PARA_UI_POS_Y * 2); /*Set its position*/ |
|||
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*/ |
|||
|
|||
buttonYValue = lv_imgbtn_create(scr, NULL); |
|||
lv_obj_set_pos(buttonYValue, PARA_UI_VALUE_POS_X, PARA_UI_POS_Y * 2 + PARA_UI_VALUE_V); |
|||
lv_obj_set_event_cb_mks(buttonYValue, event_handler, ID_JERK_Y, "bmp_value_blank.bin", 0); |
|||
lv_imgbtn_set_src(buttonYValue, LV_BTN_STATE_REL, &bmp_para_bank); |
|||
lv_imgbtn_set_src(buttonYValue, LV_BTN_STATE_PR, &bmp_para_bank); |
|||
lv_imgbtn_set_style(buttonYValue, LV_BTN_STATE_PR, &style_para_value_pre); |
|||
lv_imgbtn_set_style(buttonYValue, LV_BTN_STATE_REL, &style_para_value_rel); |
|||
lv_btn_set_layout(buttonYValue, LV_LAYOUT_OFF); |
|||
labelYValue = lv_label_create(buttonYValue, NULL); |
|||
|
|||
line2 = lv_line_create(scr, NULL); |
|||
lv_ex_line(line2, line_points[1]); |
|||
|
|||
buttonZText = lv_btn_create(scr, NULL); /*Add a button the current screen*/ |
|||
lv_obj_set_pos(buttonZText, PARA_UI_POS_X, PARA_UI_POS_Y * 3); /*Set its position*/ |
|||
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*/ |
|||
|
|||
buttonZValue = lv_imgbtn_create(scr, NULL); |
|||
lv_obj_set_pos(buttonZValue, PARA_UI_VALUE_POS_X, PARA_UI_POS_Y * 3 + PARA_UI_VALUE_V); |
|||
lv_obj_set_event_cb_mks(buttonZValue, event_handler, ID_JERK_Z, "bmp_value_blank.bin", 0); |
|||
lv_imgbtn_set_src(buttonZValue, LV_BTN_STATE_REL, &bmp_para_bank); |
|||
lv_imgbtn_set_src(buttonZValue, LV_BTN_STATE_PR, &bmp_para_bank); |
|||
lv_imgbtn_set_style(buttonZValue, LV_BTN_STATE_PR, &style_para_value_pre); |
|||
lv_imgbtn_set_style(buttonZValue, LV_BTN_STATE_REL, &style_para_value_rel); |
|||
lv_btn_set_layout(buttonZValue, LV_LAYOUT_OFF); |
|||
labelZValue = lv_label_create(buttonZValue, NULL); |
|||
|
|||
line3 = lv_line_create(scr, NULL); |
|||
lv_ex_line(line3, line_points[2]); |
|||
|
|||
buttonEText = lv_btn_create(scr, NULL); /*Add a button the current screen*/ |
|||
lv_obj_set_pos(buttonEText, PARA_UI_POS_X, PARA_UI_POS_Y * 4); /*Set its position*/ |
|||
lv_obj_set_size(buttonEText, PARA_UI_VALUE_SIZE_X, PARA_UI_SIZE_Y); /*Set its size*/ |
|||
lv_obj_set_event_cb(buttonEText, event_handler); |
|||
lv_btn_set_style(buttonEText, LV_BTN_STYLE_REL, &tft_style_label_rel); /*Set the button's released style*/ |
|||
lv_btn_set_style(buttonEText, LV_BTN_STYLE_PR, &tft_style_label_pre); /*Set the button's pressed style*/ |
|||
lv_btn_set_layout(buttonEText, LV_LAYOUT_OFF); |
|||
labelEText = lv_label_create(buttonEText, NULL); /*Add a label to the button*/ |
|||
|
|||
buttonEValue = lv_imgbtn_create(scr, NULL); |
|||
lv_obj_set_pos(buttonEValue, PARA_UI_VALUE_POS_X, PARA_UI_POS_Y * 4 + PARA_UI_VALUE_V); |
|||
lv_obj_set_event_cb_mks(buttonEValue, event_handler, ID_JERK_E, "bmp_value_blank.bin", 0); |
|||
lv_imgbtn_set_src(buttonEValue, LV_BTN_STATE_REL, &bmp_para_bank); |
|||
lv_imgbtn_set_src(buttonEValue, LV_BTN_STATE_PR, &bmp_para_bank); |
|||
lv_imgbtn_set_style(buttonEValue, LV_BTN_STATE_PR, &style_para_value_pre); |
|||
lv_imgbtn_set_style(buttonEValue, LV_BTN_STATE_REL, &style_para_value_rel); |
|||
lv_btn_set_layout(buttonEValue, LV_LAYOUT_OFF); |
|||
labelEValue = lv_label_create(buttonEValue, NULL); |
|||
|
|||
line4 = lv_line_create(scr, NULL); |
|||
lv_ex_line(line4, line_points[3]); |
|||
|
|||
buttonBack = lv_imgbtn_create(scr, NULL); |
|||
lv_obj_set_event_cb_mks(buttonBack, event_handler, ID_JERK_RETURN, "bmp_back70x40.bin", 0); |
|||
lv_imgbtn_set_src(buttonBack, LV_BTN_STATE_REL, &bmp_para_back); |
|||
lv_imgbtn_set_src(buttonBack, LV_BTN_STATE_PR, &bmp_para_back); |
|||
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 != 0) { |
|||
ZERO(public_buf_l); |
|||
sprintf_P(public_buf_l, PSTR("%.1f"), planner.max_jerk[X_AXIS]); |
|||
lv_label_set_text(labelXValue, public_buf_l); |
|||
lv_obj_align(labelXValue, buttonXValue, LV_ALIGN_CENTER, 0, 0); |
|||
|
|||
ZERO(public_buf_l); |
|||
sprintf_P(public_buf_l, PSTR("%.1f"), planner.max_jerk[Y_AXIS]); |
|||
lv_label_set_text(labelYValue, public_buf_l); |
|||
lv_obj_align(labelYValue, buttonYValue, LV_ALIGN_CENTER, 0, 0); |
|||
|
|||
ZERO(public_buf_l); |
|||
sprintf_P(public_buf_l, PSTR("%.1f"), planner.max_jerk[Z_AXIS]); |
|||
lv_label_set_text(labelZValue, public_buf_l); |
|||
lv_obj_align(labelZValue, buttonZValue, LV_ALIGN_CENTER, 0, 0); |
|||
|
|||
ZERO(public_buf_l); |
|||
sprintf_P(public_buf_l, PSTR("%.1f"), planner.max_jerk[E_AXIS]); |
|||
lv_label_set_text(labelEValue, public_buf_l); |
|||
lv_obj_align(labelEValue, buttonEValue, LV_ALIGN_CENTER, 0, 0); |
|||
|
|||
lv_label_set_text(labelXText, machine_menu.X_Jerk); |
|||
lv_obj_align(labelXText, buttonXText, LV_ALIGN_IN_LEFT_MID, 0, 0); |
|||
|
|||
lv_label_set_text(labelYText, machine_menu.Y_Jerk); |
|||
lv_obj_align(labelYText, buttonYText, LV_ALIGN_IN_LEFT_MID, 0, 0); |
|||
|
|||
lv_label_set_text(labelZText, machine_menu.Z_Jerk); |
|||
lv_obj_align(labelZText, buttonZText, LV_ALIGN_IN_LEFT_MID, 0, 0); |
|||
|
|||
lv_label_set_text(labelEText, machine_menu.E_Jerk); |
|||
lv_obj_align(labelEText, buttonEText, LV_ALIGN_IN_LEFT_MID, 0, 0); |
|||
|
|||
lv_label_set_text(label_Back, common_menu.text_back); |
|||
lv_obj_align(label_Back, buttonBack, LV_ALIGN_CENTER, 0, 0); |
|||
} |
|||
} |
|||
|
|||
void lv_clear_jerk_settings() { lv_obj_del(scr); } |
|||
|
|||
#endif // HAS_TFT_LVGL_UI && HAS_CLASSIC_JERK
|
@ -0,0 +1,33 @@ |
|||
/**
|
|||
* Marlin 3D Printer Firmware |
|||
* Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
|||
* |
|||
* Based on Sprinter and grbl. |
|||
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm |
|||
* |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|||
* |
|||
*/ |
|||
#pragma once |
|||
|
|||
#ifdef __cplusplus |
|||
extern "C" { /* C-declarations for C++ */ |
|||
#endif |
|||
|
|||
extern void lv_draw_jerk_settings(void); |
|||
extern void lv_clear_jerk_settings(); |
|||
|
|||
#ifdef __cplusplus |
|||
} /* C-declarations for C++ */ |
|||
#endif |
@ -0,0 +1,232 @@ |
|||
/**
|
|||
* Marlin 3D Printer Firmware |
|||
* Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
|||
* |
|||
* Based on Sprinter and grbl. |
|||
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm |
|||
* |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|||
* |
|||
*/ |
|||
#include "../../../../inc/MarlinConfigPre.h" |
|||
|
|||
#if HAS_TFT_LVGL_UI |
|||
|
|||
#include "lv_conf.h" |
|||
#include "draw_ui.h" |
|||
|
|||
#include "../../../../MarlinCore.h" |
|||
|
|||
static lv_obj_t * scr; |
|||
|
|||
#define ID_PARA_RETURN 1 |
|||
#define ID_PARA_MACHINE 2 |
|||
#define ID_PARA_MACHINE_ARROW 3 |
|||
#define ID_PARA_MOTOR 4 |
|||
#define ID_PARA_MOTOR_ARROW 5 |
|||
#define ID_PARA_ADVANCE 6 |
|||
#define ID_PARA_ADVANCE_ARROW 7 |
|||
|
|||
static void event_handler(lv_obj_t * obj, lv_event_t event) { |
|||
switch (obj->mks_obj_id) { |
|||
case ID_PARA_RETURN: |
|||
if (event == LV_EVENT_CLICKED) { |
|||
|
|||
} |
|||
else if (event == LV_EVENT_RELEASED) { |
|||
lv_clear_machine_para(); |
|||
draw_return_ui(); |
|||
} |
|||
break; |
|||
case ID_PARA_MACHINE: |
|||
if (event == LV_EVENT_CLICKED) { |
|||
|
|||
} |
|||
else if (event == LV_EVENT_RELEASED) { |
|||
lv_clear_machine_para(); |
|||
lv_draw_machine_settings(); |
|||
} |
|||
break; |
|||
case ID_PARA_MACHINE_ARROW: |
|||
if (event == LV_EVENT_CLICKED) { |
|||
|
|||
} |
|||
else if (event == LV_EVENT_RELEASED) { |
|||
lv_clear_machine_para(); |
|||
lv_draw_machine_settings(); |
|||
} |
|||
break; |
|||
case ID_PARA_MOTOR: |
|||
if (event == LV_EVENT_CLICKED) { |
|||
|
|||
} |
|||
else if (event == LV_EVENT_RELEASED) { |
|||
lv_clear_machine_para(); |
|||
lv_draw_motor_settings(); |
|||
} |
|||
break; |
|||
case ID_PARA_MOTOR_ARROW: |
|||
if (event == LV_EVENT_CLICKED) { |
|||
|
|||
} |
|||
else if (event == LV_EVENT_RELEASED) { |
|||
lv_clear_machine_para(); |
|||
lv_draw_motor_settings(); |
|||
} |
|||
break; |
|||
case ID_PARA_ADVANCE: |
|||
if (event == LV_EVENT_CLICKED) { |
|||
|
|||
} |
|||
else if (event == LV_EVENT_RELEASED) { |
|||
lv_clear_machine_para(); |
|||
lv_draw_advance_settings(); |
|||
} |
|||
break; |
|||
case ID_PARA_ADVANCE_ARROW: |
|||
if (event == LV_EVENT_CLICKED) { |
|||
|
|||
} |
|||
else if (event == LV_EVENT_RELEASED) { |
|||
lv_clear_machine_para(); |
|||
lv_draw_advance_settings(); |
|||
} |
|||
break; |
|||
} |
|||
} |
|||
|
|||
void lv_draw_machine_para(void) { |
|||
lv_obj_t *buttonBack, *label_Back; |
|||
lv_obj_t *buttonMachine, *labelMachine, *buttonMachineNarrow; |
|||
lv_obj_t *buttonMotor, *labelMotor, *buttonMotorNarrow; |
|||
lv_obj_t *buttonAdvance, *labelAdvance, *buttonAdvanceNarrow; |
|||
lv_obj_t * line1, * line2, * line3; |
|||
if (disp_state_stack._disp_state[disp_state_stack._disp_index] != MACHINE_PARA_UI) { |
|||
disp_state_stack._disp_index++; |
|||
disp_state_stack._disp_state[disp_state_stack._disp_index] = MACHINE_PARA_UI; |
|||
} |
|||
disp_state = MACHINE_PARA_UI; |
|||
|
|||
scr = lv_obj_create(NULL, NULL); |
|||
|
|||
lv_obj_set_style(scr, &tft_style_scr); |
|||
lv_scr_load(scr); |
|||
lv_obj_clean(scr); |
|||
|
|||
lv_obj_t * title = lv_label_create(scr, NULL); |
|||
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_IMG_DECLARE(bmp_para_back); |
|||
LV_IMG_DECLARE(bmp_para_arrow); |
|||
|
|||
buttonMachine = lv_btn_create(scr, NULL); /*Add a button the current screen*/ |
|||
lv_obj_set_pos(buttonMachine, PARA_UI_POS_X, PARA_UI_POS_Y); /*Set its position*/ |
|||
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_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_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); |
|||
labelMachine = lv_label_create(buttonMachine, NULL); /*Add a label to the button*/ |
|||
|
|||
buttonMachineNarrow = lv_imgbtn_create(scr, NULL); |
|||
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, "bmp_arrow.bin", 0); |
|||
lv_imgbtn_set_src(buttonMachineNarrow, LV_BTN_STATE_REL, &bmp_para_arrow); |
|||
lv_imgbtn_set_src(buttonMachineNarrow, LV_BTN_STATE_PR, &bmp_para_arrow); |
|||
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); |
|||
lv_ex_line(line1, line_points[0]); |
|||
|
|||
buttonMotor = lv_btn_create(scr, NULL); /*Add a button the current screen*/ |
|||
lv_obj_set_pos(buttonMotor, PARA_UI_POS_X, PARA_UI_POS_Y * 2); /*Set its position*/ |
|||
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_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_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); |
|||
labelMotor = lv_label_create(buttonMotor, NULL); /*Add a label to the button*/ |
|||
|
|||
buttonMotorNarrow = lv_imgbtn_create(scr, NULL); |
|||
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, "bmp_arrow.bin", 0); |
|||
lv_imgbtn_set_src(buttonMotorNarrow, LV_BTN_STATE_REL, &bmp_para_arrow); |
|||
lv_imgbtn_set_src(buttonMotorNarrow, LV_BTN_STATE_PR, &bmp_para_arrow); |
|||
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); |
|||
lv_ex_line(line2, line_points[1]); |
|||
|
|||
buttonAdvance = lv_btn_create(scr, NULL); /*Add a button the current screen*/ |
|||
lv_obj_set_pos(buttonAdvance, PARA_UI_POS_X, PARA_UI_POS_Y * 3); /*Set its position*/ |
|||
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_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_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); |
|||
labelAdvance = lv_label_create(buttonAdvance, NULL); /*Add a label to the button*/ |
|||
|
|||
buttonAdvanceNarrow = lv_imgbtn_create(scr, NULL); |
|||
lv_obj_set_pos(buttonAdvanceNarrow, PARA_UI_POS_X + PARA_UI_SIZE_X, PARA_UI_POS_Y * 3 + PARA_UI_ARROW_V); |
|||
lv_obj_set_event_cb_mks(buttonAdvanceNarrow, event_handler, ID_PARA_ADVANCE_ARROW, "bmp_arrow.bin", 0); |
|||
lv_imgbtn_set_src(buttonAdvanceNarrow, LV_BTN_STATE_REL, &bmp_para_arrow); |
|||
lv_imgbtn_set_src(buttonAdvanceNarrow, LV_BTN_STATE_PR, &bmp_para_arrow); |
|||
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); |
|||
|
|||
line3 = lv_line_create(scr, NULL); |
|||
lv_ex_line(line3, line_points[2]); |
|||
|
|||
buttonBack = lv_imgbtn_create(scr, NULL); |
|||
lv_obj_set_event_cb_mks(buttonBack, event_handler, ID_PARA_RETURN, "bmp_back70x40.bin", 0); |
|||
lv_imgbtn_set_src(buttonBack, LV_BTN_STATE_REL, &bmp_para_back); |
|||
lv_imgbtn_set_src(buttonBack, LV_BTN_STATE_PR, &bmp_para_back); |
|||
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 != 0) { |
|||
lv_label_set_text(label_Back, common_menu.text_back); |
|||
lv_obj_align(label_Back, buttonBack, LV_ALIGN_CENTER, 0, 0); |
|||
|
|||
lv_label_set_text(labelMachine, MachinePara_menu.MachineSetting); |
|||
lv_obj_align(labelMachine, buttonMachine, LV_ALIGN_IN_LEFT_MID, 0, 0); |
|||
|
|||
lv_label_set_text(labelMotor, MachinePara_menu.MotorSetting); |
|||
lv_obj_align(labelMotor, buttonMotor, LV_ALIGN_IN_LEFT_MID, 0, 0); |
|||
|
|||
lv_label_set_text(labelAdvance, MachinePara_menu.AdvanceSetting); |
|||
lv_obj_align(labelAdvance, buttonAdvance, LV_ALIGN_IN_LEFT_MID, 0, 0); |
|||
} |
|||
|
|||
} |
|||
|
|||
void lv_clear_machine_para() { lv_obj_del(scr); } |
|||
|
|||
#endif // HAS_TFT_LVGL_UI
|
@ -0,0 +1,33 @@ |
|||
/**
|
|||
* Marlin 3D Printer Firmware |
|||
* Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
|||
* |
|||
* Based on Sprinter and grbl. |
|||
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm |
|||
* |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|||
* |
|||
*/ |
|||
#pragma once |
|||
|
|||
#ifdef __cplusplus |
|||
extern "C" { /* C-declarations for C++ */ |
|||
#endif |
|||
|
|||
extern void lv_draw_machine_para(void); |
|||
extern void lv_clear_machine_para(); |
|||
|
|||
#ifdef __cplusplus |
|||
} /* C-declarations for C++ */ |
|||
#endif |
@ -0,0 +1,241 @@ |
|||
/**
|
|||
* Marlin 3D Printer Firmware |
|||
* Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
|||
* |
|||
* Based on Sprinter and grbl. |
|||
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm |
|||
* |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|||
* |
|||
*/ |
|||
#include "../../../../inc/MarlinConfigPre.h" |
|||
|
|||
#if HAS_TFT_LVGL_UI |
|||
|
|||
#include "lv_conf.h" |
|||
#include "draw_ui.h" |
|||
|
|||
#include "../../../../MarlinCore.h" |
|||
|
|||
static lv_obj_t * scr; |
|||
|
|||
#define ID_MACHINE_RETURN 1 |
|||
#define ID_MACHINE_ACCELERATION 2 |
|||
#define ID_MACHINE_ACCELERATION_ARROW 3 |
|||
#define ID_MACHINE_FEEDRATE 4 |
|||
#define ID_MACHINE_FEEDRATE_ARROW 5 |
|||
#define ID_MACHINE_JERK 6 |
|||
#define ID_MACHINE_JERK_ARROW 7 |
|||
|
|||
static void event_handler(lv_obj_t * obj, lv_event_t event) { |
|||
switch (obj->mks_obj_id) { |
|||
case ID_MACHINE_RETURN: |
|||
if (event == LV_EVENT_CLICKED) { |
|||
|
|||
} |
|||
else if (event == LV_EVENT_RELEASED) { |
|||
lv_clear_machine_settings(); |
|||
draw_return_ui(); |
|||
} |
|||
break; |
|||
case ID_MACHINE_ACCELERATION: |
|||
if (event == LV_EVENT_CLICKED) { |
|||
|
|||
} |
|||
else if (event == LV_EVENT_RELEASED) { |
|||
lv_clear_machine_settings(); |
|||
lv_draw_acceleration_settings(); |
|||
} |
|||
break; |
|||
case ID_MACHINE_ACCELERATION_ARROW: |
|||
if (event == LV_EVENT_CLICKED) { |
|||
|
|||
} |
|||
else if (event == LV_EVENT_RELEASED) { |
|||
lv_clear_machine_settings(); |
|||
lv_draw_acceleration_settings(); |
|||
} |
|||
break; |
|||
case ID_MACHINE_FEEDRATE: |
|||
if (event == LV_EVENT_CLICKED) { |
|||
|
|||
} |
|||
else if (event == LV_EVENT_RELEASED) { |
|||
lv_clear_machine_settings(); |
|||
lv_draw_max_feedrate_settings(); |
|||
} |
|||
break; |
|||
case ID_MACHINE_FEEDRATE_ARROW: |
|||
if (event == LV_EVENT_CLICKED) { |
|||
|
|||
} |
|||
else if (event == LV_EVENT_RELEASED) { |
|||
lv_clear_machine_settings(); |
|||
lv_draw_max_feedrate_settings(); |
|||
} |
|||
break; |
|||
#if HAS_CLASSIC_JERK |
|||
case ID_MACHINE_JERK: |
|||
if (event == LV_EVENT_CLICKED) { |
|||
|
|||
} |
|||
else if (event == LV_EVENT_RELEASED) { |
|||
lv_clear_machine_settings(); |
|||
lv_draw_jerk_settings(); |
|||
} |
|||
break; |
|||
case ID_MACHINE_JERK_ARROW: |
|||
if (event == LV_EVENT_CLICKED) { |
|||
|
|||
} |
|||
else if (event == LV_EVENT_RELEASED) { |
|||
lv_clear_machine_settings(); |
|||
lv_draw_jerk_settings(); |
|||
} |
|||
break; |
|||
#endif |
|||
} |
|||
} |
|||
|
|||
void lv_draw_machine_settings(void) { |
|||
lv_obj_t *buttonBack, *label_Back; |
|||
lv_obj_t *buttonAcceleration, *labelAcceleration, *buttonAccelerationNarrow; |
|||
lv_obj_t *buttonMaxFeedrate, *labelMaxFeedrate, *buttonMaxFeedrateNarrow; |
|||
#if HAS_CLASSIC_JERK |
|||
lv_obj_t *buttonJerk, *labelJerk, *buttonJerkNarrow; |
|||
#endif |
|||
lv_obj_t * line1, * line2; |
|||
#if HAS_CLASSIC_JERK |
|||
lv_obj_t * line3; |
|||
#endif |
|||
if (disp_state_stack._disp_state[disp_state_stack._disp_index] != MACHINE_SETTINGS_UI) { |
|||
disp_state_stack._disp_index++; |
|||
disp_state_stack._disp_state[disp_state_stack._disp_index] = MACHINE_SETTINGS_UI; |
|||
} |
|||
disp_state = MACHINE_SETTINGS_UI; |
|||
|
|||
scr = lv_obj_create(NULL, NULL); |
|||
|
|||
lv_obj_set_style(scr, &tft_style_scr); |
|||
lv_scr_load(scr); |
|||
lv_obj_clean(scr); |
|||
|
|||
lv_obj_t * title = lv_label_create(scr, NULL); |
|||
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_IMG_DECLARE(bmp_para_back); |
|||
LV_IMG_DECLARE(bmp_para_arrow); |
|||
|
|||
buttonAcceleration = lv_btn_create(scr, NULL); /*Add a button the current screen*/ |
|||
lv_obj_set_pos(buttonAcceleration, PARA_UI_POS_X, PARA_UI_POS_Y); /*Set its position*/ |
|||
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_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_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); |
|||
labelAcceleration = lv_label_create(buttonAcceleration, NULL); /*Add a label to the button*/ |
|||
|
|||
buttonAccelerationNarrow = lv_imgbtn_create(scr, NULL); |
|||
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, "bmp_arrow.bin", 0); |
|||
lv_imgbtn_set_src(buttonAccelerationNarrow, LV_BTN_STATE_REL, &bmp_para_arrow); |
|||
lv_imgbtn_set_src(buttonAccelerationNarrow, LV_BTN_STATE_PR, &bmp_para_arrow); |
|||
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); |
|||
lv_ex_line(line1, line_points[0]); |
|||
|
|||
buttonMaxFeedrate = lv_btn_create(scr, NULL); /*Add a button the current screen*/ |
|||
lv_obj_set_pos(buttonMaxFeedrate, PARA_UI_POS_X, PARA_UI_POS_Y * 2); /*Set its position*/ |
|||
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_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_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); |
|||
labelMaxFeedrate = lv_label_create(buttonMaxFeedrate, NULL); /*Add a label to the button*/ |
|||
|
|||
buttonMaxFeedrateNarrow = lv_imgbtn_create(scr, NULL); |
|||
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, "bmp_arrow.bin", 0); |
|||
lv_imgbtn_set_src(buttonMaxFeedrateNarrow, LV_BTN_STATE_REL, &bmp_para_arrow); |
|||
lv_imgbtn_set_src(buttonMaxFeedrateNarrow, LV_BTN_STATE_PR, &bmp_para_arrow); |
|||
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); |
|||
lv_ex_line(line2, line_points[1]); |
|||
|
|||
#if HAS_CLASSIC_JERK |
|||
buttonJerk = lv_btn_create(scr, NULL); /*Add a button the current screen*/ |
|||
lv_obj_set_pos(buttonJerk, PARA_UI_POS_X, PARA_UI_POS_Y * 3); /*Set its position*/ |
|||
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_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_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); |
|||
labelJerk = lv_label_create(buttonJerk, NULL); /*Add a label to the button*/ |
|||
|
|||
buttonJerkNarrow = lv_imgbtn_create(scr, NULL); |
|||
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, "bmp_arrow.bin", 0); |
|||
lv_imgbtn_set_src(buttonJerkNarrow, LV_BTN_STATE_REL, &bmp_para_arrow); |
|||
lv_imgbtn_set_src(buttonJerkNarrow, LV_BTN_STATE_PR, &bmp_para_arrow); |
|||
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); |
|||
lv_ex_line(line3, line_points[2]); |
|||
#endif |
|||
|
|||
buttonBack = lv_imgbtn_create(scr, NULL); |
|||
lv_obj_set_event_cb_mks(buttonBack, event_handler, ID_MACHINE_RETURN, "bmp_back70x40.bin", 0); |
|||
lv_imgbtn_set_src(buttonBack, LV_BTN_STATE_REL, &bmp_para_back); |
|||
lv_imgbtn_set_src(buttonBack, LV_BTN_STATE_PR, &bmp_para_back); |
|||
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 != 0) { |
|||
lv_label_set_text(label_Back, common_menu.text_back); |
|||
lv_obj_align(label_Back, buttonBack, LV_ALIGN_CENTER, 0, 0); |
|||
|
|||
lv_label_set_text(labelAcceleration, machine_menu.AccelerationConf); |
|||
lv_obj_align(labelAcceleration, buttonAcceleration, LV_ALIGN_IN_LEFT_MID, 0, 0); |
|||
|
|||
lv_label_set_text(labelMaxFeedrate, machine_menu.MaxFeedRateConf); |
|||
lv_obj_align(labelMaxFeedrate, buttonMaxFeedrate, LV_ALIGN_IN_LEFT_MID, 0, 0); |
|||
#if HAS_CLASSIC_JERK |
|||
lv_label_set_text(labelJerk, machine_menu.JerkConf); |
|||
lv_obj_align(labelJerk, buttonJerk, LV_ALIGN_IN_LEFT_MID, 0, 0); |
|||
#endif |
|||
} |
|||
} |
|||
|
|||
void lv_clear_machine_settings() { lv_obj_del(scr); } |
|||
|
|||
#endif // HAS_TFT_LVGL_UI
|
@ -0,0 +1,33 @@ |
|||
/**
|
|||
* Marlin 3D Printer Firmware |
|||
* Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
|||
* |
|||
* Based on Sprinter and grbl. |
|||
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm |
|||
* |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|||
* |
|||
*/ |
|||
#pragma once |
|||
|
|||
#ifdef __cplusplus |
|||
extern "C" { /* C-declarations for C++ */ |
|||
#endif |
|||
|
|||
extern void lv_draw_machine_settings(void); |
|||
extern void lv_clear_machine_settings(); |
|||
|
|||
#ifdef __cplusplus |
|||
} /* C-declarations for C++ */ |
|||
#endif |
@ -0,0 +1,359 @@ |
|||
/**
|
|||
* Marlin 3D Printer Firmware |
|||
* Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
|||
* |
|||
* Based on Sprinter and grbl. |
|||
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm |
|||
* |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|||
* |
|||
*/ |
|||
#include "../../../../inc/MarlinConfigPre.h" |
|||
|
|||
#if HAS_TFT_LVGL_UI |
|||
|
|||
#include "lv_conf.h" |
|||
#include "draw_ui.h" |
|||
|
|||
#include "../../../../MarlinCore.h" |
|||
#include "../../../../module/planner.h" |
|||
|
|||
static lv_obj_t * scr; |
|||
|
|||
#define ID_FEED_RETURN 1 |
|||
#define ID_FEED_X 2 |
|||
#define ID_FEED_Y 3 |
|||
#define ID_FEED_Z 4 |
|||
#define ID_FEED_E0 5 |
|||
#define ID_FEED_E1 6 |
|||
#define ID_FEED_DOWN 7 |
|||
#define ID_FEED_UP 8 |
|||
|
|||
static void event_handler(lv_obj_t * obj, lv_event_t event) { |
|||
switch (obj->mks_obj_id) { |
|||
case ID_FEED_RETURN: |
|||
if (event == LV_EVENT_CLICKED) { |
|||
|
|||
} |
|||
else if (event == LV_EVENT_RELEASED) { |
|||
uiCfg.para_ui_page = 0; |
|||
lv_clear_max_feedrate_settings(); |
|||
draw_return_ui(); |
|||
} |
|||
break; |
|||
case ID_FEED_X: |
|||
if (event == LV_EVENT_CLICKED) { |
|||
|
|||
} |
|||
else if (event == LV_EVENT_RELEASED) { |
|||
value = XMaxFeedRate; |
|||
lv_clear_max_feedrate_settings(); |
|||
lv_draw_number_key(); |
|||
} |
|||
break; |
|||
case ID_FEED_Y: |
|||
if (event == LV_EVENT_CLICKED) { |
|||
|
|||
} |
|||
else if (event == LV_EVENT_RELEASED) { |
|||
value = YMaxFeedRate; |
|||
lv_clear_max_feedrate_settings(); |
|||
lv_draw_number_key(); |
|||
} |
|||
break; |
|||
case ID_FEED_Z: |
|||
if (event == LV_EVENT_CLICKED) { |
|||
|
|||
} |
|||
else if (event == LV_EVENT_RELEASED) { |
|||
value = ZMaxFeedRate; |
|||
lv_clear_max_feedrate_settings(); |
|||
lv_draw_number_key(); |
|||
} |
|||
break; |
|||
case ID_FEED_E0: |
|||
if (event == LV_EVENT_CLICKED) { |
|||
|
|||
} |
|||
else if (event == LV_EVENT_RELEASED) { |
|||
value = E0MaxFeedRate; |
|||
lv_clear_max_feedrate_settings(); |
|||
lv_draw_number_key(); |
|||
} |
|||
break; |
|||
case ID_FEED_E1: |
|||
if (event == LV_EVENT_CLICKED) { |
|||
|
|||
} |
|||
else if (event == LV_EVENT_RELEASED) { |
|||
value = E1MaxFeedRate; |
|||
lv_clear_max_feedrate_settings(); |
|||
lv_draw_number_key(); |
|||
} |
|||
break; |
|||
case ID_FEED_UP: |
|||
if (event == LV_EVENT_CLICKED) { |
|||
|
|||
} |
|||
else if (event == LV_EVENT_RELEASED) { |
|||
uiCfg.para_ui_page = 0; |
|||
lv_clear_max_feedrate_settings(); |
|||
lv_draw_max_feedrate_settings(); |
|||
} |
|||
break; |
|||
case ID_FEED_DOWN: |
|||
if (event == LV_EVENT_CLICKED) { |
|||
|
|||
} |
|||
else if (event == LV_EVENT_RELEASED) { |
|||
uiCfg.para_ui_page = 1; |
|||
lv_clear_max_feedrate_settings(); |
|||
lv_draw_max_feedrate_settings(); |
|||
} |
|||
break; |
|||
} |
|||
} |
|||
|
|||
void lv_draw_max_feedrate_settings(void) { |
|||
lv_obj_t *buttonBack = NULL, *label_Back = NULL, *buttonTurnPage = NULL, *labelTurnPage = NULL; |
|||
lv_obj_t *buttonXText = NULL, *labelXText = NULL, *buttonXValue = NULL, *labelXValue = NULL; |
|||
lv_obj_t *buttonYText = NULL, *labelYText = NULL, *buttonYValue = NULL, *labelYValue = NULL; |
|||
lv_obj_t *buttonZText = NULL, *labelZText = NULL, *buttonZValue = NULL, *labelZValue = NULL; |
|||
lv_obj_t *buttonE0Text = NULL, *labelE0Text = NULL, *buttonE0Value = NULL, *labelE0Value = NULL; |
|||
lv_obj_t *buttonE1Text = NULL, *labelE1Text = NULL, *buttonE1Value = NULL, *labelE1Value = 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) { |
|||
disp_state_stack._disp_index++; |
|||
disp_state_stack._disp_state[disp_state_stack._disp_index] = MAXFEEDRATE_UI; |
|||
} |
|||
disp_state = MAXFEEDRATE_UI; |
|||
|
|||
scr = lv_obj_create(NULL, NULL); |
|||
|
|||
lv_obj_set_style(scr, &tft_style_scr); |
|||
lv_scr_load(scr); |
|||
lv_obj_clean(scr); |
|||
|
|||
lv_obj_t * title = lv_label_create(scr, NULL); |
|||
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_IMG_DECLARE(bmp_para_back); |
|||
// LV_IMG_DECLARE(bmp_para_arrow);
|
|||
LV_IMG_DECLARE(bmp_para_bank); |
|||
|
|||
if (uiCfg.para_ui_page != 1) { |
|||
buttonXText = lv_btn_create(scr, NULL); /*Add a button the current screen*/ |
|||
lv_obj_set_pos(buttonXText, PARA_UI_POS_X, PARA_UI_POS_Y); /*Set its position*/ |
|||
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*/ |
|||
|
|||
buttonXValue = lv_imgbtn_create(scr, NULL); |
|||
lv_obj_set_pos(buttonXValue, PARA_UI_VALUE_POS_X, PARA_UI_POS_Y + PARA_UI_VALUE_V); |
|||
lv_obj_set_event_cb_mks(buttonXValue, event_handler, ID_FEED_X, "bmp_value_blank.bin", 0); |
|||
lv_imgbtn_set_src(buttonXValue, LV_BTN_STATE_REL, &bmp_para_bank); |
|||
lv_imgbtn_set_src(buttonXValue, LV_BTN_STATE_PR, &bmp_para_bank); |
|||
lv_imgbtn_set_style(buttonXValue, LV_BTN_STATE_PR, &style_para_value_pre); |
|||
lv_imgbtn_set_style(buttonXValue, LV_BTN_STATE_REL, &style_para_value_rel); |
|||
lv_btn_set_layout(buttonXValue, LV_LAYOUT_OFF); |
|||
labelXValue = lv_label_create(buttonXValue, NULL); |
|||
|
|||
line1 = lv_line_create(scr, NULL); |
|||
lv_ex_line(line1, line_points[0]); |
|||
|
|||
buttonYText = lv_btn_create(scr, NULL); /*Add a button the current screen*/ |
|||
lv_obj_set_pos(buttonYText, PARA_UI_POS_X, PARA_UI_POS_Y * 2); /*Set its position*/ |
|||
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*/ |
|||
|
|||
buttonYValue = lv_imgbtn_create(scr, NULL); |
|||
lv_obj_set_pos(buttonYValue, PARA_UI_VALUE_POS_X, PARA_UI_POS_Y * 2 + PARA_UI_VALUE_V); |
|||
lv_obj_set_event_cb_mks(buttonYValue, event_handler, ID_FEED_Y, "bmp_value_blank.bin", 0); |
|||
lv_imgbtn_set_src(buttonYValue, LV_BTN_STATE_REL, &bmp_para_bank); |
|||
lv_imgbtn_set_src(buttonYValue, LV_BTN_STATE_PR, &bmp_para_bank); |
|||
lv_imgbtn_set_style(buttonYValue, LV_BTN_STATE_PR, &style_para_value_pre); |
|||
lv_imgbtn_set_style(buttonYValue, LV_BTN_STATE_REL, &style_para_value_rel); |
|||
lv_btn_set_layout(buttonYValue, LV_LAYOUT_OFF); |
|||
labelYValue = lv_label_create(buttonYValue, NULL); |
|||
|
|||
line2 = lv_line_create(scr, NULL); |
|||
lv_ex_line(line2, line_points[1]); |
|||
|
|||
buttonZText = lv_btn_create(scr, NULL); /*Add a button the current screen*/ |
|||
lv_obj_set_pos(buttonZText, PARA_UI_POS_X, PARA_UI_POS_Y * 3); /*Set its position*/ |
|||
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*/ |
|||
|
|||
buttonZValue = lv_imgbtn_create(scr, NULL); |
|||
lv_obj_set_pos(buttonZValue, PARA_UI_VALUE_POS_X, PARA_UI_POS_Y * 3 + PARA_UI_VALUE_V); |
|||
lv_obj_set_event_cb_mks(buttonZValue, event_handler, ID_FEED_Z, "bmp_value_blank.bin", 0); |
|||
lv_imgbtn_set_src(buttonZValue, LV_BTN_STATE_REL, &bmp_para_bank); |
|||
lv_imgbtn_set_src(buttonZValue, LV_BTN_STATE_PR, &bmp_para_bank); |
|||
lv_imgbtn_set_style(buttonZValue, LV_BTN_STATE_PR, &style_para_value_pre); |
|||
lv_imgbtn_set_style(buttonZValue, LV_BTN_STATE_REL, &style_para_value_rel); |
|||
lv_btn_set_layout(buttonZValue, LV_LAYOUT_OFF); |
|||
labelZValue = lv_label_create(buttonZValue, NULL); |
|||
|
|||
line3 = lv_line_create(scr, NULL); |
|||
lv_ex_line(line3, line_points[2]); |
|||
|
|||
buttonE0Text = lv_btn_create(scr, NULL); /*Add a button the current screen*/ |
|||
lv_obj_set_pos(buttonE0Text, PARA_UI_POS_X, PARA_UI_POS_Y * 4); /*Set its position*/ |
|||
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*/ |
|||
|
|||
buttonE0Value = lv_imgbtn_create(scr, NULL); |
|||
lv_obj_set_pos(buttonE0Value, PARA_UI_VALUE_POS_X, PARA_UI_POS_Y * 4 + PARA_UI_VALUE_V); |
|||
lv_obj_set_event_cb_mks(buttonE0Value, event_handler, ID_FEED_E0, "bmp_value_blank.bin", 0); |
|||
lv_imgbtn_set_src(buttonE0Value, LV_BTN_STATE_REL, &bmp_para_bank); |
|||
lv_imgbtn_set_src(buttonE0Value, LV_BTN_STATE_PR, &bmp_para_bank); |
|||
lv_imgbtn_set_style(buttonE0Value, LV_BTN_STATE_PR, &style_para_value_pre); |
|||
lv_imgbtn_set_style(buttonE0Value, LV_BTN_STATE_REL, &style_para_value_rel); |
|||
lv_btn_set_layout(buttonE0Value, LV_LAYOUT_OFF); |
|||
labelE0Value = lv_label_create(buttonE0Value, NULL); |
|||
|
|||
line4 = lv_line_create(scr, NULL); |
|||
lv_ex_line(line4, line_points[3]); |
|||
|
|||
buttonTurnPage = lv_imgbtn_create(scr, NULL); |
|||
lv_obj_set_event_cb_mks(buttonTurnPage, event_handler, ID_FEED_DOWN, "bmp_back70x40.bin", 0); |
|||
lv_imgbtn_set_src(buttonTurnPage, LV_BTN_STATE_REL, &bmp_para_back); |
|||
lv_imgbtn_set_src(buttonTurnPage, LV_BTN_STATE_PR, &bmp_para_back); |
|||
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); |
|||
} |
|||
else { |
|||
buttonE1Text = lv_btn_create(scr, NULL); /*Add a button the current screen*/ |
|||
lv_obj_set_pos(buttonE1Text, PARA_UI_POS_X, PARA_UI_POS_Y); /*Set its position*/ |
|||
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*/ |
|||
|
|||
buttonE1Value = lv_imgbtn_create(scr, NULL); |
|||
lv_obj_set_pos(buttonE1Value, PARA_UI_VALUE_POS_X, PARA_UI_POS_Y + PARA_UI_VALUE_V); |
|||
lv_obj_set_event_cb_mks(buttonE1Value, event_handler, ID_FEED_E1, "bmp_value_blank.bin", 0); |
|||
lv_imgbtn_set_src(buttonE1Value, LV_BTN_STATE_REL, &bmp_para_bank); |
|||
lv_imgbtn_set_src(buttonE1Value, LV_BTN_STATE_PR, &bmp_para_bank); |
|||
lv_imgbtn_set_style(buttonE1Value, LV_BTN_STATE_PR, &style_para_value_pre); |
|||
lv_imgbtn_set_style(buttonE1Value, LV_BTN_STATE_REL, &style_para_value_rel); |
|||
lv_btn_set_layout(buttonE1Value, LV_LAYOUT_OFF); |
|||
labelE1Value = lv_label_create(buttonE1Value, NULL); |
|||
|
|||
line1 = lv_line_create(scr, NULL); |
|||
lv_ex_line(line1, line_points[0]); |
|||
|
|||
buttonTurnPage = lv_imgbtn_create(scr, NULL); |
|||
lv_obj_set_event_cb_mks(buttonTurnPage, event_handler, ID_FEED_UP, "bmp_back70x40.bin", 0); |
|||
lv_imgbtn_set_src(buttonTurnPage, LV_BTN_STATE_REL, &bmp_para_back); |
|||
lv_imgbtn_set_src(buttonTurnPage, LV_BTN_STATE_PR, &bmp_para_back); |
|||
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_obj_set_pos(buttonTurnPage, PARA_UI_TURN_PAGE_POS_X, PARA_UI_TURN_PAGE_POS_Y); |
|||
lv_btn_set_layout(buttonTurnPage, LV_LAYOUT_OFF); |
|||
labelTurnPage = lv_label_create(buttonTurnPage, NULL); |
|||
|
|||
|
|||
buttonBack = lv_imgbtn_create(scr, NULL); |
|||
lv_obj_set_event_cb_mks(buttonBack, event_handler, ID_FEED_RETURN, "bmp_back70x40.bin", 0); |
|||
lv_imgbtn_set_src(buttonBack, LV_BTN_STATE_REL, &bmp_para_back); |
|||
lv_imgbtn_set_src(buttonBack, LV_BTN_STATE_PR, &bmp_para_back); |
|||
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 != 0) { |
|||
if (uiCfg.para_ui_page != 1) { |
|||
lv_label_set_text(labelXText, machine_menu.XMaxFeedRate); |
|||
lv_obj_align(labelXText, buttonXText, LV_ALIGN_IN_LEFT_MID, 0, 0); |
|||
|
|||
lv_label_set_text(labelYText, machine_menu.YMaxFeedRate); |
|||
lv_obj_align(labelYText, buttonYText, LV_ALIGN_IN_LEFT_MID, 0, 0); |
|||
|
|||
lv_label_set_text(labelZText, machine_menu.ZMaxFeedRate); |
|||
lv_obj_align(labelZText, buttonZText, LV_ALIGN_IN_LEFT_MID, 0, 0); |
|||
|
|||
lv_label_set_text(labelE0Text, machine_menu.E0MaxFeedRate); |
|||
lv_obj_align(labelE0Text, buttonE0Text, LV_ALIGN_IN_LEFT_MID, 0, 0); |
|||
|
|||
lv_label_set_text(labelTurnPage, machine_menu.next); |
|||
lv_obj_align(labelTurnPage, buttonTurnPage, LV_ALIGN_CENTER, 0, 0); |
|||
|
|||
ZERO(public_buf_l); |
|||
sprintf_P(public_buf_l, PSTR("%.1f"), planner.settings.max_feedrate_mm_s[X_AXIS]); |
|||
lv_label_set_text(labelXValue, public_buf_l); |
|||
lv_obj_align(labelXValue, buttonXValue, LV_ALIGN_CENTER, 0, 0); |
|||
|
|||
ZERO(public_buf_l); |
|||
sprintf_P(public_buf_l, PSTR("%.1f"), planner.settings.max_feedrate_mm_s[Y_AXIS]); |
|||
lv_label_set_text(labelYValue, public_buf_l); |
|||
lv_obj_align(labelYValue, buttonYValue, LV_ALIGN_CENTER, 0, 0); |
|||
|
|||
ZERO(public_buf_l); |
|||
sprintf_P(public_buf_l, PSTR("%.1f"), planner.settings.max_feedrate_mm_s[Z_AXIS]); |
|||
lv_label_set_text(labelZValue, public_buf_l); |
|||
lv_obj_align(labelZValue, buttonZValue, LV_ALIGN_CENTER, 0, 0); |
|||
|
|||
ZERO(public_buf_l); |
|||
sprintf_P(public_buf_l, PSTR("%.1f"), planner.settings.max_feedrate_mm_s[E_AXIS]); |
|||
lv_label_set_text(labelE0Value, public_buf_l); |
|||
lv_obj_align(labelE0Value, buttonE0Value, LV_ALIGN_CENTER, 0, 0); |
|||
} |
|||
else { |
|||
lv_label_set_text(labelE1Text, machine_menu.E1MaxFeedRate); |
|||
lv_obj_align(labelE1Text, buttonE1Text, LV_ALIGN_IN_LEFT_MID, 0, 0); |
|||
|
|||
lv_label_set_text(labelTurnPage, machine_menu.previous); |
|||
lv_obj_align(labelTurnPage, buttonTurnPage, LV_ALIGN_CENTER, 0, 0); |
|||
|
|||
ZERO(public_buf_l); |
|||
sprintf_P(public_buf_l, PSTR("%.1f"), planner.settings.max_feedrate_mm_s[E_AXIS_N(1)]); |
|||
lv_label_set_text(labelE1Value, public_buf_l); |
|||
lv_obj_align(labelE1Value, buttonE1Value, LV_ALIGN_CENTER, 0, 0); |
|||
} |
|||
|
|||
lv_label_set_text(label_Back, common_menu.text_back); |
|||
lv_obj_align(label_Back, buttonBack, LV_ALIGN_CENTER, 0, 0); |
|||
} |
|||
} |
|||
|
|||
void lv_clear_max_feedrate_settings() { lv_obj_del(scr); } |
|||
|
|||
#endif // HAS_TFT_LVGL_UI
|
@ -0,0 +1,33 @@ |
|||
/**
|
|||
* Marlin 3D Printer Firmware |
|||
* Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
|||
* |
|||
* Based on Sprinter and grbl. |
|||
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm |
|||
* |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|||
* |
|||
*/ |
|||
#pragma once |
|||
|
|||
#ifdef __cplusplus |
|||
extern "C" { /* C-declarations for C++ */ |
|||
#endif |
|||
|
|||
extern void lv_draw_max_feedrate_settings(void); |
|||
extern void lv_clear_max_feedrate_settings(); |
|||
|
|||
#ifdef __cplusplus |
|||
} /* C-declarations for C++ */ |
|||
#endif |
@ -0,0 +1,247 @@ |
|||
/**
|
|||
* Marlin 3D Printer Firmware |
|||
* Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
|||
* |
|||
* Based on Sprinter and grbl. |
|||
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm |
|||
* |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|||
* |
|||
*/ |
|||
#include "../../../../inc/MarlinConfigPre.h" |
|||
|
|||
#if HAS_TFT_LVGL_UI |
|||
|
|||
#include "lv_conf.h" |
|||
#include "draw_ui.h" |
|||
|
|||
#include "../../../../MarlinCore.h" |
|||
|
|||
static lv_obj_t * scr; |
|||
|
|||
#define ID_MOTOR_RETURN 1 |
|||
#define ID_MOTOR_STEPS 2 |
|||
#define ID_MOTOR_STEPS_ARROW 3 |
|||
#define ID_MOTOR_TMC_CURRENT 4 |
|||
#define ID_MOTOR_TMC_CURRENT_ARROW 5 |
|||
#define ID_MOTOR_STEP_MODE 6 |
|||
#define ID_MOTOR_STEP_MODE_ARROW 7 |
|||
|
|||
static void event_handler(lv_obj_t * obj, lv_event_t event) { |
|||
switch (obj->mks_obj_id) { |
|||
case ID_MOTOR_RETURN: |
|||
if (event == LV_EVENT_CLICKED) { |
|||
|
|||
} |
|||
else if (event == LV_EVENT_RELEASED) { |
|||
lv_clear_motor_settings(); |
|||
draw_return_ui(); |
|||
} |
|||
break; |
|||
case ID_MOTOR_STEPS: |
|||
if (event == LV_EVENT_CLICKED) { |
|||
|
|||
} |
|||
else if (event == LV_EVENT_RELEASED) { |
|||
lv_clear_motor_settings(); |
|||
lv_draw_step_settings(); |
|||
} |
|||
break; |
|||
case ID_MOTOR_STEPS_ARROW: |
|||
if (event == LV_EVENT_CLICKED) { |
|||
|
|||
} |
|||
else if (event == LV_EVENT_RELEASED) { |
|||
lv_clear_motor_settings(); |
|||
lv_draw_step_settings(); |
|||
} |
|||
break; |
|||
#if HAS_TRINAMIC_CONFIG |
|||
case ID_MOTOR_TMC_CURRENT: |
|||
if (event == LV_EVENT_CLICKED) { |
|||
|
|||
} |
|||
else if (event == LV_EVENT_RELEASED) { |
|||
lv_clear_motor_settings(); |
|||
lv_draw_tmc_current_settings(); |
|||
} |
|||
break; |
|||
case ID_MOTOR_TMC_CURRENT_ARROW: |
|||
if (event == LV_EVENT_CLICKED) { |
|||
|
|||
} |
|||
else if (event == LV_EVENT_RELEASED) { |
|||
lv_clear_motor_settings(); |
|||
lv_draw_tmc_current_settings(); |
|||
} |
|||
break; |
|||
#if HAS_STEALTHCHOP |
|||
case ID_MOTOR_STEP_MODE: |
|||
if (event == LV_EVENT_CLICKED) { |
|||
|
|||
} |
|||
else if (event == LV_EVENT_RELEASED) { |
|||
lv_clear_motor_settings(); |
|||
lv_draw_tmc_step_mode_settings(); |
|||
} |
|||
break; |
|||
case ID_MOTOR_STEP_MODE_ARROW: |
|||
if (event == LV_EVENT_CLICKED) { |
|||
|
|||
} |
|||
else if (event == LV_EVENT_RELEASED) { |
|||
lv_clear_motor_settings(); |
|||
lv_draw_tmc_step_mode_settings(); |
|||
} |
|||
break; |
|||
#endif |
|||
#endif |
|||
} |
|||
} |
|||
|
|||
void lv_draw_motor_settings(void) { |
|||
lv_obj_t *buttonBack, *label_Back; |
|||
lv_obj_t *buttonSteps, *labelSteps, *buttonStepsNarrow; |
|||
#if HAS_TRINAMIC_CONFIG |
|||
lv_obj_t *buttonTMCcurrent, *labelTMCcurrent, *buttonTMCcurrentNarrow; |
|||
lv_obj_t * line2; |
|||
#if HAS_STEALTHCHOP |
|||
lv_obj_t *buttonStepMode, *labelStepMode, *buttonStepModeNarrow; |
|||
lv_obj_t * line3; |
|||
#endif |
|||
#endif |
|||
lv_obj_t * line1; |
|||
if (disp_state_stack._disp_state[disp_state_stack._disp_index] != MOTOR_SETTINGS_UI) { |
|||
disp_state_stack._disp_index++; |
|||
disp_state_stack._disp_state[disp_state_stack._disp_index] = MOTOR_SETTINGS_UI; |
|||
} |
|||
disp_state = MOTOR_SETTINGS_UI; |
|||
|
|||
scr = lv_obj_create(NULL, NULL); |
|||
|
|||
lv_obj_set_style(scr, &tft_style_scr); |
|||
lv_scr_load(scr); |
|||
lv_obj_clean(scr); |
|||
|
|||
lv_obj_t * title = lv_label_create(scr, NULL); |
|||
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_IMG_DECLARE(bmp_para_back); |
|||
LV_IMG_DECLARE(bmp_para_arrow); |
|||
|
|||
buttonSteps = lv_btn_create(scr, NULL); /*Add a button the current screen*/ |
|||
lv_obj_set_pos(buttonSteps, PARA_UI_POS_X, PARA_UI_POS_Y); /*Set its position*/ |
|||
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_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_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); |
|||
labelSteps = lv_label_create(buttonSteps, NULL); /*Add a label to the button*/ |
|||
|
|||
buttonStepsNarrow = lv_imgbtn_create(scr, NULL); |
|||
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, "bmp_arrow.bin", 0); |
|||
lv_imgbtn_set_src(buttonStepsNarrow, LV_BTN_STATE_REL, &bmp_para_arrow); |
|||
lv_imgbtn_set_src(buttonStepsNarrow, LV_BTN_STATE_PR, &bmp_para_arrow); |
|||
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(lv_scr_act(), NULL); |
|||
lv_ex_line(line1, line_points[0]); |
|||
#if HAS_TRINAMIC_CONFIG |
|||
buttonTMCcurrent = lv_btn_create(scr, NULL); /*Add a button the current screen*/ |
|||
lv_obj_set_pos(buttonTMCcurrent, PARA_UI_POS_X, PARA_UI_POS_Y * 2); /*Set its position*/ |
|||
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_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_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); |
|||
labelTMCcurrent = lv_label_create(buttonTMCcurrent, NULL); /*Add a label to the button*/ |
|||
|
|||
buttonTMCcurrentNarrow = lv_imgbtn_create(scr, NULL); |
|||
lv_obj_set_pos(buttonTMCcurrentNarrow, PARA_UI_POS_X + PARA_UI_SIZE_X, PARA_UI_POS_Y * 2 + PARA_UI_ARROW_V); |
|||
lv_obj_set_event_cb_mks(buttonTMCcurrentNarrow, event_handler, ID_MOTOR_TMC_CURRENT_ARROW, "bmp_arrow.bin", 0); |
|||
lv_imgbtn_set_src(buttonTMCcurrentNarrow, LV_BTN_STATE_REL, &bmp_para_arrow); |
|||
lv_imgbtn_set_src(buttonTMCcurrentNarrow, LV_BTN_STATE_PR, &bmp_para_arrow); |
|||
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); |
|||
|
|||
line2 = lv_line_create(lv_scr_act(), NULL); |
|||
lv_ex_line(line2, line_points[1]); |
|||
|
|||
#if HAS_STEALTHCHOP |
|||
buttonStepMode = lv_btn_create(scr, NULL); /*Add a button the current screen*/ |
|||
lv_obj_set_pos(buttonStepMode, PARA_UI_POS_X, PARA_UI_POS_Y * 3); /*Set its position*/ |
|||
lv_obj_set_size(buttonStepMode, PARA_UI_SIZE_X, PARA_UI_SIZE_Y); /*Set its size*/ |
|||
// lv_obj_set_event_cb(buttonMachine, event_handler);
|
|||
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*/ |
|||
|
|||
buttonStepModeNarrow = lv_imgbtn_create(scr, NULL); |
|||
lv_obj_set_pos(buttonStepModeNarrow, PARA_UI_POS_X + PARA_UI_SIZE_X, PARA_UI_POS_Y * 3 + PARA_UI_ARROW_V); |
|||
lv_obj_set_event_cb_mks(buttonStepModeNarrow, event_handler, ID_MOTOR_STEP_MODE_ARROW, "bmp_arrow.bin", 0); |
|||
lv_imgbtn_set_src(buttonStepModeNarrow, LV_BTN_STATE_REL, &bmp_para_arrow); |
|||
lv_imgbtn_set_src(buttonStepModeNarrow, LV_BTN_STATE_PR, &bmp_para_arrow); |
|||
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); |
|||
|
|||
line3 = lv_line_create(lv_scr_act(), NULL); |
|||
lv_ex_line(line3, line_points[2]); |
|||
#endif |
|||
#endif // HAS_TRINAMIC_CONFIG
|
|||
|
|||
buttonBack = lv_imgbtn_create(scr, NULL); |
|||
lv_obj_set_event_cb_mks(buttonBack, event_handler, ID_MOTOR_RETURN, "bmp_back70x40.bin", 0); |
|||
lv_imgbtn_set_src(buttonBack, LV_BTN_STATE_REL, &bmp_para_back); |
|||
lv_imgbtn_set_src(buttonBack, LV_BTN_STATE_PR, &bmp_para_back); |
|||
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 != 0) { |
|||
lv_label_set_text(label_Back, common_menu.text_back); |
|||
lv_obj_align(label_Back, buttonBack, LV_ALIGN_CENTER, 0, 0); |
|||
|
|||
lv_label_set_text(labelSteps, machine_menu.StepsConf); |
|||
lv_obj_align(labelSteps, buttonSteps, LV_ALIGN_IN_LEFT_MID, 0, 0); |
|||
#if HAS_TRINAMIC_CONFIG |
|||
lv_label_set_text(labelTMCcurrent, machine_menu.TMCcurrentConf); |
|||
lv_obj_align(labelTMCcurrent, buttonTMCcurrent, LV_ALIGN_IN_LEFT_MID, 0, 0); |
|||
#if HAS_STEALTHCHOP |
|||
lv_label_set_text(labelStepMode, machine_menu.TMCStepModeConf); |
|||
lv_obj_align(labelStepMode, buttonStepMode, LV_ALIGN_IN_LEFT_MID, 0, 0); |
|||
#endif |
|||
#endif |
|||
} |
|||
|
|||
} |
|||
|
|||
void lv_clear_motor_settings() { lv_obj_del(scr); } |
|||
|
|||
#endif // HAS_TFT_LVGL_UI
|
@ -0,0 +1,33 @@ |
|||
/**
|
|||
* Marlin 3D Printer Firmware |
|||
* Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
|||
* |
|||
* Based on Sprinter and grbl. |
|||
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm |
|||
* |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|||
* |
|||
*/ |
|||
#pragma once |
|||
|
|||
#ifdef __cplusplus |
|||
extern "C" { /* C-declarations for C++ */ |
|||
#endif |
|||
|
|||
extern void lv_draw_motor_settings(void); |
|||
extern void lv_clear_motor_settings(); |
|||
|
|||
#ifdef __cplusplus |
|||
} /* C-declarations for C++ */ |
|||
#endif |
@ -0,0 +1,799 @@ |
|||
/**
|
|||
* Marlin 3D Printer Firmware |
|||
* Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
|||
* |
|||
* Based on Sprinter and grbl. |
|||
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm |
|||
* |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|||
* |
|||
*/ |
|||
#include "../../../../inc/MarlinConfigPre.h" |
|||
|
|||
#if HAS_TFT_LVGL_UI |
|||
|
|||
#include "lv_conf.h" |
|||
//#include "../../lvgl/src/lv_objx/lv_imgbtn.h"
|
|||
//#include "../../lvgl/src/lv_objx/lv_img.h"
|
|||
//#include "../../lvgl/src/lv_core/lv_disp.h"
|
|||
//#include "../../lvgl/src/lv_core/lv_refr.h"
|
|||
//#include "../../MarlinCore.h"
|
|||
#include "draw_ui.h" |
|||
|
|||
#include "../../../../MarlinCore.h" |
|||
#include "../../../../module/temperature.h" |
|||
#include "../../../../gcode/queue.h" |
|||
#if ENABLED(POWER_LOSS_RECOVERY) |
|||
#include "../../../../../feature/powerloss.h" |
|||
#endif |
|||
|
|||
#include "../../../../gcode/gcode.h" |
|||
#include "../../../../module/planner.h" |
|||
|
|||
#if HAS_TRINAMIC_CONFIG |
|||
#include "../../../../module/stepper/indirection.h" |
|||
#include "../../../../feature/tmc_util.h" |
|||
#endif |
|||
|
|||
static lv_obj_t * scr; |
|||
static lv_obj_t *buttonValue = NULL; |
|||
static lv_obj_t *labelValue = NULL; |
|||
|
|||
static char key_value[11] = {0}; |
|||
static uint8_t cnt = 0; |
|||
static char point_flg = 1; |
|||
|
|||
#define ID_NUM_KEY1 1 |
|||
#define ID_NUM_KEY2 2 |
|||
#define ID_NUM_KEY3 3 |
|||
#define ID_NUM_KEY4 4 |
|||
#define ID_NUM_KEY5 5 |
|||
#define ID_NUM_KEY6 6 |
|||
#define ID_NUM_KEY7 7 |
|||
#define ID_NUM_KEY8 8 |
|||
#define ID_NUM_KEY9 9 |
|||
#define ID_NUM_KEY0 10 |
|||
#define ID_NUM_BACK 11 |
|||
#define ID_NUM_RESET 12 |
|||
#define ID_NUM_CONFIRM 13 |
|||
#define ID_NUM_POINT 14 |
|||
#define ID_NUM_NAGETIVE 15 |
|||
|
|||
static void disp_key_value() { |
|||
char *temp; |
|||
#if HAS_TRINAMIC_CONFIG |
|||
float milliamps; |
|||
#endif |
|||
|
|||
switch (value) { |
|||
case PrintAcceleration: |
|||
ZERO(public_buf_m); |
|||
sprintf_P(public_buf_m, PSTR("%.1f"), planner.settings.acceleration); |
|||
break; |
|||
case RetractAcceleration: |
|||
ZERO(public_buf_m); |
|||
sprintf_P(public_buf_m, PSTR("%.1f"), planner.settings.retract_acceleration); |
|||
break; |
|||
case TravelAcceleration: |
|||
ZERO(public_buf_m); |
|||
sprintf_P(public_buf_m, PSTR("%.1f"), planner.settings.travel_acceleration); |
|||
break; |
|||
case XAcceleration: |
|||
ZERO(public_buf_m); |
|||
sprintf_P(public_buf_m, PSTR("%d"), (int)planner.settings.max_acceleration_mm_per_s2[X_AXIS]); |
|||
break; |
|||
case YAcceleration: |
|||
ZERO(public_buf_m); |
|||
sprintf_P(public_buf_m, PSTR("%d"), (int)planner.settings.max_acceleration_mm_per_s2[Y_AXIS]); |
|||
break; |
|||
case ZAcceleration: |
|||
ZERO(public_buf_m); |
|||
sprintf_P(public_buf_m, PSTR("%d"), (int)planner.settings.max_acceleration_mm_per_s2[Z_AXIS]); |
|||
break; |
|||
case E0Acceleration: |
|||
ZERO(public_buf_m); |
|||
sprintf_P(public_buf_m, PSTR("%d"), (int)planner.settings.max_acceleration_mm_per_s2[E_AXIS]); |
|||
break; |
|||
case E1Acceleration: |
|||
ZERO(public_buf_m); |
|||
sprintf_P(public_buf_m, PSTR("%d"), (int)planner.settings.max_acceleration_mm_per_s2[E_AXIS_N(1)]); |
|||
break; |
|||
case XMaxFeedRate: |
|||
ZERO(public_buf_m); |
|||
sprintf_P(public_buf_m, PSTR("%.1f"), planner.settings.max_feedrate_mm_s[X_AXIS]); |
|||
break; |
|||
case YMaxFeedRate: |
|||
ZERO(public_buf_m); |
|||
sprintf_P(public_buf_m, PSTR("%.1f"), planner.settings.max_feedrate_mm_s[Y_AXIS]); |
|||
break; |
|||
case ZMaxFeedRate: |
|||
ZERO(public_buf_m); |
|||
sprintf_P(public_buf_m, PSTR("%.1f"), planner.settings.max_feedrate_mm_s[Z_AXIS]); |
|||
break; |
|||
case E0MaxFeedRate: |
|||
ZERO(public_buf_m); |
|||
sprintf_P(public_buf_m, PSTR("%.1f"), planner.settings.max_feedrate_mm_s[E_AXIS]); |
|||
break; |
|||
case E1MaxFeedRate: |
|||
ZERO(public_buf_m); |
|||
sprintf_P(public_buf_m, PSTR("%.1f"), planner.settings.max_feedrate_mm_s[E_AXIS_N(1)]); |
|||
break; |
|||
|
|||
case XJerk: |
|||
#if HAS_CLASSIC_JERK |
|||
ZERO(public_buf_m); |
|||
sprintf_P(public_buf_m, PSTR("%.1f"), planner.max_jerk[X_AXIS]); |
|||
#endif |
|||
break; |
|||
case YJerk: |
|||
#if HAS_CLASSIC_JERK |
|||
ZERO(public_buf_m); |
|||
sprintf_P(public_buf_m, PSTR("%.1f"), planner.max_jerk[Y_AXIS]); |
|||
#endif |
|||
break; |
|||
case ZJerk: |
|||
#if HAS_CLASSIC_JERK |
|||
ZERO(public_buf_m); |
|||
sprintf_P(public_buf_m, PSTR("%.1f"), planner.max_jerk[Z_AXIS]); |
|||
#endif |
|||
break; |
|||
case EJerk: |
|||
#if HAS_CLASSIC_JERK |
|||
ZERO(public_buf_m); |
|||
sprintf_P(public_buf_m, PSTR("%.1f"), planner.max_jerk[E_AXIS]); |
|||
#endif |
|||
break; |
|||
|
|||
case Xstep: |
|||
ZERO(public_buf_m); |
|||
sprintf_P(public_buf_m, PSTR("%.1f"), planner.settings.axis_steps_per_mm[X_AXIS]); |
|||
|
|||
break; |
|||
case Ystep: |
|||
ZERO(public_buf_m); |
|||
sprintf_P(public_buf_m, PSTR("%.1f"), planner.settings.axis_steps_per_mm[Y_AXIS]); |
|||
|
|||
break; |
|||
case Zstep: |
|||
ZERO(public_buf_m); |
|||
sprintf_P(public_buf_m, PSTR("%.1f"), planner.settings.axis_steps_per_mm[Z_AXIS]); |
|||
|
|||
break; |
|||
case E0step: |
|||
ZERO(public_buf_m); |
|||
sprintf_P(public_buf_m, PSTR("%.1f"), planner.settings.axis_steps_per_mm[E_AXIS]); |
|||
|
|||
break; |
|||
case E1step: |
|||
ZERO(public_buf_m); |
|||
sprintf_P(public_buf_m, PSTR("%.1f"), planner.settings.axis_steps_per_mm[E_AXIS_N(1)]); |
|||
break; |
|||
|
|||
case Xcurrent: |
|||
#if AXIS_IS_TMC(X) |
|||
ZERO(public_buf_m); |
|||
milliamps = stepperX.getMilliamps(); |
|||
sprintf_P(public_buf_m, PSTR("%.1f"), milliamps); |
|||
#endif |
|||
break; |
|||
|
|||
case Ycurrent: |
|||
#if AXIS_IS_TMC(Y) |
|||
ZERO(public_buf_m); |
|||
milliamps = stepperY.getMilliamps(); |
|||
sprintf_P(public_buf_m, PSTR("%.1f"), milliamps); |
|||
#endif |
|||
break; |
|||
|
|||
case Zcurrent: |
|||
#if AXIS_IS_TMC(Z) |
|||
ZERO(public_buf_m); |
|||
milliamps = stepperZ.getMilliamps(); |
|||
sprintf_P(public_buf_m, PSTR("%.1f"), milliamps); |
|||
#endif |
|||
break; |
|||
|
|||
case E0current: |
|||
#if AXIS_IS_TMC(E0) |
|||
ZERO(public_buf_m); |
|||
milliamps = stepperE0.getMilliamps(); |
|||
sprintf_P(public_buf_m, PSTR("%.1f"), milliamps); |
|||
#endif |
|||
break; |
|||
|
|||
case E1current: |
|||
#if AXIS_IS_TMC(E1) |
|||
ZERO(public_buf_m); |
|||
milliamps = stepperE1.getMilliamps(); |
|||
sprintf_P(public_buf_m, PSTR("%.1f"), milliamps); |
|||
#endif |
|||
break; |
|||
|
|||
case pause_pos_x: |
|||
ZERO(public_buf_m); |
|||
sprintf_P(public_buf_m, PSTR("%.1f"), gCfgItems.pausePosX); |
|||
break; |
|||
case pause_pos_y: |
|||
ZERO(public_buf_m); |
|||
sprintf_P(public_buf_m, PSTR("%.1f"), gCfgItems.pausePosY); |
|||
break; |
|||
case pause_pos_z: |
|||
ZERO(public_buf_m); |
|||
sprintf_P(public_buf_m, PSTR("%.1f"), gCfgItems.pausePosZ); |
|||
break; |
|||
} |
|||
ZERO(key_value); |
|||
strcpy(key_value, public_buf_m); |
|||
cnt = strlen(key_value); |
|||
temp = strchr(key_value, '.'); |
|||
if (temp) |
|||
point_flg = 0; |
|||
else |
|||
point_flg = 1; |
|||
lv_label_set_text(labelValue, key_value); |
|||
lv_obj_align(labelValue, buttonValue, LV_ALIGN_CENTER, 0, 0); |
|||
|
|||
} |
|||
|
|||
static void set_value_confirm() { |
|||
#if HAS_TRINAMIC_CONFIG |
|||
uint16_t current_mA; |
|||
#endif |
|||
switch (value) { |
|||
case PrintAcceleration: |
|||
planner.settings.acceleration = atof(key_value); |
|||
|
|||
break; |
|||
case RetractAcceleration: |
|||
planner.settings.retract_acceleration = atof(key_value); |
|||
|
|||
break; |
|||
case TravelAcceleration: |
|||
planner.settings.travel_acceleration = atof(key_value); |
|||
|
|||
break; |
|||
case XAcceleration: |
|||
planner.settings.max_acceleration_mm_per_s2[X_AXIS] = atof(key_value); |
|||
break; |
|||
case YAcceleration: |
|||
planner.settings.max_acceleration_mm_per_s2[Y_AXIS] = atof(key_value); |
|||
break; |
|||
case ZAcceleration: |
|||
planner.settings.max_acceleration_mm_per_s2[Z_AXIS] = atof(key_value); |
|||
break; |
|||
case E0Acceleration: |
|||
planner.settings.max_acceleration_mm_per_s2[E_AXIS] = atof(key_value); |
|||
break; |
|||
case E1Acceleration: |
|||
planner.settings.max_acceleration_mm_per_s2[E_AXIS_N(1)] = atof(key_value); |
|||
break; |
|||
case XMaxFeedRate: |
|||
planner.settings.max_feedrate_mm_s[X_AXIS] = atof(key_value); |
|||
break; |
|||
case YMaxFeedRate: |
|||
planner.settings.max_feedrate_mm_s[Y_AXIS] = atof(key_value); |
|||
break; |
|||
case ZMaxFeedRate: |
|||
planner.settings.max_feedrate_mm_s[Z_AXIS] = atof(key_value); |
|||
break; |
|||
case E0MaxFeedRate: |
|||
planner.settings.max_feedrate_mm_s[E_AXIS] = atof(key_value); |
|||
break; |
|||
case E1MaxFeedRate: |
|||
planner.settings.max_feedrate_mm_s[E_AXIS_N(1)] = atof(key_value); |
|||
break; |
|||
|
|||
case XJerk: |
|||
#if HAS_CLASSIC_JERK |
|||
planner.max_jerk[X_AXIS] = atof(key_value); |
|||
#endif |
|||
break; |
|||
case YJerk: |
|||
#if HAS_CLASSIC_JERK |
|||
planner.max_jerk[Y_AXIS] = atof(key_value); |
|||
#endif |
|||
break; |
|||
case ZJerk: |
|||
#if HAS_CLASSIC_JERK |
|||
planner.max_jerk[Z_AXIS] = atof(key_value); |
|||
#endif |
|||
break; |
|||
case EJerk: |
|||
#if HAS_CLASSIC_JERK |
|||
planner.max_jerk[E_AXIS] = atof(key_value); |
|||
#endif |
|||
break; |
|||
|
|||
case Xstep: |
|||
planner.settings.axis_steps_per_mm[X_AXIS] = atof(key_value); |
|||
break; |
|||
case Ystep: |
|||
planner.settings.axis_steps_per_mm[Y_AXIS] = atof(key_value); |
|||
break; |
|||
case Zstep: |
|||
planner.settings.axis_steps_per_mm[Z_AXIS] = atof(key_value); |
|||
break; |
|||
case E0step: |
|||
planner.settings.axis_steps_per_mm[E_AXIS] = atof(key_value); |
|||
break; |
|||
case E1step: |
|||
planner.settings.axis_steps_per_mm[E_AXIS_N(1)] = atof(key_value); |
|||
break; |
|||
|
|||
case Xcurrent: |
|||
#if AXIS_IS_TMC(X) |
|||
current_mA = atoi(key_value); |
|||
stepperX.rms_current(current_mA); |
|||
#endif |
|||
break; |
|||
|
|||
case Ycurrent: |
|||
#if AXIS_IS_TMC(Y) |
|||
current_mA = atoi(key_value); |
|||
stepperY.rms_current(current_mA); |
|||
#endif |
|||
break; |
|||
|
|||
case Zcurrent: |
|||
#if AXIS_IS_TMC(Z) |
|||
current_mA = atoi(key_value); |
|||
stepperZ.rms_current(current_mA); |
|||
#endif |
|||
break; |
|||
|
|||
case E0current: |
|||
#if AXIS_IS_TMC(E0) |
|||
current_mA = atoi(key_value); |
|||
stepperE0.rms_current(current_mA); |
|||
#endif |
|||
break; |
|||
|
|||
case E1current: |
|||
#if AXIS_IS_TMC(E1) |
|||
current_mA = atoi(key_value); |
|||
stepperE1.rms_current(current_mA); |
|||
#endif |
|||
break; |
|||
|
|||
break; |
|||
case pause_pos_x: |
|||
gCfgItems.pausePosX = atof(key_value); |
|||
update_spi_flash(); |
|||
break; |
|||
case pause_pos_y: |
|||
gCfgItems.pausePosY = atof(key_value); |
|||
update_spi_flash(); |
|||
break; |
|||
case pause_pos_z: |
|||
gCfgItems.pausePosZ = atof(key_value); |
|||
update_spi_flash(); |
|||
break; |
|||
} |
|||
gcode.process_subcommands_now_P(PSTR("M500")); |
|||
} |
|||
|
|||
static void event_handler(lv_obj_t * obj, lv_event_t event) { |
|||
switch (obj->mks_obj_id) { |
|||
case ID_NUM_KEY1: |
|||
if (event == LV_EVENT_CLICKED) { |
|||
|
|||
} |
|||
else if (event == LV_EVENT_RELEASED) { |
|||
if (cnt <= 10) { |
|||
key_value[cnt] = (char)'1'; |
|||
lv_label_set_text(labelValue, key_value); |
|||
lv_obj_align(labelValue, buttonValue, LV_ALIGN_CENTER, 0, 0); |
|||
cnt++; |
|||
} |
|||
} |
|||
break; |
|||
case ID_NUM_KEY2: |
|||
if (event == LV_EVENT_CLICKED) { |
|||
|
|||
} |
|||
else if (event == LV_EVENT_RELEASED) { |
|||
if (cnt <= 10) { |
|||
key_value[cnt] = (char)'2'; |
|||
lv_label_set_text(labelValue, key_value); |
|||
lv_obj_align(labelValue, buttonValue, LV_ALIGN_CENTER, 0, 0); |
|||
cnt++; |
|||
} |
|||
} |
|||
break; |
|||
case ID_NUM_KEY3: |
|||
if (event == LV_EVENT_CLICKED) { |
|||
|
|||
} |
|||
else if (event == LV_EVENT_RELEASED) { |
|||
if (cnt <= 10) { |
|||
key_value[cnt] = (char)'3'; |
|||
lv_label_set_text(labelValue, key_value); |
|||
lv_obj_align(labelValue, buttonValue, LV_ALIGN_CENTER, 0, 0); |
|||
cnt++; |
|||
} |
|||
} |
|||
break; |
|||
case ID_NUM_KEY4: |
|||
if (event == LV_EVENT_CLICKED) { |
|||
|
|||
} |
|||
else if (event == LV_EVENT_RELEASED) { |
|||
if (cnt <= 10) { |
|||
key_value[cnt] = (char)'4'; |
|||
lv_label_set_text(labelValue, key_value); |
|||
lv_obj_align(labelValue, buttonValue, LV_ALIGN_CENTER, 0, 0); |
|||
cnt++; |
|||
} |
|||
} |
|||
break; |
|||
case ID_NUM_KEY5: |
|||
if (event == LV_EVENT_CLICKED) { |
|||
|
|||
} |
|||
else if (event == LV_EVENT_RELEASED) { |
|||
if (cnt <= 10) { |
|||
key_value[cnt] = (char)'5'; |
|||
lv_label_set_text(labelValue, key_value); |
|||
lv_obj_align(labelValue, buttonValue, LV_ALIGN_CENTER, 0, 0); |
|||
cnt++; |
|||
} |
|||
} |
|||
break; |
|||
case ID_NUM_KEY6: |
|||
if (event == LV_EVENT_CLICKED) { |
|||
|
|||
} |
|||
else if (event == LV_EVENT_RELEASED) { |
|||
if (cnt <= 10) { |
|||
key_value[cnt] = (char)'6'; |
|||
lv_label_set_text(labelValue, key_value); |
|||
lv_obj_align(labelValue, buttonValue, LV_ALIGN_CENTER, 0, 0); |
|||
cnt++; |
|||
} |
|||
} |
|||
break; |
|||
case ID_NUM_KEY7: |
|||
if (event == LV_EVENT_CLICKED) { |
|||
|
|||
} |
|||
else if (event == LV_EVENT_RELEASED) { |
|||
if (cnt <= 10) { |
|||
key_value[cnt] = (char)'7'; |
|||
lv_label_set_text(labelValue, key_value); |
|||
lv_obj_align(labelValue, buttonValue, LV_ALIGN_CENTER, 0, 0); |
|||
cnt++; |
|||
} |
|||
} |
|||
break; |
|||
case ID_NUM_KEY8: |
|||
if (event == LV_EVENT_CLICKED) { |
|||
|
|||
} |
|||
else if (event == LV_EVENT_RELEASED) { |
|||
if (cnt <= 10) { |
|||
key_value[cnt] = (char)'8'; |
|||
lv_label_set_text(labelValue, key_value); |
|||
lv_obj_align(labelValue, buttonValue, LV_ALIGN_CENTER, 0, 0); |
|||
cnt++; |
|||
} |
|||
} |
|||
break; |
|||
case ID_NUM_KEY9: |
|||
if (event == LV_EVENT_CLICKED) { |
|||
|
|||
} |
|||
else if (event == LV_EVENT_RELEASED) { |
|||
if (cnt <= 10) { |
|||
key_value[cnt] = (char)'9'; |
|||
lv_label_set_text(labelValue, key_value); |
|||
lv_obj_align(labelValue, buttonValue, LV_ALIGN_CENTER, 0, 0); |
|||
cnt++; |
|||
} |
|||
} |
|||
break; |
|||
case ID_NUM_KEY0: |
|||
if (event == LV_EVENT_CLICKED) { |
|||
|
|||
} |
|||
else if (event == LV_EVENT_RELEASED) { |
|||
if (cnt <= 10) { |
|||
key_value[cnt] = (char)'0'; |
|||
lv_label_set_text(labelValue, key_value); |
|||
lv_obj_align(labelValue, buttonValue, LV_ALIGN_CENTER, 0, 0); |
|||
cnt++; |
|||
} |
|||
} |
|||
break; |
|||
case ID_NUM_BACK: |
|||
if (event == LV_EVENT_CLICKED) { |
|||
|
|||
} |
|||
else if (event == LV_EVENT_RELEASED) { |
|||
if (cnt > 0) |
|||
cnt--; |
|||
if (key_value[cnt] == (char)'.') point_flg = 1; |
|||
key_value[cnt] = (char)'\0'; |
|||
lv_label_set_text(labelValue, key_value); |
|||
lv_obj_align(labelValue, buttonValue, LV_ALIGN_CENTER, 0, 0); |
|||
} |
|||
break; |
|||
case ID_NUM_RESET: |
|||
if (event == LV_EVENT_CLICKED) { |
|||
|
|||
} |
|||
else if (event == LV_EVENT_RELEASED) { |
|||
ZERO(key_value); |
|||
cnt = 0; |
|||
key_value[cnt] = (char)'0'; |
|||
point_flg = 1; |
|||
lv_label_set_text(labelValue, key_value); |
|||
lv_obj_align(labelValue, buttonValue, LV_ALIGN_CENTER, 0, 0); |
|||
} |
|||
break; |
|||
case ID_NUM_POINT: |
|||
if (event == LV_EVENT_CLICKED) { |
|||
|
|||
} |
|||
else if (event == LV_EVENT_RELEASED) { |
|||
if ((cnt != 0) && (point_flg == 1)) { |
|||
point_flg = 0; |
|||
key_value[cnt] = (char)'.'; |
|||
lv_label_set_text(labelValue, key_value); |
|||
lv_obj_align(labelValue, buttonValue, LV_ALIGN_CENTER, 0, 0); |
|||
cnt++; |
|||
} |
|||
} |
|||
break; |
|||
case ID_NUM_NAGETIVE: |
|||
if (event == LV_EVENT_CLICKED) { |
|||
|
|||
} |
|||
else if (event == LV_EVENT_RELEASED) { |
|||
if (cnt == 0) { |
|||
key_value[cnt] = (char)'-'; |
|||
lv_label_set_text(labelValue, key_value); |
|||
lv_obj_align(labelValue, buttonValue, LV_ALIGN_CENTER, 0, 0); |
|||
cnt++; |
|||
} |
|||
} |
|||
break; |
|||
case ID_NUM_CONFIRM: |
|||
if (event == LV_EVENT_CLICKED) { |
|||
|
|||
} |
|||
else if (event == LV_EVENT_RELEASED) { |
|||
last_disp_state = NUMBER_KEY_UI; |
|||
if (strlen(key_value) != 0) |
|||
set_value_confirm(); |
|||
lv_clear_number_key(); |
|||
draw_return_ui(); |
|||
} |
|||
break; |
|||
} |
|||
} |
|||
|
|||
void lv_draw_number_key(void) { |
|||
lv_obj_t *NumberKey_1 = NULL, *NumberKey_2 = NULL, *NumberKey_3 = NULL, *NumberKey_4 = NULL, *NumberKey_5 = NULL; |
|||
lv_obj_t *NumberKey_6 = NULL, *NumberKey_7 = NULL, *NumberKey_8 = NULL, *NumberKey_9 = NULL, *NumberKey_0 = NULL; |
|||
lv_obj_t *KeyPoint = NULL, *KeyConfirm = NULL, *KeyReset = NULL, *KeyBack = NULL; |
|||
lv_obj_t *Minus = NULL; |
|||
lv_obj_t *labelKey_1 = NULL, *labelKey_2 = NULL, *labelKey_3 = NULL, *labelKey_4 = NULL, *labelKey_5 = NULL; |
|||
lv_obj_t *labelKey_6 = NULL, *labelKey_7 = NULL, *labelKey_8 = NULL, *labelKey_9 = NULL, *labelKey_0 = NULL; |
|||
lv_obj_t *labelKeyPoint = NULL, *labelKeyConfirm = NULL, *labelKeyReset = NULL, *labelKeyBack = NULL; |
|||
lv_obj_t *labelMinus = NULL; |
|||
|
|||
buttonValue = NULL; |
|||
labelValue = NULL; |
|||
|
|||
if (disp_state_stack._disp_state[disp_state_stack._disp_index] != NUMBER_KEY_UI) { |
|||
disp_state_stack._disp_index++; |
|||
disp_state_stack._disp_state[disp_state_stack._disp_index] = NUMBER_KEY_UI; |
|||
} |
|||
disp_state = NUMBER_KEY_UI; |
|||
|
|||
scr = lv_obj_create(NULL, NULL); |
|||
|
|||
lv_obj_set_style(scr, &tft_style_scr); |
|||
lv_scr_load(scr); |
|||
lv_obj_clean(scr); |
|||
|
|||
//lv_obj_t * title = lv_label_create(scr, NULL);
|
|||
//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_IMG_DECLARE(bmp_pic);
|
|||
|
|||
buttonValue = lv_btn_create(scr, NULL); /*Add a button the current screen*/ |
|||
lv_obj_set_pos(buttonValue, 92, 40); /*Set its position*/ |
|||
lv_obj_set_size(buttonValue, 296, 40); |
|||
lv_obj_set_event_cb_mks(buttonValue, event_handler, ID_NUM_KEY1, NULL, 0); |
|||
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_layout(buttonValue, LV_LAYOUT_OFF); |
|||
labelValue = lv_label_create(buttonValue, NULL); /*Add a label to the button*/ |
|||
|
|||
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_size(NumberKey_1, 68, 40); |
|||
lv_obj_set_event_cb_mks(NumberKey_1, event_handler, ID_NUM_KEY1, NULL, 0); |
|||
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_layout(NumberKey_1, LV_LAYOUT_OFF); |
|||
labelKey_1 = lv_label_create(NumberKey_1, NULL); /*Add a label to the button*/ |
|||
lv_label_set_text(labelKey_1, machine_menu.key_1); |
|||
lv_obj_align(labelKey_1, NumberKey_1, LV_ALIGN_CENTER, 0, 0); |
|||
|
|||
NumberKey_2 = lv_btn_create(scr, NULL); /*Add a button the current screen*/ |
|||
lv_obj_set_pos(NumberKey_2, 168, 90); /*Set its position*/ |
|||
lv_obj_set_size(NumberKey_2, 68, 40); |
|||
lv_obj_set_event_cb_mks(NumberKey_2, event_handler, ID_NUM_KEY2, NULL, 0); |
|||
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_layout(NumberKey_2, LV_LAYOUT_OFF); |
|||
labelKey_2 = lv_label_create(NumberKey_2, NULL); /*Add a label to the button*/ |
|||
lv_label_set_text(labelKey_2, machine_menu.key_2); |
|||
lv_obj_align(labelKey_2, NumberKey_2, LV_ALIGN_CENTER, 0, 0); |
|||
|
|||
NumberKey_3 = lv_btn_create(scr, NULL); /*Add a button the current screen*/ |
|||
lv_obj_set_pos(NumberKey_3, 244, 90); /*Set its position*/ |
|||
lv_obj_set_size(NumberKey_3, 68, 40); |
|||
lv_obj_set_event_cb_mks(NumberKey_3, event_handler, ID_NUM_KEY3, NULL, 0); |
|||
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_layout(NumberKey_3, LV_LAYOUT_OFF); |
|||
labelKey_3 = lv_label_create(NumberKey_3, NULL); /*Add a label to the button*/ |
|||
lv_label_set_text(labelKey_3, machine_menu.key_3); |
|||
lv_obj_align(labelKey_3, NumberKey_3, LV_ALIGN_CENTER, 0, 0); |
|||
|
|||
NumberKey_4 = lv_btn_create(scr, NULL); /*Add a button the current screen*/ |
|||
lv_obj_set_pos(NumberKey_4, 92, 140); /*Set its position*/ |
|||
lv_obj_set_size(NumberKey_4, 68, 40); |
|||
lv_obj_set_event_cb_mks(NumberKey_4, event_handler, ID_NUM_KEY4, NULL, 0); |
|||
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_layout(NumberKey_4, LV_LAYOUT_OFF); |
|||
labelKey_4 = lv_label_create(NumberKey_4, NULL); /*Add a label to the button*/ |
|||
lv_label_set_text(labelKey_4, machine_menu.key_4); |
|||
lv_obj_align(labelKey_4, NumberKey_4, LV_ALIGN_CENTER, 0, 0); |
|||
|
|||
NumberKey_5 = lv_btn_create(scr, NULL); /*Add a button the current screen*/ |
|||
lv_obj_set_pos(NumberKey_5, 168, 140); /*Set its position*/ |
|||
lv_obj_set_size(NumberKey_5, 68, 40); |
|||
lv_obj_set_event_cb_mks(NumberKey_5, event_handler, ID_NUM_KEY5, NULL, 0); |
|||
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_layout(NumberKey_5, LV_LAYOUT_OFF); |
|||
labelKey_5 = lv_label_create(NumberKey_5, NULL); /*Add a label to the button*/ |
|||
lv_label_set_text(labelKey_5, machine_menu.key_5); |
|||
lv_obj_align(labelKey_5, NumberKey_5, LV_ALIGN_CENTER, 0, 0); |
|||
|
|||
NumberKey_6 = lv_btn_create(scr, NULL); /*Add a button the current screen*/ |
|||
lv_obj_set_pos(NumberKey_6, 244, 140); /*Set its position*/ |
|||
lv_obj_set_size(NumberKey_6, 68, 40); |
|||
lv_obj_set_event_cb_mks(NumberKey_6, event_handler, ID_NUM_KEY6, NULL, 0); |
|||
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_layout(NumberKey_6, LV_LAYOUT_OFF); |
|||
labelKey_6 = lv_label_create(NumberKey_6, NULL); /*Add a label to the button*/ |
|||
lv_label_set_text(labelKey_6, machine_menu.key_6); |
|||
lv_obj_align(labelKey_6, NumberKey_6, LV_ALIGN_CENTER, 0, 0); |
|||
|
|||
NumberKey_7 = lv_btn_create(scr, NULL); /*Add a button the current screen*/ |
|||
lv_obj_set_pos(NumberKey_7, 92, 190); /*Set its position*/ |
|||
lv_obj_set_size(NumberKey_7, 68, 40); |
|||
lv_obj_set_event_cb_mks(NumberKey_7, event_handler, ID_NUM_KEY7, NULL, 0); |
|||
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_layout(NumberKey_7, LV_LAYOUT_OFF); |
|||
labelKey_7 = lv_label_create(NumberKey_7, NULL); /*Add a label to the button*/ |
|||
lv_label_set_text(labelKey_7, machine_menu.key_7); |
|||
lv_obj_align(labelKey_7, NumberKey_7, LV_ALIGN_CENTER, 0, 0); |
|||
|
|||
NumberKey_8 = lv_btn_create(scr, NULL); /*Add a button the current screen*/ |
|||
lv_obj_set_pos(NumberKey_8, 168, 190); /*Set its position*/ |
|||
lv_obj_set_size(NumberKey_8, 68, 40); |
|||
lv_obj_set_event_cb_mks(NumberKey_8, event_handler, ID_NUM_KEY8, NULL, 0); |
|||
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_layout(NumberKey_8, LV_LAYOUT_OFF); |
|||
labelKey_8 = lv_label_create(NumberKey_8, NULL); /*Add a label to the button*/ |
|||
lv_label_set_text(labelKey_8, machine_menu.key_8); |
|||
lv_obj_align(labelKey_8, NumberKey_8, LV_ALIGN_CENTER, 0, 0); |
|||
|
|||
NumberKey_9 = lv_btn_create(scr, NULL); /*Add a button the current screen*/ |
|||
lv_obj_set_pos(NumberKey_9, 244, 190); /*Set its position*/ |
|||
lv_obj_set_size(NumberKey_9, 68, 40); |
|||
lv_obj_set_event_cb_mks(NumberKey_9, event_handler, ID_NUM_KEY9, NULL, 0); |
|||
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_layout(NumberKey_9, LV_LAYOUT_OFF); |
|||
labelKey_9 = lv_label_create(NumberKey_9, NULL); /*Add a label to the button*/ |
|||
lv_label_set_text(labelKey_9, machine_menu.key_9); |
|||
lv_obj_align(labelKey_9, NumberKey_9, LV_ALIGN_CENTER, 0, 0); |
|||
|
|||
NumberKey_0 = lv_btn_create(scr, NULL); /*Add a button the current screen*/ |
|||
lv_obj_set_pos(NumberKey_0, 92, 240); /*Set its position*/ |
|||
lv_obj_set_size(NumberKey_0, 68, 40); |
|||
lv_obj_set_event_cb_mks(NumberKey_0, event_handler, ID_NUM_KEY0, NULL, 0); |
|||
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_layout(NumberKey_0, LV_LAYOUT_OFF); |
|||
labelKey_0 = lv_label_create(NumberKey_0, NULL); /*Add a label to the button*/ |
|||
lv_label_set_text(labelKey_0, machine_menu.key_0); |
|||
lv_obj_align(labelKey_0, NumberKey_0, LV_ALIGN_CENTER, 0, 0); |
|||
|
|||
KeyBack = lv_btn_create(scr, NULL); /*Add a button the current screen*/ |
|||
lv_obj_set_pos(KeyBack, 320, 90); /*Set its position*/ |
|||
lv_obj_set_size(KeyBack, 68, 40); |
|||
lv_obj_set_event_cb_mks(KeyBack, event_handler, ID_NUM_BACK, NULL, 0); |
|||
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_layout(KeyBack, LV_LAYOUT_OFF); |
|||
labelKeyBack = lv_label_create(KeyBack, NULL); /*Add a label to the button*/ |
|||
lv_label_set_text(labelKeyBack, machine_menu.key_back); |
|||
lv_obj_align(labelKeyBack, KeyBack, LV_ALIGN_CENTER, 0, 0); |
|||
|
|||
KeyReset = lv_btn_create(scr, NULL); /*Add a button the current screen*/ |
|||
lv_obj_set_pos(KeyReset, 320, 140); /*Set its position*/ |
|||
lv_obj_set_size(KeyReset, 68, 40); |
|||
lv_obj_set_event_cb_mks(KeyReset, event_handler, ID_NUM_RESET, NULL, 0); |
|||
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_layout(KeyReset, LV_LAYOUT_OFF); |
|||
labelKeyReset = lv_label_create(KeyReset, NULL); /*Add a label to the button*/ |
|||
lv_label_set_text(labelKeyReset, machine_menu.key_reset); |
|||
lv_obj_align(labelKeyReset, KeyReset, LV_ALIGN_CENTER, 0, 0); |
|||
|
|||
KeyConfirm = lv_btn_create(scr, NULL); /*Add a button the current screen*/ |
|||
lv_obj_set_pos(KeyConfirm, 320, 190); /*Set its position*/ |
|||
lv_obj_set_size(KeyConfirm, 68, 90); |
|||
lv_obj_set_event_cb_mks(KeyConfirm, event_handler, ID_NUM_CONFIRM, NULL, 0); |
|||
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_layout(KeyConfirm, LV_LAYOUT_OFF); |
|||
labelKeyConfirm = lv_label_create(KeyConfirm, NULL); /*Add a label to the button*/ |
|||
lv_label_set_text(labelKeyConfirm, machine_menu.key_confirm); |
|||
lv_obj_align(labelKeyConfirm, KeyConfirm, LV_ALIGN_CENTER, 0, 0); |
|||
|
|||
KeyPoint = lv_btn_create(scr, NULL); /*Add a button the current screen*/ |
|||
lv_obj_set_pos(KeyPoint, 244, 240); /*Set its position*/ |
|||
lv_obj_set_size(KeyPoint, 68, 40); |
|||
lv_obj_set_event_cb_mks(KeyPoint, event_handler, ID_NUM_POINT, NULL, 0); |
|||
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_layout(KeyPoint, LV_LAYOUT_OFF); |
|||
labelKeyPoint = lv_label_create(KeyPoint, NULL); /*Add a label to the button*/ |
|||
lv_label_set_text(labelKeyPoint, machine_menu.key_point); |
|||
lv_obj_align(labelKeyPoint, KeyPoint, LV_ALIGN_CENTER, 0, 0); |
|||
|
|||
Minus = lv_btn_create(scr, NULL); /*Add a button the current screen*/ |
|||
lv_obj_set_pos(Minus, 168, 240); /*Set its position*/ |
|||
lv_obj_set_size(Minus, 68, 40); |
|||
lv_obj_set_event_cb_mks(Minus, event_handler, ID_NUM_NAGETIVE, NULL, 0); |
|||
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_layout(Minus, LV_LAYOUT_OFF); |
|||
labelMinus = lv_label_create(Minus, NULL); /*Add a label to the button*/ |
|||
lv_label_set_text(labelMinus, machine_menu.negative); |
|||
lv_obj_align(labelMinus, Minus, LV_ALIGN_CENTER, 0, 0); |
|||
|
|||
disp_key_value(); |
|||
} |
|||
|
|||
void lv_clear_number_key() { lv_obj_del(scr); } |
|||
|
|||
#endif // HAS_TFT_LVGL_UI
|
@ -0,0 +1,33 @@ |
|||
/**
|
|||
* Marlin 3D Printer Firmware |
|||
* Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
|||
* |
|||
* Based on Sprinter and grbl. |
|||
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm |
|||
* |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|||
* |
|||
*/ |
|||
#pragma once |
|||
|
|||
#ifdef __cplusplus |
|||
extern "C" { /* C-declarations for C++ */ |
|||
#endif |
|||
|
|||
extern void lv_draw_number_key(void); |
|||
extern void lv_clear_number_key(); |
|||
|
|||
#ifdef __cplusplus |
|||
} /* C-declarations for C++ */ |
|||
#endif |
@ -0,0 +1,222 @@ |
|||
/**
|
|||
* Marlin 3D Printer Firmware |
|||
* Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
|||
* |
|||
* Based on Sprinter and grbl. |
|||
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm |
|||
* |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|||
* |
|||
*/ |
|||
#include "../../../../inc/MarlinConfigPre.h" |
|||
|
|||
#if HAS_TFT_LVGL_UI |
|||
|
|||
#include "lv_conf.h" |
|||
#include "draw_ui.h" |
|||
|
|||
#include "../../../../MarlinCore.h" |
|||
#include "../../../../module/planner.h" |
|||
|
|||
static lv_obj_t * scr; |
|||
|
|||
#define ID_PAUSE_RETURN 1 |
|||
#define ID_PAUSE_X 2 |
|||
#define ID_PAUSE_Y 3 |
|||
#define ID_PAUSE_Z 4 |
|||
|
|||
static void event_handler(lv_obj_t * obj, lv_event_t event) { |
|||
switch (obj->mks_obj_id) { |
|||
case ID_PAUSE_RETURN: |
|||
if (event == LV_EVENT_CLICKED) { |
|||
|
|||
} |
|||
else if (event == LV_EVENT_RELEASED) { |
|||
lv_clear_pause_position(); |
|||
draw_return_ui(); |
|||
} |
|||
break; |
|||
case ID_PAUSE_X: |
|||
if (event == LV_EVENT_CLICKED) { |
|||
|
|||
} |
|||
else if (event == LV_EVENT_RELEASED) { |
|||
value = pause_pos_x; |
|||
lv_clear_pause_position(); |
|||
lv_draw_number_key(); |
|||
} |
|||
break; |
|||
case ID_PAUSE_Y: |
|||
if (event == LV_EVENT_CLICKED) { |
|||
|
|||
} |
|||
else if (event == LV_EVENT_RELEASED) { |
|||
value = pause_pos_y; |
|||
lv_clear_pause_position(); |
|||
lv_draw_number_key(); |
|||
} |
|||
break; |
|||
case ID_PAUSE_Z: |
|||
if (event == LV_EVENT_CLICKED) { |
|||
|
|||
} |
|||
else if (event == LV_EVENT_RELEASED) { |
|||
value = pause_pos_z; |
|||
lv_clear_pause_position(); |
|||
lv_draw_number_key(); |
|||
} |
|||
break; |
|||
} |
|||
} |
|||
|
|||
void lv_draw_pause_position(void) { |
|||
lv_obj_t *buttonBack = NULL, *label_Back = NULL; |
|||
lv_obj_t *buttonXText = NULL, *labelXText = NULL, *buttonXValue = NULL, *labelXValue = NULL; |
|||
lv_obj_t *buttonYText = NULL, *labelYText = NULL, *buttonYValue = NULL, *labelYValue = NULL; |
|||
lv_obj_t *buttonZText = NULL, *labelZText = NULL, *buttonZValue = NULL, *labelZValue = NULL; |
|||
|
|||
lv_obj_t * line1 = NULL, * line2 = NULL, * line3 = NULL; |
|||
if (disp_state_stack._disp_state[disp_state_stack._disp_index] != PAUSE_POS_UI) { |
|||
disp_state_stack._disp_index++; |
|||
disp_state_stack._disp_state[disp_state_stack._disp_index] = PAUSE_POS_UI; |
|||
} |
|||
disp_state = PAUSE_POS_UI; |
|||
|
|||
scr = lv_obj_create(NULL, NULL); |
|||
|
|||
lv_obj_set_style(scr, &tft_style_scr); |
|||
lv_scr_load(scr); |
|||
lv_obj_clean(scr); |
|||
|
|||
lv_obj_t * title = lv_label_create(scr, NULL); |
|||
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_IMG_DECLARE(bmp_para_back); |
|||
// LV_IMG_DECLARE(bmp_para_arrow);
|
|||
LV_IMG_DECLARE(bmp_para_bank); |
|||
|
|||
buttonXText = lv_btn_create(scr, NULL); /*Add a button the current screen*/ |
|||
lv_obj_set_pos(buttonXText, PARA_UI_POS_X, PARA_UI_POS_Y); /*Set its position*/ |
|||
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*/ |
|||
|
|||
buttonXValue = lv_imgbtn_create(scr, NULL); |
|||
lv_obj_set_pos(buttonXValue, PARA_UI_VALUE_POS_X, PARA_UI_POS_Y + PARA_UI_VALUE_V); |
|||
lv_obj_set_event_cb_mks(buttonXValue, event_handler, ID_PAUSE_X, "bmp_value_blank.bin", 0); |
|||
lv_imgbtn_set_src(buttonXValue, LV_BTN_STATE_REL, &bmp_para_bank); |
|||
lv_imgbtn_set_src(buttonXValue, LV_BTN_STATE_PR, &bmp_para_bank); |
|||
lv_imgbtn_set_style(buttonXValue, LV_BTN_STATE_PR, &style_para_value_pre); |
|||
lv_imgbtn_set_style(buttonXValue, LV_BTN_STATE_REL, &style_para_value_rel); |
|||
lv_btn_set_layout(buttonXValue, LV_LAYOUT_OFF); |
|||
labelXValue = lv_label_create(buttonXValue, NULL); |
|||
|
|||
line1 = lv_line_create(scr, NULL); |
|||
lv_ex_line(line1, line_points[0]); |
|||
|
|||
buttonYText = lv_btn_create(scr, NULL); /*Add a button the current screen*/ |
|||
lv_obj_set_pos(buttonYText, PARA_UI_POS_X, PARA_UI_POS_Y * 2); /*Set its position*/ |
|||
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*/ |
|||
|
|||
buttonYValue = lv_imgbtn_create(scr, NULL); |
|||
lv_obj_set_pos(buttonYValue, PARA_UI_VALUE_POS_X, PARA_UI_POS_Y * 2 + PARA_UI_VALUE_V); |
|||
lv_obj_set_event_cb_mks(buttonYValue, event_handler, ID_PAUSE_Y, "bmp_value_blank.bin", 0); |
|||
lv_imgbtn_set_src(buttonYValue, LV_BTN_STATE_REL, &bmp_para_bank); |
|||
lv_imgbtn_set_src(buttonYValue, LV_BTN_STATE_PR, &bmp_para_bank); |
|||
lv_imgbtn_set_style(buttonYValue, LV_BTN_STATE_PR, &style_para_value_pre); |
|||
lv_imgbtn_set_style(buttonYValue, LV_BTN_STATE_REL, &style_para_value_rel); |
|||
lv_btn_set_layout(buttonYValue, LV_LAYOUT_OFF); |
|||
labelYValue = lv_label_create(buttonYValue, NULL); |
|||
|
|||
line2 = lv_line_create(scr, NULL); |
|||
lv_ex_line(line2, line_points[1]); |
|||
|
|||
buttonZText = lv_btn_create(scr, NULL); /*Add a button the current screen*/ |
|||
lv_obj_set_pos(buttonZText, PARA_UI_POS_X, PARA_UI_POS_Y * 3); /*Set its position*/ |
|||
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*/ |
|||
|
|||
buttonZValue = lv_imgbtn_create(scr, NULL); |
|||
lv_obj_set_pos(buttonZValue, PARA_UI_VALUE_POS_X, PARA_UI_POS_Y * 3 + PARA_UI_VALUE_V); |
|||
lv_obj_set_event_cb_mks(buttonZValue, event_handler, ID_PAUSE_Z, "bmp_value_blank.bin", 0); |
|||
lv_imgbtn_set_src(buttonZValue, LV_BTN_STATE_REL, &bmp_para_bank); |
|||
lv_imgbtn_set_src(buttonZValue, LV_BTN_STATE_PR, &bmp_para_bank); |
|||
lv_imgbtn_set_style(buttonZValue, LV_BTN_STATE_PR, &style_para_value_pre); |
|||
lv_imgbtn_set_style(buttonZValue, LV_BTN_STATE_REL, &style_para_value_rel); |
|||
lv_btn_set_layout(buttonZValue, LV_LAYOUT_OFF); |
|||
labelZValue = lv_label_create(buttonZValue, NULL); |
|||
|
|||
line3 = lv_line_create(scr, NULL); |
|||
lv_ex_line(line3, line_points[2]); |
|||
|
|||
buttonBack = lv_imgbtn_create(scr, NULL); |
|||
lv_obj_set_event_cb_mks(buttonBack, event_handler, ID_PAUSE_RETURN, "bmp_back70x40.bin", 0); |
|||
lv_imgbtn_set_src(buttonBack, LV_BTN_STATE_REL, &bmp_para_back); |
|||
lv_imgbtn_set_src(buttonBack, LV_BTN_STATE_PR, &bmp_para_back); |
|||
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 != 0) { |
|||
ZERO(public_buf_l); |
|||
sprintf_P(public_buf_l, PSTR("%.1f"), gCfgItems.pausePosX); |
|||
lv_label_set_text(labelXValue, public_buf_l); |
|||
lv_obj_align(labelXValue, buttonXValue, LV_ALIGN_CENTER, 0, 0); |
|||
|
|||
ZERO(public_buf_l); |
|||
sprintf_P(public_buf_l, PSTR("%.1f"), gCfgItems.pausePosY); |
|||
lv_label_set_text(labelYValue, public_buf_l); |
|||
lv_obj_align(labelYValue, buttonYValue, LV_ALIGN_CENTER, 0, 0); |
|||
|
|||
ZERO(public_buf_l); |
|||
sprintf_P(public_buf_l, PSTR("%.1f"), gCfgItems.pausePosZ); |
|||
lv_label_set_text(labelZValue, public_buf_l); |
|||
lv_obj_align(labelZValue, buttonZValue, LV_ALIGN_CENTER, 0, 0); |
|||
|
|||
lv_label_set_text(labelXText, machine_menu.xPos); |
|||
lv_obj_align(labelXText, buttonXText, LV_ALIGN_IN_LEFT_MID, 0, 0); |
|||
|
|||
lv_label_set_text(labelYText, machine_menu.yPos); |
|||
lv_obj_align(labelYText, buttonYText, LV_ALIGN_IN_LEFT_MID, 0, 0); |
|||
|
|||
lv_label_set_text(labelZText, machine_menu.zPos); |
|||
lv_obj_align(labelZText, buttonZText, LV_ALIGN_IN_LEFT_MID, 0, 0); |
|||
|
|||
lv_label_set_text(label_Back, common_menu.text_back); |
|||
lv_obj_align(label_Back, buttonBack, LV_ALIGN_CENTER, 0, 0); |
|||
} |
|||
} |
|||
|
|||
void lv_clear_pause_position() { lv_obj_del(scr); } |
|||
|
|||
#endif // HAS_TFT_LVGL_UI
|
@ -0,0 +1,33 @@ |
|||
/**
|
|||
* Marlin 3D Printer Firmware |
|||
* Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
|||
* |
|||
* Based on Sprinter and grbl. |
|||
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm |
|||
* |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|||
* |
|||
*/ |
|||
#pragma once |
|||
|
|||
#ifdef __cplusplus |
|||
extern "C" { /* C-declarations for C++ */ |
|||
#endif |
|||
|
|||
extern void lv_draw_pause_position(void); |
|||
extern void lv_clear_pause_position(); |
|||
|
|||
#ifdef __cplusplus |
|||
} /* C-declarations for C++ */ |
|||
#endif |
@ -0,0 +1,358 @@ |
|||
/**
|
|||
* Marlin 3D Printer Firmware |
|||
* Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
|||
* |
|||
* Based on Sprinter and grbl. |
|||
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm |
|||
* |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|||
* |
|||
*/ |
|||
#include "../../../../inc/MarlinConfigPre.h" |
|||
|
|||
#if HAS_TFT_LVGL_UI |
|||
|
|||
#include "lv_conf.h" |
|||
#include "draw_ui.h" |
|||
|
|||
#include "../../../../MarlinCore.h" |
|||
#include "../../../../module/planner.h" |
|||
|
|||
static lv_obj_t * scr; |
|||
|
|||
#define ID_STEP_RETURN 1 |
|||
#define ID_STEP_X 2 |
|||
#define ID_STEP_Y 3 |
|||
#define ID_STEP_Z 4 |
|||
#define ID_STEP_E0 5 |
|||
#define ID_STEP_E1 6 |
|||
#define ID_STEP_DOWN 7 |
|||
#define ID_STEP_UP 8 |
|||
|
|||
static void event_handler(lv_obj_t * obj, lv_event_t event) { |
|||
switch (obj->mks_obj_id) { |
|||
case ID_STEP_RETURN: |
|||
if (event == LV_EVENT_CLICKED) { |
|||
|
|||
} |
|||
else if (event == LV_EVENT_RELEASED) { |
|||
uiCfg.para_ui_page = 0; |
|||
lv_clear_step_settings(); |
|||
draw_return_ui(); |
|||
} |
|||
break; |
|||
case ID_STEP_X: |
|||
if (event == LV_EVENT_CLICKED) { |
|||
|
|||
} |
|||
else if (event == LV_EVENT_RELEASED) { |
|||
value = Xstep; |
|||
lv_clear_step_settings(); |
|||
lv_draw_number_key(); |
|||
} |
|||
break; |
|||
case ID_STEP_Y: |
|||
if (event == LV_EVENT_CLICKED) { |
|||
|
|||
} |
|||
else if (event == LV_EVENT_RELEASED) { |
|||
value = Ystep; |
|||
lv_clear_step_settings(); |
|||
lv_draw_number_key(); |
|||
} |
|||
break; |
|||
case ID_STEP_Z: |
|||
if (event == LV_EVENT_CLICKED) { |
|||
|
|||
} |
|||
else if (event == LV_EVENT_RELEASED) { |
|||
value = Zstep; |
|||
lv_clear_step_settings(); |
|||
lv_draw_number_key(); |
|||
} |
|||
break; |
|||
case ID_STEP_E0: |
|||
if (event == LV_EVENT_CLICKED) { |
|||
|
|||
} |
|||
else if (event == LV_EVENT_RELEASED) { |
|||
value = E0step; |
|||
lv_clear_step_settings(); |
|||
lv_draw_number_key(); |
|||
} |
|||
break; |
|||
case ID_STEP_E1: |
|||
if (event == LV_EVENT_CLICKED) { |
|||
|
|||
} |
|||
else if (event == LV_EVENT_RELEASED) { |
|||
value = E1step; |
|||
lv_clear_step_settings(); |
|||
lv_draw_number_key(); |
|||
} |
|||
break; |
|||
case ID_STEP_UP: |
|||
if (event == LV_EVENT_CLICKED) { |
|||
|
|||
} |
|||
else if (event == LV_EVENT_RELEASED) { |
|||
uiCfg.para_ui_page = 0; |
|||
lv_clear_step_settings(); |
|||
lv_draw_step_settings(); |
|||
} |
|||
break; |
|||
case ID_STEP_DOWN: |
|||
if (event == LV_EVENT_CLICKED) { |
|||
|
|||
} |
|||
else if (event == LV_EVENT_RELEASED) { |
|||
uiCfg.para_ui_page = 1; |
|||
lv_clear_step_settings(); |
|||
lv_draw_step_settings(); |
|||
} |
|||
break; |
|||
} |
|||
} |
|||
|
|||
void lv_draw_step_settings(void) { |
|||
lv_obj_t *buttonBack = NULL, *label_Back = NULL, *buttonTurnPage = NULL, *labelTurnPage = NULL; |
|||
lv_obj_t *buttonXText = NULL, *labelXText = NULL, *buttonXValue = NULL, *labelXValue = NULL; |
|||
lv_obj_t *buttonYText = NULL, *labelYText = NULL, *buttonYValue = NULL, *labelYValue = NULL; |
|||
lv_obj_t *buttonZText = NULL, *labelZText = NULL, *buttonZValue = NULL, *labelZValue = NULL; |
|||
lv_obj_t *buttonE0Text = NULL, *labelE0Text = NULL, *buttonE0Value = NULL, *labelE0Value = NULL; |
|||
lv_obj_t *buttonE1Text = NULL, *labelE1Text = NULL, *buttonE1Value = NULL, *labelE1Value = 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) { |
|||
disp_state_stack._disp_index++; |
|||
disp_state_stack._disp_state[disp_state_stack._disp_index] = STEPS_UI; |
|||
} |
|||
disp_state = STEPS_UI; |
|||
|
|||
scr = lv_obj_create(NULL, NULL); |
|||
|
|||
lv_obj_set_style(scr, &tft_style_scr); |
|||
lv_scr_load(scr); |
|||
lv_obj_clean(scr); |
|||
|
|||
lv_obj_t * title = lv_label_create(scr, NULL); |
|||
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_IMG_DECLARE(bmp_para_back); |
|||
// LV_IMG_DECLARE(bmp_para_arrow);
|
|||
LV_IMG_DECLARE(bmp_para_bank); |
|||
|
|||
if (uiCfg.para_ui_page != 1) { |
|||
buttonXText = lv_btn_create(scr, NULL); /*Add a button the current screen*/ |
|||
lv_obj_set_pos(buttonXText, PARA_UI_POS_X, PARA_UI_POS_Y); /*Set its position*/ |
|||
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*/ |
|||
|
|||
buttonXValue = lv_imgbtn_create(scr, NULL); |
|||
lv_obj_set_pos(buttonXValue, PARA_UI_VALUE_POS_X, PARA_UI_POS_Y + PARA_UI_VALUE_V); |
|||
lv_obj_set_event_cb_mks(buttonXValue, event_handler, ID_STEP_X, "bmp_value_blank.bin", 0); |
|||
lv_imgbtn_set_src(buttonXValue, LV_BTN_STATE_REL, &bmp_para_bank); |
|||
lv_imgbtn_set_src(buttonXValue, LV_BTN_STATE_PR, &bmp_para_bank); |
|||
lv_imgbtn_set_style(buttonXValue, LV_BTN_STATE_PR, &style_para_value_pre); |
|||
lv_imgbtn_set_style(buttonXValue, LV_BTN_STATE_REL, &style_para_value_rel); |
|||
lv_btn_set_layout(buttonXValue, LV_LAYOUT_OFF); |
|||
labelXValue = lv_label_create(buttonXValue, NULL); |
|||
|
|||
line1 = lv_line_create(scr, NULL); |
|||
lv_ex_line(line1, line_points[0]); |
|||
|
|||
buttonYText = lv_btn_create(scr, NULL); /*Add a button the current screen*/ |
|||
lv_obj_set_pos(buttonYText, PARA_UI_POS_X, PARA_UI_POS_Y * 2); /*Set its position*/ |
|||
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*/ |
|||
|
|||
buttonYValue = lv_imgbtn_create(scr, NULL); |
|||
lv_obj_set_pos(buttonYValue, PARA_UI_VALUE_POS_X, PARA_UI_POS_Y * 2 + PARA_UI_VALUE_V); |
|||
lv_obj_set_event_cb_mks(buttonYValue, event_handler, ID_STEP_Y, "bmp_value_blank.bin", 0); |
|||
lv_imgbtn_set_src(buttonYValue, LV_BTN_STATE_REL, &bmp_para_bank); |
|||
lv_imgbtn_set_src(buttonYValue, LV_BTN_STATE_PR, &bmp_para_bank); |
|||
lv_imgbtn_set_style(buttonYValue, LV_BTN_STATE_PR, &style_para_value_pre); |
|||
lv_imgbtn_set_style(buttonYValue, LV_BTN_STATE_REL, &style_para_value_rel); |
|||
lv_btn_set_layout(buttonYValue, LV_LAYOUT_OFF); |
|||
labelYValue = lv_label_create(buttonYValue, NULL); |
|||
|
|||
line2 = lv_line_create(scr, NULL); |
|||
lv_ex_line(line2, line_points[1]); |
|||
|
|||
buttonZText = lv_btn_create(scr, NULL); /*Add a button the current screen*/ |
|||
lv_obj_set_pos(buttonZText, PARA_UI_POS_X, PARA_UI_POS_Y * 3); /*Set its position*/ |
|||
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*/ |
|||
|
|||
buttonZValue = lv_imgbtn_create(scr, NULL); |
|||
lv_obj_set_pos(buttonZValue, PARA_UI_VALUE_POS_X, PARA_UI_POS_Y * 3 + PARA_UI_VALUE_V); |
|||
lv_obj_set_event_cb_mks(buttonZValue, event_handler, ID_STEP_Z, "bmp_value_blank.bin", 0); |
|||
lv_imgbtn_set_src(buttonZValue, LV_BTN_STATE_REL, &bmp_para_bank); |
|||
lv_imgbtn_set_src(buttonZValue, LV_BTN_STATE_PR, &bmp_para_bank); |
|||
lv_imgbtn_set_style(buttonZValue, LV_BTN_STATE_PR, &style_para_value_pre); |
|||
lv_imgbtn_set_style(buttonZValue, LV_BTN_STATE_REL, &style_para_value_rel); |
|||
lv_btn_set_layout(buttonZValue, LV_LAYOUT_OFF); |
|||
labelZValue = lv_label_create(buttonZValue, NULL); |
|||
|
|||
line3 = lv_line_create(scr, NULL); |
|||
lv_ex_line(line3, line_points[2]); |
|||
|
|||
buttonE0Text = lv_btn_create(scr, NULL); /*Add a button the current screen*/ |
|||
lv_obj_set_pos(buttonE0Text, PARA_UI_POS_X, PARA_UI_POS_Y * 4); /*Set its position*/ |
|||
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*/ |
|||
|
|||
buttonE0Value = lv_imgbtn_create(scr, NULL); |
|||
lv_obj_set_pos(buttonE0Value, PARA_UI_VALUE_POS_X, PARA_UI_POS_Y * 4 + PARA_UI_VALUE_V); |
|||
lv_obj_set_event_cb_mks(buttonE0Value, event_handler, ID_STEP_E0, "bmp_value_blank.bin", 0); |
|||
lv_imgbtn_set_src(buttonE0Value, LV_BTN_STATE_REL, &bmp_para_bank); |
|||
lv_imgbtn_set_src(buttonE0Value, LV_BTN_STATE_PR, &bmp_para_bank); |
|||
lv_imgbtn_set_style(buttonE0Value, LV_BTN_STATE_PR, &style_para_value_pre); |
|||
lv_imgbtn_set_style(buttonE0Value, LV_BTN_STATE_REL, &style_para_value_rel); |
|||
lv_btn_set_layout(buttonE0Value, LV_LAYOUT_OFF); |
|||
labelE0Value = lv_label_create(buttonE0Value, NULL); |
|||
|
|||
line4 = lv_line_create(scr, NULL); |
|||
lv_ex_line(line4, line_points[3]); |
|||
|
|||
buttonTurnPage = lv_imgbtn_create(scr, NULL); |
|||
lv_obj_set_event_cb_mks(buttonTurnPage, event_handler, ID_STEP_DOWN, "bmp_back70x40.bin", 0); |
|||
lv_imgbtn_set_src(buttonTurnPage, LV_BTN_STATE_REL, &bmp_para_back); |
|||
lv_imgbtn_set_src(buttonTurnPage, LV_BTN_STATE_PR, &bmp_para_back); |
|||
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); |
|||
} |
|||
else { |
|||
buttonE1Text = lv_btn_create(scr, NULL); /*Add a button the current screen*/ |
|||
lv_obj_set_pos(buttonE1Text, PARA_UI_POS_X, PARA_UI_POS_Y); /*Set its position*/ |
|||
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*/ |
|||
|
|||
buttonE1Value = lv_imgbtn_create(scr, NULL); |
|||
lv_obj_set_pos(buttonE1Value, PARA_UI_VALUE_POS_X, PARA_UI_POS_Y + PARA_UI_VALUE_V); |
|||
lv_obj_set_event_cb_mks(buttonE1Value, event_handler, ID_STEP_E1, "bmp_value_blank.bin", 0); |
|||
lv_imgbtn_set_src(buttonE1Value, LV_BTN_STATE_REL, &bmp_para_bank); |
|||
lv_imgbtn_set_src(buttonE1Value, LV_BTN_STATE_PR, &bmp_para_bank); |
|||
lv_imgbtn_set_style(buttonE1Value, LV_BTN_STATE_PR, &style_para_value_pre); |
|||
lv_imgbtn_set_style(buttonE1Value, LV_BTN_STATE_REL, &style_para_value_rel); |
|||
lv_btn_set_layout(buttonE1Value, LV_LAYOUT_OFF); |
|||
labelE1Value = lv_label_create(buttonE1Value, NULL); |
|||
|
|||
line1 = lv_line_create(scr, NULL); |
|||
lv_ex_line(line1, line_points[0]); |
|||
|
|||
buttonTurnPage = lv_imgbtn_create(scr, NULL); |
|||
lv_obj_set_event_cb_mks(buttonTurnPage, event_handler, ID_STEP_UP, "bmp_back70x40.bin", 0); |
|||
lv_imgbtn_set_src(buttonTurnPage, LV_BTN_STATE_REL, &bmp_para_back); |
|||
lv_imgbtn_set_src(buttonTurnPage, LV_BTN_STATE_PR, &bmp_para_back); |
|||
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_obj_set_pos(buttonTurnPage, PARA_UI_TURN_PAGE_POS_X, PARA_UI_TURN_PAGE_POS_Y); |
|||
lv_btn_set_layout(buttonTurnPage, LV_LAYOUT_OFF); |
|||
labelTurnPage = lv_label_create(buttonTurnPage, NULL); |
|||
|
|||
buttonBack = lv_imgbtn_create(scr, NULL); |
|||
lv_obj_set_event_cb_mks(buttonBack, event_handler, ID_STEP_RETURN, "bmp_back70x40.bin", 0); |
|||
lv_imgbtn_set_src(buttonBack, LV_BTN_STATE_REL, &bmp_para_back); |
|||
lv_imgbtn_set_src(buttonBack, LV_BTN_STATE_PR, &bmp_para_back); |
|||
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 != 0) { |
|||
if (uiCfg.para_ui_page != 1) { |
|||
lv_label_set_text(labelXText, machine_menu.X_Steps); |
|||
lv_obj_align(labelXText, buttonXText, LV_ALIGN_IN_LEFT_MID, 0, 0); |
|||
|
|||
lv_label_set_text(labelYText, machine_menu.Y_Steps); |
|||
lv_obj_align(labelYText, buttonYText, LV_ALIGN_IN_LEFT_MID, 0, 0); |
|||
|
|||
lv_label_set_text(labelZText, machine_menu.Z_Steps); |
|||
lv_obj_align(labelZText, buttonZText, LV_ALIGN_IN_LEFT_MID, 0, 0); |
|||
|
|||
lv_label_set_text(labelE0Text, machine_menu.E0_Steps); |
|||
lv_obj_align(labelE0Text, buttonE0Text, LV_ALIGN_IN_LEFT_MID, 0, 0); |
|||
|
|||
lv_label_set_text(labelTurnPage, machine_menu.next); |
|||
lv_obj_align(labelTurnPage, buttonTurnPage, LV_ALIGN_CENTER, 0, 0); |
|||
|
|||
ZERO(public_buf_l); |
|||
sprintf_P(public_buf_l, PSTR("%.1f"), planner.settings.axis_steps_per_mm[X_AXIS]); |
|||
lv_label_set_text(labelXValue, public_buf_l); |
|||
lv_obj_align(labelXValue, buttonXValue, LV_ALIGN_CENTER, 0, 0); |
|||
|
|||
ZERO(public_buf_l); |
|||
sprintf_P(public_buf_l, PSTR("%.1f"), planner.settings.axis_steps_per_mm[Y_AXIS]); |
|||
lv_label_set_text(labelYValue, public_buf_l); |
|||
lv_obj_align(labelYValue, buttonYValue, LV_ALIGN_CENTER, 0, 0); |
|||
|
|||
ZERO(public_buf_l); |
|||
sprintf_P(public_buf_l, PSTR("%.1f"), planner.settings.axis_steps_per_mm[Z_AXIS]); |
|||
lv_label_set_text(labelZValue, public_buf_l); |
|||
lv_obj_align(labelZValue, buttonZValue, LV_ALIGN_CENTER, 0, 0); |
|||
|
|||
ZERO(public_buf_l); |
|||
sprintf_P(public_buf_l, PSTR("%.1f"), planner.settings.axis_steps_per_mm[E_AXIS]); |
|||
lv_label_set_text(labelE0Value, public_buf_l); |
|||
lv_obj_align(labelE0Value, buttonE0Value, LV_ALIGN_CENTER, 0, 0); |
|||
} |
|||
else { |
|||
lv_label_set_text(labelE1Text, machine_menu.E1_Steps); |
|||
lv_obj_align(labelE1Text, buttonE1Text, LV_ALIGN_IN_LEFT_MID, 0, 0); |
|||
|
|||
lv_label_set_text(labelTurnPage, machine_menu.previous); |
|||
lv_obj_align(labelTurnPage, buttonTurnPage, LV_ALIGN_CENTER, 0, 0); |
|||
|
|||
ZERO(public_buf_l); |
|||
sprintf_P(public_buf_l, PSTR("%.1f"), planner.settings.axis_steps_per_mm[E_AXIS_N(1)]); |
|||
lv_label_set_text(labelE1Value, public_buf_l); |
|||
lv_obj_align(labelE1Value, buttonE1Value, LV_ALIGN_CENTER, 0, 0); |
|||
} |
|||
|
|||
lv_label_set_text(label_Back, common_menu.text_back); |
|||
lv_obj_align(label_Back, buttonBack, LV_ALIGN_CENTER, 0, 0); |
|||
} |
|||
} |
|||
|
|||
void lv_clear_step_settings() { lv_obj_del(scr); } |
|||
|
|||
#endif // HAS_TFT_LVGL_UI
|
@ -0,0 +1,33 @@ |
|||
/**
|
|||
* Marlin 3D Printer Firmware |
|||
* Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
|||
* |
|||
* Based on Sprinter and grbl. |
|||
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm |
|||
* |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|||
* |
|||
*/ |
|||
#pragma once |
|||
|
|||
#ifdef __cplusplus |
|||
extern "C" { /* C-declarations for C++ */ |
|||
#endif |
|||
|
|||
extern void lv_draw_step_settings(void); |
|||
extern void lv_clear_step_settings(); |
|||
|
|||
#ifdef __cplusplus |
|||
} /* C-declarations for C++ */ |
|||
#endif |
@ -0,0 +1,385 @@ |
|||
/**
|
|||
* Marlin 3D Printer Firmware |
|||
* Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
|||
* |
|||
* Based on Sprinter and grbl. |
|||
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm |
|||
* |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|||
* |
|||
*/ |
|||
#include "../../../../inc/MarlinConfigPre.h" |
|||
|
|||
#if BOTH(HAS_TFT_LVGL_UI, HAS_TRINAMIC_CONFIG) |
|||
|
|||
#include "lv_conf.h" |
|||
#include "draw_ui.h" |
|||
#include "../../../../MarlinCore.h" |
|||
#include "../../../../module/planner.h" |
|||
#include "../../../../module/stepper/indirection.h" |
|||
#include "../../../../feature/tmc_util.h" |
|||
|
|||
static lv_obj_t * scr; |
|||
|
|||
#define ID_TMC_CURRENT_RETURN 1 |
|||
#define ID_TMC_CURRENT_X 2 |
|||
#define ID_TMC_CURRENT_Y 3 |
|||
#define ID_TMC_CURRENT_Z 4 |
|||
#define ID_TMC_CURRENT_E0 5 |
|||
#define ID_TMC_CURRENT_E1 6 |
|||
#define ID_TMC_CURRENT_DOWN 7 |
|||
#define ID_TMC_CURRENT_UP 8 |
|||
|
|||
static void event_handler(lv_obj_t * obj, lv_event_t event) { |
|||
switch (obj->mks_obj_id) { |
|||
case ID_TMC_CURRENT_RETURN: |
|||
if (event == LV_EVENT_CLICKED) { |
|||
|
|||
} |
|||
else if (event == LV_EVENT_RELEASED) { |
|||
uiCfg.para_ui_page = 0; |
|||
lv_clear_tmc_current_settings(); |
|||
draw_return_ui(); |
|||
} |
|||
break; |
|||
case ID_TMC_CURRENT_X: |
|||
if (event == LV_EVENT_CLICKED) { |
|||
|
|||
} |
|||
else if (event == LV_EVENT_RELEASED) { |
|||
value = Xcurrent; |
|||
lv_clear_tmc_current_settings(); |
|||
lv_draw_number_key(); |
|||
} |
|||
break; |
|||
case ID_TMC_CURRENT_Y: |
|||
if (event == LV_EVENT_CLICKED) { |
|||
|
|||
} |
|||
else if (event == LV_EVENT_RELEASED) { |
|||
value = Ycurrent; |
|||
lv_clear_tmc_current_settings(); |
|||
lv_draw_number_key(); |
|||
} |
|||
break; |
|||
case ID_TMC_CURRENT_Z: |
|||
if (event == LV_EVENT_CLICKED) { |
|||
|
|||
} |
|||
else if (event == LV_EVENT_RELEASED) { |
|||
value = Zcurrent; |
|||
lv_clear_tmc_current_settings(); |
|||
lv_draw_number_key(); |
|||
} |
|||
break; |
|||
case ID_TMC_CURRENT_E0: |
|||
if (event == LV_EVENT_CLICKED) { |
|||
|
|||
} |
|||
else if (event == LV_EVENT_RELEASED) { |
|||
value = E0current; |
|||
lv_clear_tmc_current_settings(); |
|||
lv_draw_number_key(); |
|||
} |
|||
break; |
|||
#if AXIS_IS_TMC(E1) |
|||
case ID_TMC_CURRENT_E1: |
|||
if (event == LV_EVENT_CLICKED) { |
|||
|
|||
} |
|||
else if (event == LV_EVENT_RELEASED) { |
|||
value = E1current; |
|||
lv_clear_tmc_current_settings(); |
|||
lv_draw_number_key(); |
|||
} |
|||
break; |
|||
|
|||
case ID_TMC_CURRENT_UP: |
|||
if (event == LV_EVENT_CLICKED) { |
|||
|
|||
} |
|||
else if (event == LV_EVENT_RELEASED) { |
|||
uiCfg.para_ui_page = 0; |
|||
lv_clear_tmc_current_settings(); |
|||
lv_draw_tmc_current_settings(); |
|||
} |
|||
break; |
|||
case ID_TMC_CURRENT_DOWN: |
|||
if (event == LV_EVENT_CLICKED) { |
|||
|
|||
} |
|||
else if (event == LV_EVENT_RELEASED) { |
|||
uiCfg.para_ui_page = 1; |
|||
lv_clear_tmc_current_settings(); |
|||
lv_draw_tmc_current_settings(); |
|||
} |
|||
break; |
|||
#endif |
|||
} |
|||
} |
|||
|
|||
void lv_draw_tmc_current_settings(void) { |
|||
lv_obj_t *buttonBack = NULL, *label_Back = NULL; |
|||
lv_obj_t *buttonXText = NULL, *labelXText = NULL, *buttonXValue = NULL, *labelXValue = NULL; |
|||
lv_obj_t *buttonYText = NULL, *labelYText = NULL, *buttonYValue = NULL, *labelYValue = NULL; |
|||
lv_obj_t *buttonZText = NULL, *labelZText = NULL, *buttonZValue = NULL, *labelZValue = NULL; |
|||
lv_obj_t *buttonE0Text = NULL, *labelE0Text = NULL, *buttonE0Value = NULL, *labelE0Value = NULL; |
|||
|
|||
lv_obj_t * line1 = NULL, * line2 = NULL, * line3 = NULL, * line4 = NULL; |
|||
#if AXIS_IS_TMC(E1) |
|||
lv_obj_t *buttonTurnPage = NULL, *labelTurnPage = NULL; |
|||
lv_obj_t *buttonE1Text = NULL, *labelE1Text = NULL, *buttonE1Value = NULL, *labelE1Value = NULL; |
|||
#endif |
|||
float milliamps; |
|||
|
|||
if (disp_state_stack._disp_state[disp_state_stack._disp_index] != TMC_CURRENT_UI) { |
|||
disp_state_stack._disp_index++; |
|||
disp_state_stack._disp_state[disp_state_stack._disp_index] = TMC_CURRENT_UI; |
|||
} |
|||
disp_state = TMC_CURRENT_UI; |
|||
|
|||
scr = lv_obj_create(NULL, NULL); |
|||
|
|||
lv_obj_set_style(scr, &tft_style_scr); |
|||
lv_scr_load(scr); |
|||
lv_obj_clean(scr); |
|||
|
|||
lv_obj_t * title = lv_label_create(scr, NULL); |
|||
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_IMG_DECLARE(bmp_para_back); |
|||
// LV_IMG_DECLARE(bmp_para_arrow);
|
|||
LV_IMG_DECLARE(bmp_para_bank); |
|||
|
|||
if (uiCfg.para_ui_page != 1) { |
|||
buttonXText = lv_btn_create(scr, NULL); /*Add a button the current screen*/ |
|||
lv_obj_set_pos(buttonXText, PARA_UI_POS_X, PARA_UI_POS_Y); /*Set its position*/ |
|||
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*/ |
|||
|
|||
buttonXValue = lv_imgbtn_create(scr, NULL); |
|||
lv_obj_set_pos(buttonXValue, PARA_UI_VALUE_POS_X, PARA_UI_POS_Y + PARA_UI_VALUE_V); |
|||
lv_obj_set_event_cb_mks(buttonXValue, event_handler, ID_TMC_CURRENT_X, "bmp_value_blank.bin", 0); |
|||
lv_imgbtn_set_src(buttonXValue, LV_BTN_STATE_REL, &bmp_para_bank); |
|||
lv_imgbtn_set_src(buttonXValue, LV_BTN_STATE_PR, &bmp_para_bank); |
|||
lv_imgbtn_set_style(buttonXValue, LV_BTN_STATE_PR, &style_para_value_pre); |
|||
lv_imgbtn_set_style(buttonXValue, LV_BTN_STATE_REL, &style_para_value_rel); |
|||
lv_btn_set_layout(buttonXValue, LV_LAYOUT_OFF); |
|||
labelXValue = lv_label_create(buttonXValue, NULL); |
|||
|
|||
line1 = lv_line_create(scr, NULL); |
|||
lv_ex_line(line1, line_points[0]); |
|||
|
|||
buttonYText = lv_btn_create(scr, NULL); /*Add a button the current screen*/ |
|||
lv_obj_set_pos(buttonYText, PARA_UI_POS_X, PARA_UI_POS_Y * 2); /*Set its position*/ |
|||
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*/ |
|||
|
|||
buttonYValue = lv_imgbtn_create(scr, NULL); |
|||
lv_obj_set_pos(buttonYValue, PARA_UI_VALUE_POS_X, PARA_UI_POS_Y * 2 + PARA_UI_VALUE_V); |
|||
lv_obj_set_event_cb_mks(buttonYValue, event_handler, ID_TMC_CURRENT_Y, "bmp_value_blank.bin", 0); |
|||
lv_imgbtn_set_src(buttonYValue, LV_BTN_STATE_REL, &bmp_para_bank); |
|||
lv_imgbtn_set_src(buttonYValue, LV_BTN_STATE_PR, &bmp_para_bank); |
|||
lv_imgbtn_set_style(buttonYValue, LV_BTN_STATE_PR, &style_para_value_pre); |
|||
lv_imgbtn_set_style(buttonYValue, LV_BTN_STATE_REL, &style_para_value_rel); |
|||
lv_btn_set_layout(buttonYValue, LV_LAYOUT_OFF); |
|||
labelYValue = lv_label_create(buttonYValue, NULL); |
|||
|
|||
line2 = lv_line_create(scr, NULL); |
|||
lv_ex_line(line2, line_points[1]); |
|||
|
|||
buttonZText = lv_btn_create(scr, NULL); /*Add a button the current screen*/ |
|||
lv_obj_set_pos(buttonZText, PARA_UI_POS_X, PARA_UI_POS_Y * 3); /*Set its position*/ |
|||
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*/ |
|||
|
|||
buttonZValue = lv_imgbtn_create(scr, NULL); |
|||
lv_obj_set_pos(buttonZValue, PARA_UI_VALUE_POS_X, PARA_UI_POS_Y * 3 + PARA_UI_VALUE_V); |
|||
lv_obj_set_event_cb_mks(buttonZValue, event_handler, ID_TMC_CURRENT_Z, "bmp_value_blank.bin", 0); |
|||
lv_imgbtn_set_src(buttonZValue, LV_BTN_STATE_REL, &bmp_para_bank); |
|||
lv_imgbtn_set_src(buttonZValue, LV_BTN_STATE_PR, &bmp_para_bank); |
|||
lv_imgbtn_set_style(buttonZValue, LV_BTN_STATE_PR, &style_para_value_pre); |
|||
lv_imgbtn_set_style(buttonZValue, LV_BTN_STATE_REL, &style_para_value_rel); |
|||
lv_btn_set_layout(buttonZValue, LV_LAYOUT_OFF); |
|||
labelZValue = lv_label_create(buttonZValue, NULL); |
|||
|
|||
line3 = lv_line_create(scr, NULL); |
|||
lv_ex_line(line3, line_points[2]); |
|||
|
|||
buttonE0Text = lv_btn_create(scr, NULL); /*Add a button the current screen*/ |
|||
lv_obj_set_pos(buttonE0Text, PARA_UI_POS_X, PARA_UI_POS_Y * 4); /*Set its position*/ |
|||
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*/ |
|||
|
|||
buttonE0Value = lv_imgbtn_create(scr, NULL); |
|||
lv_obj_set_pos(buttonE0Value, PARA_UI_VALUE_POS_X, PARA_UI_POS_Y * 4 + PARA_UI_VALUE_V); |
|||
lv_obj_set_event_cb_mks(buttonE0Value, event_handler, ID_TMC_CURRENT_E0, "bmp_value_blank.bin", 0); |
|||
lv_imgbtn_set_src(buttonE0Value, LV_BTN_STATE_REL, &bmp_para_bank); |
|||
lv_imgbtn_set_src(buttonE0Value, LV_BTN_STATE_PR, &bmp_para_bank); |
|||
lv_imgbtn_set_style(buttonE0Value, LV_BTN_STATE_PR, &style_para_value_pre); |
|||
lv_imgbtn_set_style(buttonE0Value, LV_BTN_STATE_REL, &style_para_value_rel); |
|||
lv_btn_set_layout(buttonE0Value, LV_LAYOUT_OFF); |
|||
labelE0Value = lv_label_create(buttonE0Value, NULL); |
|||
|
|||
line4 = lv_line_create(scr, NULL); |
|||
lv_ex_line(line4, line_points[3]); |
|||
|
|||
#if AXIS_IS_TMC(E1) |
|||
buttonTurnPage = lv_imgbtn_create(scr, NULL); |
|||
lv_obj_set_event_cb_mks(buttonTurnPage, event_handler, ID_TMC_CURRENT_DOWN, "bmp_back70x40.bin", 0); |
|||
lv_imgbtn_set_src(buttonTurnPage, LV_BTN_STATE_REL, &bmp_para_back); |
|||
lv_imgbtn_set_src(buttonTurnPage, LV_BTN_STATE_PR, &bmp_para_back); |
|||
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 |
|||
} |
|||
else { |
|||
#if AXIS_IS_TMC(E1) |
|||
buttonE1Text = lv_btn_create(scr, NULL); /*Add a button the current screen*/ |
|||
lv_obj_set_pos(buttonE1Text, PARA_UI_POS_X, PARA_UI_POS_Y); /*Set its position*/ |
|||
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*/ |
|||
|
|||
buttonE1Value = lv_imgbtn_create(scr, NULL); |
|||
lv_obj_set_pos(buttonE1Value, PARA_UI_VALUE_POS_X, PARA_UI_POS_Y + PARA_UI_VALUE_V); |
|||
lv_obj_set_event_cb_mks(buttonE1Value, event_handler, ID_TMC_CURRENT_E1, "bmp_value_blank.bin", 0); |
|||
lv_imgbtn_set_src(buttonE1Value, LV_BTN_STATE_REL, &bmp_para_bank); |
|||
lv_imgbtn_set_src(buttonE1Value, LV_BTN_STATE_PR, &bmp_para_bank); |
|||
lv_imgbtn_set_style(buttonE1Value, LV_BTN_STATE_PR, &style_para_value_pre); |
|||
lv_imgbtn_set_style(buttonE1Value, LV_BTN_STATE_REL, &style_para_value_rel); |
|||
lv_btn_set_layout(buttonE1Value, LV_LAYOUT_OFF); |
|||
labelE1Value = lv_label_create(buttonE1Value, NULL); |
|||
|
|||
line1 = lv_line_create(scr, NULL); |
|||
lv_ex_line(line1, line_points[0]); |
|||
|
|||
buttonTurnPage = lv_imgbtn_create(scr, NULL); |
|||
lv_obj_set_event_cb_mks(buttonTurnPage, event_handler, ID_TMC_CURRENT_UP, "bmp_back70x40.bin", 0); |
|||
lv_imgbtn_set_src(buttonTurnPage, LV_BTN_STATE_REL, &bmp_para_back); |
|||
lv_imgbtn_set_src(buttonTurnPage, LV_BTN_STATE_PR, &bmp_para_back); |
|||
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 |
|||
} |
|||
#if AXIS_IS_TMC(E1) |
|||
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); |
|||
labelTurnPage = lv_label_create(buttonTurnPage, NULL); |
|||
#endif |
|||
|
|||
buttonBack = lv_imgbtn_create(scr, NULL); |
|||
lv_obj_set_event_cb_mks(buttonBack, event_handler, ID_TMC_CURRENT_RETURN, "bmp_back70x40.bin", 0); |
|||
lv_imgbtn_set_src(buttonBack, LV_BTN_STATE_REL, &bmp_para_back); |
|||
lv_imgbtn_set_src(buttonBack, LV_BTN_STATE_PR, &bmp_para_back); |
|||
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 != 0) { |
|||
if (uiCfg.para_ui_page != 1) { |
|||
lv_label_set_text(labelXText, machine_menu.X_Current); |
|||
lv_obj_align(labelXText, buttonXText, LV_ALIGN_IN_LEFT_MID, 0, 0); |
|||
|
|||
lv_label_set_text(labelYText, machine_menu.Y_Current); |
|||
lv_obj_align(labelYText, buttonYText, LV_ALIGN_IN_LEFT_MID, 0, 0); |
|||
|
|||
lv_label_set_text(labelZText, machine_menu.Z_Current); |
|||
lv_obj_align(labelZText, buttonZText, LV_ALIGN_IN_LEFT_MID, 0, 0); |
|||
|
|||
lv_label_set_text(labelE0Text, machine_menu.E0_Current); |
|||
lv_obj_align(labelE0Text, buttonE0Text, LV_ALIGN_IN_LEFT_MID, 0, 0); |
|||
#if AXIS_IS_TMC(E1) |
|||
lv_label_set_text(labelTurnPage, machine_menu.next); |
|||
lv_obj_align(labelTurnPage, buttonTurnPage, LV_ALIGN_CENTER, 0, 0); |
|||
#endif |
|||
#if AXIS_IS_TMC(X) |
|||
milliamps = stepperX.getMilliamps(); |
|||
ZERO(public_buf_l); |
|||
sprintf_P(public_buf_l, PSTR("%.1f"), milliamps); |
|||
lv_label_set_text(labelXValue, public_buf_l); |
|||
lv_obj_align(labelXValue, buttonXValue, LV_ALIGN_CENTER, 0, 0); |
|||
#endif |
|||
#if AXIS_IS_TMC(Y) |
|||
milliamps = stepperY.getMilliamps(); |
|||
ZERO(public_buf_l); |
|||
sprintf_P(public_buf_l, PSTR("%.1f"), milliamps); |
|||
lv_label_set_text(labelYValue, public_buf_l); |
|||
lv_obj_align(labelYValue, buttonYValue, LV_ALIGN_CENTER, 0, 0); |
|||
#endif |
|||
#if AXIS_IS_TMC(Z) |
|||
milliamps = stepperZ.getMilliamps(); |
|||
ZERO(public_buf_l); |
|||
sprintf_P(public_buf_l, PSTR("%.1f"), milliamps); |
|||
lv_label_set_text(labelZValue, public_buf_l); |
|||
lv_obj_align(labelZValue, buttonZValue, LV_ALIGN_CENTER, 0, 0); |
|||
#endif |
|||
#if AXIS_IS_TMC(E0) |
|||
milliamps = stepperE0.getMilliamps(); |
|||
ZERO(public_buf_l); |
|||
sprintf_P(public_buf_l, PSTR("%.1f"), milliamps); |
|||
lv_label_set_text(labelE0Value, public_buf_l); |
|||
lv_obj_align(labelE0Value, buttonE0Value, LV_ALIGN_CENTER, 0, 0); |
|||
#endif |
|||
} |
|||
else { |
|||
#if AXIS_IS_TMC(E1) |
|||
lv_label_set_text(labelE1Text, machine_menu.E1_Current); |
|||
lv_obj_align(labelE1Text, buttonE1Text, LV_ALIGN_IN_LEFT_MID, 0, 0); |
|||
|
|||
lv_label_set_text(labelTurnPage, machine_menu.previous); |
|||
lv_obj_align(labelTurnPage, buttonTurnPage, LV_ALIGN_CENTER, 0, 0); |
|||
|
|||
milliamps = stepperE1.getMilliamps(); |
|||
ZERO(public_buf_l); |
|||
sprintf_P(public_buf_l, PSTR("%.1f"), milliamps); |
|||
lv_label_set_text(labelE1Value, public_buf_l); |
|||
lv_obj_align(labelE1Value, buttonE1Value, LV_ALIGN_CENTER, 0, 0); |
|||
#endif |
|||
} |
|||
|
|||
lv_label_set_text(label_Back, common_menu.text_back); |
|||
lv_obj_align(label_Back, buttonBack, LV_ALIGN_CENTER, 0, 0); |
|||
} |
|||
} |
|||
|
|||
void lv_clear_tmc_current_settings() { lv_obj_del(scr); } |
|||
|
|||
#endif // HAS_TFT_LVGL_UI && HAS_TRINAMIC_CONFIG
|
@ -0,0 +1,34 @@ |
|||
/**
|
|||
* Marlin 3D Printer Firmware |
|||
* Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
|||
* |
|||
* Based on Sprinter and grbl. |
|||
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm |
|||
* |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|||
* |
|||
*/ |
|||
#pragma once |
|||
|
|||
#ifdef __cplusplus |
|||
extern "C" { /* C-declarations for C++ */ |
|||
#endif |
|||
|
|||
extern void lv_draw_tmc_current_settings(void); |
|||
extern void lv_clear_tmc_current_settings(); |
|||
|
|||
#ifdef __cplusplus |
|||
} /* C-declarations for C++ */ |
|||
#endif |
|||
|
@ -0,0 +1,478 @@ |
|||
/**
|
|||
* Marlin 3D Printer Firmware |
|||
* Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
|||
* |
|||
* Based on Sprinter and grbl. |
|||
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm |
|||
* |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|||
* |
|||
*/ |
|||
#include "../../../../inc/MarlinConfigPre.h" |
|||
|
|||
#if BOTH(HAS_TFT_LVGL_UI, HAS_STEALTHCHOP) |
|||
|
|||
#include "lv_conf.h" |
|||
#include "draw_ui.h" |
|||
|
|||
#include "../../../../MarlinCore.h" |
|||
#include "../../../../module/planner.h" |
|||
#include "../../../../module/stepper/indirection.h" |
|||
#include "../../../../feature/tmc_util.h" |
|||
#include "../../../../gcode/gcode.h" |
|||
#include "../../../../module/planner.h" |
|||
|
|||
static lv_obj_t * scr; |
|||
|
|||
#define ID_TMC_MODE_RETURN 1 |
|||
#define ID_TMC_MODE_X 2 |
|||
#define ID_TMC_MODE_Y 3 |
|||
#define ID_TMC_MODE_Z 4 |
|||
#define ID_TMC_MODE_E0 5 |
|||
#define ID_TMC_MODE_E1 6 |
|||
#define ID_TMC_MODE_DOWN 7 |
|||
#define ID_TMC_MODE_UP 8 |
|||
|
|||
static lv_obj_t *labelXState = NULL, *labelYState = NULL, *labelZState = NULL, *labelE0State = NULL; |
|||
static lv_obj_t *buttonXState = NULL, *buttonYState = NULL, *buttonZState = NULL, *buttonE0State = NULL; |
|||
|
|||
#if AXIS_HAS_STEALTHCHOP(E1) |
|||
static lv_obj_t *labelE1State = NULL, *buttonE1State = NULL; |
|||
#endif |
|||
|
|||
static void event_handler(lv_obj_t * obj, lv_event_t event) { |
|||
switch (obj->mks_obj_id) { |
|||
case ID_TMC_MODE_RETURN: |
|||
if (event == LV_EVENT_CLICKED) { |
|||
|
|||
} |
|||
else if (event == LV_EVENT_RELEASED) { |
|||
uiCfg.para_ui_page = 0; |
|||
lv_clear_tmc_step_mode_settings(); |
|||
draw_return_ui(); |
|||
} |
|||
break; |
|||
case ID_TMC_MODE_X: |
|||
if (event == LV_EVENT_CLICKED) { |
|||
|
|||
} |
|||
else if (event == LV_EVENT_RELEASED) { |
|||
if (stepperX.stored.stealthChop_enabled == true) { |
|||
stepperX.stored.stealthChop_enabled = false; |
|||
stepperX.refresh_stepping_mode(); |
|||
lv_obj_set_event_cb_mks(buttonXState, event_handler, ID_TMC_MODE_X, "bmp_disable.bin", 0); |
|||
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 { |
|||
stepperX.stored.stealthChop_enabled = true; |
|||
stepperX.refresh_stepping_mode(); |
|||
lv_obj_set_event_cb_mks(buttonXState, event_handler, ID_TMC_MODE_X, "bmp_enable.bin", 0); |
|||
lv_label_set_text(labelXState, machine_menu.enable); |
|||
// gcode.process_subcommands_now_P(PSTR("M500"));
|
|||
} |
|||
gcode.process_subcommands_now_P(PSTR("M500")); |
|||
} |
|||
break; |
|||
case ID_TMC_MODE_Y: |
|||
if (event == LV_EVENT_CLICKED) { |
|||
|
|||
} |
|||
else if (event == LV_EVENT_RELEASED) { |
|||
if (stepperY.stored.stealthChop_enabled == true) { |
|||
stepperY.stored.stealthChop_enabled = false; |
|||
stepperY.refresh_stepping_mode(); |
|||
lv_obj_set_event_cb_mks(buttonYState, event_handler, ID_TMC_MODE_Y, "bmp_disable.bin", 0); |
|||
lv_label_set_text(labelYState, machine_menu.disable); |
|||
// lv_obj_align(labelXState, buttonE1State, LV_ALIGN_IN_LEFT_MID,0, 0);
|
|||
} |
|||
else { |
|||
stepperY.stored.stealthChop_enabled = true; |
|||
stepperY.refresh_stepping_mode(); |
|||
lv_obj_set_event_cb_mks(buttonYState, event_handler, ID_TMC_MODE_Y, "bmp_enable.bin", 0); |
|||
lv_label_set_text(labelYState, machine_menu.enable); |
|||
} |
|||
gcode.process_subcommands_now_P(PSTR("M500")); |
|||
} |
|||
break; |
|||
case ID_TMC_MODE_Z: |
|||
if (event == LV_EVENT_CLICKED) { |
|||
|
|||
} |
|||
else if (event == LV_EVENT_RELEASED) { |
|||
if (stepperZ.stored.stealthChop_enabled == true) { |
|||
stepperZ.stored.stealthChop_enabled = false; |
|||
stepperZ.refresh_stepping_mode(); |
|||
lv_obj_set_event_cb_mks(buttonZState, event_handler, ID_TMC_MODE_Z, "bmp_disable.bin", 0); |
|||
lv_label_set_text(labelZState, machine_menu.disable); |
|||
// lv_obj_align(labelXState, buttonE1State, LV_ALIGN_IN_LEFT_MID,0, 0);
|
|||
} |
|||
else { |
|||
stepperZ.stored.stealthChop_enabled = true; |
|||
stepperZ.refresh_stepping_mode(); |
|||
lv_obj_set_event_cb_mks(buttonZState, event_handler, ID_TMC_MODE_Z, "bmp_enable.bin", 0); |
|||
lv_label_set_text(labelZState, machine_menu.enable); |
|||
} |
|||
gcode.process_subcommands_now_P(PSTR("M500")); |
|||
} |
|||
break; |
|||
case ID_TMC_MODE_E0: |
|||
if (event == LV_EVENT_CLICKED) { |
|||
|
|||
} |
|||
else if (event == LV_EVENT_RELEASED) { |
|||
if (stepperE0.stored.stealthChop_enabled == true) { |
|||
stepperE0.stored.stealthChop_enabled = false; |
|||
stepperE0.refresh_stepping_mode(); |
|||
lv_obj_set_event_cb_mks(buttonE0State, event_handler, ID_TMC_MODE_E0, "bmp_disable.bin", 0); |
|||
lv_label_set_text(labelE0State, machine_menu.disable); |
|||
// lv_obj_align(labelXState, buttonE1State, LV_ALIGN_IN_LEFT_MID,0, 0);
|
|||
} |
|||
else { |
|||
stepperE0.stored.stealthChop_enabled = true; |
|||
stepperE0.refresh_stepping_mode(); |
|||
lv_obj_set_event_cb_mks(buttonE0State, event_handler, ID_TMC_MODE_E0, "bmp_enable.bin", 0); |
|||
lv_label_set_text(labelE0State, machine_menu.enable); |
|||
} |
|||
gcode.process_subcommands_now_P(PSTR("M500")); |
|||
} |
|||
break; |
|||
#if AXIS_HAS_STEALTHCHOP(E1) |
|||
case ID_TMC_MODE_E1: |
|||
if (event == LV_EVENT_CLICKED) { |
|||
|
|||
} |
|||
else if (event == LV_EVENT_RELEASED) { |
|||
if (stepperE1.stored.stealthChop_enabled == true) { |
|||
stepperE1.stored.stealthChop_enabled = false; |
|||
stepperE1.refresh_stepping_mode(); |
|||
lv_obj_set_event_cb_mks(buttonE1State, event_handler, ID_TMC_MODE_E1, "bmp_disable.bin", 0); |
|||
lv_label_set_text(labelE1State, machine_menu.disable); |
|||
// lv_obj_align(labelXState, buttonE1State, LV_ALIGN_IN_LEFT_MID,0, 0);
|
|||
} |
|||
else { |
|||
stepperE1.stored.stealthChop_enabled = true; |
|||
stepperE1.refresh_stepping_mode(); |
|||
lv_obj_set_event_cb_mks(buttonE1State, event_handler, ID_TMC_MODE_E1, "bmp_enable.bin", 0); |
|||
lv_label_set_text(labelE1State, machine_menu.enable); |
|||
} |
|||
gcode.process_subcommands_now_P(PSTR("M500")); |
|||
} |
|||
break; |
|||
|
|||
case ID_TMC_MODE_UP: |
|||
if (event == LV_EVENT_CLICKED) { |
|||
|
|||
} |
|||
else if (event == LV_EVENT_RELEASED) { |
|||
uiCfg.para_ui_page = 0; |
|||
lv_clear_tmc_step_mode_settings(); |
|||
lv_draw_tmc_step_mode_settings(); |
|||
} |
|||
break; |
|||
case ID_TMC_MODE_DOWN: |
|||
if (event == LV_EVENT_CLICKED) { |
|||
|
|||
} |
|||
else if (event == LV_EVENT_RELEASED) { |
|||
uiCfg.para_ui_page = 1; |
|||
lv_clear_tmc_step_mode_settings(); |
|||
lv_draw_tmc_step_mode_settings(); |
|||
} |
|||
break; |
|||
#endif // if AXIS_HAS_STEALTHCHOP(E1)
|
|||
} |
|||
} |
|||
|
|||
void lv_draw_tmc_step_mode_settings(void) { |
|||
lv_obj_t *buttonBack = NULL, *label_Back = NULL; |
|||
lv_obj_t *buttonXText = NULL, *labelXText = NULL; |
|||
lv_obj_t *buttonYText = NULL, *labelYText = NULL; |
|||
lv_obj_t *buttonZText = NULL, *labelZText = NULL; |
|||
lv_obj_t *buttonE0Text = NULL, *labelE0Text = NULL; |
|||
|
|||
lv_obj_t * line1 = NULL, * line2 = NULL, * line3 = NULL, * line4 = NULL; |
|||
#if AXIS_HAS_STEALTHCHOP(E1) |
|||
lv_obj_t *buttonTurnPage = NULL, *labelTurnPage = NULL; |
|||
lv_obj_t *buttonE1Text = NULL, *labelE1Text = NULL; |
|||
#endif |
|||
|
|||
|
|||
labelXState = NULL; |
|||
buttonXState = NULL; |
|||
labelYState = NULL; |
|||
buttonYState = NULL; |
|||
labelZState = NULL; |
|||
buttonZState = NULL; |
|||
labelE0State = NULL; |
|||
buttonE0State = NULL; |
|||
#if AXIS_HAS_STEALTHCHOP(E1) |
|||
labelE1State = NULL; |
|||
buttonE1State = NULL; |
|||
#endif |
|||
|
|||
if (disp_state_stack._disp_state[disp_state_stack._disp_index] != TMC_MODE_UI) { |
|||
disp_state_stack._disp_index++; |
|||
disp_state_stack._disp_state[disp_state_stack._disp_index] = TMC_MODE_UI; |
|||
} |
|||
disp_state = TMC_MODE_UI; |
|||
|
|||
scr = lv_obj_create(NULL, NULL); |
|||
|
|||
lv_obj_set_style(scr, &tft_style_scr); |
|||
lv_scr_load(scr); |
|||
lv_obj_clean(scr); |
|||
|
|||
lv_obj_t * title = lv_label_create(scr, NULL); |
|||
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_IMG_DECLARE(bmp_para_back); |
|||
LV_IMG_DECLARE(bmp_para_state); |
|||
// LV_IMG_DECLARE(bmp_para_bank);
|
|||
|
|||
if (uiCfg.para_ui_page != 1) { |
|||
buttonXText = lv_btn_create(scr, NULL); /*Add a button the current screen*/ |
|||
lv_obj_set_pos(buttonXText, PARA_UI_POS_X, PARA_UI_POS_Y); /*Set its position*/ |
|||
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); |
|||
lv_obj_set_pos(buttonXState, PARA_UI_STATE_POS_X, PARA_UI_POS_Y + PARA_UI_STATE_V); |
|||
if (stepperX.get_stealthChop_status()) |
|||
lv_obj_set_event_cb_mks(buttonXState, event_handler, ID_TMC_MODE_X, "bmp_enable.bin", 0); |
|||
else |
|||
lv_obj_set_event_cb_mks(buttonXState, event_handler, ID_TMC_MODE_X, "bmp_disable.bin", 0); |
|||
lv_imgbtn_set_src(buttonXState, LV_BTN_STATE_REL, &bmp_para_state); |
|||
lv_imgbtn_set_src(buttonXState, LV_BTN_STATE_PR, &bmp_para_state); |
|||
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); |
|||
|
|||
line1 = lv_line_create(scr, NULL); |
|||
lv_ex_line(line1, line_points[0]); |
|||
|
|||
buttonYText = lv_btn_create(scr, NULL); /*Add a button the current screen*/ |
|||
lv_obj_set_pos(buttonYText, PARA_UI_POS_X, PARA_UI_POS_Y * 2); /*Set its position*/ |
|||
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); |
|||
lv_obj_set_pos(buttonYState, PARA_UI_STATE_POS_X, PARA_UI_POS_Y * 2 + PARA_UI_STATE_V); |
|||
if (stepperY.get_stealthChop_status()) |
|||
lv_obj_set_event_cb_mks(buttonYState, event_handler, ID_TMC_MODE_Y, "bmp_enable.bin", 0); |
|||
else |
|||
lv_obj_set_event_cb_mks(buttonYState, event_handler, ID_TMC_MODE_Y, "bmp_disable.bin", 0); |
|||
lv_imgbtn_set_src(buttonYState, LV_BTN_STATE_REL, &bmp_para_state); |
|||
lv_imgbtn_set_src(buttonYState, LV_BTN_STATE_PR, &bmp_para_state); |
|||
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); |
|||
|
|||
line2 = lv_line_create(scr, NULL); |
|||
lv_ex_line(line2, line_points[1]); |
|||
|
|||
buttonZText = lv_btn_create(scr, NULL); /*Add a button the current screen*/ |
|||
lv_obj_set_pos(buttonZText, PARA_UI_POS_X, PARA_UI_POS_Y * 3); /*Set its position*/ |
|||
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); |
|||
lv_obj_set_pos(buttonZState, PARA_UI_STATE_POS_X, PARA_UI_POS_Y * 3 + PARA_UI_STATE_V); |
|||
if (stepperZ.get_stealthChop_status()) |
|||
lv_obj_set_event_cb_mks(buttonZState, event_handler, ID_TMC_MODE_Z, "bmp_enable.bin", 0); |
|||
else |
|||
lv_obj_set_event_cb_mks(buttonZState, event_handler, ID_TMC_MODE_Z, "bmp_disable.bin", 0); |
|||
lv_imgbtn_set_src(buttonZState, LV_BTN_STATE_REL, &bmp_para_state); |
|||
lv_imgbtn_set_src(buttonZState, LV_BTN_STATE_PR, &bmp_para_state); |
|||
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); |
|||
|
|||
line3 = lv_line_create(scr, NULL); |
|||
lv_ex_line(line3, line_points[2]); |
|||
|
|||
buttonE0Text = lv_btn_create(scr, NULL); /*Add a button the current screen*/ |
|||
lv_obj_set_pos(buttonE0Text, PARA_UI_POS_X, PARA_UI_POS_Y * 4); /*Set its position*/ |
|||
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); |
|||
lv_obj_set_pos(buttonE0State, PARA_UI_STATE_POS_X, PARA_UI_POS_Y * 4 + PARA_UI_STATE_V); |
|||
if (stepperE0.get_stealthChop_status()) |
|||
lv_obj_set_event_cb_mks(buttonE0State, event_handler, ID_TMC_MODE_E0, "bmp_enable.bin", 0); |
|||
else |
|||
lv_obj_set_event_cb_mks(buttonE0State, event_handler, ID_TMC_MODE_E0, "bmp_disable.bin", 0); |
|||
lv_imgbtn_set_src(buttonE0State, LV_BTN_STATE_REL, &bmp_para_state); |
|||
lv_imgbtn_set_src(buttonE0State, LV_BTN_STATE_PR, &bmp_para_state); |
|||
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); |
|||
|
|||
line4 = lv_line_create(scr, NULL); |
|||
lv_ex_line(line4, line_points[3]); |
|||
|
|||
#if AXIS_HAS_STEALTHCHOP(E1) |
|||
buttonTurnPage = lv_imgbtn_create(scr, NULL); |
|||
lv_obj_set_event_cb_mks(buttonTurnPage, event_handler, ID_TMC_MODE_DOWN, "bmp_back70x40.bin", 0); |
|||
lv_imgbtn_set_src(buttonTurnPage, LV_BTN_STATE_REL, &bmp_para_back); |
|||
lv_imgbtn_set_src(buttonTurnPage, LV_BTN_STATE_PR, &bmp_para_back); |
|||
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 |
|||
} |
|||
else { |
|||
#if AXIS_HAS_STEALTHCHOP(E1) |
|||
buttonE1Text = lv_btn_create(scr, NULL); /*Add a button the current screen*/ |
|||
lv_obj_set_pos(buttonE1Text, PARA_UI_POS_X, PARA_UI_POS_Y); /*Set its position*/ |
|||
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); |
|||
lv_obj_set_pos(buttonE1State, PARA_UI_STATE_POS_X, PARA_UI_POS_Y + PARA_UI_STATE_V); |
|||
if (stepperE1.get_stealthChop_status()) |
|||
lv_obj_set_event_cb_mks(buttonE1State, event_handler, ID_TMC_MODE_E1, "bmp_enable.bin", 0); |
|||
else |
|||
lv_obj_set_event_cb_mks(buttonE1State, event_handler, ID_TMC_MODE_E1, "bmp_disable.bin", 0); |
|||
lv_imgbtn_set_src(buttonE1State, LV_BTN_STATE_REL, &bmp_para_state); |
|||
lv_imgbtn_set_src(buttonE1State, LV_BTN_STATE_PR, &bmp_para_state); |
|||
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); |
|||
|
|||
line1 = lv_line_create(scr, NULL); |
|||
lv_ex_line(line1, line_points[0]); |
|||
|
|||
buttonTurnPage = lv_imgbtn_create(scr, NULL); |
|||
lv_obj_set_event_cb_mks(buttonTurnPage, event_handler, ID_TMC_MODE_UP, "bmp_back70x40.bin", 0); |
|||
lv_imgbtn_set_src(buttonTurnPage, LV_BTN_STATE_REL, &bmp_para_back); |
|||
lv_imgbtn_set_src(buttonTurnPage, LV_BTN_STATE_PR, &bmp_para_back); |
|||
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 |
|||
} |
|||
#if AXIS_HAS_STEALTHCHOP(E1) |
|||
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); |
|||
labelTurnPage = lv_label_create(buttonTurnPage, NULL); |
|||
#endif |
|||
|
|||
buttonBack = lv_imgbtn_create(scr, NULL); |
|||
lv_obj_set_event_cb_mks(buttonBack, event_handler, ID_TMC_MODE_RETURN, "bmp_back70x40.bin", 0); |
|||
lv_imgbtn_set_src(buttonBack, LV_BTN_STATE_REL, &bmp_para_back); |
|||
lv_imgbtn_set_src(buttonBack, LV_BTN_STATE_PR, &bmp_para_back); |
|||
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 != 0) { |
|||
if (uiCfg.para_ui_page != 1) { |
|||
lv_label_set_text(labelXText, machine_menu.X_StepMode); |
|||
lv_obj_align(labelXText, buttonXText, LV_ALIGN_IN_LEFT_MID, 0, 0); |
|||
|
|||
lv_label_set_text(labelYText, machine_menu.Y_StepMode); |
|||
lv_obj_align(labelYText, buttonYText, LV_ALIGN_IN_LEFT_MID, 0, 0); |
|||
|
|||
lv_label_set_text(labelZText, machine_menu.Z_StepMode); |
|||
lv_obj_align(labelZText, buttonZText, LV_ALIGN_IN_LEFT_MID, 0, 0); |
|||
|
|||
lv_label_set_text(labelE0Text, machine_menu.E0_StepMode); |
|||
lv_obj_align(labelE0Text, buttonE0Text, LV_ALIGN_IN_LEFT_MID, 0, 0); |
|||
|
|||
if (stepperX.get_stealthChop_status()) |
|||
lv_label_set_text(labelXState, machine_menu.enable); |
|||
else |
|||
lv_label_set_text(labelXState, machine_menu.disable); |
|||
lv_obj_align(labelXState, buttonXState, LV_ALIGN_CENTER, 0, 0); |
|||
|
|||
if (stepperY.get_stealthChop_status()) |
|||
lv_label_set_text(labelYState, machine_menu.enable); |
|||
else |
|||
lv_label_set_text(labelYState, machine_menu.disable); |
|||
lv_obj_align(labelYState, buttonYState, LV_ALIGN_CENTER, 0, 0); |
|||
|
|||
if (stepperZ.get_stealthChop_status()) |
|||
lv_label_set_text(labelZState, machine_menu.enable); |
|||
else |
|||
lv_label_set_text(labelZState, machine_menu.disable); |
|||
lv_obj_align(labelZState, buttonZState, LV_ALIGN_CENTER, 0, 0); |
|||
|
|||
if (stepperE0.get_stealthChop_status()) |
|||
lv_label_set_text(labelE0State, machine_menu.enable); |
|||
else |
|||
lv_label_set_text(labelE0State, machine_menu.disable); |
|||
lv_obj_align(labelE0State, buttonE0State, LV_ALIGN_CENTER, 0, 0); |
|||
|
|||
#if AXIS_HAS_STEALTHCHOP(E1) |
|||
lv_label_set_text(labelTurnPage, machine_menu.next); |
|||
lv_obj_align(labelTurnPage, buttonTurnPage, LV_ALIGN_CENTER, 0, 0); |
|||
#endif |
|||
} |
|||
else { |
|||
#if AXIS_HAS_STEALTHCHOP(E1) |
|||
lv_label_set_text(labelE1Text, machine_menu.E1_StepMode); |
|||
lv_obj_align(labelE1Text, buttonE1Text, LV_ALIGN_IN_LEFT_MID, 0, 0); |
|||
|
|||
if (stepperE1.get_stealthChop_status()) |
|||
lv_label_set_text(labelE1State, machine_menu.enable); |
|||
else |
|||
lv_label_set_text(labelE1State, machine_menu.disable); |
|||
lv_obj_align(labelE1State, buttonE1State, LV_ALIGN_CENTER, 0, 0); |
|||
|
|||
lv_label_set_text(labelTurnPage, machine_menu.previous); |
|||
lv_obj_align(labelTurnPage, buttonTurnPage, LV_ALIGN_CENTER, 0, 0); |
|||
|
|||
#endif |
|||
} |
|||
|
|||
lv_label_set_text(label_Back, common_menu.text_back); |
|||
lv_obj_align(label_Back, buttonBack, LV_ALIGN_CENTER, 0, 0); |
|||
} |
|||
} |
|||
|
|||
void lv_clear_tmc_step_mode_settings() { lv_obj_del(scr); } |
|||
|
|||
#endif // HAS_TFT_LVGL_UI && HAS_STEALTHCHOP
|
@ -0,0 +1,33 @@ |
|||
/**
|
|||
* Marlin 3D Printer Firmware |
|||
* Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
|||
* |
|||
* Based on Sprinter and grbl. |
|||
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm |
|||
* |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|||
* |
|||
*/ |
|||
#pragma once |
|||
|
|||
#ifdef __cplusplus |
|||
extern "C" { /* C-declarations for C++ */ |
|||
#endif |
|||
|
|||
extern void lv_draw_tmc_step_mode_settings(void); |
|||
extern void lv_clear_tmc_step_mode_settings(); |
|||
|
|||
#ifdef __cplusplus |
|||
} /* C-declarations for C++ */ |
|||
#endif |
File diff suppressed because it is too large
@ -0,0 +1,217 @@ |
|||
/**
|
|||
* Marlin 3D Printer Firmware |
|||
* Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
|||
* |
|||
* Based on Sprinter and grbl. |
|||
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm |
|||
* |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|||
* |
|||
*/ |
|||
#include "../../../../inc/MarlinConfigPre.h" |
|||
|
|||
#if HAS_TFT_LVGL_UI |
|||
|
|||
#include "../../../../MarlinCore.h" |
|||
|
|||
#include "lv_conf.h" |
|||
#include "draw_ui.h" |
|||
#include "../../../../module/temperature.h" |
|||
#include "../../../../module/motion.h" |
|||
#include "../../../../sd/cardreader.h" |
|||
#include "../../../../gcode/queue.h" |
|||
|
|||
#if ENABLED(POWER_LOSS_RECOVERY) |
|||
#include "../../../../feature/powerloss.h" |
|||
#endif |
|||
|
|||
#include "../../../../gcode/gcode.h" |
|||
#include "../../../../module/planner.h" |
|||
|
|||
extern uint32_t To_pre_view; |
|||
extern uint8_t flash_preview_begin, default_preview_flg, gcode_preview_over; |
|||
|
|||
void printer_state_polling() { |
|||
if (uiCfg.print_state == PAUSING) { |
|||
#if ENABLED(SDSUPPORT) |
|||
if (!planner.has_blocks_queued() && card.getIndex() > MIN_FILE_PRINTED) |
|||
uiCfg.waitEndMoves++; |
|||
|
|||
if (uiCfg.waitEndMoves > 20) { |
|||
uiCfg.waitEndMoves = 0; |
|||
planner.synchronize(); |
|||
gcode.process_subcommands_now_P(PSTR("M25")); |
|||
if (gCfgItems.pausePosZ != (float)-1) { |
|||
gcode.process_subcommands_now_P(PSTR("G91")); |
|||
ZERO(public_buf_l); |
|||
sprintf_P(public_buf_l, PSTR("G1 Z%.1f"), gCfgItems.pausePosZ); |
|||
gcode.process_subcommands_now(public_buf_l); |
|||
gcode.process_subcommands_now_P(PSTR("G90")); |
|||
} |
|||
if (gCfgItems.pausePosX != (float)-1 && gCfgItems.pausePosY != (float)-1) { |
|||
ZERO(public_buf_l); |
|||
sprintf_P(public_buf_l, PSTR("G1 X%.1f Y%.1f"), gCfgItems.pausePosX, gCfgItems.pausePosY); |
|||
gcode.process_subcommands_now(public_buf_l); |
|||
} |
|||
uiCfg.print_state = PAUSED; |
|||
|
|||
// #if ENABLED(POWER_LOSS_RECOVERY)
|
|||
// if (recovery.enabled) recovery.save(true);
|
|||
// #endif
|
|||
gCfgItems.pause_reprint = 1; |
|||
update_spi_flash(); |
|||
} |
|||
#endif |
|||
} |
|||
else |
|||
uiCfg.waitEndMoves = 0; |
|||
|
|||
if (uiCfg.print_state == PAUSED) { |
|||
} |
|||
|
|||
if (uiCfg.print_state == RESUMING) { |
|||
if (IS_SD_PAUSED()) { |
|||
gcode.process_subcommands_now_P(PSTR("M24\nG91\nG1 Z-5\nG90")); |
|||
uiCfg.print_state = WORKING; |
|||
start_print_time(); |
|||
|
|||
gCfgItems.pause_reprint = 0; |
|||
update_spi_flash(); |
|||
} |
|||
} |
|||
#if ENABLED(POWER_LOSS_RECOVERY) |
|||
if (uiCfg.print_state == REPRINTED) { |
|||
ZERO(public_buf_m); |
|||
#if HAS_HOTEND |
|||
HOTEND_LOOP() { |
|||
const int16_t et = recovery.info.target_temperature[e]; |
|||
if (et) { |
|||
#if HAS_MULTI_HOTEND |
|||
sprintf_P(public_buf_m, PSTR("T%i"), e); |
|||
gcode.process_subcommands_now(public_buf_m); |
|||
#endif |
|||
sprintf_P(public_buf_m, PSTR("M109 S%i"), et); |
|||
gcode.process_subcommands_now(public_buf_m); |
|||
} |
|||
} |
|||
#endif |
|||
|
|||
if (gCfgItems.pause_reprint == 1) { |
|||
gcode.process_subcommands_now_P(PSTR("G91\nG1 Z-5\nG90")); |
|||
} |
|||
recovery.resume(); |
|||
|
|||
uiCfg.print_state = WORKING; |
|||
start_print_time(); |
|||
|
|||
gCfgItems.pause_reprint = 0; |
|||
update_spi_flash(); |
|||
} |
|||
#endif |
|||
|
|||
if (uiCfg.print_state == WORKING) |
|||
filament_check(); |
|||
} |
|||
|
|||
void filament_pin_setup() { |
|||
#if PIN_EXISTS(MT_DET_1) |
|||
pinMode(MT_DET_1_PIN, INPUT_PULLUP); |
|||
#endif |
|||
#if PIN_EXISTS(MT_DET_2) |
|||
pinMode(MT_DET_2_PIN, INPUT_PULLUP); |
|||
#endif |
|||
#if PIN_EXISTS(MT_DET_3) |
|||
pinMode(MT_DET_3_PIN, INPUT_PULLUP); |
|||
#endif |
|||
} |
|||
|
|||
void filament_check() { |
|||
const int FIL_DELAY = 20; |
|||
#if PIN_EXISTS(MT_DET_1) |
|||
static int fil_det_count_1 = 0; |
|||
if (!READ(MT_DET_1_PIN) && !MT_DET_PIN_INVERTING) |
|||
fil_det_count_1++; |
|||
else if (READ(MT_DET_1_PIN) && MT_DET_PIN_INVERTING) |
|||
fil_det_count_1++; |
|||
else if (fil_det_count_1 > 0) |
|||
fil_det_count_1--; |
|||
|
|||
if (!READ(MT_DET_1_PIN) && !MT_DET_PIN_INVERTING) |
|||
fil_det_count_1++; |
|||
else if (READ(MT_DET_1_PIN) && MT_DET_PIN_INVERTING) |
|||
fil_det_count_1++; |
|||
else if (fil_det_count_1 > 0) |
|||
fil_det_count_1--; |
|||
#endif |
|||
|
|||
#if PIN_EXISTS(MT_DET_2) |
|||
static int fil_det_count_2 = 0; |
|||
if (!READ(MT_DET_2_PIN) && !MT_DET_PIN_INVERTING) |
|||
fil_det_count_2++; |
|||
else if (READ(MT_DET_2_PIN) && MT_DET_PIN_INVERTING) |
|||
fil_det_count_2++; |
|||
else if (fil_det_count_2 > 0) |
|||
fil_det_count_2--; |
|||
|
|||
if (!READ(MT_DET_2_PIN) && !MT_DET_PIN_INVERTING) |
|||
fil_det_count_2++; |
|||
else if (READ(MT_DET_2_PIN) && MT_DET_PIN_INVERTING) |
|||
fil_det_count_2++; |
|||
else if (fil_det_count_2 > 0) |
|||
fil_det_count_2--; |
|||
#endif |
|||
|
|||
#if PIN_EXISTS(MT_DET_3) |
|||
static int fil_det_count_3 = 0; |
|||
if (!READ(MT_DET_3_PIN) && !MT_DET_PIN_INVERTING) |
|||
fil_det_count_3++; |
|||
else if (READ(MT_DET_3_PIN) && MT_DET_PIN_INVERTING) |
|||
fil_det_count_3++; |
|||
else if (fil_det_count_3 > 0) |
|||
fil_det_count_3--; |
|||
|
|||
if (!READ(MT_DET_3_PIN) && !MT_DET_PIN_INVERTING) |
|||
fil_det_count_3++; |
|||
else if (READ(MT_DET_3_PIN) && MT_DET_PIN_INVERTING) |
|||
fil_det_count_3++; |
|||
else if (fil_det_count_3 > 0) |
|||
fil_det_count_3--; |
|||
#endif |
|||
|
|||
if (false |
|||
#if PIN_EXISTS(MT_DET_1) |
|||
|| fil_det_count_1 >= FIL_DELAY |
|||
#endif |
|||
#if PIN_EXISTS(MT_DET_2) |
|||
|| fil_det_count_2 >= FIL_DELAY |
|||
#endif |
|||
#if PIN_EXISTS(MT_DET_3) |
|||
|| fil_det_count_3 >= FIL_DELAY |
|||
#endif |
|||
) { |
|||
clear_cur_ui(); |
|||
card.pauseSDPrint(); |
|||
stop_print_time(); |
|||
uiCfg.print_state = PAUSING; |
|||
|
|||
if (gCfgItems.from_flash_pic == 1) |
|||
flash_preview_begin = 1; |
|||
else |
|||
default_preview_flg = 1; |
|||
|
|||
lv_draw_printing(); |
|||
} |
|||
} |
|||
|
|||
#endif // HAS_TFT_LVGL_UI
|
@ -1,209 +0,0 @@ |
|||
/**
|
|||
* Marlin 3D Printer Firmware |
|||
* Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
|||
* |
|||
* Based on Sprinter and grbl. |
|||
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm |
|||
* |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|||
* |
|||
*/ |
|||
#include "../../../../inc/MarlinConfigPre.h" |
|||
|
|||
#if ENABLED(TFT_LVGL_UI) |
|||
|
|||
#include "../../../../MarlinCore.h" |
|||
|
|||
#include "lv_conf.h" |
|||
#include "draw_ui.h" |
|||
#include "../../../../module/temperature.h" |
|||
#include "../../../../module/motion.h" |
|||
#include "../../../../sd/cardreader.h" |
|||
#include "../../../../gcode/queue.h" |
|||
|
|||
#if ENABLED(POWER_LOSS_RECOVERY) |
|||
#include "../../../../feature/powerloss.h" |
|||
#endif |
|||
|
|||
#include "../../../../gcode/gcode.h" |
|||
#include "../../../../module/planner.h" |
|||
|
|||
extern uint32_t To_pre_view; |
|||
extern uint8_t flash_preview_begin, default_preview_flg, gcode_preview_over; |
|||
|
|||
void printer_state_polling() { |
|||
if (uiCfg.print_state == PAUSING) { |
|||
#if ENABLED(SDSUPPORT) |
|||
if (!planner.has_blocks_queued() && card.getIndex() > MIN_FILE_PRINTED) //���� �ļ��� M109��M190ָ��
|
|||
uiCfg.waitEndMoves++; |
|||
|
|||
if (uiCfg.waitEndMoves > 20) { |
|||
uiCfg.waitEndMoves = 0; |
|||
planner.synchronize(); |
|||
gcode.process_subcommands_now_P(PSTR("M25\nG91\nG1 Z5\nG90")); |
|||
|
|||
uiCfg.print_state = PAUSED; |
|||
|
|||
//#if ENABLED(POWER_LOSS_RECOVERY)
|
|||
// if (recovery.enabled) recovery.save(true);
|
|||
//#endif
|
|||
gCfgItems.pause_reprint = 1; |
|||
update_spi_flash(); |
|||
} |
|||
#endif |
|||
} |
|||
else { |
|||
uiCfg.waitEndMoves = 0; |
|||
} |
|||
|
|||
if (uiCfg.print_state == PAUSED) { |
|||
|
|||
} |
|||
|
|||
if (uiCfg.print_state == RESUMING) { |
|||
if (IS_SD_PAUSED()) { |
|||
gcode.process_subcommands_now_P(PSTR("G91\nG1 Z-5\nG90\nM24")); |
|||
uiCfg.print_state = WORKING; |
|||
start_print_time(); |
|||
|
|||
gCfgItems.pause_reprint = 0; |
|||
update_spi_flash(); |
|||
} |
|||
} |
|||
#if ENABLED(POWER_LOSS_RECOVERY) |
|||
if (uiCfg.print_state == REPRINTED) { |
|||
memset(public_buf_m, 0, sizeof(public_buf_m)); |
|||
#if HOTENDS |
|||
HOTEND_LOOP() { |
|||
const int16_t et = recovery.info.target_temperature[e]; |
|||
if (et) { |
|||
#if HOTENDS > 1 |
|||
sprintf_P(public_buf_m, PSTR("T%i"), e); |
|||
gcode.process_subcommands_now(public_buf_m); |
|||
#endif |
|||
sprintf_P(public_buf_m, PSTR("M109 S%i"), et); |
|||
gcode.process_subcommands_now(public_buf_m); |
|||
} |
|||
} |
|||
#endif |
|||
|
|||
if (gCfgItems.pause_reprint == 1) |
|||
gcode.process_subcommands_now_P(PSTR("G91\nG1 Z-5\nG90")); |
|||
recovery.resume(); |
|||
|
|||
uiCfg.print_state = WORKING; |
|||
start_print_time(); |
|||
|
|||
gCfgItems.pause_reprint = 0; |
|||
update_spi_flash(); |
|||
} |
|||
#endif |
|||
|
|||
if (uiCfg.print_state == WORKING) |
|||
filament_check(); |
|||
} |
|||
|
|||
void filament_pin_setup() { |
|||
#if PIN_EXISTS(MT_DET_1) |
|||
pinMode(MT_DET_1_PIN, INPUT_PULLUP); |
|||
#endif |
|||
#if PIN_EXISTS(MT_DET_2) |
|||
pinMode(MT_DET_2_PIN, INPUT_PULLUP); |
|||
#endif |
|||
#if PIN_EXISTS(MT_DET_3) |
|||
pinMode(MT_DET_3_PIN, INPUT_PULLUP); |
|||
#endif |
|||
} |
|||
|
|||
void filament_check() { |
|||
const int FIL_DELAY = 20; |
|||
#if PIN_EXISTS(MT_DET_1) |
|||
static int fil_det_count_1 = 0; |
|||
if (!READ(MT_DET_1_PIN) && !MT_DET_PIN_INVERTING) |
|||
fil_det_count_1++; |
|||
else if (READ(MT_DET_1_PIN) && MT_DET_PIN_INVERTING) |
|||
fil_det_count_1++; |
|||
else if (fil_det_count_1 > 0) |
|||
fil_det_count_1--; |
|||
|
|||
if (!READ(MT_DET_1_PIN) && !MT_DET_PIN_INVERTING) |
|||
fil_det_count_1++; |
|||
else if (READ(MT_DET_1_PIN) && MT_DET_PIN_INVERTING) |
|||
fil_det_count_1++; |
|||
else if (fil_det_count_1 > 0) |
|||
fil_det_count_1--; |
|||
#endif |
|||
|
|||
#if PIN_EXISTS(MT_DET_2) |
|||
static int fil_det_count_2 = 0; |
|||
if (!READ(MT_DET_2_PIN) && !MT_DET_PIN_INVERTING) |
|||
fil_det_count_2++; |
|||
else if (READ(MT_DET_2_PIN) && MT_DET_PIN_INVERTING) |
|||
fil_det_count_2++; |
|||
else if (fil_det_count_2 > 0) |
|||
fil_det_count_2--; |
|||
|
|||
if (!READ(MT_DET_2_PIN) && !MT_DET_PIN_INVERTING) |
|||
fil_det_count_2++; |
|||
else if (READ(MT_DET_2_PIN) && MT_DET_PIN_INVERTING) |
|||
fil_det_count_2++; |
|||
else if (fil_det_count_2 > 0) |
|||
fil_det_count_2--; |
|||
#endif |
|||
|
|||
#if PIN_EXISTS(MT_DET_3) |
|||
static int fil_det_count_3 = 0; |
|||
if (!READ(MT_DET_3_PIN) && !MT_DET_PIN_INVERTING) |
|||
fil_det_count_3++; |
|||
else if (READ(MT_DET_3_PIN) && MT_DET_PIN_INVERTING) |
|||
fil_det_count_3++; |
|||
else if (fil_det_count_3 > 0) |
|||
fil_det_count_3--; |
|||
|
|||
if (!READ(MT_DET_3_PIN) && !MT_DET_PIN_INVERTING) |
|||
fil_det_count_3++; |
|||
else if (READ(MT_DET_3_PIN) && MT_DET_PIN_INVERTING) |
|||
fil_det_count_3++; |
|||
else if (fil_det_count_3 > 0) |
|||
fil_det_count_3--; |
|||
#endif |
|||
|
|||
if ( |
|||
#if PIN_EXISTS(MT_DET_1) |
|||
fil_det_count_1 >= FIL_DELAY |
|||
#else |
|||
false |
|||
#endif |
|||
#if PIN_EXISTS(MT_DET_2) |
|||
|| fil_det_count_2 >= FIL_DELAY |
|||
#endif |
|||
#if PIN_EXISTS(MT_DET_3) |
|||
|| fil_det_count_3 >= FIL_DELAY |
|||
#endif |
|||
) { |
|||
clear_cur_ui(); |
|||
card.pauseSDPrint(); |
|||
stop_print_time(); |
|||
uiCfg.print_state = PAUSING; |
|||
|
|||
if (gCfgItems.from_flash_pic == 1) |
|||
flash_preview_begin = 1; |
|||
else |
|||
default_preview_flg = 1; |
|||
|
|||
lv_draw_printing(); |
|||
} |
|||
} |
|||
|
|||
#endif // TFT_LVGL_UI
|
@ -0,0 +1,480 @@ |
|||
/**
|
|||
* Marlin 3D Printer Firmware |
|||
* Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
|||
* |
|||
* Based on Sprinter and grbl. |
|||
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm |
|||
* |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|||
* |
|||
*/ |
|||
#pragma once |
|||
|
|||
//***************繁体中文**********************//
|
|||
#define NEXT_T_CN "下一頁" |
|||
#define PREVIOUS_T_CN "上一頁" |
|||
#define DEFAULT_T_CN "默認值" |
|||
#define KEY_BACK_T_CN "退格" |
|||
#define KEY_REST_T_CN "重置" |
|||
#define KEY_CONFIRM_T_CN "確定" |
|||
|
|||
#define MACHINE_PARA_TITLE_T_CN "機器參數" |
|||
#define MACHINE_TYPE_CNOFIG_T_CN "機器設置" |
|||
#define TEMPERATURE_CONFIG_T_CN "溫度設置" |
|||
#define MOTOR_CONFIG_T_CN "電機設置" |
|||
#define ADVANCE_CONFIG_T_CN "高級設置" |
|||
|
|||
#define MACHINE_CONFIG_TITLE_T_CN "機器參數>機器配置" |
|||
#define MACHINE_TYPE_T_CN "機型選擇" |
|||
#define MACHINE_STROKE_T_CN "行程設置" |
|||
#define MACHINE_HOMEDIR_T_CN "歸零方向" |
|||
#define MACHINE_ENDSTOP_TYPE_T_CN "限位開關類型" |
|||
#define MACHINE_FILAMENT_CONFIG_T_CN "換料設置" |
|||
#define MACHINE_LEVELING_CONFIG_T_CN "調平設置" |
|||
|
|||
#define MACHINE_TYPE_CONFIG_TITLE_T_CN "機器參數>機型選擇" |
|||
#define MACHINE_TYPE_XYZ_T_CN "XYZ機型" |
|||
#define MACHINE_TYPE_DELTA_T_CN "Delta機型" |
|||
#define MACHINE_TYPE_COREXY_T_CN "Corexy機型" |
|||
|
|||
#define MACHINE_STROKE_CONF_TITLE_T_CN "機器參數>機器行程" |
|||
#define X_MAX_LENGTH_T_CN "X軸最大行程" |
|||
#define Y_MAX_LENGTH_T_CN "Y軸最大行程" |
|||
#define Z_MAX_LENGTH_T_CN "Z軸最大行程" |
|||
|
|||
#define X_MIN_LENGTH_T_CN "X軸最小行程" |
|||
#define Y_MIN_LENGTH_T_CN "Y軸最小行程" |
|||
#define Z_MIN_LENGTH_T_CN "Z軸最小行程" |
|||
|
|||
#define HOME_DIR_CONF_TITLE_T_CN "機器參數>歸零方向" |
|||
#define HOME_DIR_X_T_CN "X軸歸零方向" |
|||
#define HOME_DIR_Y_T_CN "Y軸歸零方向" |
|||
#define HOME_DIR_Z_T_CN "Z軸歸零方向" |
|||
#define HOME_MIN_T_CN "MIN" |
|||
#define HOME_MAX_T_CN "MAX" |
|||
|
|||
#define ENDSTOP_CONF_TITLE_T_CN "機器參數>限位開關" |
|||
#define MIN_ENDSTOP_X_T_CN "X軸最小限位" |
|||
#define MIN_ENDSTOP_Y_T_CN "Y軸最小限位" |
|||
#define MIN_ENDSTOP_Z_T_CN "Z軸最小限位" |
|||
#define MAX_ENDSTOP_X_T_CN "X軸最大限位" |
|||
#define MAX_ENDSTOP_Y_T_CN "Y軸最大限位" |
|||
#define MAX_ENDSTOP_Z_T_CN "Z軸最大限位" |
|||
#define ENDSTOP_FIL_T_CN "斷料開關類型" |
|||
#define ENDSTOP_LEVEL_T_CN "調平開關類型" |
|||
#define ENDSTOP_OPENED_T_CN "常開" |
|||
#define ENDSTOP_CLOSED_T_CN "常閉" |
|||
|
|||
#define FILAMENT_CONF_TITLE_T_CN "換料設置" |
|||
#define FILAMENT_IN_TEMPERATURE_T_CN "進料溫度" |
|||
#define FILAMENT_IN_LENGTH_T_CN "進料長度" |
|||
#define FILAMENT_IN_SPEED_T_CN "進料速度" |
|||
#define FILAMENT_OUT_TEMPERATURE_T_CN "退料溫度" |
|||
#define FILAMENT_OUT_LENGTH_T_CN "退料長度" |
|||
#define FILAMENT_OUT_SPEED_T_CN "退料速度" |
|||
|
|||
#define LEVELING_CONF_TITLE_T_CN "調平設置" |
|||
#define LEVELING_PARA_CONF_T_CN "調平設置" |
|||
#define LEVELING_DELTA_T_CN "delta機型設置" |
|||
#define LEVELING_XYZ_T_CN "手動調平坐標設置" |
|||
|
|||
#define LEVELING_PARA_CONF_TITLE_T_CN "調平參數" |
|||
#define AUTO_LEVELING_ENABLE_T_CN "自動調平" |
|||
#define BLTOUCH_LEVELING_ENABLE_T_CN "啟動BLtouch" |
|||
#define PROBE_PORT_T_CN "調平探針接口" |
|||
#define PROBE_X_OFFSET_T_CN "探針X方向偏移" |
|||
#define PROBE_Y_OFFSET_T_CN "探针Y方向偏移" |
|||
#define PROBE_Z_OFFSET_T_CN "探针Z方向偏移" |
|||
#define PROBE_XY_SPEED_T_CN "探针XY方向移動速度" |
|||
#define PROBE_Z_SPEED_T_CN "探针Z方向移動速度" |
|||
#define ENABLE_T_CN "是" |
|||
#define DISABLE_T_CN "否" |
|||
#define Z_MIN_T_CN "ZMin" |
|||
#define Z_MAX_T_CN "ZMax" |
|||
|
|||
#define DELTA_LEVEL_CONF_TITLE_T_CN "Delta機器參數" |
|||
#define DELTA_LEVEL_CONF_T_CN "Delta機器調平" |
|||
#define DELTA_MACHINE_RADIUS_T_CN "機器半徑" |
|||
#define DELTA_DIAGONAL_ROD_T_CN "機器桿長" |
|||
#define DELTA_PRINT_RADIUS_T_CN "打印半徑" |
|||
#define DELTA_HEIGHT_T_CN "打印高度" |
|||
#define SMOOTH_ROD_OFFSET_T_CN "滑塊偏移" |
|||
#define EFFECTOR_OFFSET_T_CN "效應器偏移" |
|||
#define CALIBRATION_RADIUS_T_CN "調平半徑" |
|||
|
|||
#define XYZ_LEVEL_CONF_TITLE_T_CN "XYZ機器參數" |
|||
#define PROBE_REACH_MAX_LEFT_T_CN "探针達到最左位置" |
|||
#define PROBE_REACH_MAX_RIGHT_T_CN "探针達到最右位置" |
|||
#define PROBE_REACH_MAX_FRONT_T_CN "探针達到最前位置" |
|||
#define PROBE_REACH_MAX_BACK_T_CN "探针達到最後位置" |
|||
|
|||
#define TEMPERATURE_CONF_TITLE_T_CN "機器參數>溫度設置" |
|||
#define NOZZLE_CONF_T_CN "噴頭設置" |
|||
#define HOTBED_CONF_T_CN "熱床設置" |
|||
#define PREHEAT_TEMPER_T_CN "預設溫度" |
|||
|
|||
#define NOZZLE_CONF_TITLE_T_CN "機器參數>噴頭設置" |
|||
#define NOZZLECNT_T_CN "噴頭數量" |
|||
#define NOZZLE_TYPE_T_CN "E0溫感類型" |
|||
#define NOZZLE_ADJUST_TYPE_T_CN "PID調溫" |
|||
#define NOZZLE_MIN_TEMPERATURE_T_CN "最低溫度" |
|||
#define NOZZLE_MAX_TEMPERATURE_T_CN "最高溫度" |
|||
#define EXTRUD_MIN_TEMPER_T_CN "最低擠出溫度" |
|||
|
|||
#define HOTBED_CONF_TITLE_T_CN "機器參數>熱床設置" |
|||
#define HOTBED_ADJUST_T_CN "PID調溫" |
|||
#define HOTBED_MIN_TEMPERATURE_T_CN "最低溫度" |
|||
#define HOTBED_MAX_TEMPERATURE_T_CN "最高溫度" |
|||
|
|||
#define MOTOR_CONF_TITLE_T_CN "機器參數>電機設置" |
|||
#define MAXFEEDRATE_CONF_T_CN "最大速度設置" |
|||
#define ACCELERATION_CONF_T_CN "加速度設置" |
|||
#define JERKCONF_T_CN "突變速度設置" |
|||
#define STEPSCONF_T_CN "脈沖設置" |
|||
#define TMC_CURRENT_T_CN "TMC 驅動電流設置" |
|||
#define TMC_STEP_MODE_T_CN "TMC 驅動模式設置" |
|||
#define MOTORDIRCONF_T_CN "電機方向設置" |
|||
#define HOMEFEEDRATECONF_T_CN "歸零速度設置" |
|||
|
|||
#define MAXFEEDRATE_CONF_TITLE_T_CN "機器參數>最大速度" |
|||
#define X_MAXFEEDRATE_T_CN "X軸最大速度" |
|||
#define Y_MAXFEEDRATE_T_CN "Y軸最大速度" |
|||
#define Z_MAXFEEDRATE_T_CN "Z軸最大速度" |
|||
#define E0_MAXFEEDRATE_T_CN "E0軸最大速度" |
|||
#define E1_MAXFEEDRATE_T_CN "E1軸最大速度" |
|||
|
|||
#define ACCELERATION_CONF_TITLE_T_CN "機器參數>加速度" |
|||
#define PRINT_ACCELERATION_T_CN "打印加速度" |
|||
#define RETRACT_ACCELERATION_T_CN "回抽加速度" |
|||
#define TRAVEL_ACCELERATION_T_CN "空載加速度" |
|||
#define X_ACCELERATION_T_CN "X軸加速度" |
|||
#define Y_ACCELERATION_T_CN "Y軸加速度" |
|||
#define Z_ACCELERATION_T_CN "Z軸加速度" |
|||
#define E0_ACCELERATION_T_CN "E0軸加速度" |
|||
#define E1_ACCELERATION_T_CN "E1軸加速度" |
|||
|
|||
#define JERK_CONF_TITLE_T_CN "機器參數>突變速度" |
|||
#define X_JERK_T_CN "X軸突變速度" |
|||
#define Y_JERK_T_CN "Y軸突變速度" |
|||
#define Z_JERK_T_CN "Z軸突變速度" |
|||
#define E_JERK_T_CN "E軸突變速度" |
|||
|
|||
#define STEPS_CONF_TITLE_T_CN "機器參數>脈衝設置" |
|||
#define X_STEPS_T_CN "X軸脈沖" |
|||
#define Y_STEPS_T_CN "Y軸脈沖" |
|||
#define Z_STEPS_T_CN "Z軸脈沖" |
|||
#define E0_STEPS_T_CN "E0軸脈沖" |
|||
#define E1_STEPS_T_CN "E1軸脈沖" |
|||
|
|||
#define TMC_CURRENT_CONF_TITLE_T_CN "機器參數>TMC電流設置" |
|||
#define X_TMC_CURRENT_T_CN "X軸電流(毫安)" |
|||
#define Y_TMC_CURRENT_T_CN "Y軸電流(毫安)" |
|||
#define Z_TMC_CURRENT_T_CN "Z軸電流(毫安)" |
|||
#define E0_TMC_CURRENT_T_CN "E0軸電流(毫安)" |
|||
#define E1_TMC_CURRENT_T_CN "E1軸電流(毫安)" |
|||
|
|||
#define TMC_MODE_CONF_TITLE_T_CN "機器參數>TMC模式設置" |
|||
#define X_TMC_MODE_T_CN "X軸是否使能靜音模式" |
|||
#define Y_TMC_MODE_T_CN "Y軸是否使能靜音模式" |
|||
#define Z_TMC_MODE_T_CN "Z軸是否使能靜音模式" |
|||
#define E0_TMC_MODE_T_CN "E0軸是否使能靜音模式" |
|||
#define E1_TMC_MODE_T_CN "E1軸是否使能靜音模式" |
|||
|
|||
#define MOTORDIR_CONF_TITLE_T_CN "機器參數>電機方向" |
|||
#define X_MOTORDIR_T_CN "X軸電機方向" |
|||
#define Y_MOTORDIR_T_CN "Y軸電機方向" |
|||
#define Z_MOTORDIR_T_CN "Z軸電機方向" |
|||
#define E0_MOTORDIR_T_CN "E0軸電機方向" |
|||
#define E1_MOTORDIR_T_CN "E1軸電機方向" |
|||
#define INVERT_P_T_CN "正向" |
|||
#define INVERT_N_T_CN "反向" |
|||
|
|||
#define HOMEFEEDRATE_CONF_TITLE_T_CN "機器參數>歸零速度" |
|||
#define X_HOMESPEED_T_CN "XY軸歸零速度" |
|||
#define Y_HOMESPEED_T_CN "Y軸歸零速度" |
|||
#define Z_HOMESPEED_T_CN "Z軸歸零速度" |
|||
|
|||
#define ADVANCED_CONF_TITLE_T_CN "機器參數>高級設置" |
|||
#define PWROFF_DECTION_T_CN "斷電檢測模塊" |
|||
#define PWROFF_AFTER_PRINT_T_CN "啟動打完關機功能" |
|||
#define HAVE_UPS_T_CN "機器配備UPS電壓" |
|||
#define Z2_AND_Z2ENDSTOP_CONF_T_CN "雙z軸雙限位功能設置" |
|||
#define ENABLE_PINS_CONF_T_CN "電機使能腳電平設置" |
|||
|
|||
#define Z2_AND_Z2ENDSTOP_CONF_TITLE_T_CN "雙z軸雙限位設置" |
|||
#define Z2_ENABLE_T_CN "啟用Z2軸" |
|||
#define Z2_ENDSTOP_T_CN "啟用Z2限位" |
|||
#define Z2_PORT_T_CN "Z2限位接口" |
|||
|
|||
#define ENABLE_PINS_CONF_TITLE_T_CN "電機使能腳電平" |
|||
#define X_ENABLE_PINS_INVERT_T_CN "X軸電機使能電平" |
|||
#define Y_ENABLE_PINS_INVERT_T_CN "Y軸電機使能電平" |
|||
#define Z_ENABLE_PINS_INVERT_T_CN "Z軸電機使能電平" |
|||
#define E_ENABLE_PINS_INVERT_T_CN "E軸電機使能電平" |
|||
|
|||
#define PAUSE_POSITION_T_CN "打印暫停位置設置" |
|||
#define PAUSE_POSITION_X_T_CN "X軸暫停位置(絕對位置,-1無效)" |
|||
#define PAUSE_POSITION_Y_T_CN "Y軸暫停位置(絕對位置,-1無效)" |
|||
#define PAUSE_POSITION_Z_T_CN "Z軸暫停位置(相對位置,-1無效)" |
|||
|
|||
#define TOOL_TEXT_T_CN "工具" |
|||
#define PREHEAT_TEXT_T_CN "預熱" |
|||
#define MOVE_TEXT_T_CN "移動" |
|||
#define HOME_TEXT_T_CN "回零" |
|||
#define PRINT_TEXT_T_CN "打印" |
|||
#define EXTRUDE_TEXT_T_CN "擠出" |
|||
#define LEVELING_TEXT_T_CN "調平" |
|||
#define AUTO_LEVELING_TEXT_T_CN "自動調平" |
|||
#define SET_TEXT_T_CN "設置" |
|||
#define MORE_TEXT_T_CN "更多" |
|||
|
|||
#define ADD_TEXT_T_CN "增加" |
|||
#define DEC_TEXT_T_CN "減少" |
|||
#define EXTRUDER_1_TEXT_T_CN "噴頭1" |
|||
#define EXTRUDER_2_TEXT_T_CN "噴頭2" |
|||
#define HEATBED_TEXT_T_CN "熱床" |
|||
#define TEXT_1C_T_CN "1℃" |
|||
#define TEXT_5C_T_CN "5℃" |
|||
#define TEXT_10C_T_CN "10℃" |
|||
#define CLOSE_TEXT_T_CN "關閉" |
|||
|
|||
#define BACK_TEXT_T_CN "返回" |
|||
|
|||
#define TOOL_PREHEAT_T_CN "預熱" |
|||
#define TOOL_EXTRUDE_T_CN "擠出" |
|||
#define TOOL_MOVE_T_CN "移動" |
|||
#define TOOL_HOME_T_CN "回零" |
|||
#define TOOL_LEVELING_T_CN "調平" |
|||
#define TOOL_AUTO_LEVELING_T_CN "自動調平" |
|||
#define TOOL_FILAMENT_T_CN "換料" |
|||
#define TOOL_MORE_T_CN "更多" |
|||
|
|||
#define AXIS_X_ADD_TEXT_T_CN "X+" |
|||
#define AXIS_X_DEC_TEXT_T_CN "X-" |
|||
#define AXIS_Y_ADD_TEXT_T_CN "Y+" |
|||
#define AXIS_Y_DEC_TEXT_T_CN "Y-" |
|||
#define AXIS_Z_ADD_TEXT_T_CN "Z+" |
|||
#define AXIS_Z_DEC_TEXT_T_CN "Z-" |
|||
#define TEXT_01MM_T_CN "0.1mm" |
|||
#define TEXT_1MM_T_CN "1mm" |
|||
#define TEXT_10MM_T_CN "10mm" |
|||
|
|||
#define HOME_X_TEXT_T_CN "X" |
|||
#define HOME_Y_TEXT_T_CN "Y" |
|||
#define HOME_Z_TEXT_T_CN "Z" |
|||
#define HOME_ALL_TEXT_T_CN "回零" |
|||
#define HOME_STOPMOVE_T_CN "急停" |
|||
|
|||
#define PAGE_UP_TEXT_T_CN "上一頁" |
|||
#define PAGE_DOWN_TEXT_T_CN "下一頁" |
|||
|
|||
#define EXTRUDER_IN_TEXT_T_CN "進料" |
|||
#define EXTRUDER_OUT_TEXT_T_CN "退料" |
|||
#define EXTRUDE_1MM_TEXT_T_CN "1mm" |
|||
#define EXTRUDE_5MM_TEXT_T_CN "5mm" |
|||
#define EXTRUDE_10MM_TEXT_T_CN "10mm" |
|||
#define EXTRUDE_LOW_SPEED_TEXT_T_CN "低速" |
|||
#define EXTRUDE_MEDIUM_SPEED_TEXT_T_CN "常速" |
|||
#define EXTRUDE_HIGH_SPEED_TEXT_T_CN "高速" |
|||
|
|||
#define LEVELING_POINT1_TEXT_T_CN "第一點" |
|||
#define LEVELING_POINT2_TEXT_T_CN "第二點" |
|||
#define LEVELING_POINT3_TEXT_T_CN "第三點" |
|||
#define LEVELING_POINT4_TEXT_T_CN "第四點" |
|||
#define LEVELING_POINT5_TEXT_T_CN "第五點" |
|||
|
|||
#define FILESYS_TEXT_T_CN "文件系統" |
|||
#define WIFI_TEXT_T_CN "WIFI" |
|||
#define FAN_TEXT_T_CN "風扇" |
|||
#define ABOUT_TEXT_T_CN "關於" |
|||
#define BREAK_POINT_TEXT_T_CN "斷點續打" |
|||
#define FILAMENT_TEXT_T_CN "換料" |
|||
#define LANGUAGE_TEXT_T_CN "語言" |
|||
#define MOTOR_OFF_TEXT_T_CN "關閉電機" |
|||
#define MOTOR_OFF_XY_TEXT_T_CN "關閉XY" |
|||
#define SHUTDOWN_TEXT_T_CN "關機" |
|||
#define MACHINE_PARA_T_CN "機器參數" |
|||
#define EEPROM_SETTINGS_T_CN "Eeprom設置" |
|||
|
|||
#define U_DISK_TEXT_T_CN "U盤" |
|||
#define SD_CARD_TEXT_T_CN "SD卡" |
|||
#define WIFI_NAME_TEXT_T_CN "無線網絡:" |
|||
#define WIFI_KEY_TEXT_T_CN "密碼: " |
|||
#define WIFI_IP_TEXT_T_CN "IP: " |
|||
#define WIFI_AP_TEXT_T_CN "狀態: AP" |
|||
#define WIFI_STA_TEXT_T_CN "狀態: STA" |
|||
#define WIFI_CONNECTED_TEXT_T_CN "已連接" |
|||
#define WIFI_DISCONNECTED_TEXT_T_CN "未連接" |
|||
#define WIFI_EXCEPTION_TEXT_T_CN "模塊異常" |
|||
#define CLOUD_TEXT_T_CN "雲服務" |
|||
#define CLOUD_BIND_T_CN "已綁定" |
|||
#define CLOUD_UNBIND_T_CN "解綁" |
|||
#define CLOUD_UNBINDING_T_CN "解绑中" |
|||
#define CLOUD_DISCONNECTED_T_CN "未連接" |
|||
#define CLOUD_UNBINDED_T_CN "未綁定" |
|||
#define CLOUD_BINDED_T_CN "已綁定" |
|||
#define CLOUD_DISABLE_T_CN "已禁用" |
|||
|
|||
#define FAN_ADD_TEXT_T_CN "增加" |
|||
#define FAN_DEC_TEXT_T_CN "減少" |
|||
#define FAN_OPEN_TEXT_T_CN "100%" |
|||
#define FAN_HALF_TEXT_T_CN "50%" |
|||
#define FAN_CLOSE_TEXT_T_CN "關閉" |
|||
#define FAN_TIPS1_TEXT_T_CN "風扇" |
|||
#define FAN_TIPS2_TEXT_T_CN "FAN\nClose" |
|||
|
|||
#define FILAMENT_IN_TEXT_T_CN "進料" |
|||
#define FILAMENT_OUT_TEXT_T_CN "退料" |
|||
#define FILAMENT_EXT0_TEXT_T_CN "噴頭1" |
|||
#define FILAMENT_EXT1_TEXT_T_CN "噴頭2" |
|||
#define FILAMENT_HEAT_TEXT_T_CN "預熱" |
|||
#define FILAMENT_STOP_TEXT_T_CN "停止" |
|||
//#define FILAMENT_CHANGE_TEXT_T_CN "準備換料"
|
|||
#define FILAMENT_TIPS2_TEXT_T_CN "T:" |
|||
#define FILAMENT_TIPS3_TEXT_T_CN "正在進料" |
|||
#define FILAMENT_TIPS4_TEXT_T_CN "正在退料" |
|||
#define FILAMENT_TIPS5_TEXT_T_CN "溫度太低,請先預熱" |
|||
#define FILAMENT_TIPS6_TEXT_T_CN "換料完成" |
|||
|
|||
#if 0 |
|||
#define FILAMENT_REPLAYS_IDLE_TEXT_T_CN "請按<進料>或<退料>進行換料!" |
|||
#define FILAMENT_CHANGE_TEXT_T_CN "待打印機暫停后,請按<進料>或<退料>進行換料!" |
|||
#endif |
|||
|
|||
#define FILAMENT_CHANGE_TEXT_T_CN "待打印機暫停后,\n請按<進料>或<退料>" |
|||
|
|||
#define FILAMENT_DIALOG_LOAD_HEAT_TIPS_T_CN "準備進料,正在加熱,請稍等" |
|||
#define FILAMENT_DIALOG_UNLOAD_HEAT_TIPS_T_CN "準備退料,正在加熱,請稍等" |
|||
#define FILAMENT_DIALOG_LOAD_CONFIRM1_TIPS_T_CN "加熱完成,請裝載耗材后,按<確定>開始進料" |
|||
#define FILAMENT_DIALOG_LOAD_CONFIRM2_TIPS_T_CN "請裝載耗,按<確定>開始進料!" |
|||
#define FILAMENT_DIALOG_UNLOAD_CONFIRM_TIPS_T_CN "加熱完成,请按<確定>開始退料!" |
|||
#define FILAMENT_DIALOG_LOADING_TIPS_T_CN "正在進料,请等待耗材加載完成!" |
|||
#define FILAMENT_DIALOG_UNLOADING_TIPS_T_CN "正在退料,请等待耗材卸載完成!" |
|||
#define FILAMENT_DIALOG_LOAD_COMPLETE_TIPS_T_CN "進料完成,请按<確定>返回" |
|||
#define FILAMENT_DIALOG_UNLOAD_COMPLETE_TIPS_T_CN "退料完成,请按<確定>返回" |
|||
|
|||
#define PRE_HEAT_EXT_TEXT_T_CN "噴頭" |
|||
#define PRE_HEAT_BED_TEXT_T_CN "熱床" |
|||
|
|||
#define FILE_LOADING_T_CN "正在載入......" |
|||
#define NO_FILE_AND_CHECK_T_CN "無文件!請插入sd卡/u盤!" |
|||
#define NO_FILE_T_CN "無文件!" |
|||
|
|||
#define EXTRUDER_TEMP_TEXT_T_CN "溫度" |
|||
#define EXTRUDER_E_LENGTH1_TEXT_T_CN "噴頭" |
|||
#define EXTRUDER_E_LENGTH2_TEXT_T_CN "噴頭" |
|||
#define EXTRUDER_E_LENGTH3_TEXT_T_CN "噴頭" |
|||
|
|||
#define ABOUT_TYPE_TEXT_T_CN "Type: " |
|||
#define ABOUT_VERSION_TEXT_T_CN "Firmware: " |
|||
#define ABOUT_WIFI_TEXT_T_CN "Wifi: " |
|||
|
|||
#define PRINTING_OPERATION_T_CN "操作" |
|||
#define PRINTING_PAUSE_T_CN "暫停" |
|||
#define PRINTING_TEMP_T_CN "溫度" |
|||
#define PRINTING_CHANGESPEED_T_CN "變速" |
|||
#define PRINTING_RESUME_T_CN "恢復" |
|||
#define PRINTING_STOP_T_CN "停止" |
|||
#define PRINTING_MORE_T_CN "更多" |
|||
#define PRINTING_EXTRUDER_T_CN "擠出" |
|||
#define PRINTING_MOVE_T_CN "移動" |
|||
|
|||
#define EXTRUDER_SPEED_T_CN "擠出" |
|||
#define MOVE_SPEED_T_CN "移動" |
|||
#define EXTRUDER_SPEED_STATE_T_CN "擠出速度" |
|||
#define MOVE_SPEED_STATE_T_CN "移動速度" |
|||
#define STEP_1PERCENT_T_CN "1%%" |
|||
#define STEP_5PERCENT_T_CN "5%%" |
|||
#define STEP_10PERCENT_T_CN "10%%" |
|||
|
|||
#define ZOFFSET_T_CN "Z Offset" |
|||
#define ZOFFSET_INC_T_CN "增加" |
|||
#define ZOFFSET_DEC_T_CN "減少" |
|||
|
|||
#define TITLE_READYPRINT_T_CN "準備打印" |
|||
#define TITLE_PREHEAT_T_CN "預熱" |
|||
#define TITLE_MOVE_T_CN "移動" |
|||
#define TITLE_HOME_T_CN "回零" |
|||
#define TITLE_EXTRUDE_T_CN "擠出" |
|||
#define TITLE_LEVELING_T_CN "調平" |
|||
#define TITLE_SET_T_CN "設置" |
|||
#define TITLE_MORE_T_CN "更多" |
|||
#define TITLE_CHOOSEFILE_T_CN "選擇文件" |
|||
#define TITLE_PRINTING_T_CN "正在打印" |
|||
#define TITLE_OPERATION_T_CN "操作" |
|||
#define TITLE_ADJUST_T_CN "調整" |
|||
#define TITLE_WIRELESS_T_CN "無線網絡" |
|||
#define TITLE_FILAMENT_T_CN "換料" |
|||
#define TITLE_ABOUT_T_CN "關於" |
|||
#define TITLE_FAN_T_CN "風扇" |
|||
#define TITLE_LANGUAGE_T_CN "語言" |
|||
#define TITLE_PAUSE_T_CN "暫停" |
|||
#define TITLE_CHANGESPEED_T_CN "變速" |
|||
#define TITLE_CLOUD_TEXT_T_CN "雲服務" |
|||
#define TITLE_DIALOG_CONFIRM_T_CN "確認" |
|||
#define TITLE_FILESYS_T_CN "文件系統" |
|||
#define TITLE_ZOFFSET_T_CN "Z Offset" |
|||
|
|||
#define AUTO_SHUTDOWN_T_CN "自動關機" |
|||
#define MANUAL_SHUTDOWN_T_CN "手動關機" |
|||
|
|||
#define DIALOG_CONFIRM_T_CN "確定" |
|||
#define DIALOG_CANCLE_T_CN "取消" |
|||
#define DIALOG_OK_T_CN "確認" |
|||
#define DIALOG_RESET_T_CN "重設" |
|||
#define DIALOG_RETRY_T_CN "重試" |
|||
#define DIALOG_DISABLE_T_CN "禁用" |
|||
#define DIALOG_PRINT_MODEL_T_CN "打印模型?" |
|||
#define DIALOG_CANCEL_PRINT_T_CN "停止打印?" |
|||
#define DIALOG_RETRY_T_CN "重試" |
|||
#define DIALOG_STOP_T_CN "停止" |
|||
#define DIALOG_REPRINT_FROM_BREAKPOINT_T_CN "從斷點續打?" |
|||
//#define DIALOG_UNBIND_PRINTER_T_CN "解除綁定?"
|
|||
#define DIALOG_ERROR_TIPS1_T_CN "錯誤:找不到文件,請插入sd卡/u盤!" |
|||
#define DIALOG_ERROR_TIPS2_T_CN "錯誤:通信失敗,請檢查波特率或主板硬件!" |
|||
#define DIALOG_ERROR_TIPS3_T_CN "錯誤:文件名或文件路徑太長!" |
|||
#define DIALOG_CLOSE_MACHINE_T_CN "正在關機......" |
|||
#define DIALOG_UNBIND_PRINTER_T_CN "解除綁定?" |
|||
#define DIALOG_FILAMENT_NO_PRESS_T_CN "請先裝載耗材!" |
|||
#define DIALOG_PRINT_FINISH_T_CN "打印完成!" |
|||
#define DIALOG_PRINT_TIME_T_CN "打印時間: " |
|||
#define DIALOG_REPRINT_T_CN "再打印壹次" |
|||
#define DIALOG_WIFI_ENABLE_TIPS_T_CN "wifi模塊正在配置中,請稍等......" |
|||
|
|||
#define TEXT_VALUE_T_CN "%d℃/%d℃" |
|||
#define EXTRUDE_TEXT_VALUE_T_T_CN ": %d℃" |
|||
#define WIFI_RECONNECT_TEXT_T_CN "重新連接" |
|||
|
|||
#define MESSAGE_PAUSING_T_CN "暫停中..." |
|||
#define MESSAGE_CHANGING_T_CN "等待換料開始..." |
|||
#define MESSAGE_UNLOAD_T_CN "退料中,請稍等..." |
|||
#define MESSAGE_WAITING_T_CN "點擊按鈕恢復打印" |
|||
#define MESSAGE_INSERT_T_CN "裝載耗材後,點擊按鈕開始打印" |
|||
#define MESSAGE_LOAD_T_CN "進料中,請稍等..." |
|||
#define MESSAGE_PURGE_T_CN "等待擠出..." |
|||
#define MESSAGE_RESUME_T_CN "等待恢復打印..." |
|||
#define MESSAGE_HEAT_T_CN "按下按鈕,加熱噴頭" |
|||
#define MESSAGE_HEATING_T_CN "噴頭加熱中,請等待..." |
|||
#define MESSAGE_OPTION_T_CN "擠出更多還是繼續打印" |
|||
#define MESSAGE_PURGE_MORE_T_CN "擠出" |
|||
#define MESSAGE_CONTINUE_PRINT_T_CN "打印" |
|||
|
|||
#define EEPROM_SETTINGS_TITLE_T_CN "EEPROM 設置" |
|||
#define EEPROM_SETTINGS_STORE_T_CN "保存參數至EEPROM" |
|||
#define EEPROM_SETTINGS_READ_T_CN "讀取EEPROM參數" |
|||
#define EEPROM_SETTINGS_REVERT_T_CN "恢復默認參數" |
|||
|
|||
#define EEPROM_STORE_TIPS_T_CN "是否保存參數到EEPROM?" |
|||
#define EEPROM_READ_TIPS_T_CN "是否使用EEPROM參數?" |
|||
#define EEPROM_REVERT_TIPS_T_CN "是否恢復默認參數?" |
File diff suppressed because it is too large
@ -0,0 +1,325 @@ |
|||
/**
|
|||
* Marlin 3D Printer Firmware |
|||
* Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
|||
* |
|||
* Based on Sprinter and grbl. |
|||
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm |
|||
* |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|||
* |
|||
*/ |
|||
#pragma once |
|||
|
|||
/**
|
|||
* MKS Robin nano (STM32F130VET6) board pin assignments |
|||
*/ |
|||
|
|||
#ifndef __STM32F1__ |
|||
#error "Oops! Select an STM32F1 board in 'Tools > Board.'" |
|||
#elif HOTENDS > 2 || E_STEPPERS > 2 |
|||
#error "MKS Robin nano supports up to 2 hotends / E-steppers. Comment out this line to continue." |
|||
#endif |
|||
|
|||
#define BOARD_INFO_NAME "MKS Robin nano V2.0" |
|||
|
|||
//
|
|||
// Release PB4 (Y_ENABLE_PIN) from JTAG NRST role
|
|||
//
|
|||
|
|||
//#define DISABLE_DEBUG
|
|||
|
|||
//
|
|||
// EEPROM
|
|||
//
|
|||
//#define FLASH_EEPROM_EMULATION
|
|||
//#define SDCARD_EEPROM_EMULATION
|
|||
|
|||
#if EITHER(NO_EEPROM_SELECTED, I2C_EEPROM) |
|||
#define I2C_EEPROM // EEPROM on I2C-0
|
|||
#define MARLIN_EEPROM_SIZE 0x1000 // 4KB
|
|||
#endif |
|||
|
|||
//
|
|||
// Note: MKS Robin board is using SPI2 interface.
|
|||
//
|
|||
//#define SPI_MODULE 2
|
|||
#define ENABLE_SPI2 |
|||
|
|||
//
|
|||
// Limit Switches
|
|||
//
|
|||
#define X_DIAG_PIN PA15 |
|||
#define Y_DIAG_PIN PA12 |
|||
#define Z_DIAG_PIN PA11 |
|||
#define E0_DIAG_PIN PC4 |
|||
#define E1_DIAG_PIN PE7 |
|||
|
|||
#define X_STOP_PIN PA15 |
|||
#define Y_STOP_PIN PA12 |
|||
#define Z_MIN_PIN PA11 |
|||
#define Z_MAX_PIN PC4 |
|||
|
|||
//
|
|||
// Steppers
|
|||
//
|
|||
#define X_ENABLE_PIN PE4 |
|||
#define X_STEP_PIN PE3 |
|||
#define X_DIR_PIN PE2 |
|||
#ifndef X_CS_PIN |
|||
#define X_CS_PIN PD5 |
|||
#endif |
|||
|
|||
#define Y_ENABLE_PIN PE1 |
|||
#define Y_STEP_PIN PE0 |
|||
#define Y_DIR_PIN PB9 |
|||
#ifndef Y_CS_PIN |
|||
#define Y_CS_PIN PD7 |
|||
#endif |
|||
|
|||
#define Z_ENABLE_PIN PB8 |
|||
#define Z_STEP_PIN PB5 |
|||
#define Z_DIR_PIN PB4 |
|||
#ifndef Z_CS_PIN |
|||
#define Z_CS_PIN PD4 |
|||
#endif |
|||
|
|||
#define E0_ENABLE_PIN PB3 |
|||
#define E0_STEP_PIN PD6 |
|||
#define E0_DIR_PIN PD3 |
|||
#ifndef E0_CS_PIN |
|||
#define E0_CS_PIN PD9 |
|||
#endif |
|||
|
|||
#define E1_ENABLE_PIN PA3 |
|||
#define E1_STEP_PIN PD15 |
|||
#define E1_DIR_PIN PA1 |
|||
#ifndef E1_CS_PIN |
|||
#define E1_CS_PIN PD8 |
|||
#endif |
|||
|
|||
//
|
|||
// Software SPI pins for TMC2130 stepper drivers
|
|||
//
|
|||
#if ENABLED(TMC_USE_SW_SPI) |
|||
#ifndef TMC_SW_MOSI |
|||
#define TMC_SW_MOSI PD14 |
|||
#endif |
|||
#ifndef TMC_SW_MISO |
|||
#define TMC_SW_MISO PD1 |
|||
#endif |
|||
#ifndef TMC_SW_SCK |
|||
#define TMC_SW_SCK PD0 |
|||
#endif |
|||
#endif |
|||
|
|||
#if HAS_TMC_UART |
|||
/**
|
|||
* TMC2208/TMC2209 stepper drivers |
|||
* |
|||
* Hardware serial communication ports. |
|||
* If undefined software serial is used according to the pins below |
|||
*/ |
|||
//#define X_HARDWARE_SERIAL Serial
|
|||
//#define X2_HARDWARE_SERIAL Serial1
|
|||
//#define Y_HARDWARE_SERIAL Serial1
|
|||
//#define Y2_HARDWARE_SERIAL Serial1
|
|||
//#define Z_HARDWARE_SERIAL Serial1
|
|||
//#define Z2_HARDWARE_SERIAL Serial1
|
|||
//#define E0_HARDWARE_SERIAL Serial1
|
|||
//#define E1_HARDWARE_SERIAL Serial1
|
|||
//#define E2_HARDWARE_SERIAL Serial1
|
|||
//#define E3_HARDWARE_SERIAL Serial1
|
|||
//#define E4_HARDWARE_SERIAL Serial1
|
|||
|
|||
//
|
|||
// Software serial
|
|||
//
|
|||
|
|||
#define X_SERIAL_TX_PIN PD5 |
|||
#define X_SERIAL_RX_PIN PD5 |
|||
|
|||
#define Y_SERIAL_TX_PIN PD7 |
|||
#define Y_SERIAL_RX_PIN PD7 |
|||
|
|||
#define Z_SERIAL_TX_PIN PD4 |
|||
#define Z_SERIAL_RX_PIN PD4 |
|||
|
|||
#define E0_SERIAL_TX_PIN PD9 |
|||
#define E0_SERIAL_RX_PIN PD9 |
|||
|
|||
#define E1_SERIAL_TX_PIN PD8 |
|||
#define E1_SERIAL_RX_PIN PD8 |
|||
|
|||
// Reduce baud rate to improve software serial reliability
|
|||
#define TMC_BAUD_RATE 19200 |
|||
#endif // TMC2208 || TMC2209
|
|||
|
|||
//
|
|||
// Temperature Sensors
|
|||
//
|
|||
#define TEMP_0_PIN PC1 // TH1
|
|||
#define TEMP_1_PIN PC2 // TH2
|
|||
#define TEMP_BED_PIN PC0 // TB1
|
|||
|
|||
//
|
|||
// Heaters / Fans
|
|||
//
|
|||
#define HEATER_0_PIN PC3 // HEATER1
|
|||
#define HEATER_1_PIN PB0 // HEATER2
|
|||
#define HEATER_BED_PIN PA0 // HOT BED
|
|||
|
|||
#define FAN_PIN PB1 // FAN
|
|||
|
|||
//
|
|||
// Thermocouples
|
|||
//
|
|||
//#define MAX6675_SS_PIN PE5 // TC1 - CS1
|
|||
//#define MAX6675_SS_PIN PE6 // TC2 - CS2
|
|||
|
|||
//
|
|||
// Misc. Functions
|
|||
//
|
|||
#define POWER_LOSS_PIN PA2 // PW_DET
|
|||
#define PS_ON_PIN PA3 // PW_OFF
|
|||
|
|||
//#define SUICIDE_PIN PB2 // Enable MKSPWC support ROBIN NANO v1.2 ONLY
|
|||
//#define SUICIDE_PIN_INVERTING false
|
|||
|
|||
//#define KILL_PIN PA2 // Enable MKSPWC support ROBIN NANO v1.2 ONLY
|
|||
//#define KILL_PIN_INVERTING true // Enable MKSPWC support ROBIN NANO v1.2 ONLY
|
|||
|
|||
#define SERVO0_PIN PA8 // Enable BLTOUCH support ROBIN NANO v1.2 ONLY
|
|||
|
|||
//#define LED_PIN PB2
|
|||
|
|||
#define MT_DET_1_PIN PA4 |
|||
#define MT_DET_2_PIN PE6 |
|||
#define MT_DET_PIN_INVERTING false |
|||
|
|||
#define WIFI_IO0_PIN PC13 |
|||
|
|||
//
|
|||
// SD Card
|
|||
//
|
|||
#ifndef SDCARD_CONNECTION |
|||
#define SDCARD_CONNECTION ONBOARD |
|||
#endif |
|||
|
|||
#define SDIO_SUPPORT |
|||
#define SDIO_CLOCK 4500000 // 4.5 MHz
|
|||
#define SD_DETECT_PIN PD12 |
|||
#define ONBOARD_SD_CS_PIN PC11 |
|||
|
|||
//
|
|||
// LCD / Controller
|
|||
//
|
|||
#define BEEPER_PIN PC5 |
|||
|
|||
/**
|
|||
* Note: MKS Robin TFT screens use various TFT controllers. |
|||
* If the screen stays white, disable 'LCD_RESET_PIN' |
|||
* to let the bootloader init the screen. |
|||
*/ |
|||
|
|||
#if ENABLED(TFT_LVGL_UI_SPI) |
|||
|
|||
#define SPI_TFT_CS_PIN PD11 |
|||
#define SPI_TFT_SCK_PIN PA5 |
|||
#define SPI_TFT_MISO_PIN PA6 |
|||
#define SPI_TFT_MOSI_PIN PA7 |
|||
#define SPI_TFT_DC_PIN PD10 |
|||
#define SPI_TFT_RST_PIN PC6 |
|||
|
|||
#define LCD_BACKLIGHT_PIN PD13 |
|||
|
|||
#define TOUCH_CS_PIN PE14 // SPI1_NSS
|
|||
#define TOUCH_SCK_PIN PA5 // SPI1_SCK
|
|||
#define TOUCH_MISO_PIN PA6 // SPI1_MISO
|
|||
#define TOUCH_MOSI_PIN PA7 // SPI1_MOSI
|
|||
|
|||
#define BTN_EN1 PE8 |
|||
#define BTN_EN2 PE11 |
|||
#define BEEPER_PIN PC5 |
|||
#define BTN_ENC PE13 |
|||
|
|||
#else |
|||
#if ENABLED(TFT_LITTLE_VGL_UI) |
|||
//FSMC LCD
|
|||
#define FSMC_CS_PIN PD7 // NE4
|
|||
#define FSMC_RS_PIN PD11 // A0
|
|||
|
|||
#define TOUCH_CS_PIN PA7 // SPI2_NSS
|
|||
#define TOUCH_SCK_PIN PB13 // SPI2_SCK
|
|||
#define TOUCH_MISO_PIN PB14 // SPI2_MISO
|
|||
#define TOUCH_MOSI_PIN PB15 // SPI2_MOSI
|
|||
|
|||
#define LCD_BACKLIGHT_PIN PD13 |
|||
|
|||
#endif // TFT_LITTLE_VGL_UI
|
|||
|
|||
#endif // TFT_LVGL_UI_SPI
|
|||
|
|||
#if HAS_SPI_LCD |
|||
|
|||
#define BEEPER_PIN PC5 |
|||
#define BTN_ENC PE13 |
|||
#define LCD_PINS_ENABLE PD13 |
|||
#define LCD_PINS_RS PC6 |
|||
#define BTN_EN1 PE8 |
|||
#define BTN_EN2 PE11 |
|||
#define LCD_BACKLIGHT_PIN -1 |
|||
|
|||
// MKS MINI12864 and MKS LCD12864B; If using MKS LCD12864A (Need to remove RPK2 resistor)
|
|||
#if ENABLED(MKS_MINI_12864) |
|||
#define LCD_BACKLIGHT_PIN -1 |
|||
#define LCD_RESET_PIN -1 |
|||
#define DOGLCD_A0 PD11 |
|||
#define DOGLCD_CS PE15 |
|||
#define DOGLCD_SCK PA5 |
|||
#define DOGLCD_MOSI PA7 |
|||
|
|||
// Required for MKS_MINI_12864 with this board
|
|||
#define MKS_LCD12864B |
|||
#undef SHOW_BOOTSCREEN |
|||
|
|||
#else // !MKS_MINI_12864
|
|||
|
|||
#define LCD_PINS_D4 PE14 |
|||
#if ENABLED(ULTIPANEL) |
|||
#define LCD_PINS_D5 PE15 |
|||
#define LCD_PINS_D6 PD11 |
|||
#define LCD_PINS_D7 PD10 |
|||
#endif |
|||
|
|||
#ifndef BOARD_ST7920_DELAY_1 |
|||
#define BOARD_ST7920_DELAY_1 DELAY_NS(125) |
|||
#endif |
|||
#ifndef BOARD_ST7920_DELAY_2 |
|||
#define BOARD_ST7920_DELAY_2 DELAY_NS(125) |
|||
#endif |
|||
#ifndef BOARD_ST7920_DELAY_3 |
|||
#define BOARD_ST7920_DELAY_3 DELAY_NS(125) |
|||
#endif |
|||
|
|||
#endif // !MKS_MINI_12864
|
|||
|
|||
#endif // HAS_SPI_LCD
|
|||
|
|||
#define SPI_FLASH |
|||
#if ENABLED(SPI_FLASH) |
|||
#define W25QXX_CS_PIN PB12 |
|||
#define W25QXX_MOSI_PIN PB15 |
|||
#define W25QXX_MISO_PIN PB14 |
|||
#define W25QXX_SCK_PIN PB13 |
|||
#endif |
@ -0,0 +1,46 @@ |
|||
Import("env") |
|||
import os |
|||
import requests |
|||
import zipfile |
|||
import tempfile |
|||
import shutil |
|||
|
|||
url = "https://github.com/makerbase-mks/Mks-Robin-Nano-Marlin2.0-Firmware/archive/master.zip" |
|||
zip_path = os.path.join(env.Dictionary("PROJECT_LIBDEPS_DIR"), "mks-assets.zip") |
|||
assets_path = os.path.join(env.Dictionary("PROJECT_BUILD_DIR"), env.Dictionary("PIOENV"), "assets") |
|||
|
|||
def download_mks_assets(): |
|||
print("Downloading MKS Assets") |
|||
r = requests.get(url, stream=True) |
|||
# the user may have a very clean workspace, |
|||
# so create the PROJECT_LIBDEPS_DIR directory if not exits |
|||
if os.path.exists(env.Dictionary("PROJECT_LIBDEPS_DIR")) == False: |
|||
os.mkdir(env.Dictionary("PROJECT_LIBDEPS_DIR")) |
|||
with open(zip_path, 'wb') as fd: |
|||
for chunk in r.iter_content(chunk_size=128): |
|||
fd.write(chunk) |
|||
|
|||
def copy_mks_assets(): |
|||
print("Copying MKS Assets") |
|||
output_path = tempfile.mkdtemp() |
|||
zip_obj = zipfile.ZipFile(zip_path, 'r') |
|||
zip_obj.extractall(output_path) |
|||
zip_obj.close() |
|||
if os.path.exists(assets_path) == True and os.path.isdir(assets_path) == False: |
|||
os.unlink(assets_path) |
|||
if os.path.exists(assets_path) == False: |
|||
os.mkdir(assets_path) |
|||
base_path = '' |
|||
for filename in os.listdir(output_path): |
|||
base_path = filename |
|||
for filename in os.listdir(os.path.join(output_path, base_path, 'Firmware', 'mks_font')): |
|||
shutil.copy(os.path.join(output_path, base_path, 'Firmware', 'mks_font', filename), assets_path) |
|||
for filename in os.listdir(os.path.join(output_path, base_path, 'Firmware', 'mks_pic')): |
|||
shutil.copy(os.path.join(output_path, base_path, 'Firmware', 'mks_pic', filename), assets_path) |
|||
shutil.rmtree(output_path, ignore_errors=True) |
|||
|
|||
if os.path.exists(zip_path) == False: |
|||
download_mks_assets() |
|||
|
|||
if os.path.exists(assets_path) == False: |
|||
copy_mks_assets() |
Loading…
Reference in new issue