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_advanced.cpp 20KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625
  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. // Advanced Settings Menus
  24. //
  25. #include "../../inc/MarlinConfigPre.h"
  26. #if HAS_LCD_MENU
  27. #include "menu_item.h"
  28. #include "../../module/planner.h"
  29. #if DISABLED(NO_VOLUMETRICS)
  30. #include "../../gcode/parser.h"
  31. #endif
  32. #if HAS_BED_PROBE
  33. #include "../../module/probe.h"
  34. #endif
  35. #if ENABLED(PIDTEMP)
  36. #include "../../module/temperature.h"
  37. #endif
  38. #if HAS_FILAMENT_RUNOUT_DISTANCE
  39. #include "../../feature/runout.h"
  40. #endif
  41. #if ENABLED(SD_FIRMWARE_UPDATE)
  42. #include "../../module/settings.h"
  43. #endif
  44. #if ENABLED(PASSWORD_FEATURE)
  45. #include "../../feature/password/password.h"
  46. #endif
  47. void menu_tmc();
  48. void menu_backlash();
  49. #if ENABLED(DAC_STEPPER_CURRENT)
  50. #include "../../feature/dac/stepper_dac.h"
  51. void menu_dac() {
  52. static xyze_uint8_t driverPercent;
  53. LOOP_XYZE(i) driverPercent[i] = dac_current_get_percent((AxisEnum)i);
  54. START_MENU();
  55. BACK_ITEM(MSG_ADVANCED_SETTINGS);
  56. #define EDIT_DAC_PERCENT(A) EDIT_ITEM(uint8, MSG_DAC_PERCENT_##A, &driverPercent[_AXIS(A)], 0, 100, []{ dac_current_set_percents(driverPercent); })
  57. EDIT_DAC_PERCENT(X);
  58. EDIT_DAC_PERCENT(Y);
  59. EDIT_DAC_PERCENT(Z);
  60. EDIT_DAC_PERCENT(E);
  61. ACTION_ITEM(MSG_DAC_EEPROM_WRITE, dac_commit_eeprom);
  62. END_MENU();
  63. }
  64. #endif
  65. #if HAS_MOTOR_CURRENT_PWM
  66. #include "../../module/stepper.h"
  67. void menu_pwm() {
  68. START_MENU();
  69. BACK_ITEM(MSG_ADVANCED_SETTINGS);
  70. #define EDIT_CURRENT_PWM(LABEL,I) EDIT_ITEM_P(long5, PSTR(LABEL), &stepper.motor_current_setting[I], 100, 2000, stepper.refresh_motor_power)
  71. #if ANY_PIN(MOTOR_CURRENT_PWM_XY, MOTOR_CURRENT_PWM_X, MOTOR_CURRENT_PWM_Y)
  72. EDIT_CURRENT_PWM(STR_X STR_Y, 0);
  73. #endif
  74. #if PIN_EXISTS(MOTOR_CURRENT_PWM_Z)
  75. EDIT_CURRENT_PWM(STR_Z, 1);
  76. #endif
  77. #if PIN_EXISTS(MOTOR_CURRENT_PWM_E)
  78. EDIT_CURRENT_PWM(STR_E, 2);
  79. #endif
  80. END_MENU();
  81. }
  82. #endif
  83. #if DISABLED(NO_VOLUMETRICS) || ENABLED(ADVANCED_PAUSE_FEATURE)
  84. //
  85. // Advanced Settings > Filament
  86. //
  87. void menu_advanced_filament() {
  88. START_MENU();
  89. BACK_ITEM(MSG_ADVANCED_SETTINGS);
  90. #if ENABLED(LIN_ADVANCE)
  91. #if EXTRUDERS == 1
  92. EDIT_ITEM(float42_52, MSG_ADVANCE_K, &planner.extruder_advance_K[0], 0, 999);
  93. #elif HAS_MULTI_EXTRUDER
  94. LOOP_L_N(n, EXTRUDERS)
  95. EDIT_ITEM_N(float42_52, n, MSG_ADVANCE_K_E, &planner.extruder_advance_K[n], 0, 999);
  96. #endif
  97. #endif
  98. #if DISABLED(NO_VOLUMETRICS)
  99. EDIT_ITEM(bool, MSG_VOLUMETRIC_ENABLED, &parser.volumetric_enabled, planner.calculate_volumetric_multipliers);
  100. #if ENABLED(VOLUMETRIC_EXTRUDER_LIMIT)
  101. EDIT_ITEM_FAST(float42_52, MSG_VOLUMETRIC_LIMIT, &planner.volumetric_extruder_limit[active_extruder], 0.0f, 20.0f, planner.calculate_volumetric_extruder_limits);
  102. #if HAS_MULTI_EXTRUDER
  103. LOOP_L_N(n, EXTRUDERS)
  104. EDIT_ITEM_FAST_N(float42_52, n, MSG_VOLUMETRIC_LIMIT_E, &planner.volumetric_extruder_limit[n], 0.0f, 20.00f, planner.calculate_volumetric_extruder_limits);
  105. #endif
  106. #endif
  107. if (parser.volumetric_enabled) {
  108. EDIT_ITEM_FAST(float43, MSG_FILAMENT_DIAM, &planner.filament_size[active_extruder], 1.5f, 3.25f, planner.calculate_volumetric_multipliers);
  109. #if HAS_MULTI_EXTRUDER
  110. LOOP_L_N(n, EXTRUDERS)
  111. EDIT_ITEM_FAST_N(float43, n, MSG_FILAMENT_DIAM_E, &planner.filament_size[n], 1.5f, 3.25f, planner.calculate_volumetric_multipliers);
  112. #endif
  113. }
  114. #endif
  115. #if ENABLED(ADVANCED_PAUSE_FEATURE)
  116. constexpr float extrude_maxlength = TERN(PREVENT_LENGTHY_EXTRUDE, EXTRUDE_MAXLENGTH, 999);
  117. EDIT_ITEM_FAST(float3, MSG_FILAMENT_UNLOAD, &fc_settings[active_extruder].unload_length, 0, extrude_maxlength);
  118. #if HAS_MULTI_EXTRUDER
  119. LOOP_L_N(n, EXTRUDERS)
  120. EDIT_ITEM_FAST_N(float3, n, MSG_FILAMENTUNLOAD_E, &fc_settings[n].unload_length, 0, extrude_maxlength);
  121. #endif
  122. EDIT_ITEM_FAST(float3, MSG_FILAMENT_LOAD, &fc_settings[active_extruder].load_length, 0, extrude_maxlength);
  123. #if HAS_MULTI_EXTRUDER
  124. LOOP_L_N(n, EXTRUDERS)
  125. EDIT_ITEM_FAST_N(float3, n, MSG_FILAMENTLOAD_E, &fc_settings[n].load_length, 0, extrude_maxlength);
  126. #endif
  127. #endif
  128. #if HAS_FILAMENT_RUNOUT_DISTANCE
  129. editable.decimal = runout.runout_distance();
  130. EDIT_ITEM(float3, MSG_RUNOUT_DISTANCE_MM, &editable.decimal, 1, float(FILAMENT_RUNOUT_DISTANCE_MM) * 1.5f,
  131. []{ runout.set_runout_distance(editable.decimal); }, true
  132. );
  133. #endif
  134. END_MENU();
  135. }
  136. #endif // !NO_VOLUMETRICS || ADVANCED_PAUSE_FEATURE
  137. //
  138. // Advanced Settings > Temperature helpers
  139. //
  140. #if ENABLED(PID_AUTOTUNE_MENU)
  141. #if ENABLED(PIDTEMP)
  142. int16_t autotune_temp[HOTENDS] = ARRAY_BY_HOTENDS1(PREHEAT_1_TEMP_HOTEND);
  143. #endif
  144. #if ENABLED(PIDTEMPBED)
  145. int16_t autotune_temp_bed = PREHEAT_1_TEMP_BED;
  146. #endif
  147. #include "../../gcode/queue.h"
  148. void _lcd_autotune(const int16_t e) {
  149. char cmd[30];
  150. sprintf_P(cmd, PSTR("M303 U1 E%i S%i"), e,
  151. #if HAS_PID_FOR_BOTH
  152. e < 0 ? autotune_temp_bed : autotune_temp[e]
  153. #else
  154. TERN(PIDTEMPBED, autotune_temp_bed, autotune_temp[e])
  155. #endif
  156. );
  157. queue.inject(cmd);
  158. ui.return_to_status();
  159. }
  160. #endif // PID_AUTOTUNE_MENU
  161. #if ENABLED(PID_EDIT_MENU)
  162. float raw_Ki, raw_Kd; // place-holders for Ki and Kd edits
  163. // Helpers for editing PID Ki & Kd values
  164. // grab the PID value out of the temp variable; scale it; then update the PID driver
  165. void copy_and_scalePID_i(int16_t e) {
  166. TERN(PID_PARAMS_PER_HOTEND,,UNUSED(e));
  167. PID_PARAM(Ki, e) = scalePID_i(raw_Ki);
  168. thermalManager.updatePID();
  169. }
  170. void copy_and_scalePID_d(int16_t e) {
  171. TERN(PID_PARAMS_PER_HOTEND,,UNUSED(e));
  172. PID_PARAM(Kd, e) = scalePID_d(raw_Kd);
  173. thermalManager.updatePID();
  174. }
  175. #define _DEFINE_PIDTEMP_BASE_FUNCS(N) \
  176. void copy_and_scalePID_i_E##N() { copy_and_scalePID_i(N); } \
  177. void copy_and_scalePID_d_E##N() { copy_and_scalePID_d(N); }
  178. #else
  179. #define _DEFINE_PIDTEMP_BASE_FUNCS(N) //
  180. #endif
  181. #if ENABLED(PID_AUTOTUNE_MENU)
  182. #define DEFINE_PIDTEMP_FUNCS(N) \
  183. _DEFINE_PIDTEMP_BASE_FUNCS(N); \
  184. void lcd_autotune_callback_E##N() { _lcd_autotune(N); }
  185. #else
  186. #define DEFINE_PIDTEMP_FUNCS(N) _DEFINE_PIDTEMP_BASE_FUNCS(N);
  187. #endif
  188. #if HAS_HOTEND
  189. DEFINE_PIDTEMP_FUNCS(0);
  190. #if ENABLED(PID_PARAMS_PER_HOTEND)
  191. REPEAT_S(1, HOTENDS, DEFINE_PIDTEMP_FUNCS)
  192. #endif
  193. #endif
  194. #if BOTH(AUTOTEMP, HAS_TEMP_HOTEND) || EITHER(PID_AUTOTUNE_MENU, PID_EDIT_MENU)
  195. #define SHOW_MENU_ADVANCED_TEMPERATURE 1
  196. #endif
  197. //
  198. // Advanced Settings > Temperature
  199. //
  200. #if SHOW_MENU_ADVANCED_TEMPERATURE
  201. void menu_advanced_temperature() {
  202. START_MENU();
  203. BACK_ITEM(MSG_ADVANCED_SETTINGS);
  204. //
  205. // Autotemp, Min, Max, Fact
  206. //
  207. #if BOTH(AUTOTEMP, HAS_TEMP_HOTEND)
  208. EDIT_ITEM(bool, MSG_AUTOTEMP, &planner.autotemp_enabled);
  209. EDIT_ITEM(float3, MSG_MIN, &planner.autotemp_min, 0, float(HEATER_0_MAXTEMP) - HOTEND_OVERSHOOT);
  210. EDIT_ITEM(float3, MSG_MAX, &planner.autotemp_max, 0, float(HEATER_0_MAXTEMP) - HOTEND_OVERSHOOT);
  211. EDIT_ITEM(float42_52, MSG_FACTOR, &planner.autotemp_factor, 0, 10);
  212. #endif
  213. //
  214. // PID-P, PID-I, PID-D, PID-C, PID Autotune
  215. // PID-P E1, PID-I E1, PID-D E1, PID-C E1, PID Autotune E1
  216. // PID-P E2, PID-I E2, PID-D E2, PID-C E2, PID Autotune E2
  217. // PID-P E3, PID-I E3, PID-D E3, PID-C E3, PID Autotune E3
  218. // PID-P E4, PID-I E4, PID-D E4, PID-C E4, PID Autotune E4
  219. // PID-P E5, PID-I E5, PID-D E5, PID-C E5, PID Autotune E5
  220. //
  221. #if ENABLED(PID_EDIT_MENU)
  222. #define __PID_BASE_MENU_ITEMS(N) \
  223. raw_Ki = unscalePID_i(TERN(PID_BED_MENU_SECTION, thermalManager.temp_bed.pid.Ki, PID_PARAM(Ki, N))); \
  224. raw_Kd = unscalePID_d(TERN(PID_BED_MENU_SECTION, thermalManager.temp_bed.pid.Kd, PID_PARAM(Kd, N))); \
  225. EDIT_ITEM_FAST_N(float41sign, N, MSG_PID_P_E, &TERN(PID_BED_MENU_SECTION, thermalManager.temp_bed.pid.Kp, PID_PARAM(Kp, N)), 1, 9990); \
  226. EDIT_ITEM_FAST_N(float52sign, N, MSG_PID_I_E, &raw_Ki, 0.01f, 9990, []{ copy_and_scalePID_i(N); }); \
  227. EDIT_ITEM_FAST_N(float41sign, N, MSG_PID_D_E, &raw_Kd, 1, 9990, []{ copy_and_scalePID_d(N); })
  228. #if ENABLED(PID_EXTRUSION_SCALING)
  229. #define _PID_BASE_MENU_ITEMS(N) \
  230. __PID_BASE_MENU_ITEMS(N); \
  231. EDIT_ITEM_N(float3, N, MSG_PID_C_E, &PID_PARAM(Kc, N), 1, 9990)
  232. #else
  233. #define _PID_BASE_MENU_ITEMS(N) __PID_BASE_MENU_ITEMS(N)
  234. #endif
  235. #if ENABLED(PID_FAN_SCALING)
  236. #define _PID_EDIT_MENU_ITEMS(N) \
  237. _PID_BASE_MENU_ITEMS(N); \
  238. EDIT_ITEM_N(float3, N, MSG_PID_F_E, &PID_PARAM(Kf, N), 1, 9990)
  239. #else
  240. #define _PID_EDIT_MENU_ITEMS(N) _PID_BASE_MENU_ITEMS(N)
  241. #endif
  242. #else
  243. #define _PID_EDIT_MENU_ITEMS(N) NOOP
  244. #endif
  245. #if ENABLED(PID_AUTOTUNE_MENU)
  246. #define PID_EDIT_MENU_ITEMS(N) \
  247. _PID_EDIT_MENU_ITEMS(N); \
  248. EDIT_ITEM_FAST_N(int3, N, MSG_PID_AUTOTUNE_E, &autotune_temp[N], 150, thermalManager.heater_maxtemp[N] - HOTEND_OVERSHOOT, []{ _lcd_autotune(MenuItemBase::itemIndex); });
  249. #else
  250. #define PID_EDIT_MENU_ITEMS(N) _PID_EDIT_MENU_ITEMS(N);
  251. #endif
  252. PID_EDIT_MENU_ITEMS(0);
  253. #if ENABLED(PID_PARAMS_PER_HOTEND)
  254. REPEAT_S(1, HOTENDS, PID_EDIT_MENU_ITEMS)
  255. #endif
  256. #if ENABLED(PIDTEMPBED)
  257. #if ENABLED(PID_EDIT_MENU)
  258. #define PID_BED_MENU_SECTION
  259. __PID_BASE_MENU_ITEMS(-1);
  260. #undef PID_BED_MENU_SECTION
  261. #endif
  262. #if ENABLED(PID_AUTOTUNE_MENU)
  263. EDIT_ITEM_FAST_N(int3, -1, MSG_PID_AUTOTUNE_E, &autotune_temp_bed, PREHEAT_1_TEMP_BED, BED_MAX_TARGET, []{ _lcd_autotune(-1); });
  264. #endif
  265. #endif
  266. END_MENU();
  267. }
  268. #endif // SHOW_MENU_ADVANCED_TEMPERATURE
  269. #if DISABLED(SLIM_LCD_MENUS)
  270. #if ENABLED(DISTINCT_E_FACTORS)
  271. inline void _reset_e_acceleration_rate(const uint8_t e) { if (e == active_extruder) planner.reset_acceleration_rates(); }
  272. inline void _planner_refresh_e_positioning(const uint8_t e) {
  273. if (e == active_extruder)
  274. planner.refresh_positioning();
  275. else
  276. planner.steps_to_mm[E_AXIS_N(e)] = 1.0f / planner.settings.axis_steps_per_mm[E_AXIS_N(e)];
  277. }
  278. #endif
  279. // M203 / M205 Velocity options
  280. void menu_advanced_velocity() {
  281. // M203 Max Feedrate
  282. constexpr xyze_feedrate_t max_fr_edit =
  283. #ifdef MAX_FEEDRATE_EDIT_VALUES
  284. MAX_FEEDRATE_EDIT_VALUES
  285. #elif ENABLED(LIMITED_MAX_FR_EDITING)
  286. DEFAULT_MAX_FEEDRATE
  287. #else
  288. { 999, 999, 999, 999 }
  289. #endif
  290. ;
  291. #if ENABLED(LIMITED_MAX_FR_EDITING) && !defined(MAX_FEEDRATE_EDIT_VALUES)
  292. const xyze_feedrate_t max_fr_edit_scaled = max_fr_edit * 2;
  293. #else
  294. const xyze_feedrate_t &max_fr_edit_scaled = max_fr_edit;
  295. #endif
  296. START_MENU();
  297. BACK_ITEM(MSG_ADVANCED_SETTINGS);
  298. #define EDIT_VMAX(N) EDIT_ITEM_FAST(float3, MSG_VMAX_##N, &planner.settings.max_feedrate_mm_s[_AXIS(N)], 1, max_fr_edit_scaled[_AXIS(N)])
  299. EDIT_VMAX(A);
  300. EDIT_VMAX(B);
  301. EDIT_VMAX(C);
  302. #if E_STEPPERS
  303. EDIT_ITEM_FAST(float3, MSG_VMAX_E, &planner.settings.max_feedrate_mm_s[E_AXIS_N(active_extruder)], 1, max_fr_edit_scaled.e);
  304. #endif
  305. #if ENABLED(DISTINCT_E_FACTORS)
  306. LOOP_L_N(n, E_STEPPERS)
  307. EDIT_ITEM_FAST_N(float3, n, MSG_VMAX_EN, &planner.settings.max_feedrate_mm_s[E_AXIS_N(n)], 1, max_fr_edit_scaled.e);
  308. #endif
  309. // M205 S Min Feedrate
  310. EDIT_ITEM_FAST(float3, MSG_VMIN, &planner.settings.min_feedrate_mm_s, 0, 999);
  311. // M205 T Min Travel Feedrate
  312. EDIT_ITEM_FAST(float3, MSG_VTRAV_MIN, &planner.settings.min_travel_feedrate_mm_s, 0, 999);
  313. END_MENU();
  314. }
  315. // M201 / M204 Accelerations
  316. void menu_advanced_acceleration() {
  317. const float max_accel = _MAX(planner.settings.max_acceleration_mm_per_s2[A_AXIS], planner.settings.max_acceleration_mm_per_s2[B_AXIS], planner.settings.max_acceleration_mm_per_s2[C_AXIS]);
  318. // M201 settings
  319. constexpr xyze_ulong_t max_accel_edit =
  320. #ifdef MAX_ACCEL_EDIT_VALUES
  321. MAX_ACCEL_EDIT_VALUES
  322. #elif ENABLED(LIMITED_MAX_ACCEL_EDITING)
  323. DEFAULT_MAX_ACCELERATION
  324. #else
  325. { 99000, 99000, 99000, 99000 }
  326. #endif
  327. ;
  328. #if ENABLED(LIMITED_MAX_ACCEL_EDITING) && !defined(MAX_ACCEL_EDIT_VALUES)
  329. const xyze_ulong_t max_accel_edit_scaled = max_accel_edit * 2;
  330. #else
  331. const xyze_ulong_t &max_accel_edit_scaled = max_accel_edit;
  332. #endif
  333. START_MENU();
  334. BACK_ITEM(MSG_ADVANCED_SETTINGS);
  335. // M204 P Acceleration
  336. EDIT_ITEM_FAST(float5_25, MSG_ACC, &planner.settings.acceleration, 25, max_accel);
  337. // M204 R Retract Acceleration
  338. EDIT_ITEM_FAST(float5, MSG_A_RETRACT, &planner.settings.retract_acceleration, 100, planner.settings.max_acceleration_mm_per_s2[E_AXIS_N(active_extruder)]);
  339. // M204 T Travel Acceleration
  340. EDIT_ITEM_FAST(float5_25, MSG_A_TRAVEL, &planner.settings.travel_acceleration, 25, max_accel);
  341. #define EDIT_AMAX(Q,L) EDIT_ITEM_FAST(long5_25, MSG_AMAX_##Q, &planner.settings.max_acceleration_mm_per_s2[_AXIS(Q)], L, max_accel_edit_scaled[_AXIS(Q)], []{ planner.reset_acceleration_rates(); })
  342. EDIT_AMAX(A, 100);
  343. EDIT_AMAX(B, 100);
  344. EDIT_AMAX(C, 10);
  345. #if ENABLED(DISTINCT_E_FACTORS)
  346. EDIT_ITEM_FAST(long5_25, MSG_AMAX_E, &planner.settings.max_acceleration_mm_per_s2[E_AXIS_N(active_extruder)], 100, max_accel_edit_scaled.e, []{ planner.reset_acceleration_rates(); });
  347. LOOP_L_N(n, E_STEPPERS)
  348. EDIT_ITEM_FAST_N(long5_25, n, MSG_AMAX_EN, &planner.settings.max_acceleration_mm_per_s2[E_AXIS_N(n)], 100, max_accel_edit_scaled.e, []{ _reset_e_acceleration_rate(MenuItemBase::itemIndex); });
  349. #elif E_STEPPERS
  350. EDIT_ITEM_FAST(long5_25, MSG_AMAX_E, &planner.settings.max_acceleration_mm_per_s2[E_AXIS], 100, max_accel_edit_scaled.e, []{ planner.reset_acceleration_rates(); });
  351. #endif
  352. #ifdef XY_FREQUENCY_LIMIT
  353. EDIT_ITEM(int8, MSG_XY_FREQUENCY_LIMIT, &planner.xy_freq_limit_hz, 0, 100, planner.refresh_frequency_limit, true);
  354. editable.uint8 = uint8_t(LROUND(planner.xy_freq_min_speed_factor * 255)); // percent to u8
  355. EDIT_ITEM(percent, MSG_XY_FREQUENCY_FEEDRATE, &editable.uint8, 3, 255, []{ planner.set_min_speed_factor_u8(editable.uint8); }, true);
  356. #endif
  357. END_MENU();
  358. }
  359. #if HAS_CLASSIC_JERK
  360. void menu_advanced_jerk() {
  361. START_MENU();
  362. BACK_ITEM(MSG_ADVANCED_SETTINGS);
  363. #if HAS_JUNCTION_DEVIATION
  364. #if ENABLED(LIN_ADVANCE)
  365. EDIT_ITEM(float43, MSG_JUNCTION_DEVIATION, &planner.junction_deviation_mm, 0.001f, 0.3f, planner.recalculate_max_e_jerk);
  366. #else
  367. EDIT_ITEM(float43, MSG_JUNCTION_DEVIATION, &planner.junction_deviation_mm, 0.001f, 0.5f);
  368. #endif
  369. #endif
  370. constexpr xyze_float_t max_jerk_edit =
  371. #ifdef MAX_JERK_EDIT_VALUES
  372. MAX_JERK_EDIT_VALUES
  373. #elif ENABLED(LIMITED_JERK_EDITING)
  374. { (DEFAULT_XJERK) * 2, (DEFAULT_YJERK) * 2, (DEFAULT_ZJERK) * 2, (DEFAULT_EJERK) * 2 }
  375. #else
  376. { 990, 990, 990, 990 }
  377. #endif
  378. ;
  379. #define EDIT_JERK(N) EDIT_ITEM_FAST(float3, MSG_V##N##_JERK, &planner.max_jerk[_AXIS(N)], 1, max_jerk_edit[_AXIS(N)])
  380. EDIT_JERK(A);
  381. EDIT_JERK(B);
  382. #if ENABLED(DELTA)
  383. EDIT_JERK(C);
  384. #else
  385. EDIT_ITEM_FAST(float52sign, MSG_VC_JERK, &planner.max_jerk.c, 0.1f, max_jerk_edit.c);
  386. #endif
  387. #if HAS_CLASSIC_E_JERK
  388. EDIT_ITEM_FAST(float52sign, MSG_VE_JERK, &planner.max_jerk.e, 0.1f, max_jerk_edit.e);
  389. #endif
  390. END_MENU();
  391. }
  392. #endif
  393. // M851 - Z Probe Offsets
  394. #if HAS_BED_PROBE
  395. void menu_probe_offsets() {
  396. START_MENU();
  397. BACK_ITEM(MSG_ADVANCED_SETTINGS);
  398. #if HAS_PROBE_XY_OFFSET
  399. EDIT_ITEM(float31sign, MSG_ZPROBE_XOFFSET, &probe.offset.x, -(X_BED_SIZE), X_BED_SIZE);
  400. EDIT_ITEM(float31sign, MSG_ZPROBE_YOFFSET, &probe.offset.y, -(Y_BED_SIZE), Y_BED_SIZE);
  401. #endif
  402. EDIT_ITEM(LCD_Z_OFFSET_TYPE, MSG_ZPROBE_ZOFFSET, &probe.offset.z, Z_PROBE_OFFSET_RANGE_MIN, Z_PROBE_OFFSET_RANGE_MAX);
  403. END_MENU();
  404. }
  405. #endif
  406. #endif // !SLIM_LCD_MENUS
  407. // M92 Steps-per-mm
  408. void menu_advanced_steps_per_mm() {
  409. START_MENU();
  410. BACK_ITEM(MSG_ADVANCED_SETTINGS);
  411. #define EDIT_QSTEPS(Q) EDIT_ITEM_FAST(float51, MSG_##Q##_STEPS, &planner.settings.axis_steps_per_mm[_AXIS(Q)], 5, 9999, []{ planner.refresh_positioning(); })
  412. EDIT_QSTEPS(A);
  413. EDIT_QSTEPS(B);
  414. EDIT_QSTEPS(C);
  415. #if ENABLED(DISTINCT_E_FACTORS)
  416. LOOP_L_N(n, E_STEPPERS)
  417. EDIT_ITEM_FAST_N(float51, n, MSG_EN_STEPS, &planner.settings.axis_steps_per_mm[E_AXIS_N(n)], 5, 9999, []{ _planner_refresh_e_positioning(MenuItemBase::itemIndex); });
  418. #elif E_STEPPERS
  419. EDIT_ITEM_FAST(float51, MSG_E_STEPS, &planner.settings.axis_steps_per_mm[E_AXIS], 5, 9999, []{ planner.refresh_positioning(); });
  420. #endif
  421. END_MENU();
  422. }
  423. void menu_advanced_settings() {
  424. const bool is_busy = printer_busy();
  425. #if ENABLED(SD_FIRMWARE_UPDATE)
  426. bool sd_update_state = settings.sd_update_status();
  427. #endif
  428. START_MENU();
  429. BACK_ITEM(MSG_CONFIGURATION);
  430. #if DISABLED(SLIM_LCD_MENUS)
  431. #if HAS_M206_COMMAND
  432. //
  433. // Set Home Offsets
  434. //
  435. ACTION_ITEM(MSG_SET_HOME_OFFSETS, []{ queue.inject_P(PSTR("M428")); ui.return_to_status(); });
  436. #endif
  437. // M203 / M205 - Feedrate items
  438. SUBMENU(MSG_VELOCITY, menu_advanced_velocity);
  439. // M201 - Acceleration items
  440. SUBMENU(MSG_ACCELERATION, menu_advanced_acceleration);
  441. #if HAS_CLASSIC_JERK
  442. // M205 - Max Jerk
  443. SUBMENU(MSG_JERK, menu_advanced_jerk);
  444. #elif HAS_JUNCTION_DEVIATION
  445. EDIT_ITEM(float43, MSG_JUNCTION_DEVIATION, &planner.junction_deviation_mm, 0.001f, 0.3f
  446. #if ENABLED(LIN_ADVANCE)
  447. , planner.recalculate_max_e_jerk
  448. #endif
  449. );
  450. #endif
  451. // M851 - Z Probe Offsets
  452. #if HAS_BED_PROBE
  453. if (!is_busy) SUBMENU(MSG_ZPROBE_OFFSETS, menu_probe_offsets);
  454. #endif
  455. #endif // !SLIM_LCD_MENUS
  456. // M92 - Steps Per mm
  457. if (!is_busy)
  458. SUBMENU(MSG_STEPS_PER_MM, menu_advanced_steps_per_mm);
  459. #if ENABLED(BACKLASH_GCODE)
  460. SUBMENU(MSG_BACKLASH, menu_backlash);
  461. #endif
  462. #if ENABLED(DAC_STEPPER_CURRENT)
  463. SUBMENU(MSG_DRIVE_STRENGTH, menu_dac);
  464. #endif
  465. #if HAS_MOTOR_CURRENT_PWM
  466. SUBMENU(MSG_DRIVE_STRENGTH, menu_pwm);
  467. #endif
  468. #if HAS_TRINAMIC_CONFIG
  469. SUBMENU(MSG_TMC_DRIVERS, menu_tmc);
  470. #endif
  471. #if SHOW_MENU_ADVANCED_TEMPERATURE
  472. SUBMENU(MSG_TEMPERATURE, menu_advanced_temperature);
  473. #endif
  474. #if DISABLED(NO_VOLUMETRICS) || ENABLED(ADVANCED_PAUSE_FEATURE)
  475. SUBMENU(MSG_FILAMENT, menu_advanced_filament);
  476. #elif ENABLED(LIN_ADVANCE)
  477. #if EXTRUDERS == 1
  478. EDIT_ITEM(float42_52, MSG_ADVANCE_K, &planner.extruder_advance_K[0], 0, 999);
  479. #elif HAS_MULTI_EXTRUDER
  480. LOOP_L_N(n, E_STEPPERS)
  481. EDIT_ITEM_N(float42_52, n, MSG_ADVANCE_K_E, &planner.extruder_advance_K[n], 0, 999);
  482. #endif
  483. #endif
  484. // M540 S - Abort on endstop hit when SD printing
  485. #if ENABLED(SD_ABORT_ON_ENDSTOP_HIT)
  486. EDIT_ITEM(bool, MSG_ENDSTOP_ABORT, &planner.abort_on_endstop_hit);
  487. #endif
  488. #if ENABLED(SD_FIRMWARE_UPDATE)
  489. EDIT_ITEM(bool, MSG_MEDIA_UPDATE, &sd_update_state, []{
  490. //
  491. // Toggle the SD Firmware Update state in EEPROM
  492. //
  493. const bool new_state = !settings.sd_update_status(),
  494. didset = settings.set_sd_update_status(new_state);
  495. ui.completion_feedback(didset);
  496. ui.return_to_status();
  497. if (new_state) LCD_MESSAGEPGM(MSG_RESET_PRINTER); else ui.reset_status();
  498. });
  499. #endif
  500. #if ENABLED(PASSWORD_FEATURE)
  501. SUBMENU(MSG_PASSWORD_SETTINGS, password.access_menu_password);
  502. #endif
  503. #if ENABLED(EEPROM_SETTINGS) && DISABLED(SLIM_LCD_MENUS)
  504. CONFIRM_ITEM(MSG_INIT_EEPROM,
  505. MSG_BUTTON_INIT, MSG_BUTTON_CANCEL,
  506. ui.init_eeprom, nullptr,
  507. GET_TEXT(MSG_INIT_EEPROM), (const char *)nullptr, PSTR("?")
  508. );
  509. #endif
  510. END_MENU();
  511. }
  512. #endif // HAS_LCD_MENU