My Marlin configs for Fabrikator Mini and CTC i3 Pro B
Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

configuration_store.cpp 34KB

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