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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  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_MACHINE_RETURN = 1,
  31. ID_MACHINE_ACCELERATION,
  32. ID_MACHINE_FEEDRATE,
  33. ID_MACHINE_JERK
  34. };
  35. static void event_handler(lv_obj_t *obj, lv_event_t event) {
  36. if (event != LV_EVENT_RELEASED) return;
  37. clear_cur_ui();
  38. switch (obj->mks_obj_id) {
  39. case ID_MACHINE_RETURN: draw_return_ui(); break;
  40. case ID_MACHINE_ACCELERATION: lv_draw_acceleration_settings(); break;
  41. case ID_MACHINE_FEEDRATE: lv_draw_max_feedrate_settings(); break;
  42. #if HAS_CLASSIC_JERK
  43. case ID_MACHINE_JERK: lv_draw_jerk_settings(); break;
  44. #endif
  45. }
  46. }
  47. void lv_draw_machine_settings() {
  48. scr = lv_screen_create(MACHINE_SETTINGS_UI, machine_menu.MachineConfigTitle);
  49. lv_coord_t y = PARA_UI_POS_Y;
  50. lv_screen_menu_item(scr, machine_menu.AccelerationConf, PARA_UI_POS_X, y, event_handler, ID_MACHINE_ACCELERATION, 0);
  51. y += PARA_UI_POS_Y;
  52. lv_screen_menu_item(scr, machine_menu.MaxFeedRateConf, PARA_UI_POS_X, y, event_handler, ID_MACHINE_FEEDRATE, 1);
  53. #if HAS_CLASSIC_JERK
  54. y += PARA_UI_POS_Y;
  55. lv_screen_menu_item(scr, machine_menu.JerkConf, PARA_UI_POS_X, y, event_handler, ID_MACHINE_JERK, 2);
  56. #endif
  57. 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_MACHINE_RETURN, true);
  58. }
  59. void lv_clear_machine_settings() {
  60. #if HAS_ROTARY_ENCODER
  61. if (gCfgItems.encoder_enable) lv_group_remove_all_objs(g);
  62. #endif
  63. lv_obj_del(scr);
  64. }
  65. #endif // HAS_TFT_LVGL_UI