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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195
  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: <http://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 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. #ifdef TOUCH_UI_PORTRAIT
  34. #if EITHER(HAS_CASE_LIGHT, 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 OFFSETS_POS BTN_POS(1,7), BTN_SIZE(1,1)
  52. #define BACKLASH_POS BTN_POS(2,7), BTN_SIZE(1,1)
  53. #define CASE_LIGHT_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_CASE_LIGHT, 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_ROWS 6
  62. #define GRID_COLS 3
  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(
  85. #if HAS_BED_PROBE
  86. 1
  87. #endif
  88. )
  89. .tag(2) .button( ZPROBE_ZOFFSET_POS, GET_TEXT_F(MSG_ZPROBE_ZOFFSET))
  90. .enabled(
  91. #if HAS_CASE_LIGHT
  92. 1
  93. #endif
  94. )
  95. .tag(16).button( CASE_LIGHT_POS, GET_TEXT_F(MSG_CASE_LIGHT))
  96. .tag(3) .button( STEPS_PER_MM_POS, GET_TEXT_F(MSG_STEPS_PER_MM))
  97. .enabled(
  98. #if HAS_TRINAMIC_CONFIG
  99. 1
  100. #endif
  101. )
  102. .tag(13).button( TMC_CURRENT_POS, GET_TEXT_F(MSG_TMC_CURRENT))
  103. .enabled(
  104. #if ENABLED(SENSORLESS_HOMING)
  105. 1
  106. #endif
  107. )
  108. .tag(14).button( TMC_HOMING_THRS_POS, GET_TEXT_F(MSG_TMC_HOMING_THRS))
  109. .enabled(
  110. #if HAS_MULTI_HOTEND
  111. 1
  112. #endif
  113. )
  114. .tag(4) .button( OFFSETS_POS, GET_TEXT_F(MSG_OFFSETS_MENU))
  115. .enabled(
  116. #if EITHER(LIN_ADVANCE, FILAMENT_RUNOUT_SENSOR)
  117. 1
  118. #endif
  119. )
  120. .tag(11).button( FILAMENT_POS, GET_TEXT_F(MSG_FILAMENT))
  121. .tag(12).button( ENDSTOPS_POS, GET_TEXT_F(MSG_LCD_ENDSTOPS))
  122. .tag(15).button( DISPLAY_POS, GET_TEXT_F(MSG_DISPLAY_MENU))
  123. .tag(9) .button( INTERFACE_POS, GET_TEXT_F(MSG_INTERFACE))
  124. .tag(10).button( RESTORE_DEFAULTS_POS, GET_TEXT_F(MSG_RESTORE_DEFAULTS))
  125. .tag(5) .button( VELOCITY_POS, GET_TEXT_F(MSG_VELOCITY))
  126. .tag(6) .button( ACCELERATION_POS, GET_TEXT_F(MSG_ACCELERATION))
  127. .tag(7) .button( JERK_POS, GET_TEXT_F(
  128. #if HAS_JUNCTION_DEVIATION
  129. MSG_JUNCTION_DEVIATION
  130. #else
  131. MSG_JERK
  132. #endif
  133. ))
  134. .enabled(
  135. #if ENABLED(BACKLASH_GCODE)
  136. 1
  137. #endif
  138. )
  139. .tag(8).button( BACKLASH_POS, GET_TEXT_F(MSG_BACKLASH))
  140. .colors(action_btn)
  141. .tag(1).button( BACK_POS, GET_TEXT_F(MSG_BACK));
  142. }
  143. }
  144. bool AdvancedSettingsMenu::onTouchEnd(uint8_t tag) {
  145. switch (tag) {
  146. case 1: SaveSettingsDialogBox::promptToSaveSettings(); break;
  147. #if HAS_BED_PROBE
  148. case 2: GOTO_SCREEN(ZOffsetScreen); break;
  149. #endif
  150. case 3: GOTO_SCREEN(StepsScreen); break;
  151. #if HAS_MULTI_HOTEND
  152. case 4: GOTO_SCREEN(NozzleOffsetScreen); break;
  153. #endif
  154. case 5: GOTO_SCREEN(MaxVelocityScreen); break;
  155. case 6: GOTO_SCREEN(DefaultAccelerationScreen); break;
  156. case 7:
  157. #if HAS_JUNCTION_DEVIATION
  158. GOTO_SCREEN(JunctionDeviationScreen);
  159. #else
  160. GOTO_SCREEN(JerkScreen);
  161. #endif
  162. break;
  163. #if ENABLED(BACKLASH_GCODE)
  164. case 8: GOTO_SCREEN(BacklashCompensationScreen); break;
  165. #endif
  166. case 9: GOTO_SCREEN(InterfaceSettingsScreen); LockScreen::check_passcode(); break;
  167. case 10: GOTO_SCREEN(RestoreFailsafeDialogBox); LockScreen::check_passcode(); break;
  168. #if EITHER(LIN_ADVANCE, FILAMENT_RUNOUT_SENSOR)
  169. case 11: GOTO_SCREEN(FilamentMenu); break;
  170. #endif
  171. case 12: GOTO_SCREEN(EndstopStatesScreen); break;
  172. #if HAS_TRINAMIC_CONFIG
  173. case 13: GOTO_SCREEN(StepperCurrentScreen); break;
  174. #endif
  175. #if ENABLED(SENSORLESS_HOMING)
  176. case 14: GOTO_SCREEN(StepperBumpSensitivityScreen); break;
  177. #endif
  178. case 15: GOTO_SCREEN(DisplayTuningScreen); break;
  179. #if HAS_CASE_LIGHT
  180. case 16: GOTO_SCREEN(CaseLightScreen); break;
  181. #endif
  182. default: return false;
  183. }
  184. return true;
  185. }
  186. #endif // TOUCH_UI_FTDI_EVE