My Marlin configs for Fabrikator Mini and CTC i3 Pro B
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

draw_about.cpp 4.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. /**
  2. * Marlin 3D Printer Firmware
  3. * Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
  4. *
  5. * Based on Sprinter and grbl.
  6. * Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
  7. *
  8. * This program is free software: you can redistribute it and/or modify
  9. * it under the terms of the GNU General Public License as published by
  10. * the Free Software Foundation, either version 3 of the License, or
  11. * (at your option) any later version.
  12. *
  13. * This program is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public License
  19. * along with this program. If not, see <https://www.gnu.org/licenses/>.
  20. *
  21. */
  22. #include "../../../../inc/MarlinConfigPre.h"
  23. #if HAS_TFT_LVGL_UI
  24. #include "draw_ui.h"
  25. #include <lv_conf.h>
  26. //#include "../lvgl/src/lv_objx/lv_imgbtn.h"
  27. //#include "../lvgl/src/lv_objx/lv_img.h"
  28. //#include "../lvgl/src/lv_core/lv_disp.h"
  29. //#include "../lvgl/src/lv_core/lv_refr.h"
  30. #include "../../../../inc/MarlinConfig.h"
  31. extern lv_group_t * g;
  32. static lv_obj_t * scr;
  33. static lv_obj_t * fw_type, *board; //*fw_version;
  34. #define ID_A_RETURN 1
  35. static void event_handler(lv_obj_t * obj, lv_event_t event) {
  36. switch (obj->mks_obj_id) {
  37. case ID_A_RETURN:
  38. if (event == LV_EVENT_CLICKED) {
  39. // do nothing
  40. }
  41. else if (event == LV_EVENT_RELEASED) {
  42. clear_cur_ui();
  43. draw_return_ui();
  44. }
  45. break;
  46. }
  47. }
  48. void lv_draw_about(void) {
  49. lv_obj_t *buttonBack, *label_Back;
  50. if (disp_state_stack._disp_state[disp_state_stack._disp_index] != ABOUT_UI) {
  51. disp_state_stack._disp_index++;
  52. disp_state_stack._disp_state[disp_state_stack._disp_index] = ABOUT_UI;
  53. }
  54. disp_state = ABOUT_UI;
  55. scr = lv_obj_create(NULL, NULL);
  56. lv_obj_set_style(scr, &tft_style_scr);
  57. lv_scr_load(scr);
  58. lv_obj_clean(scr);
  59. lv_obj_t * title = lv_label_create(scr, NULL);
  60. lv_obj_set_style(title, &tft_style_label_rel);
  61. lv_obj_set_pos(title, TITLE_XPOS, TITLE_YPOS);
  62. lv_label_set_text(title, creat_title_text());
  63. lv_refr_now(lv_refr_get_disp_refreshing());
  64. // Create an Image button
  65. buttonBack = lv_imgbtn_create(scr, NULL);
  66. #if 1
  67. lv_obj_set_event_cb_mks(buttonBack, event_handler, ID_A_RETURN, NULL, 0);
  68. lv_imgbtn_set_src(buttonBack, LV_BTN_STATE_REL, "F:/bmp_return.bin");
  69. lv_imgbtn_set_src(buttonBack, LV_BTN_STATE_PR, "F:/bmp_return.bin");
  70. lv_imgbtn_set_style(buttonBack, LV_BTN_STATE_PR, &tft_style_label_pre);
  71. lv_imgbtn_set_style(buttonBack, LV_BTN_STATE_REL, &tft_style_label_rel);
  72. #if HAS_ROTARY_ENCODER
  73. if (gCfgItems.encoder_enable) lv_group_add_obj(g, buttonBack);
  74. #endif
  75. #endif
  76. lv_obj_set_pos(buttonBack, BTN_X_PIXEL * 3 + INTERVAL_V * 4, BTN_Y_PIXEL + INTERVAL_H + titleHeight);
  77. lv_btn_set_layout(buttonBack, LV_LAYOUT_OFF);
  78. // Create a label on the image button
  79. label_Back = lv_label_create(buttonBack, NULL);
  80. if (gCfgItems.multiple_language) {
  81. lv_label_set_text(label_Back, common_menu.text_back);
  82. lv_obj_align(label_Back, buttonBack, LV_ALIGN_IN_BOTTOM_MID, 0, BUTTON_TEXT_Y_OFFSET);
  83. }
  84. //fw_version = lv_label_create(scr, NULL);
  85. //lv_obj_set_style(fw_version, &tft_style_label_rel);
  86. //lv_label_set_text(fw_version, SHORT_BUILD_VERSION);
  87. //lv_obj_align(fw_version, NULL, LV_ALIGN_CENTER, 0, -60);
  88. fw_type = lv_label_create(scr, NULL);
  89. lv_obj_set_style(fw_type, &tft_style_label_rel);
  90. lv_label_set_text(fw_type, "Firmware: Marlin " SHORT_BUILD_VERSION);
  91. lv_obj_align(fw_type, NULL, LV_ALIGN_CENTER, 0, -20);
  92. board = lv_label_create(scr, NULL);
  93. lv_obj_set_style(board, &tft_style_label_rel);
  94. lv_label_set_text(board, "Board: " BOARD_INFO_NAME);
  95. lv_obj_align(board, NULL, LV_ALIGN_CENTER, 0, -60);
  96. }
  97. void lv_clear_about() {
  98. #if HAS_ROTARY_ENCODER
  99. if (gCfgItems.encoder_enable) lv_group_remove_all_objs(g);
  100. #endif
  101. lv_obj_del(scr);
  102. }
  103. #endif // HAS_TFT_LVGL_UI