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.

menu_tune.cpp 6.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232
  1. /**
  2. * Marlin 3D Printer Firmware
  3. * Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
  4. *
  5. * Based on Sprinter and grbl.
  6. * Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
  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. * You should have received a copy of the GNU General Public License
  19. * along with this program. If not, see <https://www.gnu.org/licenses/>.
  20. *
  21. */
  22. //
  23. // Tune Menu
  24. //
  25. #include "../../inc/MarlinConfigPre.h"
  26. #if HAS_LCD_MENU
  27. #include "menu_item.h"
  28. #include "../../module/motion.h"
  29. #include "../../module/planner.h"
  30. #include "../../module/temperature.h"
  31. #include "../../MarlinCore.h"
  32. #if HAS_LEVELING
  33. #include "../../feature/bedlevel/bedlevel.h"
  34. #endif
  35. #if ENABLED(SINGLENOZZLE)
  36. #include "../../module/tool_change.h"
  37. #endif
  38. #if ENABLED(BABYSTEPPING)
  39. #include "../../feature/babystep.h"
  40. #include "../lcdprint.h"
  41. #if HAS_MARLINUI_U8GLIB
  42. #include "../dogm/marlinui_DOGM.h"
  43. #endif
  44. void _lcd_babystep(const AxisEnum axis, PGM_P const msg) {
  45. if (ui.use_click()) return ui.goto_previous_screen_no_defer();
  46. if (ui.encoderPosition) {
  47. const int16_t steps = int16_t(ui.encoderPosition) * (
  48. #if ENABLED(BABYSTEP_XY)
  49. axis == X_AXIS ? BABYSTEP_SIZE_X :
  50. axis == Y_AXIS ? BABYSTEP_SIZE_Y :
  51. #endif
  52. BABYSTEP_SIZE_Z
  53. );
  54. ui.encoderPosition = 0;
  55. ui.refresh(LCDVIEW_REDRAW_NOW);
  56. babystep.add_steps(axis, steps);
  57. }
  58. if (ui.should_draw()) {
  59. const float spm = planner.steps_to_mm[axis];
  60. MenuEditItemBase::draw_edit_screen(msg, BABYSTEP_TO_STR(spm * babystep.accum));
  61. #if ENABLED(BABYSTEP_DISPLAY_TOTAL)
  62. const bool in_view = TERN1(HAS_MARLINUI_U8GLIB, PAGE_CONTAINS(LCD_PIXEL_HEIGHT - MENU_FONT_HEIGHT, LCD_PIXEL_HEIGHT - 1));
  63. if (in_view) {
  64. TERN_(HAS_MARLINUI_U8GLIB, ui.set_font(FONT_MENU));
  65. lcd_moveto(0, TERN(HAS_MARLINUI_U8GLIB, LCD_PIXEL_HEIGHT - MENU_FONT_DESCENT, LCD_HEIGHT - 1));
  66. lcd_put_u8str_P(GET_TEXT(MSG_BABYSTEP_TOTAL));
  67. lcd_put_wchar(':');
  68. lcd_put_u8str(BABYSTEP_TO_STR(spm * babystep.axis_total[BS_TOTAL_IND(axis)]));
  69. }
  70. #endif
  71. }
  72. }
  73. inline void _lcd_babystep_go(const screenFunc_t screen) {
  74. ui.goto_screen(screen);
  75. ui.defer_status_screen();
  76. babystep.accum = 0;
  77. }
  78. #if ENABLED(BABYSTEP_XY)
  79. void _lcd_babystep_x() { _lcd_babystep(X_AXIS, GET_TEXT(MSG_BABYSTEP_X)); }
  80. void _lcd_babystep_y() { _lcd_babystep(Y_AXIS, GET_TEXT(MSG_BABYSTEP_Y)); }
  81. #endif
  82. #if DISABLED(BABYSTEP_ZPROBE_OFFSET)
  83. void _lcd_babystep_z() { _lcd_babystep(Z_AXIS, GET_TEXT(MSG_BABYSTEP_Z)); }
  84. void lcd_babystep_z() { _lcd_babystep_go(_lcd_babystep_z); }
  85. #endif
  86. #endif // BABYSTEPPING
  87. void menu_tune() {
  88. START_MENU();
  89. BACK_ITEM(MSG_MAIN);
  90. //
  91. // Speed:
  92. //
  93. EDIT_ITEM(int3, MSG_SPEED, &feedrate_percentage, 10, 999);
  94. //
  95. // Manual bed leveling, Bed Z:
  96. //
  97. #if BOTH(MESH_BED_LEVELING, LCD_BED_LEVELING)
  98. EDIT_ITEM(float43, MSG_BED_Z, &mbl.z_offset, -1, 1);
  99. #endif
  100. //
  101. // Nozzle:
  102. // Nozzle [1-4]:
  103. //
  104. #if HOTENDS == 1
  105. EDIT_ITEM_FAST(int3, MSG_NOZZLE, &thermalManager.temp_hotend[0].target, 0, HEATER_0_MAXTEMP - HOTEND_OVERSHOOT, []{ thermalManager.start_watching_hotend(0); });
  106. #elif HAS_MULTI_HOTEND
  107. HOTEND_LOOP()
  108. EDIT_ITEM_FAST_N(int3, e, MSG_NOZZLE_N, &thermalManager.temp_hotend[e].target, 0, thermalManager.heater_maxtemp[e] - HOTEND_OVERSHOOT, []{ thermalManager.start_watching_hotend(MenuItemBase::itemIndex); });
  109. #endif
  110. #if ENABLED(SINGLENOZZLE_STANDBY_TEMP)
  111. LOOP_S_L_N(e, 1, EXTRUDERS)
  112. EDIT_ITEM_FAST_N(uint16_3, e, MSG_NOZZLE_STANDBY, &singlenozzle_temp[e], 0, thermalManager.heater_maxtemp[0] - HOTEND_OVERSHOOT);
  113. #endif
  114. //
  115. // Bed:
  116. //
  117. #if HAS_HEATED_BED
  118. EDIT_ITEM_FAST(int3, MSG_BED, &thermalManager.temp_bed.target, 0, BED_MAX_TARGET, thermalManager.start_watching_bed);
  119. #endif
  120. //
  121. // Fan Speed:
  122. //
  123. #if HAS_FAN
  124. DEFINE_SINGLENOZZLE_ITEM();
  125. #if HAS_FAN0
  126. _FAN_EDIT_ITEMS(0,FIRST_FAN_SPEED);
  127. #endif
  128. #if HAS_FAN1
  129. FAN_EDIT_ITEMS(1);
  130. #elif SNFAN(1)
  131. singlenozzle_item(1);
  132. #endif
  133. #if HAS_FAN2
  134. FAN_EDIT_ITEMS(2);
  135. #elif SNFAN(2)
  136. singlenozzle_item(2);
  137. #endif
  138. #if HAS_FAN3
  139. FAN_EDIT_ITEMS(3);
  140. #elif SNFAN(3)
  141. singlenozzle_item(3);
  142. #endif
  143. #if HAS_FAN4
  144. FAN_EDIT_ITEMS(4);
  145. #elif SNFAN(4)
  146. singlenozzle_item(4);
  147. #endif
  148. #if HAS_FAN5
  149. FAN_EDIT_ITEMS(5);
  150. #elif SNFAN(5)
  151. singlenozzle_item(5);
  152. #endif
  153. #if HAS_FAN6
  154. FAN_EDIT_ITEMS(6);
  155. #elif SNFAN(6)
  156. singlenozzle_item(6);
  157. #endif
  158. #if HAS_FAN7
  159. FAN_EDIT_ITEMS(7);
  160. #elif SNFAN(7)
  161. singlenozzle_item(7);
  162. #endif
  163. #endif // HAS_FAN
  164. //
  165. // Flow:
  166. //
  167. #if EXTRUDERS
  168. EDIT_ITEM(int3, MSG_FLOW, &planner.flow_percentage[active_extruder], 10, 999, []{ planner.refresh_e_factor(active_extruder); });
  169. // Flow En:
  170. #if HAS_MULTI_EXTRUDER
  171. LOOP_L_N(n, EXTRUDERS)
  172. EDIT_ITEM_N(int3, n, MSG_FLOW_N, &planner.flow_percentage[n], 10, 999, []{ planner.refresh_e_factor(MenuItemBase::itemIndex); });
  173. #endif
  174. #endif
  175. //
  176. // Advance K:
  177. //
  178. #if ENABLED(LIN_ADVANCE) && DISABLED(SLIM_LCD_MENUS)
  179. #if EXTRUDERS == 1
  180. EDIT_ITEM(float42_52, MSG_ADVANCE_K, &planner.extruder_advance_K[0], 0, 999);
  181. #elif HAS_MULTI_EXTRUDER
  182. LOOP_L_N(n, EXTRUDERS)
  183. EDIT_ITEM_N(float42_52, n, MSG_ADVANCE_K_E, &planner.extruder_advance_K[n], 0, 999);
  184. #endif
  185. #endif
  186. //
  187. // Babystep X:
  188. // Babystep Y:
  189. // Babystep Z:
  190. //
  191. #if ENABLED(BABYSTEPPING)
  192. #if ENABLED(BABYSTEP_XY)
  193. SUBMENU(MSG_BABYSTEP_X, []{ _lcd_babystep_go(_lcd_babystep_x); });
  194. SUBMENU(MSG_BABYSTEP_Y, []{ _lcd_babystep_go(_lcd_babystep_y); });
  195. #endif
  196. #if ENABLED(BABYSTEP_ZPROBE_OFFSET)
  197. SUBMENU(MSG_ZPROBE_ZOFFSET, lcd_babystep_zoffset);
  198. #else
  199. SUBMENU(MSG_BABYSTEP_Z, lcd_babystep_z);
  200. #endif
  201. #endif
  202. END_MENU();
  203. }
  204. #endif // HAS_LCD_MENU