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.

advanced_settings_menu.cpp 7.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155
  1. /*****************************
  2. * advance_settings_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. #include "../screens.h"
  23. #ifdef FTDI_ADVANCED_SETTINGS_MENU
  24. using namespace FTDI;
  25. using namespace ExtUI;
  26. using namespace Theme;
  27. void AdvancedSettingsMenu::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. #if EITHER(HAS_MULTI_HOTEND, SENSORLESS_HOMING)
  35. #define GRID_ROWS 9
  36. #else
  37. #define GRID_ROWS 8
  38. #endif
  39. #define GRID_COLS 2
  40. #define RESTORE_DEFAULTS_POS BTN_POS(1,1), BTN_SIZE(2,1)
  41. #define DISPLAY_POS BTN_POS(1,2), BTN_SIZE(1,1)
  42. #define INTERFACE_POS BTN_POS(2,2), BTN_SIZE(1,1)
  43. #define ZPROBE_ZOFFSET_POS BTN_POS(1,3), BTN_SIZE(1,1)
  44. #define STEPS_PER_MM_POS BTN_POS(2,3), BTN_SIZE(1,1)
  45. #define FILAMENT_POS BTN_POS(1,4), BTN_SIZE(1,1)
  46. #define VELOCITY_POS BTN_POS(2,4), BTN_SIZE(1,1)
  47. #define TMC_CURRENT_POS BTN_POS(1,5), BTN_SIZE(1,1)
  48. #define ACCELERATION_POS BTN_POS(2,5), BTN_SIZE(1,1)
  49. #define ENDSTOPS_POS BTN_POS(1,6), BTN_SIZE(1,1)
  50. #define JERK_POS BTN_POS(2,6), BTN_SIZE(1,1)
  51. #define CASE_LIGHT_POS BTN_POS(1,7), BTN_SIZE(1,1)
  52. #define BACKLASH_POS BTN_POS(2,7), BTN_SIZE(1,1)
  53. #define OFFSETS_POS BTN_POS(1,8), BTN_SIZE(1,1)
  54. #define TMC_HOMING_THRS_POS BTN_POS(2,8), BTN_SIZE(1,1)
  55. #if EITHER(HAS_MULTI_HOTEND, SENSORLESS_HOMING)
  56. #define BACK_POS BTN_POS(1,9), BTN_SIZE(2,1)
  57. #else
  58. #define BACK_POS BTN_POS(1,8), BTN_SIZE(2,1)
  59. #endif
  60. #else
  61. #define GRID_COLS 3
  62. #define GRID_ROWS 6
  63. #define ZPROBE_ZOFFSET_POS BTN_POS(1,1), BTN_SIZE(1,1)
  64. #define CASE_LIGHT_POS BTN_POS(1,4), BTN_SIZE(1,1)
  65. #define STEPS_PER_MM_POS BTN_POS(2,1), BTN_SIZE(1,1)
  66. #define TMC_CURRENT_POS BTN_POS(3,1), BTN_SIZE(1,1)
  67. #define TMC_HOMING_THRS_POS BTN_POS(3,2), BTN_SIZE(1,1)
  68. #define BACKLASH_POS BTN_POS(3,3), BTN_SIZE(1,1)
  69. #define FILAMENT_POS BTN_POS(1,3), BTN_SIZE(1,1)
  70. #define ENDSTOPS_POS BTN_POS(3,4), BTN_SIZE(1,1)
  71. #define DISPLAY_POS BTN_POS(3,5), BTN_SIZE(1,1)
  72. #define INTERFACE_POS BTN_POS(1,5), BTN_SIZE(2,1)
  73. #define RESTORE_DEFAULTS_POS BTN_POS(1,6), BTN_SIZE(2,1)
  74. #define VELOCITY_POS BTN_POS(2,2), BTN_SIZE(1,1)
  75. #define ACCELERATION_POS BTN_POS(2,3), BTN_SIZE(1,1)
  76. #define JERK_POS BTN_POS(2,4), BTN_SIZE(1,1)
  77. #define OFFSETS_POS BTN_POS(1,2), BTN_SIZE(1,1)
  78. #define BACK_POS BTN_POS(3,6), BTN_SIZE(1,1)
  79. #endif
  80. if (what & FOREGROUND) {
  81. CommandProcessor cmd;
  82. cmd.colors(normal_btn)
  83. .font(Theme::font_medium)
  84. .enabled(ENABLED(HAS_BED_PROBE))
  85. .tag(2) .button(ZPROBE_ZOFFSET_POS, GET_TEXT_F(MSG_ZPROBE_ZOFFSET))
  86. .enabled(ENABLED(CASE_LIGHT_ENABLE))
  87. .tag(16).button(CASE_LIGHT_POS, GET_TEXT_F(MSG_CASE_LIGHT))
  88. .tag(3) .button(STEPS_PER_MM_POS, GET_TEXT_F(MSG_STEPS_PER_MM))
  89. .enabled(ENABLED(HAS_TRINAMIC_CONFIG))
  90. .tag(13).button(TMC_CURRENT_POS, GET_TEXT_F(MSG_TMC_CURRENT))
  91. .enabled(ENABLED(SENSORLESS_HOMING))
  92. .tag(14).button(TMC_HOMING_THRS_POS, GET_TEXT_F(MSG_TMC_HOMING_THRS))
  93. .enabled(ENABLED(HAS_MULTI_HOTEND))
  94. .tag(4) .button(OFFSETS_POS, GET_TEXT_F(MSG_OFFSETS_MENU))
  95. .enabled(EITHER(LIN_ADVANCE, FILAMENT_RUNOUT_SENSOR))
  96. .tag(11).button(FILAMENT_POS, GET_TEXT_F(MSG_FILAMENT))
  97. .tag(12).button(ENDSTOPS_POS, GET_TEXT_F(MSG_LCD_ENDSTOPS))
  98. .tag(15).button(DISPLAY_POS, GET_TEXT_F(MSG_DISPLAY_MENU))
  99. .tag(9) .button(INTERFACE_POS, GET_TEXT_F(MSG_INTERFACE))
  100. .tag(10).button(RESTORE_DEFAULTS_POS, GET_TEXT_F(MSG_RESTORE_DEFAULTS))
  101. .tag(5) .button(VELOCITY_POS, GET_TEXT_F(MSG_MAX_SPEED))
  102. .tag(6) .button(ACCELERATION_POS, GET_TEXT_F(MSG_ACCELERATION))
  103. .tag(7) .button(JERK_POS, GET_TEXT_F(TERN(HAS_JUNCTION_DEVIATION, MSG_JUNCTION_DEVIATION, MSG_JERK)))
  104. .enabled(ENABLED(BACKLASH_GCODE))
  105. .tag(8).button(BACKLASH_POS, GET_TEXT_F(MSG_BACKLASH))
  106. .colors(action_btn)
  107. .tag(1).button(BACK_POS, GET_TEXT_F(MSG_BUTTON_DONE));
  108. }
  109. }
  110. bool AdvancedSettingsMenu::onTouchEnd(uint8_t tag) {
  111. switch (tag) {
  112. case 1: SaveSettingsDialogBox::promptToSaveSettings(); break;
  113. #if HAS_BED_PROBE
  114. case 2: GOTO_SCREEN(ZOffsetScreen); break;
  115. #endif
  116. case 3: GOTO_SCREEN(StepsScreen); break;
  117. #if HAS_MULTI_HOTEND
  118. case 4: GOTO_SCREEN(NozzleOffsetScreen); break;
  119. #endif
  120. case 5: GOTO_SCREEN(MaxVelocityScreen); break;
  121. case 6: GOTO_SCREEN(DefaultAccelerationScreen); break;
  122. case 7: GOTO_SCREEN(TERN(HAS_JUNCTION_DEVIATION, JunctionDeviationScreen, JerkScreen)); break;
  123. #if ENABLED(BACKLASH_GCODE)
  124. case 8: GOTO_SCREEN(BacklashCompensationScreen); break;
  125. #endif
  126. case 9: GOTO_SCREEN(InterfaceSettingsScreen); LockScreen::check_passcode(); break;
  127. case 10: GOTO_SCREEN(RestoreFailsafeDialogBox); LockScreen::check_passcode(); break;
  128. #if EITHER(LIN_ADVANCE, FILAMENT_RUNOUT_SENSOR)
  129. case 11: GOTO_SCREEN(FilamentMenu); break;
  130. #endif
  131. case 12: GOTO_SCREEN(EndstopStatesScreen); break;
  132. #if HAS_TRINAMIC_CONFIG
  133. case 13: GOTO_SCREEN(StepperCurrentScreen); break;
  134. #endif
  135. #if ENABLED(SENSORLESS_HOMING)
  136. case 14: GOTO_SCREEN(StepperBumpSensitivityScreen); break;
  137. #endif
  138. case 15: GOTO_SCREEN(DisplayTuningScreen); break;
  139. #if ENABLED(CASE_LIGHT_ENABLE)
  140. case 16: GOTO_SCREEN(CaseLightScreen); break;
  141. #endif
  142. default: return false;
  143. }
  144. return true;
  145. }
  146. #endif // FTDI_ADVANCED_SETTINGS_MENU