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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  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. #if ENABLED(TOUCH_UI_FTDI_EVE) && !defined(TOUCH_UI_LULZBOT_BIO)
  24. #include "screens.h"
  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. #ifdef TOUCH_UI_PORTRAIT
  34. #define GRID_ROWS 8
  35. #define GRID_COLS 2
  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. #define FILAMENTCHANGE_POS BTN_POS(1,3), BTN_SIZE(2,1)
  39. #define TEMPERATURE_POS BTN_POS(1,4), BTN_SIZE(2,1)
  40. #define DISABLE_STEPPERS_POS BTN_POS(1,5), BTN_SIZE(2,1)
  41. #define MOVE_AXIS_POS BTN_POS(1,6), BTN_SIZE(1,1)
  42. #define LEVELING_POS BTN_POS(2,6), BTN_SIZE(1,1)
  43. #define AUTO_HOME_POS BTN_POS(1,7), BTN_SIZE(1,1)
  44. #define CLEAN_NOZZLE_POS BTN_POS(2,7), BTN_SIZE(1,1)
  45. #define BACK_POS BTN_POS(1,8), BTN_SIZE(2,1)
  46. #else
  47. #define GRID_ROWS 5
  48. #define GRID_COLS 2
  49. #define ADVANCED_SETTINGS_POS BTN_POS(1,1), BTN_SIZE(1,1)
  50. #define ABOUT_PRINTER_POS BTN_POS(2,1), BTN_SIZE(1,1)
  51. #define AUTO_HOME_POS BTN_POS(1,2), BTN_SIZE(1,1)
  52. #define CLEAN_NOZZLE_POS BTN_POS(2,2), BTN_SIZE(1,1)
  53. #define MOVE_AXIS_POS BTN_POS(1,3), BTN_SIZE(1,1)
  54. #define DISABLE_STEPPERS_POS BTN_POS(2,3), BTN_SIZE(1,1)
  55. #define TEMPERATURE_POS BTN_POS(1,4), BTN_SIZE(1,1)
  56. #define FILAMENTCHANGE_POS BTN_POS(2,4), BTN_SIZE(1,1)
  57. #define LEVELING_POS BTN_POS(1,5), BTN_SIZE(1,1)
  58. #define BACK_POS BTN_POS(2,5), BTN_SIZE(1,1)
  59. #endif
  60. if (what & FOREGROUND) {
  61. CommandProcessor cmd;
  62. cmd.colors(normal_btn)
  63. .font(Theme::font_medium)
  64. .tag(2).button( AUTO_HOME_POS, GET_TEXT_F(MSG_AUTO_HOME))
  65. .enabled(
  66. #if ANY(NOZZLE_CLEAN_FEATURE, TOUCH_UI_COCOA_PRESS)
  67. 1
  68. #endif
  69. )
  70. .tag(3).button( CLEAN_NOZZLE_POS, GET_TEXT_F(
  71. #if ENABLED(TOUCH_UI_COCOA_PRESS)
  72. MSG_PREHEAT_1
  73. #else
  74. MSG_CLEAN_NOZZLE
  75. #endif
  76. ))
  77. .tag(4).button( MOVE_AXIS_POS, GET_TEXT_F(MSG_MOVE_AXIS))
  78. .tag(5).button( DISABLE_STEPPERS_POS, GET_TEXT_F(MSG_DISABLE_STEPPERS))
  79. .tag(6).button( TEMPERATURE_POS, GET_TEXT_F(MSG_TEMPERATURE))
  80. .enabled(
  81. #if DISABLED(TOUCH_UI_LULZBOT_BIO)
  82. 1
  83. #endif
  84. )
  85. .tag(7).button( FILAMENTCHANGE_POS, GET_TEXT_F(
  86. #if ENABLED(TOUCH_UI_COCOA_PRESS)
  87. MSG_CASE_LIGHT
  88. #else
  89. MSG_FILAMENTCHANGE
  90. #endif
  91. ))
  92. .tag(8).button( ADVANCED_SETTINGS_POS, GET_TEXT_F(MSG_ADVANCED_SETTINGS))
  93. .enabled(
  94. #ifdef HAS_LEVELING
  95. 1
  96. #endif
  97. )
  98. .tag(9).button( LEVELING_POS, GET_TEXT_F(MSG_LEVELING))
  99. .tag(10).button( ABOUT_PRINTER_POS, GET_TEXT_F(MSG_INFO_MENU))
  100. .colors(action_btn)
  101. .tag(1).button( BACK_POS, GET_TEXT_F(MSG_BACK));
  102. }
  103. }
  104. bool MainMenu::onTouchEnd(uint8_t tag) {
  105. using namespace ExtUI;
  106. switch (tag) {
  107. case 1: SaveSettingsDialogBox::promptToSaveSettings(); break;
  108. case 2: SpinnerDialogBox::enqueueAndWait_P(F("G28")); break;
  109. #if ENABLED(TOUCH_UI_COCOA_PRESS)
  110. case 3: GOTO_SCREEN(PreheatMenu); break;
  111. #elif ENABLED(NOZZLE_CLEAN_FEATURE)
  112. case 3: injectCommands_P(PSTR("G12")); GOTO_SCREEN(StatusScreen); break;
  113. #endif
  114. case 4: GOTO_SCREEN(MoveAxisScreen); break;
  115. case 5: injectCommands_P(PSTR("M84")); break;
  116. case 6: GOTO_SCREEN(TemperatureScreen); break;
  117. #if BOTH(TOUCH_UI_COCOA_PRESS, CASE_LIGHT_ENABLE)
  118. case 7: GOTO_SCREEN(CaseLightScreen); break;
  119. #else
  120. case 7: GOTO_SCREEN(ChangeFilamentScreen); break;
  121. #endif
  122. case 8: GOTO_SCREEN(AdvancedSettingsMenu); break;
  123. #ifdef HAS_LEVELING
  124. case 9: GOTO_SCREEN(LevelingMenu); break;
  125. #endif
  126. case 10: GOTO_SCREEN(AboutScreen); break;
  127. default:
  128. return false;
  129. }
  130. return true;
  131. }
  132. #endif // TOUCH_UI_FTDI_EVE