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_machine_para.cpp 2.6KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  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 "../../../inc/MarlinConfig.h"
  27. extern lv_group_t *g;
  28. static lv_obj_t *scr;
  29. enum {
  30. ID_PARA_RETURN = 1,
  31. ID_PARA_MACHINE,
  32. ID_PARA_MOTOR,
  33. ID_PARA_LEVEL,
  34. ID_PARA_ADVANCE
  35. };
  36. static void event_handler(lv_obj_t *obj, lv_event_t event) {
  37. if (event != LV_EVENT_RELEASED) return;
  38. switch (obj->mks_obj_id) {
  39. case ID_PARA_RETURN:
  40. lv_clear_machine_para();
  41. draw_return_ui();
  42. break;
  43. case ID_PARA_MACHINE:
  44. lv_clear_machine_para();
  45. lv_draw_machine_settings();
  46. break;
  47. case ID_PARA_MOTOR:
  48. lv_clear_machine_para();
  49. lv_draw_motor_settings();
  50. break;
  51. case ID_PARA_LEVEL:
  52. lv_clear_machine_para();
  53. lv_draw_level_settings();
  54. break;
  55. case ID_PARA_ADVANCE:
  56. lv_clear_machine_para();
  57. lv_draw_advance_settings();
  58. break;
  59. }
  60. }
  61. void lv_draw_machine_para() {
  62. scr = lv_screen_create(MACHINE_PARA_UI);
  63. lv_screen_menu_item(scr, MachinePara_menu.MachineSetting, PARA_UI_POS_X, PARA_UI_POS_Y, event_handler, ID_PARA_MACHINE, 0);
  64. lv_screen_menu_item(scr, MachinePara_menu.MotorSetting, PARA_UI_POS_X, PARA_UI_POS_Y * 2, event_handler, ID_PARA_MOTOR, 1);
  65. lv_screen_menu_item(scr, MachinePara_menu.leveling, PARA_UI_POS_X, PARA_UI_POS_Y * 3, event_handler, ID_PARA_LEVEL, 2);
  66. lv_screen_menu_item(scr, MachinePara_menu.AdvanceSetting, PARA_UI_POS_X, PARA_UI_POS_Y * 4, event_handler, ID_PARA_ADVANCE, 3);
  67. lv_big_button_create(scr, "F:/bmp_back70x40.bin", common_menu.text_back, PARA_UI_BACK_POS_X + 10, PARA_UI_BACK_POS_Y, event_handler, ID_PARA_RETURN, true);
  68. }
  69. void lv_clear_machine_para() {
  70. #if HAS_ROTARY_ENCODER
  71. if (gCfgItems.encoder_enable) lv_group_remove_all_objs(g);
  72. #endif
  73. lv_obj_del(scr);
  74. }
  75. #endif // HAS_TFT_LVGL_UI