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_eeprom_settings.cpp 2.4KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  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_EEPROM_RETURN = 1,
  31. ID_EEPROM_STORE,
  32. ID_EEPROM_STORE_ARROW,
  33. ID_EEPROM_READ,
  34. ID_EEPROM_READ_ARROW,
  35. ID_EEPROM_REVERT,
  36. ID_EEPROM_REVERT_ARROW
  37. };
  38. static void event_handler(lv_obj_t *obj, lv_event_t event) {
  39. if (event != LV_EVENT_RELEASED) return;
  40. switch (obj->mks_obj_id) {
  41. case ID_EEPROM_RETURN:
  42. lv_clear_eeprom_settings();
  43. draw_return_ui();
  44. break;
  45. case ID_EEPROM_STORE:
  46. lv_clear_eeprom_settings();
  47. lv_draw_dialog(DIALOG_STORE_EEPROM_TIPS);
  48. break;
  49. #if 0
  50. case ID_EEPROM_READ:
  51. lv_clear_eeprom_settings();
  52. lv_draw_dialog(DIALOG_READ_EEPROM_TIPS);
  53. break;
  54. #endif
  55. case ID_EEPROM_REVERT:
  56. lv_clear_eeprom_settings();
  57. lv_draw_dialog(DIALOG_REVERT_EEPROM_TIPS);
  58. break;
  59. }
  60. }
  61. void lv_draw_eeprom_settings() {
  62. scr = lv_screen_create(EEPROM_SETTINGS_UI);
  63. lv_screen_menu_item(scr, eeprom_menu.revert, PARA_UI_POS_X, PARA_UI_POS_Y, event_handler, ID_EEPROM_REVERT, 0);
  64. lv_screen_menu_item(scr, eeprom_menu.store, PARA_UI_POS_X, PARA_UI_POS_Y * 2, event_handler, ID_EEPROM_STORE, 1);
  65. lv_big_button_create(scr, "F:/bmp_back70x40.bin", common_menu.text_back, PARA_UI_BACK_POS_X, PARA_UI_BACK_POS_Y, event_handler, ID_EEPROM_RETURN, true);
  66. }
  67. void lv_clear_eeprom_settings() {
  68. #if HAS_ROTARY_ENCODER
  69. if (gCfgItems.encoder_enable) lv_group_remove_all_objs(g);
  70. #endif
  71. lv_obj_del(scr);
  72. }
  73. #endif // HAS_TFT_LVGL_UI