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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  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: <https://www.gnu.org/licenses/>. *
  20. ****************************************************************************/
  21. #include "../config.h"
  22. #include "../screens.h"
  23. #ifdef FTDI_FILAMENT_MENU
  24. using namespace FTDI;
  25. using namespace ExtUI;
  26. using namespace Theme;
  27. #if ENABLED(TOUCH_UI_PORTRAIT)
  28. #define GRID_COLS 2
  29. #define GRID_ROWS 9
  30. #define TITLE_POS BTN_POS(1,1), BTN_SIZE(2,1)
  31. #define RUNOUT_SENSOR_POS BTN_POS(1,2), BTN_SIZE(2,1)
  32. #define LIN_ADVANCE_POS BTN_POS(1,3), BTN_SIZE(2,1)
  33. #define BACK_POS BTN_POS(1,9), BTN_SIZE(2,1)
  34. #else
  35. #define GRID_COLS 2
  36. #define GRID_ROWS 6
  37. #define TITLE_POS BTN_POS(1,1), BTN_SIZE(2,1)
  38. #define RUNOUT_SENSOR_POS BTN_POS(1,2), BTN_SIZE(2,1)
  39. #define LIN_ADVANCE_POS BTN_POS(1,3), BTN_SIZE(2,1)
  40. #define BACK_POS BTN_POS(1,6), BTN_SIZE(2,1)
  41. #endif
  42. void FilamentMenu::onRedraw(draw_mode_t what) {
  43. if (what & BACKGROUND) {
  44. CommandProcessor cmd;
  45. cmd.cmd(CLEAR_COLOR_RGB(Theme::bg_color))
  46. .cmd(CLEAR(true,true,true))
  47. .tag(0);
  48. }
  49. if (what & FOREGROUND) {
  50. CommandProcessor cmd;
  51. cmd.font(font_large)
  52. .text(TITLE_POS, GET_TEXT_F(MSG_FILAMENT))
  53. .font(font_medium).colors(normal_btn)
  54. .enabled(ENABLED(FILAMENT_RUNOUT_SENSOR))
  55. .tag(2).button(RUNOUT_SENSOR_POS, GET_TEXT_F(MSG_RUNOUT_SENSOR))
  56. .enabled(ENABLED(LIN_ADVANCE))
  57. .tag(3).button(LIN_ADVANCE_POS, GET_TEXT_F(MSG_LINEAR_ADVANCE))
  58. .colors(action_btn)
  59. .tag(1).button(BACK_POS, GET_TEXT_F(MSG_BUTTON_DONE));
  60. }
  61. }
  62. bool FilamentMenu::onTouchEnd(uint8_t tag) {
  63. switch (tag) {
  64. case 1: GOTO_PREVIOUS(); break;
  65. #if ENABLED(FILAMENT_RUNOUT_SENSOR)
  66. case 2: GOTO_SCREEN(FilamentRunoutScreen); break;
  67. #endif
  68. #if ENABLED(LIN_ADVANCE)
  69. case 3: GOTO_SCREEN(LinearAdvanceScreen); break;
  70. #endif
  71. default: return false;
  72. }
  73. return true;
  74. }
  75. #endif // FTDI_FILAMENT_MENU