My Marlin configs for Fabrikator Mini and CTC i3 Pro B
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

main_menu.cpp 6.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169
  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: <http://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 MOVE_AXIS_POS BTN_POS(1,5), BTN_SIZE(1,1)
  41. #define DISABLE_STEPPERS_POS BTN_POS(2,5), BTN_SIZE(1,1)
  42. #define AUTO_HOME_POS BTN_POS(1,6), BTN_SIZE(1,1)
  43. #define CLEAN_NOZZLE_POS BTN_POS(2,6), BTN_SIZE(1,1)
  44. #define LEVEL_BED_POS BTN_POS(1,7), BTN_SIZE(1,1)
  45. #define LEVEL_AXIS_POS BTN_POS(2,7), BTN_SIZE(1,1)
  46. #define BACK_POS BTN_POS(1,8), BTN_SIZE(2,1)
  47. #else
  48. #define GRID_ROWS 6
  49. #define GRID_COLS 2
  50. #define ADVANCED_SETTINGS_POS BTN_POS(1,1), BTN_SIZE(1,1)
  51. #define ABOUT_PRINTER_POS BTN_POS(2,1), BTN_SIZE(1,1)
  52. #define AUTO_HOME_POS BTN_POS(1,2), BTN_SIZE(1,1)
  53. #define CLEAN_NOZZLE_POS BTN_POS(2,2), BTN_SIZE(1,1)
  54. #define MOVE_AXIS_POS BTN_POS(1,3), BTN_SIZE(1,1)
  55. #define DISABLE_STEPPERS_POS BTN_POS(2,3), BTN_SIZE(1,1)
  56. #define TEMPERATURE_POS BTN_POS(1,4), BTN_SIZE(1,1)
  57. #define FILAMENTCHANGE_POS BTN_POS(2,4), BTN_SIZE(1,1)
  58. #define LEVEL_BED_POS BTN_POS(1,5), BTN_SIZE(1,1)
  59. #define LEVEL_AXIS_POS BTN_POS(2,5), BTN_SIZE(1,1)
  60. #define BACK_POS BTN_POS(1,6), BTN_SIZE(2,1)
  61. #endif
  62. if (what & FOREGROUND) {
  63. CommandProcessor cmd;
  64. cmd.colors(normal_btn)
  65. .font(Theme::font_medium)
  66. .tag(2).button( AUTO_HOME_POS, GET_TEXT_F(MSG_AUTO_HOME))
  67. .enabled(
  68. #if ANY(NOZZLE_CLEAN_FEATURE, TOUCH_UI_COCOA_PRESS)
  69. 1
  70. #endif
  71. )
  72. .tag(3).button( CLEAN_NOZZLE_POS, GET_TEXT_F(
  73. #if ENABLED(TOUCH_UI_COCOA_PRESS)
  74. MSG_PREHEAT_1
  75. #else
  76. MSG_CLEAN_NOZZLE
  77. #endif
  78. ))
  79. .tag(4).button( MOVE_AXIS_POS, GET_TEXT_F(MSG_MOVE_AXIS))
  80. .tag(5).button( DISABLE_STEPPERS_POS, GET_TEXT_F(MSG_DISABLE_STEPPERS))
  81. .tag(6).button( TEMPERATURE_POS, GET_TEXT_F(MSG_TEMPERATURE))
  82. .enabled(
  83. #if DISABLED(TOUCH_UI_LULZBOT_BIO)
  84. 1
  85. #endif
  86. )
  87. .tag(7).button( FILAMENTCHANGE_POS, GET_TEXT_F(
  88. #if ENABLED(TOUCH_UI_COCOA_PRESS)
  89. MSG_CASE_LIGHT
  90. #else
  91. MSG_FILAMENTCHANGE
  92. #endif
  93. ))
  94. .tag(8).button( ADVANCED_SETTINGS_POS, GET_TEXT_F(MSG_ADVANCED_SETTINGS))
  95. .enabled(
  96. #ifdef PRINTCOUNTER
  97. 1
  98. #endif
  99. )
  100. .enabled(
  101. #ifdef AXIS_LEVELING_COMMANDS
  102. 1
  103. #endif
  104. )
  105. .tag(9).button( LEVEL_AXIS_POS, GET_TEXT_F(MSG_AUTOLEVEL_X_AXIS))
  106. .enabled(
  107. #ifdef HAS_LEVELING
  108. 1
  109. #endif
  110. )
  111. .tag(10).button( LEVEL_BED_POS, GET_TEXT_F(MSG_LEVEL_BED))
  112. .tag(11).button( ABOUT_PRINTER_POS, GET_TEXT_F(MSG_INFO_MENU))
  113. .colors(action_btn)
  114. .tag(1).button( BACK_POS, GET_TEXT_F(MSG_BACK));
  115. }
  116. }
  117. bool MainMenu::onTouchEnd(uint8_t tag) {
  118. using namespace ExtUI;
  119. switch (tag) {
  120. case 1: SaveSettingsDialogBox::promptToSaveSettings(); break;
  121. case 2: SpinnerDialogBox::enqueueAndWait_P(F("G28")); break;
  122. #if ENABLED(TOUCH_UI_COCOA_PRESS)
  123. case 3: GOTO_SCREEN(PreheatMenu); break;
  124. #elif ENABLED(NOZZLE_CLEAN_FEATURE)
  125. case 3: injectCommands_P(PSTR("G12")); GOTO_SCREEN(StatusScreen); break;
  126. #endif
  127. case 4: GOTO_SCREEN(MoveAxisScreen); break;
  128. case 5: injectCommands_P(PSTR("M84")); break;
  129. case 6: GOTO_SCREEN(TemperatureScreen); break;
  130. #if BOTH(TOUCH_UI_COCOA_PRESS, HAS_CASE_LIGHT)
  131. case 7: GOTO_SCREEN(CaseLightScreen); break;
  132. #else
  133. case 7: GOTO_SCREEN(ChangeFilamentScreen); break;
  134. #endif
  135. case 8: GOTO_SCREEN(AdvancedSettingsMenu); break;
  136. #ifdef AXIS_LEVELING_COMMANDS
  137. case 9: SpinnerDialogBox::enqueueAndWait_P(F(AXIS_LEVELING_COMMANDS)); break;
  138. #endif
  139. #if HAS_LEVELING
  140. case 10:
  141. #ifndef BED_LEVELING_COMMANDS
  142. #define BED_LEVELING_COMMANDS "G29"
  143. #endif
  144. #if HAS_MESH
  145. GOTO_SCREEN(BedMeshScreen);
  146. injectCommands_P(PSTR(BED_LEVELING_COMMANDS));
  147. #else
  148. SpinnerDialogBox::enqueueAndWait_P(F(BED_LEVELING_COMMANDS));
  149. #endif
  150. break;
  151. #endif
  152. case 11: GOTO_SCREEN(AboutScreen); break;
  153. default:
  154. return false;
  155. }
  156. return true;
  157. }
  158. #endif // TOUCH_UI_FTDI_EVE