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_wifi_tips.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 "lv_conf.h"
  25. #include "draw_ui.h"
  26. #if ENABLED(USE_WIFI_FUNCTION)
  27. #include "../../../../../Configuration.h"
  28. #include "../../../../module/temperature.h"
  29. static lv_obj_t * scr;
  30. TIPS_TYPE wifi_tips_type;
  31. TIPS_DISP tips_disp;
  32. tips_menu_def tips_menu;
  33. void lv_draw_wifi_tips(void) {
  34. static lv_obj_t * text_tips,*wifi_name;
  35. if (disp_state_stack._disp_state[disp_state_stack._disp_index] != WIFI_TIPS_UI) {
  36. disp_state_stack._disp_index++;
  37. disp_state_stack._disp_state[disp_state_stack._disp_index] = WIFI_TIPS_UI;
  38. }
  39. disp_state = WIFI_TIPS_UI;
  40. scr = lv_obj_create(NULL, NULL);
  41. lv_obj_set_style(scr, &tft_style_scr);
  42. lv_scr_load(scr);
  43. lv_obj_clean(scr);
  44. lv_refr_now(lv_refr_get_disp_refreshing());
  45. text_tips = lv_label_create(scr, NULL);
  46. lv_obj_set_style(text_tips, &tft_style_label_rel);
  47. wifi_name = lv_label_create(scr, NULL);
  48. lv_obj_set_style(wifi_name, &tft_style_label_rel);
  49. if (wifi_tips_type == TIPS_TYPE_JOINING) {
  50. lv_label_set_text(text_tips, tips_menu.joining);
  51. lv_obj_align(text_tips, NULL, LV_ALIGN_CENTER,0, -60);
  52. }
  53. else if (wifi_tips_type == TIPS_TYPE_TAILED_JOIN) {
  54. lv_label_set_text(text_tips, tips_menu.failedJoin);
  55. lv_obj_align(text_tips, NULL, LV_ALIGN_CENTER,0, -60);
  56. }
  57. else if (wifi_tips_type == TIPS_TYPE_WIFI_CONECTED) {
  58. lv_label_set_text(text_tips, tips_menu.wifiConected);
  59. lv_obj_align(text_tips, NULL, LV_ALIGN_CENTER,0, -60);
  60. }
  61. lv_label_set_text(wifi_name, (const char *)wifi_list.wifiName[wifi_list.nameIndex]);
  62. lv_obj_align(wifi_name, NULL, LV_ALIGN_CENTER,0, -20);
  63. tips_disp.timer = TIPS_TIMER_START;
  64. tips_disp.timer_count = 0;
  65. }
  66. void lv_clear_wifi_tips() { lv_obj_del(scr); }
  67. #endif // USE_WIFI_FUNCTION
  68. #endif // HAS_TFT_LVGL_UI