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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  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. * Written By Marcio Teixeira 2019 - Cocoa Press *
  8. * *
  9. * This program is free software: you can redistribute it and/or modify *
  10. * it under the terms of the GNU General Public License as published by *
  11. * the Free Software Foundation, either version 3 of the License, or *
  12. * (at your option) any later version. *
  13. * *
  14. * This program is distributed in the hope that it will be useful, *
  15. * but WITHOUT ANY WARRANTY; without even the implied warranty of *
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
  17. * GNU General Public License for more details. *
  18. * *
  19. * To view a copy of the GNU General Public License, go to the following *
  20. * location: <https://www.gnu.org/licenses/>. *
  21. ****************************************************************************/
  22. #include "../config.h"
  23. #include "../screens.h"
  24. #ifdef FTDI_MAIN_MENU
  25. using namespace FTDI;
  26. using namespace Theme;
  27. void MainMenu::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 ENABLED(TOUCH_UI_PORTRAIT)
  34. #define GRID_COLS 2
  35. #define GRID_ROWS 8
  36. #define ABOUT_PRINTER_POS BTN_POS(1,1), BTN_SIZE(2,1)
  37. #define ADVANCED_SETTINGS_POS BTN_POS(1,2), BTN_SIZE(2,1)
  38. #if ENABLED(CUSTOM_MENU_MAIN)
  39. #define FILAMENTCHANGE_POS BTN_POS(1,3), BTN_SIZE(1,1)
  40. #define CUSTOM_MENU_POS BTN_POS(2,3), BTN_SIZE(1,1)
  41. #else
  42. #define FILAMENTCHANGE_POS BTN_POS(1,3), BTN_SIZE(2,1)
  43. #endif
  44. #define TEMPERATURE_POS BTN_POS(1,4), BTN_SIZE(2,1)
  45. #define DISABLE_STEPPERS_POS BTN_POS(1,5), BTN_SIZE(2,1)
  46. #define MOVE_AXIS_POS BTN_POS(1,6), BTN_SIZE(1,1)
  47. #define LEVELING_POS BTN_POS(2,6), BTN_SIZE(1,1)
  48. #define AUTO_HOME_POS BTN_POS(1,7), BTN_SIZE(1,1)
  49. #define CLEAN_NOZZLE_POS BTN_POS(2,7), BTN_SIZE(1,1)
  50. #define BACK_POS BTN_POS(1,8), BTN_SIZE(2,1)
  51. #else
  52. #define GRID_COLS 6
  53. #define GRID_ROWS 5
  54. #define ADVANCED_SETTINGS_POS BTN_POS(1,1), BTN_SIZE(3,1)
  55. #define ABOUT_PRINTER_POS BTN_POS(4,1), BTN_SIZE(3,1)
  56. #define AUTO_HOME_POS BTN_POS(1,2), BTN_SIZE(3,1)
  57. #define CLEAN_NOZZLE_POS BTN_POS(4,2), BTN_SIZE(3,1)
  58. #define MOVE_AXIS_POS BTN_POS(1,3), BTN_SIZE(3,1)
  59. #define DISABLE_STEPPERS_POS BTN_POS(4,3), BTN_SIZE(3,1)
  60. #if ENABLED(CUSTOM_MENU_MAIN)
  61. #define TEMPERATURE_POS BTN_POS(1,4), BTN_SIZE(2,1)
  62. #define FILAMENTCHANGE_POS BTN_POS(3,4), BTN_SIZE(2,1)
  63. #define CUSTOM_MENU_POS BTN_POS(5,4), BTN_SIZE(2,1)
  64. #else
  65. #define TEMPERATURE_POS BTN_POS(1,4), BTN_SIZE(3,1)
  66. #define FILAMENTCHANGE_POS BTN_POS(4,4), BTN_SIZE(3,1)
  67. #endif
  68. #define LEVELING_POS BTN_POS(1,5), BTN_SIZE(3,1)
  69. #define BACK_POS BTN_POS(4,5), BTN_SIZE(3,1)
  70. #endif
  71. if (what & FOREGROUND) {
  72. CommandProcessor cmd;
  73. cmd.colors(normal_btn)
  74. .font(Theme::font_medium)
  75. .tag( 2).button(AUTO_HOME_POS, GET_TEXT_F(MSG_AUTO_HOME))
  76. .enabled(ENABLED(NOZZLE_CLEAN_FEATURE))
  77. .tag( 3).button(CLEAN_NOZZLE_POS, GET_TEXT_F(MSG_CLEAN_NOZZLE))
  78. .tag( 4).button(MOVE_AXIS_POS, GET_TEXT_F(MSG_MOVE_AXIS))
  79. .tag( 5).button(DISABLE_STEPPERS_POS,GET_TEXT_F(MSG_DISABLE_STEPPERS))
  80. .tag( 6).button(TEMPERATURE_POS, GET_TEXT_F(MSG_TEMPERATURE))
  81. .enabled(DISABLED(TOUCH_UI_LULZBOT_BIO))
  82. .tag( 7).button(FILAMENTCHANGE_POS, GET_TEXT_F(MSG_FILAMENTCHANGE))
  83. .tag( 8).button(ADVANCED_SETTINGS_POS, GET_TEXT_F(MSG_ADVANCED_SETTINGS))
  84. .enabled(ENABLED(HAS_LEVELING))
  85. .tag( 9).button(LEVELING_POS, GET_TEXT_F(MSG_LEVELING))
  86. .tag(10).button(ABOUT_PRINTER_POS, GET_TEXT_F(MSG_INFO_MENU))
  87. #if ENABLED(CUSTOM_MENU_MAIN)
  88. .tag(11).button(CUSTOM_MENU_POS, GET_TEXT_F(MSG_CUSTOM_COMMANDS))
  89. #endif
  90. .colors(action_btn)
  91. .tag(1).button(BACK_POS, GET_TEXT_F(MSG_BUTTON_DONE));
  92. }
  93. }
  94. bool MainMenu::onTouchEnd(uint8_t tag) {
  95. using namespace ExtUI;
  96. switch (tag) {
  97. case 1: SaveSettingsDialogBox::promptToSaveSettings(); break;
  98. case 2: SpinnerDialogBox::enqueueAndWait(F("G28")); break;
  99. #if ENABLED(NOZZLE_CLEAN_FEATURE)
  100. case 3: injectCommands(F("G12")); GOTO_SCREEN(StatusScreen); break;
  101. #endif
  102. case 4: GOTO_SCREEN(MoveAxisScreen); break;
  103. case 5: injectCommands(F("M84")); break;
  104. case 6: GOTO_SCREEN(TemperatureScreen); break;
  105. case 7: GOTO_SCREEN(ChangeFilamentScreen); break;
  106. case 8: GOTO_SCREEN(AdvancedSettingsMenu); break;
  107. #if HAS_LEVELING
  108. case 9: GOTO_SCREEN(LevelingMenu); break;
  109. #endif
  110. case 10: GOTO_SCREEN(AboutScreen); break;
  111. #if ENABLED(CUSTOM_MENU_MAIN)
  112. case 11: GOTO_SCREEN(CustomUserMenus); break;
  113. #endif
  114. default:
  115. return false;
  116. }
  117. return true;
  118. }
  119. #endif // FTDI_MAIN_MENU