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.

filament_menu.cpp 3.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. /*********************
  2. * filament_menu.cpp *
  3. *********************/
  4. /****************************************************************************
  5. * Written By Mark Pelletier 2017 - Aleph Objects, Inc. *
  6. * Written By Marcio Teixeira 2018 - Aleph Objects, Inc. *
  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. * To view a copy of the GNU General Public License, go to the following *
  19. * location: <http://www.gnu.org/licenses/>. *
  20. ****************************************************************************/
  21. #include "../config.h"
  22. #if ENABLED(LULZBOT_TOUCH_UI) && ANY(LIN_ADVANCE, FILAMENT_RUNOUT_SENSOR)
  23. #include "screens.h"
  24. using namespace FTDI;
  25. using namespace ExtUI;
  26. using namespace Theme;
  27. void FilamentMenu::onRedraw(draw_mode_t what) {
  28. if (what & BACKGROUND) {
  29. CommandProcessor cmd;
  30. cmd.cmd(CLEAR_COLOR_RGB(Theme::bg_color))
  31. .cmd(CLEAR(true,true,true));
  32. }
  33. if (what & FOREGROUND) {
  34. CommandProcessor cmd;
  35. cmd.font(font_large)
  36. #ifdef TOUCH_UI_PORTRAIT
  37. #define GRID_ROWS 9
  38. #define GRID_COLS 2
  39. .text ( BTN_POS(1,1), BTN_SIZE(2,1), GET_TEXTF(FILAMENT))
  40. .font(font_medium).colors(normal_btn)
  41. #if ENABLED(FILAMENT_RUNOUT_SENSOR)
  42. .enabled(1)
  43. #else
  44. .enabled(0)
  45. #endif
  46. .tag(2).button( BTN_POS(1,2), BTN_SIZE(2,1), GET_TEXTF(RUNOUT_SENSOR))
  47. #if ENABLED(LIN_ADVANCE)
  48. .enabled(1)
  49. #else
  50. .enabled(0)
  51. #endif
  52. .tag(3).button( BTN_POS(1,3), BTN_SIZE(2,1), GET_TEXTF(LINEAR_ADVANCE))
  53. .colors(action_btn)
  54. .tag(1) .button( BTN_POS(1,9), BTN_SIZE(2,1), GET_TEXTF(BACK));
  55. #undef GRID_COLS
  56. #undef GRID_ROWS
  57. #else
  58. #define GRID_ROWS 6
  59. #define GRID_COLS 3
  60. .text ( BTN_POS(1,1), BTN_SIZE(3,1), GET_TEXTF(FILAMENT))
  61. .font(font_medium).colors(normal_btn)
  62. #if ENABLED(FILAMENT_RUNOUT_SENSOR)
  63. .enabled(1)
  64. #else
  65. .enabled(0)
  66. #endif
  67. .tag(2).button( BTN_POS(1,2), BTN_SIZE(3,1), GET_TEXTF(RUNOUT_SENSOR))
  68. #if ENABLED(LIN_ADVANCE)
  69. .enabled(1)
  70. #else
  71. .enabled(0)
  72. #endif
  73. .tag(3).button( BTN_POS(1,3), BTN_SIZE(3,1), GET_TEXTF(LINEAR_ADVANCE))
  74. .colors(action_btn)
  75. .tag(1) .button( BTN_POS(1,6), BTN_SIZE(3,1), GET_TEXTF(BACK));
  76. #endif
  77. }
  78. }
  79. bool FilamentMenu::onTouchEnd(uint8_t tag) {
  80. switch (tag) {
  81. case 1: GOTO_PREVIOUS(); break;
  82. #if ENABLED(FILAMENT_RUNOUT_SENSOR)
  83. case 2: GOTO_SCREEN(FilamentRunoutScreen); break;
  84. #endif
  85. #if ENABLED(LIN_ADVANCE)
  86. case 3: GOTO_SCREEN(LinearAdvanceScreen); break;
  87. #endif
  88. default: return false;
  89. }
  90. return true;
  91. }
  92. #endif // LULZBOT_TOUCH_UI