My Marlin configs for Fabrikator Mini and CTC i3 Pro B
Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

leveling_menu.cpp 4.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. /*********************
  2. * leveling_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. #if BOTH(TOUCH_UI_FTDI_EVE,HAS_LEVELING)
  23. #include "screens.h"
  24. #if BOTH(HAS_BED_PROBE,BLTOUCH)
  25. #include "../../../../../feature/bltouch.h"
  26. #endif
  27. using namespace FTDI;
  28. using namespace ExtUI;
  29. using namespace Theme;
  30. #ifdef TOUCH_UI_PORTRAIT
  31. #define GRID_ROWS 9
  32. #define GRID_COLS 2
  33. #define TITLE_POS BTN_POS(1,1), BTN_SIZE(2,1)
  34. #define LEVEL_BED_POS BTN_POS(1,2), BTN_SIZE(2,1)
  35. #define LEVEL_AXIS_POS BTN_POS(1,3), BTN_SIZE(2,1)
  36. #define SHOW_MESH_POS BTN_POS(1,4), BTN_SIZE(2,1)
  37. #define BLTOUCH_TITLE_POS BTN_POS(1,6), BTN_SIZE(2,1)
  38. #define BLTOUCH_RESET_POS BTN_POS(1,7), BTN_SIZE(1,1)
  39. #define BLTOUCH_TEST_POS BTN_POS(2,7), BTN_SIZE(1,1)
  40. #define BACK_POS BTN_POS(1,9), BTN_SIZE(2,1)
  41. #else
  42. #define GRID_ROWS 7
  43. #define GRID_COLS 2
  44. #define TITLE_POS BTN_POS(1,1), BTN_SIZE(2,1)
  45. #define LEVEL_BED_POS BTN_POS(1,2), BTN_SIZE(2,1)
  46. #define LEVEL_AXIS_POS BTN_POS(1,3), BTN_SIZE(2,1)
  47. #define SHOW_MESH_POS BTN_POS(1,4), BTN_SIZE(2,1)
  48. #define BLTOUCH_TITLE_POS BTN_POS(1,5), BTN_SIZE(2,1)
  49. #define BLTOUCH_RESET_POS BTN_POS(1,6), BTN_SIZE(1,1)
  50. #define BLTOUCH_TEST_POS BTN_POS(2,6), BTN_SIZE(1,1)
  51. #define BACK_POS BTN_POS(1,7), BTN_SIZE(2,1)
  52. #endif
  53. void LevelingMenu::onRedraw(draw_mode_t what) {
  54. if (what & BACKGROUND) {
  55. CommandProcessor cmd;
  56. cmd.cmd(CLEAR_COLOR_RGB(Theme::bg_color))
  57. .cmd(CLEAR(true,true,true))
  58. .tag(0);
  59. }
  60. if (what & FOREGROUND) {
  61. CommandProcessor cmd;
  62. cmd.font(font_large)
  63. .text(TITLE_POS, GET_TEXT_F(MSG_LEVELING))
  64. .font(font_medium).colors(normal_btn)
  65. .tag(2).button(LEVEL_BED_POS, GET_TEXT_F(MSG_LEVEL_BED))
  66. .enabled(
  67. #ifdef AXIS_LEVELING_COMMANDS
  68. 1
  69. #endif
  70. )
  71. .tag(3).button(LEVEL_AXIS_POS, GET_TEXT_F(MSG_AUTOLEVEL_X_AXIS))
  72. .enabled(ENABLED(HAS_MESH))
  73. .tag(4).button(SHOW_MESH_POS, GET_TEXT_F(MSG_SHOW_MESH));
  74. #if ENABLED(BLTOUCH)
  75. cmd.text(BLTOUCH_TITLE_POS, GET_TEXT_F(MSG_BLTOUCH))
  76. .tag(5).button(BLTOUCH_RESET_POS, GET_TEXT_F(MSG_BLTOUCH_RESET))
  77. .tag(6).button(BLTOUCH_TEST_POS, GET_TEXT_F(MSG_BLTOUCH_SELFTEST));
  78. #endif
  79. cmd.colors(action_btn)
  80. .tag(1).button(BACK_POS, GET_TEXT_F(MSG_BACK));
  81. }
  82. }
  83. bool LevelingMenu::onTouchEnd(uint8_t tag) {
  84. switch (tag) {
  85. case 1: GOTO_PREVIOUS(); break;
  86. case 2:
  87. #ifndef BED_LEVELING_COMMANDS
  88. #define BED_LEVELING_COMMANDS "G29"
  89. #endif
  90. #if HAS_MESH
  91. BedMeshScreen::startMeshProbe();
  92. #else
  93. SpinnerDialogBox::enqueueAndWait_P(F(BED_LEVELING_COMMANDS));
  94. #endif
  95. break;
  96. #ifdef AXIS_LEVELING_COMMANDS
  97. case 3: SpinnerDialogBox::enqueueAndWait_P(F(AXIS_LEVELING_COMMANDS)); break;
  98. #endif
  99. #if HAS_MESH
  100. case 4: GOTO_SCREEN(BedMeshScreen); break;
  101. #endif
  102. #if ENABLED(BLTOUCH)
  103. case 5: injectCommands_P(PSTR("M280 P0 S60")); break;
  104. case 6: SpinnerDialogBox::enqueueAndWait_P(F("M280 P0 S90\nG4 P100\nM280 P0 S120")); break;
  105. #endif
  106. default: return false;
  107. }
  108. return true;
  109. }
  110. #endif // BOTH(TOUCH_UI_FTDI_EVE,HAS_LEVELING)