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_pause_position.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 "../../../../module/planner.h"
  27. #include "../../../../inc/MarlinConfig.h"
  28. extern lv_group_t *g;
  29. static lv_obj_t *scr;
  30. enum {
  31. ID_PAUSE_RETURN = 1,
  32. ID_PAUSE_X,
  33. ID_PAUSE_Y,
  34. ID_PAUSE_Z
  35. };
  36. static void event_handler(lv_obj_t *obj, lv_event_t event) {
  37. if (event != LV_EVENT_RELEASED) return;
  38. lv_clear_pause_position();
  39. switch (obj->mks_obj_id) {
  40. case ID_PAUSE_RETURN:
  41. draw_return_ui();
  42. return;
  43. case ID_PAUSE_X:
  44. value = pause_pos_x;
  45. break;
  46. case ID_PAUSE_Y:
  47. value = pause_pos_y;
  48. break;
  49. case ID_PAUSE_Z:
  50. value = pause_pos_z;
  51. break;
  52. }
  53. lv_draw_number_key();
  54. }
  55. void lv_draw_pause_position() {
  56. char str_1[16];
  57. scr = lv_screen_create(PAUSE_POS_UI, machine_menu.PausePosText);
  58. sprintf_P(public_buf_l, PSTR("%s"), dtostrf(gCfgItems.pausePosX, 1, 1, str_1));
  59. lv_screen_menu_item_1_edit(scr, machine_menu.xPos, PARA_UI_POS_X, PARA_UI_POS_Y, event_handler, ID_PAUSE_X, 0, public_buf_l);
  60. sprintf_P(public_buf_l, PSTR("%s"), dtostrf(gCfgItems.pausePosY, 1, 1, str_1));
  61. lv_screen_menu_item_1_edit(scr, machine_menu.yPos, PARA_UI_POS_X, PARA_UI_POS_Y * 2, event_handler, ID_PAUSE_Y, 1, public_buf_l);
  62. sprintf_P(public_buf_l, PSTR("%s"), dtostrf(gCfgItems.pausePosZ, 1, 1, str_1));
  63. lv_screen_menu_item_1_edit(scr, machine_menu.zPos, PARA_UI_POS_X, PARA_UI_POS_Y * 3, event_handler, ID_PAUSE_Z, 2, public_buf_l);
  64. lv_big_button_create(scr, "F:/bmp_back70x40.bin", common_menu.text_back, PARA_UI_BACL_POS_X, PARA_UI_BACL_POS_Y, event_handler, ID_PAUSE_RETURN, true);
  65. }
  66. void lv_clear_pause_position() {
  67. #if HAS_ROTARY_ENCODER
  68. if (gCfgItems.encoder_enable) lv_group_remove_all_objs(g);
  69. #endif
  70. lv_obj_del(scr);
  71. }
  72. #endif // HAS_TFT_LVGL_UI