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.

tune_menu.cpp 4.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. /*******************
  2. * tune_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 ENABLED(TOUCH_UI_FTDI_EVE) && !defined(TOUCH_UI_LULZBOT_BIO)
  23. #include "screens.h"
  24. using namespace FTDI;
  25. using namespace Theme;
  26. void TuneMenu::onRedraw(draw_mode_t what) {
  27. if (what & BACKGROUND) {
  28. CommandProcessor cmd;
  29. cmd.cmd(CLEAR_COLOR_RGB(bg_color))
  30. .cmd(CLEAR(true,true,true));
  31. }
  32. #ifdef TOUCH_UI_PORTRAIT
  33. #define GRID_ROWS 8
  34. #define GRID_COLS 2
  35. #define TEMPERATURE_POS BTN_POS(1,1), BTN_SIZE(2,1)
  36. #define FIL_CHANGE_POS BTN_POS(1,2), BTN_SIZE(2,1)
  37. #define FILAMENT_POS BTN_POS(1,3), BTN_SIZE(2,1)
  38. #define NUDGE_NOZ_POS BTN_POS(1,4), BTN_SIZE(2,1)
  39. #define SPEED_POS BTN_POS(1,5), BTN_SIZE(2,1)
  40. #define PAUSE_POS BTN_POS(1,6), BTN_SIZE(2,1)
  41. #define STOP_POS BTN_POS(1,7), BTN_SIZE(2,1)
  42. #define BACK_POS BTN_POS(1,8), BTN_SIZE(2,1)
  43. #else
  44. #define GRID_ROWS 4
  45. #define GRID_COLS 2
  46. #define TEMPERATURE_POS BTN_POS(1,1), BTN_SIZE(1,1)
  47. #define NUDGE_NOZ_POS BTN_POS(2,1), BTN_SIZE(1,1)
  48. #define FIL_CHANGE_POS BTN_POS(1,2), BTN_SIZE(1,1)
  49. #define SPEED_POS BTN_POS(2,2), BTN_SIZE(1,1)
  50. #define PAUSE_POS BTN_POS(1,3), BTN_SIZE(1,1)
  51. #define STOP_POS BTN_POS(2,3), BTN_SIZE(1,1)
  52. #define FILAMENT_POS BTN_POS(1,4), BTN_SIZE(1,1)
  53. #define BACK_POS BTN_POS(2,4), BTN_SIZE(1,1)
  54. #endif
  55. if (what & FOREGROUND) {
  56. using namespace ExtUI;
  57. CommandProcessor cmd;
  58. cmd.colors(normal_btn)
  59. .font(font_medium)
  60. .tag(2).button( TEMPERATURE_POS, GET_TEXT_F(MSG_TEMPERATURE))
  61. .enabled(!isPrinting() || isPrintingFromMediaPaused())
  62. .tag(3).button( FIL_CHANGE_POS, GET_TEXT_F(MSG_FILAMENTCHANGE))
  63. .enabled(EITHER(LIN_ADVANCE, FILAMENT_RUNOUT_SENSOR))
  64. .tag(9).button( FILAMENT_POS, GET_TEXT_F(MSG_FILAMENT))
  65. .enabled(EITHER(HAS_BED_PROBE, BABYSTEPPING))
  66. .tag(4).button( NUDGE_NOZ_POS, GET_TEXT_F(TERN(BABYSTEPPING, MSG_NUDGE_NOZZLE, MSG_ZPROBE_ZOFFSET)))
  67. .tag(5).button( SPEED_POS, GET_TEXT_F(MSG_PRINT_SPEED))
  68. .tag(isPrintingFromMediaPaused() ? 7 : 6)
  69. .enabled(TERN0(SDSUPPORT, isPrintingFromMedia()))
  70. .button( PAUSE_POS, isPrintingFromMediaPaused() ? GET_TEXT_F(MSG_RESUME_PRINT) : GET_TEXT_F(MSG_PAUSE_PRINT))
  71. .enabled(TERN0(SDSUPPORT, isPrintingFromMedia()))
  72. .tag(8).button( STOP_POS, GET_TEXT_F(MSG_STOP_PRINT))
  73. .tag(1).colors(action_btn)
  74. .button( BACK_POS, GET_TEXT_F(MSG_BACK));
  75. }
  76. #undef GRID_COLS
  77. #undef GRID_ROWS
  78. }
  79. bool TuneMenu::onTouchEnd(uint8_t tag) {
  80. using namespace Theme;
  81. using namespace ExtUI;
  82. switch (tag) {
  83. case 1: GOTO_PREVIOUS(); break;
  84. case 2: GOTO_SCREEN(TemperatureScreen); break;
  85. case 3: GOTO_SCREEN(ChangeFilamentScreen); break;
  86. case 4:
  87. #if ENABLED(BABYSTEPPING)
  88. GOTO_SCREEN(NudgeNozzleScreen);
  89. #elif HAS_BED_PROBE
  90. GOTO_SCREEN(ZOffsetScreen);
  91. #endif
  92. break;
  93. case 5: GOTO_SCREEN(FeedratePercentScreen); break;
  94. case 6: sound.play(twinkle, PLAY_ASYNCHRONOUS); ExtUI::pausePrint(); GOTO_SCREEN(StatusScreen); break;
  95. case 7: sound.play(twinkle, PLAY_ASYNCHRONOUS); ExtUI::resumePrint(); GOTO_SCREEN(StatusScreen); break;
  96. case 8:
  97. GOTO_SCREEN(ConfirmAbortPrintDialogBox);
  98. current_screen.forget();
  99. PUSH_SCREEN(StatusScreen);
  100. break;
  101. #if EITHER(LIN_ADVANCE, FILAMENT_RUNOUT_SENSOR)
  102. case 9: GOTO_SCREEN(FilamentMenu); break;
  103. #endif
  104. default:
  105. return false;
  106. }
  107. return true;
  108. }
  109. #endif // TOUCH_UI_FTDI_EVE