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.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  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(TOUCH_UI_FTDI_EVE) && 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. .tag(0);
  33. }
  34. if (what & FOREGROUND) {
  35. CommandProcessor cmd;
  36. cmd.font(font_large)
  37. #ifdef TOUCH_UI_PORTRAIT
  38. #define GRID_ROWS 9
  39. #define GRID_COLS 2
  40. .text ( BTN_POS(1,1), BTN_SIZE(2,1), GET_TEXT_F(MSG_FILAMENT))
  41. .font(font_medium).colors(normal_btn)
  42. #if ENABLED(FILAMENT_RUNOUT_SENSOR)
  43. .enabled(1)
  44. #else
  45. .enabled(0)
  46. #endif
  47. .tag(2).button( BTN_POS(1,2), BTN_SIZE(2,1), GET_TEXT_F(MSG_RUNOUT_SENSOR))
  48. #if ENABLED(LIN_ADVANCE)
  49. .enabled(1)
  50. #else
  51. .enabled(0)
  52. #endif
  53. .tag(3).button( BTN_POS(1,3), BTN_SIZE(2,1), GET_TEXT_F(MSG_LINEAR_ADVANCE))
  54. .colors(action_btn)
  55. .tag(1) .button( BTN_POS(1,9), BTN_SIZE(2,1), GET_TEXT_F(MSG_BACK));
  56. #undef GRID_COLS
  57. #undef GRID_ROWS
  58. #else
  59. #define GRID_ROWS 6
  60. #define GRID_COLS 3
  61. .text ( BTN_POS(1,1), BTN_SIZE(3,1), GET_TEXT_F(MSG_FILAMENT))
  62. .font(font_medium).colors(normal_btn)
  63. #if ENABLED(FILAMENT_RUNOUT_SENSOR)
  64. .enabled(1)
  65. #else
  66. .enabled(0)
  67. #endif
  68. .tag(2).button( BTN_POS(1,2), BTN_SIZE(3,1), GET_TEXT_F(MSG_RUNOUT_SENSOR))
  69. #if ENABLED(LIN_ADVANCE)
  70. .enabled(1)
  71. #else
  72. .enabled(0)
  73. #endif
  74. .tag(3).button( BTN_POS(1,3), BTN_SIZE(3,1), GET_TEXT_F(MSG_LINEAR_ADVANCE))
  75. .colors(action_btn)
  76. .tag(1) .button( BTN_POS(1,6), BTN_SIZE(3,1), GET_TEXT_F(MSG_BACK));
  77. #endif
  78. }
  79. }
  80. bool FilamentMenu::onTouchEnd(uint8_t tag) {
  81. switch (tag) {
  82. case 1: GOTO_PREVIOUS(); break;
  83. #if ENABLED(FILAMENT_RUNOUT_SENSOR)
  84. case 2: GOTO_SCREEN(FilamentRunoutScreen); break;
  85. #endif
  86. #if ENABLED(LIN_ADVANCE)
  87. case 3: GOTO_SCREEN(LinearAdvanceScreen); break;
  88. #endif
  89. default: return false;
  90. }
  91. return true;
  92. }
  93. #endif // TOUCH_UI_FTDI_EVE