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_level_settings.cpp 2.5KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  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_LEVEL_RETURN = 1,
  31. ID_LEVEL_POSITION,
  32. ID_LEVEL_COMMAND,
  33. ID_LEVEL_ZOFFSET
  34. };
  35. static void event_handler(lv_obj_t *obj, lv_event_t event) {
  36. if (event != LV_EVENT_RELEASED) return;
  37. lv_clear_level_settings();
  38. switch (obj->mks_obj_id) {
  39. case ID_LEVEL_RETURN:
  40. draw_return_ui();
  41. break;
  42. case ID_LEVEL_POSITION:
  43. lv_draw_manual_level_pos_settings();
  44. break;
  45. case ID_LEVEL_COMMAND:
  46. keyboard_value = autoLevelGcodeCommand;
  47. lv_draw_keyboard();
  48. break;
  49. #if HAS_BED_PROBE
  50. case ID_LEVEL_ZOFFSET:
  51. lv_draw_auto_level_offset_settings();
  52. break;
  53. #endif
  54. }
  55. }
  56. void lv_draw_level_settings() {
  57. scr = lv_screen_create(LEVELING_PARA_UI, machine_menu.LevelingParaConfTitle);
  58. lv_screen_menu_item(scr, machine_menu.LevelingManuPosConf, PARA_UI_POS_X, PARA_UI_POS_Y, event_handler, ID_LEVEL_POSITION, 0);
  59. lv_screen_menu_item(scr, machine_menu.LevelingAutoCommandConf, PARA_UI_POS_X, PARA_UI_POS_Y * 2, event_handler, ID_LEVEL_COMMAND, 1);
  60. #if HAS_BED_PROBE
  61. lv_screen_menu_item(scr, machine_menu.LevelingAutoZoffsetConf, PARA_UI_POS_X, PARA_UI_POS_Y * 3, event_handler, ID_LEVEL_ZOFFSET, 2);
  62. #endif
  63. lv_big_button_create(scr, "F:/bmp_back70x40.bin", common_menu.text_back, PARA_UI_BACL_POS_X + 10, PARA_UI_BACL_POS_Y, event_handler, ID_LEVEL_RETURN, true);
  64. }
  65. void lv_clear_level_settings() {
  66. #if HAS_ROTARY_ENCODER
  67. if (gCfgItems.encoder_enable) lv_group_remove_all_objs(g);
  68. #endif
  69. lv_obj_del(scr);
  70. }
  71. #endif // HAS_TFT_LVGL_UI