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_home.cpp 3.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  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_ready_print.h"
  25. #include "draw_set.h"
  26. #include "draw_ui.h"
  27. #include <lv_conf.h>
  28. #include "../../../gcode/queue.h"
  29. #include "../../../inc/MarlinConfig.h"
  30. extern lv_group_t *g;
  31. static lv_obj_t *scr;
  32. enum {
  33. ID_H_ALL = 1,
  34. ID_H_X,
  35. ID_H_Y,
  36. ID_H_Z,
  37. ID_H_RETURN,
  38. ID_H_OFF_ALL,
  39. ID_H_OFF_XY
  40. };
  41. static void event_handler(lv_obj_t *obj, lv_event_t event) {
  42. if (event != LV_EVENT_RELEASED) return;
  43. switch (obj->mks_obj_id) {
  44. case ID_H_ALL:
  45. queue.inject_P(G28_STR);
  46. break;
  47. case ID_H_X:
  48. queue.inject(F("G28X"));
  49. break;
  50. case ID_H_Y:
  51. queue.inject(F("G28Y"));
  52. break;
  53. case ID_H_Z:
  54. queue.inject(F("G28Z"));
  55. break;
  56. case ID_H_OFF_ALL:
  57. queue.inject(F("M84"));
  58. break;
  59. case ID_H_OFF_XY:
  60. queue.inject(F("M84XY"));
  61. break;
  62. case ID_H_RETURN:
  63. goto_previous_ui();
  64. break;
  65. }
  66. }
  67. void lv_draw_home() {
  68. scr = lv_screen_create(ZERO_UI);
  69. lv_big_button_create(scr, "F:/bmp_zeroAll.bin", home_menu.home_all, INTERVAL_V, titleHeight, event_handler, ID_H_ALL);
  70. lv_big_button_create(scr, "F:/bmp_zeroX.bin", home_menu.home_x, BTN_X_PIXEL + INTERVAL_V * 2, titleHeight, event_handler, ID_H_X);
  71. lv_big_button_create(scr, "F:/bmp_zeroY.bin", home_menu.home_y, BTN_X_PIXEL * 2 + INTERVAL_V * 3, titleHeight, event_handler, ID_H_Y);
  72. lv_big_button_create(scr, "F:/bmp_zeroZ.bin", home_menu.home_z, BTN_X_PIXEL * 3 + INTERVAL_V * 4, titleHeight, event_handler, ID_H_Z);
  73. lv_big_button_create(scr, "F:/bmp_function1.bin", set_menu.motoroff, INTERVAL_V, BTN_Y_PIXEL + INTERVAL_H + titleHeight, event_handler, ID_H_OFF_ALL);
  74. lv_big_button_create(scr, "F:/bmp_function1.bin", set_menu.motoroffXY, BTN_X_PIXEL + INTERVAL_V * 2, BTN_Y_PIXEL + INTERVAL_H + titleHeight, event_handler, ID_H_OFF_XY);
  75. lv_big_button_create(scr, "F:/bmp_return.bin", common_menu.text_back, BTN_X_PIXEL * 3 + INTERVAL_V * 4, BTN_Y_PIXEL + INTERVAL_H + titleHeight, event_handler, ID_H_RETURN);
  76. }
  77. void lv_clear_home() {
  78. #if HAS_ROTARY_ENCODER
  79. if (gCfgItems.encoder_enable) lv_group_remove_all_objs(g);
  80. #endif
  81. lv_obj_del(scr);
  82. }
  83. #endif // HAS_TFT_LVGL_UI