My Marlin configs for Fabrikator Mini and CTC i3 Pro B
Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.

configuration_store.cpp 32KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034
  1. /**
  2. * Marlin 3D Printer Firmware
  3. * Copyright (C) 2016 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 <http://www.gnu.org/licenses/>.
  20. *
  21. */
  22. /**
  23. * configuration_store.cpp
  24. *
  25. * Configuration and EEPROM storage
  26. *
  27. * IMPORTANT: Whenever there are changes made to the variables stored in EEPROM
  28. * in the functions below, also increment the version number. This makes sure that
  29. * the default values are used whenever there is a change to the data, to prevent
  30. * wrong data being written to the variables.
  31. *
  32. * ALSO: Variables in the Store and Retrieve sections must be in the same order.
  33. * If a feature is disabled, some data must still be written that, when read,
  34. * either sets a Sane Default, or results in No Change to the existing value.
  35. *
  36. */
  37. #define EEPROM_VERSION "V27"
  38. // Change EEPROM version if these are changed:
  39. #define EEPROM_OFFSET 100
  40. /**
  41. * V27 EEPROM Layout:
  42. *
  43. * 100 Version (char x4)
  44. * 104 EEPROM Checksum (uint16_t)
  45. *
  46. * 106 M92 XYZE planner.axis_steps_per_mm (float x4 ... x7)
  47. * 122 M203 XYZE planner.max_feedrate_mm_s (float x4 ... x7)
  48. * 138 M201 XYZE planner.max_acceleration_mm_per_s2 (uint32_t x4 ... x7)
  49. * 154 M204 P planner.acceleration (float)
  50. * 158 M204 R planner.retract_acceleration (float)
  51. * 162 M204 T planner.travel_acceleration (float)
  52. * 166 M205 S planner.min_feedrate_mm_s (float)
  53. * 170 M205 T planner.min_travel_feedrate_mm_s (float)
  54. * 174 M205 B planner.min_segment_time (ulong)
  55. * 178 M205 X planner.max_jerk[X_AXIS] (float)
  56. * 182 M205 Y planner.max_jerk[Y_AXIS] (float)
  57. * 186 M205 Z planner.max_jerk[Z_AXIS] (float)
  58. * 190 M205 E planner.max_jerk[E_AXIS] (float)
  59. * 194 M206 XYZ home_offset (float x3)
  60. * 206 M218 XYZ hotend_offset (float x3 per additional hotend)
  61. *
  62. * Mesh bed leveling:
  63. * 218 M420 S status (uint8)
  64. * 219 z_offset (float)
  65. * 223 mesh_num_x (uint8 as set in firmware)
  66. * 224 mesh_num_y (uint8 as set in firmware)
  67. * 225 G29 S3 XYZ z_values[][] (float x9, by default, up to float x 81)
  68. *
  69. * AUTO BED LEVELING
  70. * 261 M851 zprobe_zoffset (float)
  71. *
  72. * DELTA:
  73. * 265 M666 XYZ endstop_adj (float x3)
  74. * 277 M665 R delta_radius (float)
  75. * 281 M665 L delta_diagonal_rod (float)
  76. * 285 M665 S delta_segments_per_second (float)
  77. * 289 M665 A delta_diagonal_rod_trim_tower_1 (float)
  78. * 293 M665 B delta_diagonal_rod_trim_tower_2 (float)
  79. * 297 M665 C delta_diagonal_rod_trim_tower_3 (float)
  80. *
  81. * Z_DUAL_ENDSTOPS:
  82. * 301 M666 Z z_endstop_adj (float)
  83. *
  84. * ULTIPANEL:
  85. * 305 M145 S0 H lcd_preheat_hotend_temp (int x2)
  86. * 309 M145 S0 B lcd_preheat_bed_temp (int x2)
  87. * 313 M145 S0 F lcd_preheat_fan_speed (int x2)
  88. *
  89. * PIDTEMP:
  90. * 317 M301 E0 PIDC Kp[0], Ki[0], Kd[0], Kc[0] (float x4)
  91. * 333 M301 E1 PIDC Kp[1], Ki[1], Kd[1], Kc[1] (float x4)
  92. * 349 M301 E2 PIDC Kp[2], Ki[2], Kd[2], Kc[2] (float x4)
  93. * 365 M301 E3 PIDC Kp[3], Ki[3], Kd[3], Kc[3] (float x4)
  94. * 381 M301 L lpq_len (int)
  95. *
  96. * PIDTEMPBED:
  97. * 383 M304 PID thermalManager.bedKp, thermalManager.bedKi, thermalManager.bedKd (float x3)
  98. *
  99. * DOGLCD:
  100. * 395 M250 C lcd_contrast (int)
  101. *
  102. * FWRETRACT:
  103. * 397 M209 S autoretract_enabled (bool)
  104. * 398 M207 S retract_length (float)
  105. * 402 M207 W retract_length_swap (float)
  106. * 406 M207 F retract_feedrate_mm_s (float)
  107. * 410 M207 Z retract_zlift (float)
  108. * 414 M208 S retract_recover_length (float)
  109. * 418 M208 W retract_recover_length_swap (float)
  110. * 422 M208 F retract_recover_feedrate_mm_s (float)
  111. *
  112. * Volumetric Extrusion:
  113. * 426 M200 D volumetric_enabled (bool)
  114. * 427 M200 T D filament_size (float x4) (T0..3)
  115. *
  116. * 443 This Slot is Available!
  117. *
  118. */
  119. #include "Marlin.h"
  120. #include "language.h"
  121. #include "endstops.h"
  122. #include "planner.h"
  123. #include "temperature.h"
  124. #include "ultralcd.h"
  125. #include "configuration_store.h"
  126. #if ENABLED(MESH_BED_LEVELING)
  127. #include "mesh_bed_leveling.h"
  128. #endif
  129. uint16_t eeprom_checksum;
  130. const char version[4] = EEPROM_VERSION;
  131. void _EEPROM_writeData(int &pos, uint8_t* value, uint8_t size) {
  132. uint8_t c;
  133. while (size--) {
  134. eeprom_write_byte((unsigned char*)pos, *value);
  135. c = eeprom_read_byte((unsigned char*)pos);
  136. if (c != *value) {
  137. SERIAL_ECHO_START;
  138. SERIAL_ECHOLNPGM(MSG_ERR_EEPROM_WRITE);
  139. }
  140. eeprom_checksum += c;
  141. pos++;
  142. value++;
  143. };
  144. }
  145. void _EEPROM_readData(int &pos, uint8_t* value, uint8_t size) {
  146. do {
  147. uint8_t c = eeprom_read_byte((unsigned char*)pos);
  148. *value = c;
  149. eeprom_checksum += c;
  150. pos++;
  151. value++;
  152. } while (--size);
  153. }
  154. /**
  155. * Post-process after Retrieve or Reset
  156. */
  157. void Config_Postprocess() {
  158. // steps per s2 needs to be updated to agree with units per s2
  159. planner.reset_acceleration_rates();
  160. // Make sure delta kinematics are updated before refreshing the
  161. // planner position so the stepper counts will be set correctly.
  162. #if ENABLED(DELTA)
  163. recalc_delta_settings(delta_radius, delta_diagonal_rod);
  164. #endif
  165. // Refresh steps_to_mm with the reciprocal of axis_steps_per_mm
  166. // and init stepper.count[], planner.position[] with current_position
  167. planner.refresh_positioning();
  168. #if ENABLED(PIDTEMP)
  169. thermalManager.updatePID();
  170. #endif
  171. calculate_volumetric_multipliers();
  172. // Software endstops depend on home_offset
  173. LOOP_XYZ(i) update_software_endstops((AxisEnum)i);
  174. }
  175. #if ENABLED(EEPROM_SETTINGS)
  176. #define DUMMY_PID_VALUE 3000.0f
  177. #define EEPROM_START() int eeprom_index = EEPROM_OFFSET
  178. #define EEPROM_SKIP(VAR) eeprom_index += sizeof(VAR)
  179. #define EEPROM_WRITE(VAR) _EEPROM_writeData(eeprom_index, (uint8_t*)&VAR, sizeof(VAR))
  180. #define EEPROM_READ(VAR) _EEPROM_readData(eeprom_index, (uint8_t*)&VAR, sizeof(VAR))
  181. /**
  182. * M500 - Store Configuration
  183. */
  184. void Config_StoreSettings() {
  185. float dummy = 0.0f;
  186. char ver[4] = "000";
  187. EEPROM_START();
  188. EEPROM_WRITE(ver); // invalidate data first
  189. EEPROM_SKIP(eeprom_checksum); // Skip the checksum slot
  190. eeprom_checksum = 0; // clear before first "real data"
  191. EEPROM_WRITE(planner.axis_steps_per_mm);
  192. EEPROM_WRITE(planner.max_feedrate_mm_s);
  193. EEPROM_WRITE(planner.max_acceleration_mm_per_s2);
  194. EEPROM_WRITE(planner.acceleration);
  195. EEPROM_WRITE(planner.retract_acceleration);
  196. EEPROM_WRITE(planner.travel_acceleration);
  197. EEPROM_WRITE(planner.min_feedrate_mm_s);
  198. EEPROM_WRITE(planner.min_travel_feedrate_mm_s);
  199. EEPROM_WRITE(planner.min_segment_time);
  200. EEPROM_WRITE(planner.max_jerk);
  201. EEPROM_WRITE(home_offset);
  202. #if HOTENDS > 1
  203. // Skip hotend 0 which must be 0
  204. for (uint8_t e = 1; e < HOTENDS; e++)
  205. LOOP_XYZ(i) EEPROM_WRITE(hotend_offset[i][e]);
  206. #endif
  207. #if ENABLED(MESH_BED_LEVELING)
  208. // Compile time test that sizeof(mbl.z_values) is as expected
  209. typedef char c_assert[(sizeof(mbl.z_values) == (MESH_NUM_X_POINTS) * (MESH_NUM_Y_POINTS) * sizeof(dummy)) ? 1 : -1];
  210. uint8_t mesh_num_x = MESH_NUM_X_POINTS,
  211. mesh_num_y = MESH_NUM_Y_POINTS,
  212. dummy_uint8 = mbl.status & _BV(MBL_STATUS_HAS_MESH_BIT);
  213. EEPROM_WRITE(dummy_uint8);
  214. EEPROM_WRITE(mbl.z_offset);
  215. EEPROM_WRITE(mesh_num_x);
  216. EEPROM_WRITE(mesh_num_y);
  217. EEPROM_WRITE(mbl.z_values);
  218. #else
  219. // For disabled MBL write a default mesh
  220. uint8_t mesh_num_x = 3,
  221. mesh_num_y = 3,
  222. dummy_uint8 = 0;
  223. dummy = 0.0f;
  224. EEPROM_WRITE(dummy_uint8);
  225. EEPROM_WRITE(dummy);
  226. EEPROM_WRITE(mesh_num_x);
  227. EEPROM_WRITE(mesh_num_y);
  228. for (uint8_t q = 0; q < mesh_num_x * mesh_num_y; q++) EEPROM_WRITE(dummy);
  229. #endif // MESH_BED_LEVELING
  230. #if !HAS_BED_PROBE
  231. float zprobe_zoffset = 0;
  232. #endif
  233. EEPROM_WRITE(zprobe_zoffset);
  234. // 9 floats for DELTA / Z_DUAL_ENDSTOPS
  235. #if ENABLED(DELTA)
  236. EEPROM_WRITE(endstop_adj); // 3 floats
  237. EEPROM_WRITE(delta_radius); // 1 float
  238. EEPROM_WRITE(delta_diagonal_rod); // 1 float
  239. EEPROM_WRITE(delta_segments_per_second); // 1 float
  240. EEPROM_WRITE(delta_diagonal_rod_trim_tower_1); // 1 float
  241. EEPROM_WRITE(delta_diagonal_rod_trim_tower_2); // 1 float
  242. EEPROM_WRITE(delta_diagonal_rod_trim_tower_3); // 1 float
  243. #elif ENABLED(Z_DUAL_ENDSTOPS)
  244. EEPROM_WRITE(z_endstop_adj); // 1 float
  245. dummy = 0.0f;
  246. for (uint8_t q = 8; q--;) EEPROM_WRITE(dummy);
  247. #else
  248. dummy = 0.0f;
  249. for (uint8_t q = 9; q--;) EEPROM_WRITE(dummy);
  250. #endif
  251. #if DISABLED(ULTIPANEL)
  252. const int lcd_preheat_hotend_temp[2] = { PREHEAT_1_TEMP_HOTEND, PREHEAT_2_TEMP_HOTEND },
  253. lcd_preheat_bed_temp[2] = { PREHEAT_1_TEMP_BED, PREHEAT_2_TEMP_BED },
  254. lcd_preheat_fan_speed[2] = { PREHEAT_1_FAN_SPEED, PREHEAT_2_FAN_SPEED };
  255. #endif // !ULTIPANEL
  256. EEPROM_WRITE(lcd_preheat_hotend_temp);
  257. EEPROM_WRITE(lcd_preheat_bed_temp);
  258. EEPROM_WRITE(lcd_preheat_fan_speed);
  259. for (uint8_t e = 0; e < MAX_EXTRUDERS; e++) {
  260. #if ENABLED(PIDTEMP)
  261. if (e < HOTENDS) {
  262. EEPROM_WRITE(PID_PARAM(Kp, e));
  263. EEPROM_WRITE(PID_PARAM(Ki, e));
  264. EEPROM_WRITE(PID_PARAM(Kd, e));
  265. #if ENABLED(PID_EXTRUSION_SCALING)
  266. EEPROM_WRITE(PID_PARAM(Kc, e));
  267. #else
  268. dummy = 1.0f; // 1.0 = default kc
  269. EEPROM_WRITE(dummy);
  270. #endif
  271. }
  272. else
  273. #endif // !PIDTEMP
  274. {
  275. dummy = DUMMY_PID_VALUE; // When read, will not change the existing value
  276. EEPROM_WRITE(dummy); // Kp
  277. dummy = 0.0f;
  278. for (uint8_t q = 3; q--;) EEPROM_WRITE(dummy); // Ki, Kd, Kc
  279. }
  280. } // Hotends Loop
  281. #if DISABLED(PID_EXTRUSION_SCALING)
  282. int lpq_len = 20;
  283. #endif
  284. EEPROM_WRITE(lpq_len);
  285. #if DISABLED(PIDTEMPBED)
  286. dummy = DUMMY_PID_VALUE;
  287. for (uint8_t q = 3; q--;) EEPROM_WRITE(dummy);
  288. #else
  289. EEPROM_WRITE(thermalManager.bedKp);
  290. EEPROM_WRITE(thermalManager.bedKi);
  291. EEPROM_WRITE(thermalManager.bedKd);
  292. #endif
  293. #if !HAS_LCD_CONTRAST
  294. const int lcd_contrast = 32;
  295. #endif
  296. EEPROM_WRITE(lcd_contrast);
  297. #if ENABLED(FWRETRACT)
  298. EEPROM_WRITE(autoretract_enabled);
  299. EEPROM_WRITE(retract_length);
  300. #if EXTRUDERS > 1
  301. EEPROM_WRITE(retract_length_swap);
  302. #else
  303. dummy = 0.0f;
  304. EEPROM_WRITE(dummy);
  305. #endif
  306. EEPROM_WRITE(retract_feedrate_mm_s);
  307. EEPROM_WRITE(retract_zlift);
  308. EEPROM_WRITE(retract_recover_length);
  309. #if EXTRUDERS > 1
  310. EEPROM_WRITE(retract_recover_length_swap);
  311. #else
  312. dummy = 0.0f;
  313. EEPROM_WRITE(dummy);
  314. #endif
  315. EEPROM_WRITE(retract_recover_feedrate_mm_s);
  316. #endif // FWRETRACT
  317. EEPROM_WRITE(volumetric_enabled);
  318. // Save filament sizes
  319. for (uint8_t q = 0; q < MAX_EXTRUDERS; q++) {
  320. if (q < COUNT(filament_size)) dummy = filament_size[q];
  321. EEPROM_WRITE(dummy);
  322. }
  323. uint16_t final_checksum = eeprom_checksum,
  324. eeprom_size = eeprom_index;
  325. eeprom_index = EEPROM_OFFSET;
  326. EEPROM_WRITE(version);
  327. EEPROM_WRITE(final_checksum);
  328. // Report storage size
  329. SERIAL_ECHO_START;
  330. SERIAL_ECHOPAIR("Settings Stored (", eeprom_size);
  331. SERIAL_ECHOLNPGM(" bytes)");
  332. }
  333. /**
  334. * M501 - Retrieve Configuration
  335. */
  336. void Config_RetrieveSettings() {
  337. EEPROM_START();
  338. char stored_ver[4];
  339. EEPROM_READ(stored_ver);
  340. uint16_t stored_checksum;
  341. EEPROM_READ(stored_checksum);
  342. // SERIAL_ECHOPAIR("Version: [", ver);
  343. // SERIAL_ECHOPAIR("] Stored version: [", stored_ver);
  344. // SERIAL_CHAR(']');
  345. // SERIAL_EOL;
  346. if (strncmp(version, stored_ver, 3) != 0) {
  347. Config_ResetDefault();
  348. }
  349. else {
  350. float dummy = 0;
  351. eeprom_checksum = 0; // clear before reading first "real data"
  352. // version number match
  353. EEPROM_READ(planner.axis_steps_per_mm);
  354. EEPROM_READ(planner.max_feedrate_mm_s);
  355. EEPROM_READ(planner.max_acceleration_mm_per_s2);
  356. EEPROM_READ(planner.acceleration);
  357. EEPROM_READ(planner.retract_acceleration);
  358. EEPROM_READ(planner.travel_acceleration);
  359. EEPROM_READ(planner.min_feedrate_mm_s);
  360. EEPROM_READ(planner.min_travel_feedrate_mm_s);
  361. EEPROM_READ(planner.min_segment_time);
  362. EEPROM_READ(planner.max_jerk);
  363. EEPROM_READ(home_offset);
  364. #if HOTENDS > 1
  365. // Skip hotend 0 which must be 0
  366. for (uint8_t e = 1; e < HOTENDS; e++)
  367. LOOP_XYZ(i) EEPROM_READ(hotend_offset[i][e]);
  368. #endif
  369. uint8_t dummy_uint8 = 0, mesh_num_x = 0, mesh_num_y = 0;
  370. EEPROM_READ(dummy_uint8);
  371. EEPROM_READ(dummy);
  372. EEPROM_READ(mesh_num_x);
  373. EEPROM_READ(mesh_num_y);
  374. #if ENABLED(MESH_BED_LEVELING)
  375. mbl.status = dummy_uint8;
  376. mbl.z_offset = dummy;
  377. if (mesh_num_x == MESH_NUM_X_POINTS && mesh_num_y == MESH_NUM_Y_POINTS) {
  378. // EEPROM data fits the current mesh
  379. EEPROM_READ(mbl.z_values);
  380. }
  381. else {
  382. // EEPROM data is stale
  383. mbl.reset();
  384. for (uint8_t q = 0; q < mesh_num_x * mesh_num_y; q++) EEPROM_READ(dummy);
  385. }
  386. #else
  387. // MBL is disabled - skip the stored data
  388. for (uint8_t q = 0; q < mesh_num_x * mesh_num_y; q++) EEPROM_READ(dummy);
  389. #endif // MESH_BED_LEVELING
  390. #if !HAS_BED_PROBE
  391. float zprobe_zoffset = 0;
  392. #endif
  393. EEPROM_READ(zprobe_zoffset);
  394. #if ENABLED(DELTA)
  395. EEPROM_READ(endstop_adj); // 3 floats
  396. EEPROM_READ(delta_radius); // 1 float
  397. EEPROM_READ(delta_diagonal_rod); // 1 float
  398. EEPROM_READ(delta_segments_per_second); // 1 float
  399. EEPROM_READ(delta_diagonal_rod_trim_tower_1); // 1 float
  400. EEPROM_READ(delta_diagonal_rod_trim_tower_2); // 1 float
  401. EEPROM_READ(delta_diagonal_rod_trim_tower_3); // 1 float
  402. #elif ENABLED(Z_DUAL_ENDSTOPS)
  403. EEPROM_READ(z_endstop_adj);
  404. dummy = 0.0f;
  405. for (uint8_t q=8; q--;) EEPROM_READ(dummy);
  406. #else
  407. dummy = 0.0f;
  408. for (uint8_t q=9; q--;) EEPROM_READ(dummy);
  409. #endif
  410. #if DISABLED(ULTIPANEL)
  411. int lcd_preheat_hotend_temp[2], lcd_preheat_bed_temp[2], lcd_preheat_fan_speed[2];
  412. #endif
  413. EEPROM_READ(lcd_preheat_hotend_temp);
  414. EEPROM_READ(lcd_preheat_bed_temp);
  415. EEPROM_READ(lcd_preheat_fan_speed);
  416. #if ENABLED(PIDTEMP)
  417. for (uint8_t e = 0; e < MAX_EXTRUDERS; e++) {
  418. EEPROM_READ(dummy); // Kp
  419. if (e < HOTENDS && dummy != DUMMY_PID_VALUE) {
  420. // do not need to scale PID values as the values in EEPROM are already scaled
  421. PID_PARAM(Kp, e) = dummy;
  422. EEPROM_READ(PID_PARAM(Ki, e));
  423. EEPROM_READ(PID_PARAM(Kd, e));
  424. #if ENABLED(PID_EXTRUSION_SCALING)
  425. EEPROM_READ(PID_PARAM(Kc, e));
  426. #else
  427. EEPROM_READ(dummy);
  428. #endif
  429. }
  430. else {
  431. for (uint8_t q=3; q--;) EEPROM_READ(dummy); // Ki, Kd, Kc
  432. }
  433. }
  434. #else // !PIDTEMP
  435. // 4 x 4 = 16 slots for PID parameters
  436. for (uint8_t q = MAX_EXTRUDERS * 4; q--;) EEPROM_READ(dummy); // Kp, Ki, Kd, Kc
  437. #endif // !PIDTEMP
  438. #if DISABLED(PID_EXTRUSION_SCALING)
  439. int lpq_len;
  440. #endif
  441. EEPROM_READ(lpq_len);
  442. #if ENABLED(PIDTEMPBED)
  443. EEPROM_READ(dummy); // bedKp
  444. if (dummy != DUMMY_PID_VALUE) {
  445. thermalManager.bedKp = dummy;
  446. EEPROM_READ(thermalManager.bedKi);
  447. EEPROM_READ(thermalManager.bedKd);
  448. }
  449. #else
  450. for (uint8_t q=3; q--;) EEPROM_READ(dummy); // bedKp, bedKi, bedKd
  451. #endif
  452. #if !HAS_LCD_CONTRAST
  453. int lcd_contrast;
  454. #endif
  455. EEPROM_READ(lcd_contrast);
  456. #if ENABLED(FWRETRACT)
  457. EEPROM_READ(autoretract_enabled);
  458. EEPROM_READ(retract_length);
  459. #if EXTRUDERS > 1
  460. EEPROM_READ(retract_length_swap);
  461. #else
  462. EEPROM_READ(dummy);
  463. #endif
  464. EEPROM_READ(retract_feedrate_mm_s);
  465. EEPROM_READ(retract_zlift);
  466. EEPROM_READ(retract_recover_length);
  467. #if EXTRUDERS > 1
  468. EEPROM_READ(retract_recover_length_swap);
  469. #else
  470. EEPROM_READ(dummy);
  471. #endif
  472. EEPROM_READ(retract_recover_feedrate_mm_s);
  473. #endif // FWRETRACT
  474. EEPROM_READ(volumetric_enabled);
  475. for (uint8_t q = 0; q < MAX_EXTRUDERS; q++) {
  476. EEPROM_READ(dummy);
  477. if (q < COUNT(filament_size)) filament_size[q] = dummy;
  478. }
  479. if (eeprom_checksum == stored_checksum) {
  480. Config_Postprocess();
  481. SERIAL_ECHO_START;
  482. SERIAL_ECHO(version);
  483. SERIAL_ECHOPAIR(" stored settings retrieved (", eeprom_index);
  484. SERIAL_ECHOLNPGM(" bytes)");
  485. }
  486. else {
  487. SERIAL_ERROR_START;
  488. SERIAL_ERRORLNPGM("EEPROM checksum mismatch");
  489. Config_ResetDefault();
  490. }
  491. }
  492. #if ENABLED(EEPROM_CHITCHAT)
  493. Config_PrintSettings();
  494. #endif
  495. }
  496. #else // !EEPROM_SETTINGS
  497. void Config_StoreSettings() {
  498. SERIAL_ERROR_START;
  499. SERIAL_ERRORLNPGM("EEPROM disabled");
  500. }
  501. #endif // !EEPROM_SETTINGS
  502. /**
  503. * M502 - Reset Configuration
  504. */
  505. void Config_ResetDefault() {
  506. const float tmp1[] = DEFAULT_AXIS_STEPS_PER_UNIT, tmp2[] = DEFAULT_MAX_FEEDRATE;
  507. const long tmp3[] = DEFAULT_MAX_ACCELERATION;
  508. LOOP_XYZE_N(i) {
  509. planner.axis_steps_per_mm[i] = tmp1[i < COUNT(tmp1) ? i : COUNT(tmp1) - 1];
  510. planner.max_feedrate_mm_s[i] = tmp2[i < COUNT(tmp2) ? i : COUNT(tmp2) - 1];
  511. planner.max_acceleration_mm_per_s2[i] = tmp3[i < COUNT(tmp3) ? i : COUNT(tmp3) - 1];
  512. }
  513. planner.acceleration = DEFAULT_ACCELERATION;
  514. planner.retract_acceleration = DEFAULT_RETRACT_ACCELERATION;
  515. planner.travel_acceleration = DEFAULT_TRAVEL_ACCELERATION;
  516. planner.min_feedrate_mm_s = DEFAULT_MINIMUMFEEDRATE;
  517. planner.min_segment_time = DEFAULT_MINSEGMENTTIME;
  518. planner.min_travel_feedrate_mm_s = DEFAULT_MINTRAVELFEEDRATE;
  519. planner.max_jerk[X_AXIS] = DEFAULT_XJERK;
  520. planner.max_jerk[Y_AXIS] = DEFAULT_YJERK;
  521. planner.max_jerk[Z_AXIS] = DEFAULT_ZJERK;
  522. planner.max_jerk[E_AXIS] = DEFAULT_EJERK;
  523. home_offset[X_AXIS] = home_offset[Y_AXIS] = home_offset[Z_AXIS] = 0;
  524. #if HOTENDS > 1
  525. constexpr float tmp4[XYZ][HOTENDS] = {
  526. HOTEND_OFFSET_X,
  527. HOTEND_OFFSET_Y
  528. #ifdef HOTEND_OFFSET_Z
  529. , HOTEND_OFFSET_Z
  530. #else
  531. , { 0 }
  532. #endif
  533. };
  534. static_assert(
  535. tmp4[X_AXIS][0] == 0 && tmp4[Y_AXIS][0] == 0 && tmp4[Z_AXIS][0] == 0,
  536. "Offsets for the first hotend must be 0.0."
  537. );
  538. LOOP_XYZ(i) HOTEND_LOOP() hotend_offset[i][e] = tmp4[i][e];
  539. #endif
  540. #if ENABLED(MESH_BED_LEVELING)
  541. mbl.reset();
  542. #endif
  543. #if HAS_BED_PROBE
  544. zprobe_zoffset = Z_PROBE_OFFSET_FROM_EXTRUDER;
  545. #endif
  546. #if ENABLED(DELTA)
  547. const float adj[ABC] = DELTA_ENDSTOP_ADJ;
  548. endstop_adj[A_AXIS] = adj[A_AXIS];
  549. endstop_adj[B_AXIS] = adj[B_AXIS];
  550. endstop_adj[C_AXIS] = adj[C_AXIS];
  551. delta_radius = DELTA_RADIUS;
  552. delta_diagonal_rod = DELTA_DIAGONAL_ROD;
  553. delta_segments_per_second = DELTA_SEGMENTS_PER_SECOND;
  554. delta_diagonal_rod_trim_tower_1 = DELTA_DIAGONAL_ROD_TRIM_TOWER_1;
  555. delta_diagonal_rod_trim_tower_2 = DELTA_DIAGONAL_ROD_TRIM_TOWER_2;
  556. delta_diagonal_rod_trim_tower_3 = DELTA_DIAGONAL_ROD_TRIM_TOWER_3;
  557. #elif ENABLED(Z_DUAL_ENDSTOPS)
  558. z_endstop_adj = 0;
  559. #endif
  560. #if ENABLED(ULTIPANEL)
  561. lcd_preheat_hotend_temp[0] = PREHEAT_1_TEMP_HOTEND;
  562. lcd_preheat_hotend_temp[1] = PREHEAT_2_TEMP_HOTEND;
  563. lcd_preheat_bed_temp[0] = PREHEAT_1_TEMP_BED;
  564. lcd_preheat_bed_temp[1] = PREHEAT_2_TEMP_BED;
  565. lcd_preheat_fan_speed[0] = PREHEAT_1_FAN_SPEED;
  566. lcd_preheat_fan_speed[1] = PREHEAT_2_FAN_SPEED;
  567. #endif
  568. #if HAS_LCD_CONTRAST
  569. lcd_contrast = DEFAULT_LCD_CONTRAST;
  570. #endif
  571. #if ENABLED(PIDTEMP)
  572. #if ENABLED(PID_PARAMS_PER_HOTEND) && HOTENDS > 1
  573. HOTEND_LOOP()
  574. #else
  575. int e = 0; UNUSED(e); // only need to write once
  576. #endif
  577. {
  578. PID_PARAM(Kp, e) = DEFAULT_Kp;
  579. PID_PARAM(Ki, e) = scalePID_i(DEFAULT_Ki);
  580. PID_PARAM(Kd, e) = scalePID_d(DEFAULT_Kd);
  581. #if ENABLED(PID_EXTRUSION_SCALING)
  582. PID_PARAM(Kc, e) = DEFAULT_Kc;
  583. #endif
  584. }
  585. #if ENABLED(PID_EXTRUSION_SCALING)
  586. lpq_len = 20; // default last-position-queue size
  587. #endif
  588. #endif // PIDTEMP
  589. #if ENABLED(PIDTEMPBED)
  590. thermalManager.bedKp = DEFAULT_bedKp;
  591. thermalManager.bedKi = scalePID_i(DEFAULT_bedKi);
  592. thermalManager.bedKd = scalePID_d(DEFAULT_bedKd);
  593. #endif
  594. #if ENABLED(FWRETRACT)
  595. autoretract_enabled = false;
  596. retract_length = RETRACT_LENGTH;
  597. #if EXTRUDERS > 1
  598. retract_length_swap = RETRACT_LENGTH_SWAP;
  599. #endif
  600. retract_feedrate_mm_s = RETRACT_FEEDRATE;
  601. retract_zlift = RETRACT_ZLIFT;
  602. retract_recover_length = RETRACT_RECOVER_LENGTH;
  603. #if EXTRUDERS > 1
  604. retract_recover_length_swap = RETRACT_RECOVER_LENGTH_SWAP;
  605. #endif
  606. retract_recover_feedrate_mm_s = RETRACT_RECOVER_FEEDRATE;
  607. #endif
  608. volumetric_enabled = false;
  609. for (uint8_t q = 0; q < COUNT(filament_size); q++)
  610. filament_size[q] = DEFAULT_NOMINAL_FILAMENT_DIA;
  611. endstops.enable_globally(
  612. #if ENABLED(ENDSTOPS_ALWAYS_ON_DEFAULT)
  613. (true)
  614. #else
  615. (false)
  616. #endif
  617. );
  618. Config_Postprocess();
  619. SERIAL_ECHO_START;
  620. SERIAL_ECHOLNPGM("Hardcoded Default Settings Loaded");
  621. }
  622. #if DISABLED(DISABLE_M503)
  623. #define CONFIG_ECHO_START do{ if (!forReplay) SERIAL_ECHO_START; }while(0)
  624. /**
  625. * M503 - Print Configuration
  626. */
  627. void Config_PrintSettings(bool forReplay) {
  628. // Always have this function, even with EEPROM_SETTINGS disabled, the current values will be shown
  629. CONFIG_ECHO_START;
  630. if (!forReplay) {
  631. SERIAL_ECHOLNPGM("Steps per unit:");
  632. CONFIG_ECHO_START;
  633. }
  634. SERIAL_ECHOPAIR(" M92 X", planner.axis_steps_per_mm[X_AXIS]);
  635. SERIAL_ECHOPAIR(" Y", planner.axis_steps_per_mm[Y_AXIS]);
  636. SERIAL_ECHOPAIR(" Z", planner.axis_steps_per_mm[Z_AXIS]);
  637. #if E_STEPPERS == 1
  638. SERIAL_ECHOPAIR(" E", planner.axis_steps_per_mm[E_AXIS]);
  639. #endif
  640. SERIAL_EOL;
  641. #if ENABLED(DISTINCT_E_FACTORS)
  642. for (uint8_t i = 0; i < E_STEPPERS; i++) {
  643. SERIAL_ECHOPAIR(" M92 T", (int)i);
  644. SERIAL_ECHOLNPAIR(" E", planner.axis_steps_per_mm[E_AXIS + i]);
  645. }
  646. #endif
  647. CONFIG_ECHO_START;
  648. if (!forReplay) {
  649. SERIAL_ECHOLNPGM("Maximum feedrates (mm/s):");
  650. CONFIG_ECHO_START;
  651. }
  652. SERIAL_ECHOPAIR(" M203 X", planner.max_feedrate_mm_s[X_AXIS]);
  653. SERIAL_ECHOPAIR(" Y", planner.max_feedrate_mm_s[Y_AXIS]);
  654. SERIAL_ECHOPAIR(" Z", planner.max_feedrate_mm_s[Z_AXIS]);
  655. #if E_STEPPERS == 1
  656. SERIAL_ECHOPAIR(" E", planner.max_feedrate_mm_s[E_AXIS]);
  657. #endif
  658. SERIAL_EOL;
  659. #if ENABLED(DISTINCT_E_FACTORS)
  660. for (uint8_t i = 0; i < E_STEPPERS; i++) {
  661. SERIAL_ECHOPAIR(" M203 T", (int)i);
  662. SERIAL_ECHOLNPAIR(" E", planner.max_feedrate_mm_s[E_AXIS + i]);
  663. }
  664. #endif
  665. CONFIG_ECHO_START;
  666. if (!forReplay) {
  667. SERIAL_ECHOLNPGM("Maximum Acceleration (mm/s2):");
  668. CONFIG_ECHO_START;
  669. }
  670. SERIAL_ECHOPAIR(" M201 X", planner.max_acceleration_mm_per_s2[X_AXIS]);
  671. SERIAL_ECHOPAIR(" Y", planner.max_acceleration_mm_per_s2[Y_AXIS]);
  672. SERIAL_ECHOPAIR(" Z", planner.max_acceleration_mm_per_s2[Z_AXIS]);
  673. #if E_STEPPERS == 1
  674. SERIAL_ECHOPAIR(" E", planner.max_acceleration_mm_per_s2[E_AXIS]);
  675. #endif
  676. SERIAL_EOL;
  677. #if ENABLED(DISTINCT_E_FACTORS)
  678. for (uint8_t i = 0; i < E_STEPPERS; i++) {
  679. SERIAL_ECHOPAIR(" M201 T", (int)i);
  680. SERIAL_ECHOLNPAIR(" E", planner.max_acceleration_mm_per_s2[E_AXIS + i]);
  681. }
  682. #endif
  683. CONFIG_ECHO_START;
  684. if (!forReplay) {
  685. SERIAL_ECHOLNPGM("Accelerations: P=printing, R=retract and T=travel");
  686. CONFIG_ECHO_START;
  687. }
  688. SERIAL_ECHOPAIR(" M204 P", planner.acceleration);
  689. SERIAL_ECHOPAIR(" R", planner.retract_acceleration);
  690. SERIAL_ECHOPAIR(" T", planner.travel_acceleration);
  691. SERIAL_EOL;
  692. CONFIG_ECHO_START;
  693. if (!forReplay) {
  694. SERIAL_ECHOLNPGM("Advanced variables: S=Min feedrate (mm/s), T=Min travel feedrate (mm/s), B=minimum segment time (ms), X=maximum XY jerk (mm/s), Z=maximum Z jerk (mm/s), E=maximum E jerk (mm/s)");
  695. CONFIG_ECHO_START;
  696. }
  697. SERIAL_ECHOPAIR(" M205 S", planner.min_feedrate_mm_s);
  698. SERIAL_ECHOPAIR(" T", planner.min_travel_feedrate_mm_s);
  699. SERIAL_ECHOPAIR(" B", planner.min_segment_time);
  700. SERIAL_ECHOPAIR(" X", planner.max_jerk[X_AXIS]);
  701. SERIAL_ECHOPAIR(" Y", planner.max_jerk[Y_AXIS]);
  702. SERIAL_ECHOPAIR(" Z", planner.max_jerk[Z_AXIS]);
  703. SERIAL_ECHOPAIR(" E", planner.max_jerk[E_AXIS]);
  704. SERIAL_EOL;
  705. CONFIG_ECHO_START;
  706. if (!forReplay) {
  707. SERIAL_ECHOLNPGM("Home offset (mm)");
  708. CONFIG_ECHO_START;
  709. }
  710. SERIAL_ECHOPAIR(" M206 X", home_offset[X_AXIS]);
  711. SERIAL_ECHOPAIR(" Y", home_offset[Y_AXIS]);
  712. SERIAL_ECHOPAIR(" Z", home_offset[Z_AXIS]);
  713. SERIAL_EOL;
  714. #if HOTENDS > 1
  715. CONFIG_ECHO_START;
  716. if (!forReplay) {
  717. SERIAL_ECHOLNPGM("Hotend offsets (mm)");
  718. CONFIG_ECHO_START;
  719. }
  720. for (uint8_t e = 1; e < HOTENDS; e++) {
  721. SERIAL_ECHOPAIR(" M218 T", (int)e);
  722. SERIAL_ECHOPAIR(" X", hotend_offset[X_AXIS][e]);
  723. SERIAL_ECHOPAIR(" Y", hotend_offset[Y_AXIS][e]);
  724. #if ENABLED(DUAL_X_CARRIAGE) || ENABLED(SWITCHING_EXTRUDER)
  725. SERIAL_ECHOPAIR(" Z", hotend_offset[Z_AXIS][e]);
  726. #endif
  727. SERIAL_EOL;
  728. }
  729. #endif
  730. #if ENABLED(MESH_BED_LEVELING)
  731. if (!forReplay) {
  732. SERIAL_ECHOLNPGM("Mesh bed leveling:");
  733. CONFIG_ECHO_START;
  734. }
  735. SERIAL_ECHOPAIR(" M420 S", mbl.has_mesh() ? 1 : 0);
  736. SERIAL_ECHOPAIR(" X", MESH_NUM_X_POINTS);
  737. SERIAL_ECHOPAIR(" Y", MESH_NUM_Y_POINTS);
  738. SERIAL_EOL;
  739. for (uint8_t py = 1; py <= MESH_NUM_Y_POINTS; py++) {
  740. for (uint8_t px = 1; px <= MESH_NUM_X_POINTS; px++) {
  741. CONFIG_ECHO_START;
  742. SERIAL_ECHOPAIR(" G29 S3 X", (int)px);
  743. SERIAL_ECHOPAIR(" Y", (int)py);
  744. SERIAL_ECHOPGM(" Z");
  745. SERIAL_PROTOCOL_F(mbl.z_values[py-1][px-1], 5);
  746. SERIAL_EOL;
  747. }
  748. }
  749. #endif
  750. #if ENABLED(DELTA)
  751. CONFIG_ECHO_START;
  752. if (!forReplay) {
  753. SERIAL_ECHOLNPGM("Endstop adjustment (mm):");
  754. CONFIG_ECHO_START;
  755. }
  756. SERIAL_ECHOPAIR(" M666 X", endstop_adj[X_AXIS]);
  757. SERIAL_ECHOPAIR(" Y", endstop_adj[Y_AXIS]);
  758. SERIAL_ECHOPAIR(" Z", endstop_adj[Z_AXIS]);
  759. SERIAL_EOL;
  760. CONFIG_ECHO_START;
  761. if (!forReplay) {
  762. SERIAL_ECHOLNPGM("Delta settings: L=diagonal_rod, R=radius, S=segments_per_second, ABC=diagonal_rod_trim_tower_[123]");
  763. CONFIG_ECHO_START;
  764. }
  765. SERIAL_ECHOPAIR(" M665 L", delta_diagonal_rod);
  766. SERIAL_ECHOPAIR(" R", delta_radius);
  767. SERIAL_ECHOPAIR(" S", delta_segments_per_second);
  768. SERIAL_ECHOPAIR(" A", delta_diagonal_rod_trim_tower_1);
  769. SERIAL_ECHOPAIR(" B", delta_diagonal_rod_trim_tower_2);
  770. SERIAL_ECHOPAIR(" C", delta_diagonal_rod_trim_tower_3);
  771. SERIAL_EOL;
  772. #elif ENABLED(Z_DUAL_ENDSTOPS)
  773. CONFIG_ECHO_START;
  774. if (!forReplay) {
  775. SERIAL_ECHOLNPGM("Z2 Endstop adjustment (mm):");
  776. CONFIG_ECHO_START;
  777. }
  778. SERIAL_ECHOPAIR(" M666 Z", z_endstop_adj);
  779. SERIAL_EOL;
  780. #endif // DELTA
  781. #if ENABLED(ULTIPANEL)
  782. CONFIG_ECHO_START;
  783. if (!forReplay) {
  784. SERIAL_ECHOLNPGM("Material heatup parameters:");
  785. CONFIG_ECHO_START;
  786. }
  787. for (uint8_t i = 0; i < COUNT(lcd_preheat_hotend_temp); i++) {
  788. SERIAL_ECHOPAIR(" M145 S", (int)i);
  789. SERIAL_ECHOPAIR(" H", lcd_preheat_hotend_temp[i]);
  790. SERIAL_ECHOPAIR(" B", lcd_preheat_bed_temp[i]);
  791. SERIAL_ECHOPAIR(" F", lcd_preheat_fan_speed[i]);
  792. SERIAL_EOL;
  793. }
  794. #endif // ULTIPANEL
  795. #if HAS_PID_HEATING
  796. CONFIG_ECHO_START;
  797. if (!forReplay) {
  798. SERIAL_ECHOLNPGM("PID settings:");
  799. }
  800. #if ENABLED(PIDTEMP)
  801. #if HOTENDS > 1
  802. if (forReplay) {
  803. HOTEND_LOOP() {
  804. CONFIG_ECHO_START;
  805. SERIAL_ECHOPAIR(" M301 E", e);
  806. SERIAL_ECHOPAIR(" P", PID_PARAM(Kp, e));
  807. SERIAL_ECHOPAIR(" I", unscalePID_i(PID_PARAM(Ki, e)));
  808. SERIAL_ECHOPAIR(" D", unscalePID_d(PID_PARAM(Kd, e)));
  809. #if ENABLED(PID_EXTRUSION_SCALING)
  810. SERIAL_ECHOPAIR(" C", PID_PARAM(Kc, e));
  811. if (e == 0) SERIAL_ECHOPAIR(" L", lpq_len);
  812. #endif
  813. SERIAL_EOL;
  814. }
  815. }
  816. else
  817. #endif // HOTENDS > 1
  818. // !forReplay || HOTENDS == 1
  819. {
  820. CONFIG_ECHO_START;
  821. SERIAL_ECHOPAIR(" M301 P", PID_PARAM(Kp, 0)); // for compatibility with hosts, only echo values for E0
  822. SERIAL_ECHOPAIR(" I", unscalePID_i(PID_PARAM(Ki, 0)));
  823. SERIAL_ECHOPAIR(" D", unscalePID_d(PID_PARAM(Kd, 0)));
  824. #if ENABLED(PID_EXTRUSION_SCALING)
  825. SERIAL_ECHOPAIR(" C", PID_PARAM(Kc, 0));
  826. SERIAL_ECHOPAIR(" L", lpq_len);
  827. #endif
  828. SERIAL_EOL;
  829. }
  830. #endif // PIDTEMP
  831. #if ENABLED(PIDTEMPBED)
  832. CONFIG_ECHO_START;
  833. SERIAL_ECHOPAIR(" M304 P", thermalManager.bedKp);
  834. SERIAL_ECHOPAIR(" I", unscalePID_i(thermalManager.bedKi));
  835. SERIAL_ECHOPAIR(" D", unscalePID_d(thermalManager.bedKd));
  836. SERIAL_EOL;
  837. #endif
  838. #endif // PIDTEMP || PIDTEMPBED
  839. #if HAS_LCD_CONTRAST
  840. CONFIG_ECHO_START;
  841. if (!forReplay) {
  842. SERIAL_ECHOLNPGM("LCD Contrast:");
  843. CONFIG_ECHO_START;
  844. }
  845. SERIAL_ECHOPAIR(" M250 C", lcd_contrast);
  846. SERIAL_EOL;
  847. #endif
  848. #if ENABLED(FWRETRACT)
  849. CONFIG_ECHO_START;
  850. if (!forReplay) {
  851. SERIAL_ECHOLNPGM("Retract: S=Length (mm) F:Speed (mm/m) Z: ZLift (mm)");
  852. CONFIG_ECHO_START;
  853. }
  854. SERIAL_ECHOPAIR(" M207 S", retract_length);
  855. #if EXTRUDERS > 1
  856. SERIAL_ECHOPAIR(" W", retract_length_swap);
  857. #endif
  858. SERIAL_ECHOPAIR(" F", MMS_TO_MMM(retract_feedrate_mm_s));
  859. SERIAL_ECHOPAIR(" Z", retract_zlift);
  860. SERIAL_EOL;
  861. CONFIG_ECHO_START;
  862. if (!forReplay) {
  863. SERIAL_ECHOLNPGM("Recover: S=Extra length (mm) F:Speed (mm/m)");
  864. CONFIG_ECHO_START;
  865. }
  866. SERIAL_ECHOPAIR(" M208 S", retract_recover_length);
  867. #if EXTRUDERS > 1
  868. SERIAL_ECHOPAIR(" W", retract_recover_length_swap);
  869. #endif
  870. SERIAL_ECHOPAIR(" F", MMS_TO_MMM(retract_recover_feedrate_mm_s));
  871. SERIAL_EOL;
  872. CONFIG_ECHO_START;
  873. if (!forReplay) {
  874. SERIAL_ECHOLNPGM("Auto-Retract: S=0 to disable, 1 to interpret extrude-only moves as retracts or recoveries");
  875. CONFIG_ECHO_START;
  876. }
  877. SERIAL_ECHOPAIR(" M209 S", autoretract_enabled ? 1 : 0);
  878. SERIAL_EOL;
  879. #endif // FWRETRACT
  880. /**
  881. * Volumetric extrusion M200
  882. */
  883. if (!forReplay) {
  884. CONFIG_ECHO_START;
  885. SERIAL_ECHOPGM("Filament settings:");
  886. if (volumetric_enabled)
  887. SERIAL_EOL;
  888. else
  889. SERIAL_ECHOLNPGM(" Disabled");
  890. }
  891. CONFIG_ECHO_START;
  892. SERIAL_ECHOPAIR(" M200 D", filament_size[0]);
  893. SERIAL_EOL;
  894. #if EXTRUDERS > 1
  895. CONFIG_ECHO_START;
  896. SERIAL_ECHOPAIR(" M200 T1 D", filament_size[1]);
  897. SERIAL_EOL;
  898. #if EXTRUDERS > 2
  899. CONFIG_ECHO_START;
  900. SERIAL_ECHOPAIR(" M200 T2 D", filament_size[2]);
  901. SERIAL_EOL;
  902. #if EXTRUDERS > 3
  903. CONFIG_ECHO_START;
  904. SERIAL_ECHOPAIR(" M200 T3 D", filament_size[3]);
  905. SERIAL_EOL;
  906. #endif
  907. #endif
  908. #endif
  909. if (!volumetric_enabled) {
  910. CONFIG_ECHO_START;
  911. SERIAL_ECHOLNPGM(" M200 D0");
  912. }
  913. /**
  914. * Auto Bed Leveling
  915. */
  916. #if HAS_BED_PROBE
  917. if (!forReplay) {
  918. CONFIG_ECHO_START;
  919. SERIAL_ECHOLNPGM("Z-Probe Offset (mm):");
  920. }
  921. CONFIG_ECHO_START;
  922. SERIAL_ECHOPAIR(" M851 Z", zprobe_zoffset);
  923. SERIAL_EOL;
  924. #endif
  925. }
  926. #endif // !DISABLE_M503