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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  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 "lv_conf.h"
  25. #include "draw_ui.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 "../../../../MarlinCore.h"
  31. #include "../../../../module/temperature.h"
  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. LV_IMG_DECLARE(bmp_pic);
  65. /*Create an Image button*/
  66. buttonBack = lv_imgbtn_create(scr, NULL);
  67. #if 1
  68. lv_obj_set_event_cb_mks(buttonBack, event_handler, ID_A_RETURN, "bmp_return.bin", 0);
  69. lv_imgbtn_set_src(buttonBack, LV_BTN_STATE_REL, &bmp_pic);
  70. lv_imgbtn_set_src(buttonBack, LV_BTN_STATE_PR, &bmp_pic);
  71. lv_imgbtn_set_style(buttonBack, LV_BTN_STATE_PR, &tft_style_label_pre);
  72. lv_imgbtn_set_style(buttonBack, LV_BTN_STATE_REL, &tft_style_label_rel);
  73. #endif
  74. lv_obj_set_pos(buttonBack, BTN_X_PIXEL * 3 + INTERVAL_V * 4, BTN_Y_PIXEL + INTERVAL_H + titleHeight);
  75. lv_btn_set_layout(buttonBack, LV_LAYOUT_OFF);
  76. /*Create a label on the Image button*/
  77. label_Back = lv_label_create(buttonBack, NULL);
  78. if (gCfgItems.multiple_language != 0) {
  79. lv_label_set_text(label_Back, common_menu.text_back);
  80. lv_obj_align(label_Back, buttonBack, LV_ALIGN_IN_BOTTOM_MID, 0, BUTTON_TEXT_Y_OFFSET);
  81. }
  82. fw_version = lv_label_create(scr, NULL);
  83. lv_obj_set_style(fw_version, &tft_style_label_rel);
  84. lv_label_set_text(fw_version, SHORT_BUILD_VERSION);
  85. lv_obj_align(fw_version, NULL, LV_ALIGN_CENTER, 0, -60);
  86. fw_type = lv_label_create(scr, NULL);
  87. lv_obj_set_style(fw_type, &tft_style_label_rel);
  88. lv_label_set_text(fw_type,
  89. #if MB(MKS_ROBIN_PRO)
  90. "Firmware: Robin_Pro35"
  91. #elif MB(MKS_ROBIN_NANO, MKS_ROBIN_NANO_V2)
  92. "Firmware: Robin_Nano35"
  93. #else
  94. CUSTOM_MACHINE_NAME
  95. #endif
  96. );
  97. lv_obj_align(fw_type, NULL, LV_ALIGN_CENTER, 0, -20);
  98. board = lv_label_create(scr, NULL);
  99. lv_obj_set_style(board, &tft_style_label_rel);
  100. lv_label_set_text(board, "Board: " BOARD_INFO_NAME);
  101. lv_obj_align(board, NULL, LV_ALIGN_CENTER, 0, 20);
  102. }
  103. void lv_clear_about() { lv_obj_del(scr); }
  104. #endif // HAS_TFT_LVGL_UI