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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239
  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_MARLINUI_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 ENABLED(SINGLENOZZLE_STANDBY_TEMP)
  33. #include "../../module/tool_change.h"
  34. #endif
  35. #if HAS_LEVELING
  36. #include "../../feature/bedlevel/bedlevel.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 mps = planner.mm_per_step[axis];
  60. MenuEditItemBase::draw_edit_screen(msg, BABYSTEP_TO_STR(mps * 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. #if ENABLED(TFT_COLOR_UI)
  66. lcd_moveto(4, 3);
  67. lcd_put_u8str(GET_TEXT_F(MSG_BABYSTEP_TOTAL));
  68. lcd_put_wchar(':');
  69. lcd_moveto(10, 3);
  70. #else
  71. lcd_moveto(0, TERN(HAS_MARLINUI_U8GLIB, LCD_PIXEL_HEIGHT - MENU_FONT_DESCENT, LCD_HEIGHT - 1));
  72. lcd_put_u8str(GET_TEXT_F(MSG_BABYSTEP_TOTAL));
  73. lcd_put_wchar(':');
  74. #endif
  75. lcd_put_u8str(BABYSTEP_TO_STR(mps * babystep.axis_total[BS_TOTAL_IND(axis)]));
  76. }
  77. #endif
  78. }
  79. }
  80. inline void _lcd_babystep_go(const screenFunc_t screen) {
  81. ui.goto_screen(screen);
  82. ui.defer_status_screen();
  83. babystep.accum = 0;
  84. }
  85. #if ENABLED(BABYSTEP_XY)
  86. void _lcd_babystep_x() { _lcd_babystep(X_AXIS, GET_TEXT(MSG_BABYSTEP_X)); }
  87. void _lcd_babystep_y() { _lcd_babystep(Y_AXIS, GET_TEXT(MSG_BABYSTEP_Y)); }
  88. #endif
  89. #if DISABLED(BABYSTEP_ZPROBE_OFFSET)
  90. void _lcd_babystep_z() { _lcd_babystep(Z_AXIS, GET_TEXT(MSG_BABYSTEP_Z)); }
  91. void lcd_babystep_z() { _lcd_babystep_go(_lcd_babystep_z); }
  92. #endif
  93. #endif // BABYSTEPPING
  94. void menu_tune() {
  95. START_MENU();
  96. BACK_ITEM(MSG_MAIN);
  97. //
  98. // Speed:
  99. //
  100. EDIT_ITEM(int3, MSG_SPEED, &feedrate_percentage, 10, 999);
  101. //
  102. // Manual bed leveling, Bed Z:
  103. //
  104. #if BOTH(MESH_BED_LEVELING, LCD_BED_LEVELING)
  105. EDIT_ITEM(float43, MSG_BED_Z, &bedlevel.z_offset, -1, 1);
  106. #endif
  107. //
  108. // Nozzle:
  109. // Nozzle [1-4]:
  110. //
  111. #if HOTENDS == 1
  112. EDIT_ITEM_FAST(int3, MSG_NOZZLE, &thermalManager.temp_hotend[0].target, 0, thermalManager.hotend_max_target(0), []{ thermalManager.start_watching_hotend(0); });
  113. #elif HAS_MULTI_HOTEND
  114. HOTEND_LOOP()
  115. EDIT_ITEM_FAST_N(int3, e, MSG_NOZZLE_N, &thermalManager.temp_hotend[e].target, 0, thermalManager.hotend_max_target(e), []{ thermalManager.start_watching_hotend(MenuItemBase::itemIndex); });
  116. #endif
  117. #if ENABLED(SINGLENOZZLE_STANDBY_TEMP)
  118. LOOP_S_L_N(e, 1, EXTRUDERS)
  119. EDIT_ITEM_FAST_N(int3, e, MSG_NOZZLE_STANDBY, &thermalManager.singlenozzle_temp[e], 0, thermalManager.hotend_max_target(0));
  120. #endif
  121. //
  122. // Bed:
  123. //
  124. #if HAS_HEATED_BED
  125. EDIT_ITEM_FAST(int3, MSG_BED, &thermalManager.temp_bed.target, 0, BED_MAX_TARGET, thermalManager.start_watching_bed);
  126. #endif
  127. //
  128. // Fan Speed:
  129. //
  130. #if HAS_FAN
  131. DEFINE_SINGLENOZZLE_ITEM();
  132. #if HAS_FAN0
  133. _FAN_EDIT_ITEMS(0,FIRST_FAN_SPEED);
  134. #endif
  135. #if HAS_FAN1
  136. FAN_EDIT_ITEMS(1);
  137. #elif SNFAN(1)
  138. singlenozzle_item(1);
  139. #endif
  140. #if HAS_FAN2
  141. FAN_EDIT_ITEMS(2);
  142. #elif SNFAN(2)
  143. singlenozzle_item(2);
  144. #endif
  145. #if HAS_FAN3
  146. FAN_EDIT_ITEMS(3);
  147. #elif SNFAN(3)
  148. singlenozzle_item(3);
  149. #endif
  150. #if HAS_FAN4
  151. FAN_EDIT_ITEMS(4);
  152. #elif SNFAN(4)
  153. singlenozzle_item(4);
  154. #endif
  155. #if HAS_FAN5
  156. FAN_EDIT_ITEMS(5);
  157. #elif SNFAN(5)
  158. singlenozzle_item(5);
  159. #endif
  160. #if HAS_FAN6
  161. FAN_EDIT_ITEMS(6);
  162. #elif SNFAN(6)
  163. singlenozzle_item(6);
  164. #endif
  165. #if HAS_FAN7
  166. FAN_EDIT_ITEMS(7);
  167. #elif SNFAN(7)
  168. singlenozzle_item(7);
  169. #endif
  170. #endif // HAS_FAN
  171. //
  172. // Flow:
  173. //
  174. #if HAS_EXTRUDERS
  175. EDIT_ITEM(int3, MSG_FLOW, &planner.flow_percentage[active_extruder], 10, 999, []{ planner.refresh_e_factor(active_extruder); });
  176. // Flow En:
  177. #if HAS_MULTI_EXTRUDER
  178. EXTRUDER_LOOP()
  179. EDIT_ITEM_N(int3, e, MSG_FLOW_N, &planner.flow_percentage[e], 10, 999, []{ planner.refresh_e_factor(MenuItemBase::itemIndex); });
  180. #endif
  181. #endif
  182. //
  183. // Advance K:
  184. //
  185. #if ENABLED(LIN_ADVANCE) && DISABLED(SLIM_LCD_MENUS)
  186. #if EXTRUDERS == 1
  187. EDIT_ITEM(float42_52, MSG_ADVANCE_K, &planner.extruder_advance_K[0], 0, 10);
  188. #elif HAS_MULTI_EXTRUDER
  189. EXTRUDER_LOOP()
  190. EDIT_ITEM_N(float42_52, e, MSG_ADVANCE_K_E, &planner.extruder_advance_K[e], 0, 10);
  191. #endif
  192. #endif
  193. //
  194. // Babystep X:
  195. // Babystep Y:
  196. // Babystep Z:
  197. //
  198. #if ENABLED(BABYSTEPPING)
  199. #if ENABLED(BABYSTEP_XY)
  200. SUBMENU(MSG_BABYSTEP_X, []{ _lcd_babystep_go(_lcd_babystep_x); });
  201. SUBMENU(MSG_BABYSTEP_Y, []{ _lcd_babystep_go(_lcd_babystep_y); });
  202. #endif
  203. #if ENABLED(BABYSTEP_ZPROBE_OFFSET)
  204. SUBMENU(MSG_ZPROBE_ZOFFSET, lcd_babystep_zoffset);
  205. #else
  206. SUBMENU(MSG_BABYSTEP_Z, lcd_babystep_z);
  207. #endif
  208. #endif
  209. END_MENU();
  210. }
  211. #endif // HAS_MARLINUI_MENU