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_error_message.cpp 2.9KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  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 "SPI_TFT.h"
  25. #include "lv_conf.h"
  26. #include "draw_ui.h"
  27. #include "tft_lvgl_configuration.h"
  28. #include "mks_hardware_test.h"
  29. //#include "../lvgl/src/lv_objx/lv_imgbtn.h"
  30. //#include "../lvgl/src/lv_objx/lv_img.h"
  31. //#include "../lvgl/src/lv_core/lv_disp.h"
  32. //#include "../lvgl/src/lv_core/lv_refr.h"
  33. #include "../../../../MarlinCore.h"
  34. static lv_obj_t * scr;
  35. void lv_draw_error_message(PGM_P const msg) {
  36. #if 0
  37. static lv_obj_t * message = NULL, *kill_message = NULL, *reset_tips = NULL;
  38. if (disp_state_stack._disp_state[disp_state_stack._disp_index] != ERROR_MESSAGE_UI) {
  39. disp_state_stack._disp_index++;
  40. disp_state_stack._disp_state[disp_state_stack._disp_index] = ERROR_MESSAGE_UI;
  41. }
  42. disp_state = ERROR_MESSAGE_UI;
  43. scr = lv_obj_create(NULL, NULL);
  44. lv_obj_set_style(scr, &tft_style_scr);
  45. lv_scr_load(scr);
  46. lv_obj_clean(scr);
  47. lv_refr_now(lv_refr_get_disp_refreshing());
  48. if (msg) {
  49. message = lv_label_create(scr, NULL);
  50. lv_obj_set_style(message, &tft_style_label_rel);
  51. lv_label_set_text(message, msg);
  52. lv_obj_align(message, NULL, LV_ALIGN_CENTER, 0, -50);
  53. }
  54. kill_message = lv_label_create(scr, NULL);
  55. lv_obj_set_style(kill_message, &tft_style_label_rel);
  56. lv_label_set_text(kill_message, "PRINTER HALTED");
  57. lv_obj_align(kill_message, NULL, LV_ALIGN_CENTER, 0, -10);
  58. reset_tips = lv_label_create(scr, NULL);
  59. lv_obj_set_style(reset_tips, &tft_style_label_rel);
  60. lv_label_set_text(reset_tips, "Please Reset");
  61. lv_obj_align(reset_tips, NULL, LV_ALIGN_CENTER, 0, 30);
  62. lv_task_handler();
  63. #endif
  64. SPI_TFT.LCD_clear(0x0000);
  65. if (msg) disp_string((TFT_WIDTH - strlen(msg) * 16) / 2, 100, msg, 0xFFFF, 0x0000);
  66. disp_string((TFT_WIDTH - strlen("PRINTER HALTED") * 16) / 2, 140, "PRINTER HALTED", 0xFFFF, 0x0000);
  67. disp_string((TFT_WIDTH - strlen("Please Reset") * 16) / 2, 180, "Please Reset", 0xFFFF, 0x0000);
  68. }
  69. void lv_clear_error_message() { lv_obj_del(scr); }
  70. #endif // HAS_TFT_LVGL_UI