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.

main_menu.cpp 5.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. /*****************
  2. * main_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) && !defined(LULZBOT_USE_BIOPRINTER_UI)
  23. #include "screens.h"
  24. using namespace FTDI;
  25. using namespace Theme;
  26. void MainMenu::onRedraw(draw_mode_t what) {
  27. if (what & BACKGROUND) {
  28. CommandProcessor cmd;
  29. cmd.cmd(CLEAR_COLOR_RGB(Theme::bg_color))
  30. .cmd(CLEAR(true,true,true));
  31. }
  32. if (what & FOREGROUND) {
  33. CommandProcessor cmd;
  34. cmd.colors(normal_btn)
  35. .font(Theme::font_medium)
  36. #ifdef TOUCH_UI_PORTRAIT
  37. #define GRID_ROWS 8
  38. #define GRID_COLS 2
  39. .tag(2).button( BTN_POS(1,1), BTN_SIZE(1,1), GET_TEXTF(AUTO_HOME))
  40. #ifdef NOZZLE_CLEAN_FEATURE
  41. .enabled(1)
  42. #else
  43. .enabled(0)
  44. #endif
  45. .tag(3).button( BTN_POS(2,1), BTN_SIZE(1,1), GET_TEXTF(CLEAN_NOZZLE))
  46. .tag(4).button( BTN_POS(1,2), BTN_SIZE(1,1), GET_TEXTF(MOVE_AXIS))
  47. .tag(5).button( BTN_POS(2,2), BTN_SIZE(1,1), GET_TEXTF(MOTORS_OFF))
  48. .tag(6).button( BTN_POS(1,3), BTN_SIZE(2,1), GET_TEXTF(TEMPERATURE))
  49. .tag(7).button( BTN_POS(1,4), BTN_SIZE(2,1), GET_TEXTF(CHANGE_FILAMENT))
  50. .tag(8).button( BTN_POS(1,5), BTN_SIZE(2,1), GET_TEXTF(ADVANCED_SETTINGS))
  51. #ifdef PRINTCOUNTER
  52. .enabled(1)
  53. #else
  54. .enabled(0)
  55. #endif
  56. .tag(9).button( BTN_POS(1,7), BTN_SIZE(2,1), GET_TEXTF(PRINTER_STATISTICS))
  57. .tag(10).button( BTN_POS(1,6), BTN_SIZE(2,1), GET_TEXTF(ABOUT_PRINTER))
  58. .colors(action_btn)
  59. .tag(1).button( BTN_POS(1,8), BTN_SIZE(2,1), GET_TEXTF(BACK));
  60. #undef GRID_COLS
  61. #undef GRID_ROWS
  62. #else
  63. #define GRID_ROWS 5
  64. #define GRID_COLS 2
  65. .tag(2).button( BTN_POS(1,1), BTN_SIZE(1,1), GET_TEXT(AUTO_HOME))
  66. #if ENABLED(NOZZLE_CLEAN_FEATURE)
  67. .enabled(1)
  68. #else
  69. .enabled(0)
  70. #endif
  71. .tag(3).button( BTN_POS(2,1), BTN_SIZE(1,1), GET_TEXTF(CLEAN_NOZZLE))
  72. .tag(4).button( BTN_POS(1,2), BTN_SIZE(1,1), GET_TEXTF(MOVE_AXIS))
  73. .tag(5).button( BTN_POS(2,2), BTN_SIZE(1,1), GET_TEXTF(MOTORS_OFF))
  74. .tag(6).button( BTN_POS(1,3), BTN_SIZE(1,1), GET_TEXTF(TEMPERATURE))
  75. .tag(7).button( BTN_POS(2,3), BTN_SIZE(1,1), GET_TEXTF(CHANGE_FILAMENT))
  76. .tag(8).button( BTN_POS(1,4), BTN_SIZE(1,1), GET_TEXTF(ADVANCED_SETTINGS))
  77. #ifdef PRINTCOUNTER
  78. .enabled(1)
  79. #else
  80. .enabled(0)
  81. #endif
  82. .tag(9).button( BTN_POS(2,4), BTN_SIZE(1,1), GET_TEXTF(PRINTER_STATISTICS))
  83. .tag(10).button( BTN_POS(1,5), BTN_SIZE(1,1), GET_TEXTF(ABOUT_PRINTER))
  84. .colors(action_btn)
  85. .tag(1).button( BTN_POS(2,5), BTN_SIZE(1,1), GET_TEXTF(BACK));
  86. #undef GRID_COLS
  87. #undef GRID_ROWS
  88. #endif
  89. }
  90. }
  91. bool MainMenu::onTouchEnd(uint8_t tag) {
  92. using namespace ExtUI;
  93. switch (tag) {
  94. case 1: GOTO_PREVIOUS(); break;
  95. case 2: SpinnerDialogBox::enqueueAndWait_P(F("G28")); break;
  96. #if ENABLED(NOZZLE_CLEAN_FEATURE)
  97. case 3: injectCommands_P(PSTR("G12")); GOTO_SCREEN(StatusScreen); break;
  98. #endif
  99. case 4: GOTO_SCREEN(MoveAxisScreen); break;
  100. case 5: injectCommands_P(PSTR("M84")); break;
  101. case 6: GOTO_SCREEN(TemperatureScreen); break;
  102. case 7: GOTO_SCREEN(ChangeFilamentScreen); break;
  103. case 8: GOTO_SCREEN(AdvancedSettingsMenu); break;
  104. #if ENABLED(PRINTCOUNTER)
  105. case 9: GOTO_SCREEN(StatisticsScreen); break;
  106. #endif
  107. case 10: GOTO_SCREEN(AboutScreen); break;
  108. default:
  109. return false;
  110. }
  111. return true;
  112. }
  113. #endif // LULZBOT_TOUCH_UI