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.

configuration_store.cpp 49KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508
  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 "V32"
  38. // Change EEPROM version if these are changed:
  39. #define EEPROM_OFFSET 100
  40. /**
  41. * V31 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 ... x8)
  48. * 123 M203 XYZE planner.max_feedrate_mm_s (float x4 ... x8)
  49. * 139 M201 XYZE planner.max_acceleration_mm_per_s2 (uint32_t x4 ... x8)
  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: 43 bytes
  64. * 219 M420 S from mbl.status (bool)
  65. * 220 mbl.z_offset (float)
  66. * 224 GRID_MAX_POINTS_X (uint8_t)
  67. * 225 GRID_MAX_POINTS_Y (uint8_t)
  68. * 226 G29 S3 XYZ z_values[][] (float x9, up to float x 81) +288
  69. *
  70. * AUTO BED LEVELING 4 bytes
  71. * 262 M851 zprobe_zoffset (float)
  72. *
  73. * ABL_PLANAR (or placeholder): 36 bytes
  74. * 266 planner.bed_level_matrix (matrix_3x3 = float x9)
  75. *
  76. * AUTO_BED_LEVELING_BILINEAR (or placeholder): 47 bytes
  77. * 302 GRID_MAX_POINTS_X (uint8_t)
  78. * 303 GRID_MAX_POINTS_Y (uint8_t)
  79. * 304 bilinear_grid_spacing (int x2)
  80. * 308 G29 L F bilinear_start (int x2)
  81. * 312 bed_level_grid[][] (float x9, up to float x256) +988
  82. *
  83. * DELTA (if deltabot): 48 bytes
  84. * 348 M666 XYZ endstop_adj (float x3)
  85. * 360 M665 R delta_radius (float)
  86. * 364 M665 L delta_diagonal_rod (float)
  87. * 368 M665 S delta_segments_per_second (float)
  88. * 372 M665 A delta_diagonal_rod_trim[A] (float)
  89. * 376 M665 B delta_diagonal_rod_trim[B] (float)
  90. * 380 M665 C delta_diagonal_rod_trim[C] (float)
  91. * 384 M665 I delta_tower_angle_trim[A] (float)
  92. * 388 M665 J delta_tower_angle_trim[B] (float)
  93. * 392 M665 K delta_tower_angle_trim[C] (float)
  94. *
  95. * Z_DUAL_ENDSTOPS (if not deltabot): 48 bytes
  96. * 348 M666 Z z_endstop_adj (float)
  97. * --- dummy data (float x11)
  98. *
  99. * ULTIPANEL: 6 bytes
  100. * 396 M145 S0 H lcd_preheat_hotend_temp (int x2)
  101. * 400 M145 S0 B lcd_preheat_bed_temp (int x2)
  102. * 404 M145 S0 F lcd_preheat_fan_speed (int x2)
  103. *
  104. * PIDTEMP: 66 bytes
  105. * 408 M301 E0 PIDC Kp[0], Ki[0], Kd[0], Kc[0] (float x4)
  106. * 424 M301 E1 PIDC Kp[1], Ki[1], Kd[1], Kc[1] (float x4)
  107. * 440 M301 E2 PIDC Kp[2], Ki[2], Kd[2], Kc[2] (float x4)
  108. * 456 M301 E3 PIDC Kp[3], Ki[3], Kd[3], Kc[3] (float x4)
  109. * 472 M301 E4 PIDC Kp[3], Ki[3], Kd[3], Kc[3] (float x4)
  110. * 488 M301 L lpq_len (int)
  111. *
  112. * PIDTEMPBED: 12 bytes
  113. * 490 M304 PID thermalManager.bedKp, .bedKi, .bedKd (float x3)
  114. *
  115. * DOGLCD: 2 bytes
  116. * 502 M250 C lcd_contrast (int)
  117. *
  118. * FWRETRACT: 29 bytes
  119. * 504 M209 S autoretract_enabled (bool)
  120. * 505 M207 S retract_length (float)
  121. * 509 M207 W retract_length_swap (float)
  122. * 513 M207 F retract_feedrate_mm_s (float)
  123. * 517 M207 Z retract_zlift (float)
  124. * 521 M208 S retract_recover_length (float)
  125. * 525 M208 W retract_recover_length_swap (float)
  126. * 529 M208 F retract_recover_feedrate_mm_s (float)
  127. *
  128. * Volumetric Extrusion: 21 bytes
  129. * 533 M200 D volumetric_enabled (bool)
  130. * 534 M200 T D filament_size (float x5) (T0..3)
  131. *
  132. * TMC2130 Stepper Current: 20 bytes
  133. * 554 M906 X stepperX current (uint16_t)
  134. * 556 M906 Y stepperY current (uint16_t)
  135. * 558 M906 Z stepperZ current (uint16_t)
  136. * 560 M906 X2 stepperX2 current (uint16_t)
  137. * 562 M906 Y2 stepperY2 current (uint16_t)
  138. * 564 M906 Z2 stepperZ2 current (uint16_t)
  139. * 566 M906 E0 stepperE0 current (uint16_t)
  140. * 568 M906 E1 stepperE1 current (uint16_t)
  141. * 570 M906 E2 stepperE2 current (uint16_t)
  142. * 572 M906 E3 stepperE3 current (uint16_t)
  143. *
  144. * 574 Minimum end-point
  145. * 1895 (574 + 36 + 9 + 288 + 988) Maximum end-point
  146. *
  147. */
  148. #include "Marlin.h"
  149. #include "language.h"
  150. #include "endstops.h"
  151. #include "planner.h"
  152. #include "temperature.h"
  153. #include "ultralcd.h"
  154. #include "configuration_store.h"
  155. #if ENABLED(MESH_BED_LEVELING)
  156. #include "mesh_bed_leveling.h"
  157. #endif
  158. #if ENABLED(HAVE_TMC2130)
  159. #include "stepper_indirection.h"
  160. #endif
  161. #if ENABLED(AUTO_BED_LEVELING_UBL)
  162. #include "ubl.h"
  163. #endif
  164. #if ENABLED(ABL_BILINEAR_SUBDIVISION)
  165. extern void bed_level_virt_interpolate();
  166. #endif
  167. /**
  168. * Post-process after Retrieve or Reset
  169. */
  170. void Config_Postprocess() {
  171. // steps per s2 needs to be updated to agree with units per s2
  172. planner.reset_acceleration_rates();
  173. // Make sure delta kinematics are updated before refreshing the
  174. // planner position so the stepper counts will be set correctly.
  175. #if ENABLED(DELTA)
  176. recalc_delta_settings(delta_radius, delta_diagonal_rod);
  177. #endif
  178. // Refresh steps_to_mm with the reciprocal of axis_steps_per_mm
  179. // and init stepper.count[], planner.position[] with current_position
  180. planner.refresh_positioning();
  181. #if ENABLED(PIDTEMP)
  182. thermalManager.updatePID();
  183. #endif
  184. calculate_volumetric_multipliers();
  185. #if DISABLED(NO_WORKSPACE_OFFSETS) || ENABLED(DUAL_X_CARRIAGE) || ENABLED(DELTA)
  186. // Software endstops depend on home_offset
  187. LOOP_XYZ(i) update_software_endstops((AxisEnum)i);
  188. #endif
  189. }
  190. #if ENABLED(EEPROM_SETTINGS)
  191. uint16_t eeprom_checksum;
  192. const char version[4] = EEPROM_VERSION;
  193. bool eeprom_write_error;
  194. void _EEPROM_writeData(int &pos, const uint8_t* value, uint16_t size) {
  195. if (eeprom_write_error) return;
  196. while (size--) {
  197. uint8_t * const p = (uint8_t * const)pos;
  198. const uint8_t v = *value;
  199. // EEPROM has only ~100,000 write cycles,
  200. // so only write bytes that have changed!
  201. if (v != eeprom_read_byte(p)) {
  202. eeprom_write_byte(p, v);
  203. if (eeprom_read_byte(p) != v) {
  204. SERIAL_ECHO_START;
  205. SERIAL_ECHOLNPGM(MSG_ERR_EEPROM_WRITE);
  206. eeprom_write_error = true;
  207. return;
  208. }
  209. }
  210. eeprom_checksum += v;
  211. pos++;
  212. value++;
  213. };
  214. }
  215. bool eeprom_read_error;
  216. void _EEPROM_readData(int &pos, uint8_t* value, uint16_t size) {
  217. do {
  218. uint8_t c = eeprom_read_byte((unsigned char*)pos);
  219. if (!eeprom_read_error) *value = c;
  220. eeprom_checksum += c;
  221. pos++;
  222. value++;
  223. } while (--size);
  224. }
  225. #define DUMMY_PID_VALUE 3000.0f
  226. #define EEPROM_START() int eeprom_index = EEPROM_OFFSET
  227. #define EEPROM_SKIP(VAR) eeprom_index += sizeof(VAR)
  228. #define EEPROM_WRITE(VAR) _EEPROM_writeData(eeprom_index, (uint8_t*)&VAR, sizeof(VAR))
  229. #define EEPROM_READ(VAR) _EEPROM_readData(eeprom_index, (uint8_t*)&VAR, sizeof(VAR))
  230. #define EEPROM_ASSERT(TST,ERR) if () do{ SERIAL_ERROR_START; SERIAL_ERRORLNPGM(ERR); eeprom_read_error |= true; }while(0)
  231. /**
  232. * M500 - Store Configuration
  233. */
  234. bool Config_StoreSettings() {
  235. float dummy = 0.0f;
  236. char ver[4] = "000";
  237. EEPROM_START();
  238. eeprom_write_error = false;
  239. EEPROM_WRITE(ver); // invalidate data first
  240. EEPROM_SKIP(eeprom_checksum); // Skip the checksum slot
  241. eeprom_checksum = 0; // clear before first "real data"
  242. const uint8_t esteppers = COUNT(planner.axis_steps_per_mm) - XYZ;
  243. EEPROM_WRITE(esteppers);
  244. EEPROM_WRITE(planner.axis_steps_per_mm);
  245. EEPROM_WRITE(planner.max_feedrate_mm_s);
  246. EEPROM_WRITE(planner.max_acceleration_mm_per_s2);
  247. EEPROM_WRITE(planner.acceleration);
  248. EEPROM_WRITE(planner.retract_acceleration);
  249. EEPROM_WRITE(planner.travel_acceleration);
  250. EEPROM_WRITE(planner.min_feedrate_mm_s);
  251. EEPROM_WRITE(planner.min_travel_feedrate_mm_s);
  252. EEPROM_WRITE(planner.min_segment_time);
  253. EEPROM_WRITE(planner.max_jerk);
  254. #if ENABLED(NO_WORKSPACE_OFFSETS)
  255. float home_offset[XYZ] = { 0 };
  256. #endif
  257. EEPROM_WRITE(home_offset);
  258. #if HOTENDS > 1
  259. // Skip hotend 0 which must be 0
  260. for (uint8_t e = 1; e < HOTENDS; e++)
  261. LOOP_XYZ(i) EEPROM_WRITE(hotend_offset[i][e]);
  262. #endif
  263. //
  264. // Mesh Bed Leveling
  265. //
  266. #if ENABLED(MESH_BED_LEVELING)
  267. // Compile time test that sizeof(mbl.z_values) is as expected
  268. typedef char c_assert[(sizeof(mbl.z_values) == (GRID_MAX_POINTS_X) * (GRID_MAX_POINTS_Y) * sizeof(dummy)) ? 1 : -1];
  269. const bool leveling_is_on = TEST(mbl.status, MBL_STATUS_HAS_MESH_BIT);
  270. const uint8_t mesh_num_x = GRID_MAX_POINTS_X, mesh_num_y = GRID_MAX_POINTS_Y;
  271. EEPROM_WRITE(leveling_is_on);
  272. EEPROM_WRITE(mbl.z_offset);
  273. EEPROM_WRITE(mesh_num_x);
  274. EEPROM_WRITE(mesh_num_y);
  275. EEPROM_WRITE(mbl.z_values);
  276. #else
  277. // For disabled MBL write a default mesh
  278. const bool leveling_is_on = false;
  279. dummy = 0.0f;
  280. const uint8_t mesh_num_x = 3, mesh_num_y = 3;
  281. EEPROM_WRITE(leveling_is_on);
  282. EEPROM_WRITE(dummy); // z_offset
  283. EEPROM_WRITE(mesh_num_x);
  284. EEPROM_WRITE(mesh_num_y);
  285. for (uint8_t q = mesh_num_x * mesh_num_y; q--;) EEPROM_WRITE(dummy);
  286. #endif // MESH_BED_LEVELING
  287. #if !HAS_BED_PROBE
  288. float zprobe_zoffset = 0;
  289. #endif
  290. EEPROM_WRITE(zprobe_zoffset);
  291. //
  292. // Planar Bed Leveling matrix
  293. //
  294. #if ABL_PLANAR
  295. EEPROM_WRITE(planner.bed_level_matrix);
  296. #else
  297. dummy = 0.0;
  298. for (uint8_t q = 9; q--;) EEPROM_WRITE(dummy);
  299. #endif
  300. //
  301. // Bilinear Auto Bed Leveling
  302. //
  303. #if ENABLED(AUTO_BED_LEVELING_BILINEAR)
  304. // Compile time test that sizeof(bed_level_grid) is as expected
  305. typedef char c_assert[(sizeof(bed_level_grid) == (GRID_MAX_POINTS_X) * (GRID_MAX_POINTS_Y) * sizeof(dummy)) ? 1 : -1];
  306. const uint8_t grid_max_x = GRID_MAX_POINTS_X, grid_max_y = GRID_MAX_POINTS_Y;
  307. EEPROM_WRITE(grid_max_x); // 1 byte
  308. EEPROM_WRITE(grid_max_y); // 1 byte
  309. EEPROM_WRITE(bilinear_grid_spacing); // 2 ints
  310. EEPROM_WRITE(bilinear_start); // 2 ints
  311. EEPROM_WRITE(bed_level_grid); // 9-256 floats
  312. #else
  313. // For disabled Bilinear Grid write an empty 3x3 grid
  314. const uint8_t grid_max_x = 3, grid_max_y = 3;
  315. const int bilinear_start[2] = { 0 }, bilinear_grid_spacing[2] = { 0 };
  316. dummy = 0.0f;
  317. EEPROM_WRITE(grid_max_x);
  318. EEPROM_WRITE(grid_max_y);
  319. EEPROM_WRITE(bilinear_grid_spacing);
  320. EEPROM_WRITE(bilinear_start);
  321. for (uint16_t q = grid_max_x * grid_max_y; q--;) EEPROM_WRITE(dummy);
  322. #endif // AUTO_BED_LEVELING_BILINEAR
  323. // 9 floats for DELTA / Z_DUAL_ENDSTOPS
  324. #if ENABLED(DELTA)
  325. EEPROM_WRITE(endstop_adj); // 3 floats
  326. EEPROM_WRITE(delta_radius); // 1 float
  327. EEPROM_WRITE(delta_diagonal_rod); // 1 float
  328. EEPROM_WRITE(delta_segments_per_second); // 1 float
  329. EEPROM_WRITE(delta_diagonal_rod_trim); // 3 floats
  330. EEPROM_WRITE(delta_tower_angle_trim); // 3 floats
  331. #elif ENABLED(Z_DUAL_ENDSTOPS)
  332. EEPROM_WRITE(z_endstop_adj); // 1 float
  333. dummy = 0.0f;
  334. for (uint8_t q = 11; q--;) EEPROM_WRITE(dummy);
  335. #else
  336. dummy = 0.0f;
  337. for (uint8_t q = 12; q--;) EEPROM_WRITE(dummy);
  338. #endif
  339. #if DISABLED(ULTIPANEL)
  340. const int lcd_preheat_hotend_temp[2] = { PREHEAT_1_TEMP_HOTEND, PREHEAT_2_TEMP_HOTEND },
  341. lcd_preheat_bed_temp[2] = { PREHEAT_1_TEMP_BED, PREHEAT_2_TEMP_BED },
  342. lcd_preheat_fan_speed[2] = { PREHEAT_1_FAN_SPEED, PREHEAT_2_FAN_SPEED };
  343. #endif // !ULTIPANEL
  344. EEPROM_WRITE(lcd_preheat_hotend_temp);
  345. EEPROM_WRITE(lcd_preheat_bed_temp);
  346. EEPROM_WRITE(lcd_preheat_fan_speed);
  347. for (uint8_t e = 0; e < MAX_EXTRUDERS; e++) {
  348. #if ENABLED(PIDTEMP)
  349. if (e < HOTENDS) {
  350. EEPROM_WRITE(PID_PARAM(Kp, e));
  351. EEPROM_WRITE(PID_PARAM(Ki, e));
  352. EEPROM_WRITE(PID_PARAM(Kd, e));
  353. #if ENABLED(PID_EXTRUSION_SCALING)
  354. EEPROM_WRITE(PID_PARAM(Kc, e));
  355. #else
  356. dummy = 1.0f; // 1.0 = default kc
  357. EEPROM_WRITE(dummy);
  358. #endif
  359. }
  360. else
  361. #endif // !PIDTEMP
  362. {
  363. dummy = DUMMY_PID_VALUE; // When read, will not change the existing value
  364. EEPROM_WRITE(dummy); // Kp
  365. dummy = 0.0f;
  366. for (uint8_t q = 3; q--;) EEPROM_WRITE(dummy); // Ki, Kd, Kc
  367. }
  368. } // Hotends Loop
  369. #if DISABLED(PID_EXTRUSION_SCALING)
  370. int lpq_len = 20;
  371. #endif
  372. EEPROM_WRITE(lpq_len);
  373. #if DISABLED(PIDTEMPBED)
  374. dummy = DUMMY_PID_VALUE;
  375. for (uint8_t q = 3; q--;) EEPROM_WRITE(dummy);
  376. #else
  377. EEPROM_WRITE(thermalManager.bedKp);
  378. EEPROM_WRITE(thermalManager.bedKi);
  379. EEPROM_WRITE(thermalManager.bedKd);
  380. #endif
  381. #if !HAS_LCD_CONTRAST
  382. const int lcd_contrast = 32;
  383. #endif
  384. EEPROM_WRITE(lcd_contrast);
  385. #if ENABLED(FWRETRACT)
  386. EEPROM_WRITE(autoretract_enabled);
  387. EEPROM_WRITE(retract_length);
  388. #if EXTRUDERS > 1
  389. EEPROM_WRITE(retract_length_swap);
  390. #else
  391. dummy = 0.0f;
  392. EEPROM_WRITE(dummy);
  393. #endif
  394. EEPROM_WRITE(retract_feedrate_mm_s);
  395. EEPROM_WRITE(retract_zlift);
  396. EEPROM_WRITE(retract_recover_length);
  397. #if EXTRUDERS > 1
  398. EEPROM_WRITE(retract_recover_length_swap);
  399. #else
  400. dummy = 0.0f;
  401. EEPROM_WRITE(dummy);
  402. #endif
  403. EEPROM_WRITE(retract_recover_feedrate_mm_s);
  404. #endif // FWRETRACT
  405. EEPROM_WRITE(volumetric_enabled);
  406. // Save filament sizes
  407. for (uint8_t q = 0; q < MAX_EXTRUDERS; q++) {
  408. if (q < COUNT(filament_size)) dummy = filament_size[q];
  409. EEPROM_WRITE(dummy);
  410. }
  411. // Save TCM2130 Configuration, and placeholder values
  412. uint16_t val;
  413. #if ENABLED(HAVE_TMC2130)
  414. #if ENABLED(X_IS_TMC2130)
  415. val = stepperX.getCurrent();
  416. #else
  417. val = 0;
  418. #endif
  419. EEPROM_WRITE(val);
  420. #if ENABLED(Y_IS_TMC2130)
  421. val = stepperY.getCurrent();
  422. #else
  423. val = 0;
  424. #endif
  425. EEPROM_WRITE(val);
  426. #if ENABLED(Z_IS_TMC2130)
  427. val = stepperZ.getCurrent();
  428. #else
  429. val = 0;
  430. #endif
  431. EEPROM_WRITE(val);
  432. #if ENABLED(X2_IS_TMC2130)
  433. val = stepperX2.getCurrent();
  434. #else
  435. val = 0;
  436. #endif
  437. EEPROM_WRITE(val);
  438. #if ENABLED(Y2_IS_TMC2130)
  439. val = stepperY2.getCurrent();
  440. #else
  441. val = 0;
  442. #endif
  443. EEPROM_WRITE(val);
  444. #if ENABLED(Z2_IS_TMC2130)
  445. val = stepperZ2.getCurrent();
  446. #else
  447. val = 0;
  448. #endif
  449. EEPROM_WRITE(val);
  450. #if ENABLED(E0_IS_TMC2130)
  451. val = stepperE0.getCurrent();
  452. #else
  453. val = 0;
  454. #endif
  455. EEPROM_WRITE(val);
  456. #if ENABLED(E1_IS_TMC2130)
  457. val = stepperE1.getCurrent();
  458. #else
  459. val = 0;
  460. #endif
  461. EEPROM_WRITE(val);
  462. #if ENABLED(E2_IS_TMC2130)
  463. val = stepperE2.getCurrent();
  464. #else
  465. val = 0;
  466. #endif
  467. EEPROM_WRITE(val);
  468. #if ENABLED(E3_IS_TMC2130)
  469. val = stepperE3.getCurrent();
  470. #else
  471. val = 0;
  472. #endif
  473. EEPROM_WRITE(val);
  474. #else
  475. val = 0;
  476. for (uint8_t q = 0; q < 10; ++q) EEPROM_WRITE(val);
  477. #endif
  478. if (!eeprom_write_error) {
  479. const uint16_t final_checksum = eeprom_checksum,
  480. eeprom_size = eeprom_index;
  481. // Write the EEPROM header
  482. eeprom_index = EEPROM_OFFSET;
  483. EEPROM_WRITE(version);
  484. EEPROM_WRITE(final_checksum);
  485. // Report storage size
  486. SERIAL_ECHO_START;
  487. SERIAL_ECHOPAIR("Settings Stored (", eeprom_size - (EEPROM_OFFSET));
  488. SERIAL_ECHOLNPGM(" bytes)");
  489. }
  490. #if ENABLED(AUTO_BED_LEVELING_UBL)
  491. ubl.store_state();
  492. if (ubl.state.eeprom_storage_slot >= 0)
  493. ubl.store_mesh(ubl.state.eeprom_storage_slot);
  494. #endif
  495. return !eeprom_write_error;
  496. }
  497. /**
  498. * M501 - Retrieve Configuration
  499. */
  500. bool Config_RetrieveSettings() {
  501. EEPROM_START();
  502. eeprom_read_error = false; // If set EEPROM_READ won't write into RAM
  503. char stored_ver[4];
  504. EEPROM_READ(stored_ver);
  505. uint16_t stored_checksum;
  506. EEPROM_READ(stored_checksum);
  507. // Version has to match or defaults are used
  508. if (strncmp(version, stored_ver, 3) != 0) {
  509. if (stored_ver[0] != 'V') {
  510. stored_ver[0] = '?';
  511. stored_ver[1] = '\0';
  512. }
  513. SERIAL_ECHO_START;
  514. SERIAL_ECHOPGM("EEPROM version mismatch ");
  515. SERIAL_ECHOPAIR("(EEPROM=", stored_ver);
  516. SERIAL_ECHOLNPGM(" Marlin=" EEPROM_VERSION ")");
  517. Config_ResetDefault();
  518. }
  519. else {
  520. float dummy = 0;
  521. eeprom_checksum = 0; // clear before reading first "real data"
  522. // Number of esteppers may change
  523. uint8_t esteppers;
  524. EEPROM_READ(esteppers);
  525. // Get only the number of E stepper parameters previously stored
  526. // Any steppers added later are set to their defaults
  527. const float def1[] = DEFAULT_AXIS_STEPS_PER_UNIT, def2[] = DEFAULT_MAX_FEEDRATE;
  528. const uint32_t def3[] = DEFAULT_MAX_ACCELERATION;
  529. float tmp1[XYZ + esteppers], tmp2[XYZ + esteppers];
  530. uint32_t tmp3[XYZ + esteppers];
  531. EEPROM_READ(tmp1);
  532. EEPROM_READ(tmp2);
  533. EEPROM_READ(tmp3);
  534. LOOP_XYZE_N(i) {
  535. planner.axis_steps_per_mm[i] = i < XYZ + esteppers ? tmp1[i] : def1[i < COUNT(def1) ? i : COUNT(def1) - 1];
  536. planner.max_feedrate_mm_s[i] = i < XYZ + esteppers ? tmp2[i] : def2[i < COUNT(def2) ? i : COUNT(def2) - 1];
  537. planner.max_acceleration_mm_per_s2[i] = i < XYZ + esteppers ? tmp3[i] : def3[i < COUNT(def3) ? i : COUNT(def3) - 1];
  538. }
  539. EEPROM_READ(planner.acceleration);
  540. EEPROM_READ(planner.retract_acceleration);
  541. EEPROM_READ(planner.travel_acceleration);
  542. EEPROM_READ(planner.min_feedrate_mm_s);
  543. EEPROM_READ(planner.min_travel_feedrate_mm_s);
  544. EEPROM_READ(planner.min_segment_time);
  545. EEPROM_READ(planner.max_jerk);
  546. #if ENABLED(NO_WORKSPACE_OFFSETS)
  547. float home_offset[XYZ];
  548. #endif
  549. EEPROM_READ(home_offset);
  550. #if HOTENDS > 1
  551. // Skip hotend 0 which must be 0
  552. for (uint8_t e = 1; e < HOTENDS; e++)
  553. LOOP_XYZ(i) EEPROM_READ(hotend_offset[i][e]);
  554. #endif
  555. //
  556. // Mesh (Manual) Bed Leveling
  557. //
  558. bool leveling_is_on;
  559. uint8_t mesh_num_x, mesh_num_y;
  560. EEPROM_READ(leveling_is_on);
  561. EEPROM_READ(dummy);
  562. EEPROM_READ(mesh_num_x);
  563. EEPROM_READ(mesh_num_y);
  564. #if ENABLED(MESH_BED_LEVELING)
  565. mbl.status = leveling_is_on ? _BV(MBL_STATUS_HAS_MESH_BIT) : 0;
  566. mbl.z_offset = dummy;
  567. if (mesh_num_x == GRID_MAX_POINTS_X && mesh_num_y == GRID_MAX_POINTS_Y) {
  568. // EEPROM data fits the current mesh
  569. EEPROM_READ(mbl.z_values);
  570. }
  571. else {
  572. // EEPROM data is stale
  573. mbl.reset();
  574. for (uint16_t q = mesh_num_x * mesh_num_y; q--;) EEPROM_READ(dummy);
  575. }
  576. #else
  577. // MBL is disabled - skip the stored data
  578. for (uint16_t q = mesh_num_x * mesh_num_y; q--;) EEPROM_READ(dummy);
  579. #endif // MESH_BED_LEVELING
  580. #if !HAS_BED_PROBE
  581. float zprobe_zoffset = 0;
  582. #endif
  583. EEPROM_READ(zprobe_zoffset);
  584. //
  585. // Planar Bed Leveling matrix
  586. //
  587. #if ABL_PLANAR
  588. EEPROM_READ(planner.bed_level_matrix);
  589. #else
  590. for (uint8_t q = 9; q--;) EEPROM_READ(dummy);
  591. #endif
  592. //
  593. // Bilinear Auto Bed Leveling
  594. //
  595. uint8_t grid_max_x, grid_max_y;
  596. EEPROM_READ(grid_max_x); // 1 byte
  597. EEPROM_READ(grid_max_y); // 1 byte
  598. #if ENABLED(AUTO_BED_LEVELING_BILINEAR)
  599. if (grid_max_x == GRID_MAX_POINTS_X && grid_max_y == GRID_MAX_POINTS_Y) {
  600. set_bed_leveling_enabled(false);
  601. EEPROM_READ(bilinear_grid_spacing); // 2 ints
  602. EEPROM_READ(bilinear_start); // 2 ints
  603. EEPROM_READ(bed_level_grid); // 9 to 256 floats
  604. #if ENABLED(ABL_BILINEAR_SUBDIVISION)
  605. bed_level_virt_interpolate();
  606. #endif
  607. //set_bed_leveling_enabled(leveling_is_on);
  608. }
  609. else // EEPROM data is stale
  610. #endif // AUTO_BED_LEVELING_BILINEAR
  611. {
  612. // Skip past disabled (or stale) Bilinear Grid data
  613. int bgs[2], bs[2];
  614. EEPROM_READ(bgs);
  615. EEPROM_READ(bs);
  616. for (uint16_t q = grid_max_x * grid_max_y; q--;) EEPROM_READ(dummy);
  617. }
  618. #if ENABLED(DELTA)
  619. EEPROM_READ(endstop_adj); // 3 floats
  620. EEPROM_READ(delta_radius); // 1 float
  621. EEPROM_READ(delta_diagonal_rod); // 1 float
  622. EEPROM_READ(delta_segments_per_second); // 1 float
  623. EEPROM_READ(delta_diagonal_rod_trim); // 3 floats
  624. EEPROM_READ(delta_tower_angle_trim); // 3 floats
  625. #elif ENABLED(Z_DUAL_ENDSTOPS)
  626. EEPROM_READ(z_endstop_adj);
  627. dummy = 0.0f;
  628. for (uint8_t q=11; q--;) EEPROM_READ(dummy);
  629. #else
  630. dummy = 0.0f;
  631. for (uint8_t q=12; q--;) EEPROM_READ(dummy);
  632. #endif
  633. #if DISABLED(ULTIPANEL)
  634. int lcd_preheat_hotend_temp[2], lcd_preheat_bed_temp[2], lcd_preheat_fan_speed[2];
  635. #endif
  636. EEPROM_READ(lcd_preheat_hotend_temp);
  637. EEPROM_READ(lcd_preheat_bed_temp);
  638. EEPROM_READ(lcd_preheat_fan_speed);
  639. #if ENABLED(PIDTEMP)
  640. for (uint8_t e = 0; e < MAX_EXTRUDERS; e++) {
  641. EEPROM_READ(dummy); // Kp
  642. if (e < HOTENDS && dummy != DUMMY_PID_VALUE) {
  643. // do not need to scale PID values as the values in EEPROM are already scaled
  644. PID_PARAM(Kp, e) = dummy;
  645. EEPROM_READ(PID_PARAM(Ki, e));
  646. EEPROM_READ(PID_PARAM(Kd, e));
  647. #if ENABLED(PID_EXTRUSION_SCALING)
  648. EEPROM_READ(PID_PARAM(Kc, e));
  649. #else
  650. EEPROM_READ(dummy);
  651. #endif
  652. }
  653. else {
  654. for (uint8_t q=3; q--;) EEPROM_READ(dummy); // Ki, Kd, Kc
  655. }
  656. }
  657. #else // !PIDTEMP
  658. // 4 x 4 = 16 slots for PID parameters
  659. for (uint8_t q = MAX_EXTRUDERS * 4; q--;) EEPROM_READ(dummy); // Kp, Ki, Kd, Kc
  660. #endif // !PIDTEMP
  661. #if DISABLED(PID_EXTRUSION_SCALING)
  662. int lpq_len;
  663. #endif
  664. EEPROM_READ(lpq_len);
  665. #if ENABLED(PIDTEMPBED)
  666. EEPROM_READ(dummy); // bedKp
  667. if (dummy != DUMMY_PID_VALUE) {
  668. thermalManager.bedKp = dummy;
  669. EEPROM_READ(thermalManager.bedKi);
  670. EEPROM_READ(thermalManager.bedKd);
  671. }
  672. #else
  673. for (uint8_t q=3; q--;) EEPROM_READ(dummy); // bedKp, bedKi, bedKd
  674. #endif
  675. #if !HAS_LCD_CONTRAST
  676. int lcd_contrast;
  677. #endif
  678. EEPROM_READ(lcd_contrast);
  679. #if ENABLED(FWRETRACT)
  680. EEPROM_READ(autoretract_enabled);
  681. EEPROM_READ(retract_length);
  682. #if EXTRUDERS > 1
  683. EEPROM_READ(retract_length_swap);
  684. #else
  685. EEPROM_READ(dummy);
  686. #endif
  687. EEPROM_READ(retract_feedrate_mm_s);
  688. EEPROM_READ(retract_zlift);
  689. EEPROM_READ(retract_recover_length);
  690. #if EXTRUDERS > 1
  691. EEPROM_READ(retract_recover_length_swap);
  692. #else
  693. EEPROM_READ(dummy);
  694. #endif
  695. EEPROM_READ(retract_recover_feedrate_mm_s);
  696. #endif // FWRETRACT
  697. EEPROM_READ(volumetric_enabled);
  698. for (uint8_t q = 0; q < MAX_EXTRUDERS; q++) {
  699. EEPROM_READ(dummy);
  700. if (q < COUNT(filament_size)) filament_size[q] = dummy;
  701. }
  702. uint16_t val;
  703. #if ENABLED(HAVE_TMC2130)
  704. EEPROM_READ(val);
  705. #if ENABLED(X_IS_TMC2130)
  706. stepperX.setCurrent(val, R_SENSE, HOLD_MULTIPLIER);
  707. #endif
  708. EEPROM_READ(val);
  709. #if ENABLED(Y_IS_TMC2130)
  710. stepperY.setCurrent(val, R_SENSE, HOLD_MULTIPLIER);
  711. #endif
  712. EEPROM_READ(val);
  713. #if ENABLED(Z_IS_TMC2130)
  714. stepperZ.setCurrent(val, R_SENSE, HOLD_MULTIPLIER);
  715. #endif
  716. EEPROM_READ(val);
  717. #if ENABLED(X2_IS_TMC2130)
  718. stepperX2.setCurrent(val, R_SENSE, HOLD_MULTIPLIER);
  719. #endif
  720. EEPROM_READ(val);
  721. #if ENABLED(Y2_IS_TMC2130)
  722. stepperY2.setCurrent(val, R_SENSE, HOLD_MULTIPLIER);
  723. #endif
  724. EEPROM_READ(val);
  725. #if ENABLED(Z2_IS_TMC2130)
  726. stepperZ2.setCurrent(val, R_SENSE, HOLD_MULTIPLIER);
  727. #endif
  728. EEPROM_READ(val);
  729. #if ENABLED(E0_IS_TMC2130)
  730. stepperE0.setCurrent(val, R_SENSE, HOLD_MULTIPLIER);
  731. #endif
  732. EEPROM_READ(val);
  733. #if ENABLED(E1_IS_TMC2130)
  734. stepperE1.setCurrent(val, R_SENSE, HOLD_MULTIPLIER);
  735. #endif
  736. EEPROM_READ(val);
  737. #if ENABLED(E2_IS_TMC2130)
  738. stepperE2.setCurrent(val, R_SENSE, HOLD_MULTIPLIER);
  739. #endif
  740. EEPROM_READ(val);
  741. #if ENABLED(E3_IS_TMC2130)
  742. stepperE3.setCurrent(val, R_SENSE, HOLD_MULTIPLIER);
  743. #endif
  744. #else
  745. for (uint8_t q = 0; q < 10; q++) EEPROM_READ(val);
  746. #endif
  747. if (eeprom_checksum == stored_checksum) {
  748. if (eeprom_read_error)
  749. Config_ResetDefault();
  750. else {
  751. Config_Postprocess();
  752. SERIAL_ECHO_START;
  753. SERIAL_ECHO(version);
  754. SERIAL_ECHOPAIR(" stored settings retrieved (", eeprom_index - (EEPROM_OFFSET));
  755. SERIAL_ECHOLNPGM(" bytes)");
  756. }
  757. }
  758. else {
  759. SERIAL_ERROR_START;
  760. SERIAL_ERRORLNPGM("EEPROM checksum mismatch");
  761. Config_ResetDefault();
  762. }
  763. #if ENABLED(AUTO_BED_LEVELING_UBL)
  764. ubl.eeprom_start = (eeprom_index + 32) & 0xFFF8; // Pad the end of configuration data so it
  765. // can float up or down a little bit without
  766. // disrupting the Unified Bed Leveling data
  767. ubl.load_state();
  768. SERIAL_ECHOPGM(" UBL ");
  769. if (!ubl.state.active) SERIAL_ECHO("not ");
  770. SERIAL_ECHOLNPGM("active!");
  771. if (!ubl.sanity_check()) {
  772. int tmp_mesh; // We want to preserve whether the UBL System is Active
  773. bool tmp_active; // If it is, we want to preserve the Mesh that is being used.
  774. tmp_mesh = ubl.state.eeprom_storage_slot;
  775. tmp_active = ubl.state.active;
  776. SERIAL_ECHOLNPGM("\nInitializing Bed Leveling State to current firmware settings.\n");
  777. ubl.state = ubl.pre_initialized; // Initialize with the pre_initialized data structure
  778. ubl.state.eeprom_storage_slot = tmp_mesh; // But then restore some data we don't want mangled
  779. ubl.state.active = tmp_active;
  780. }
  781. else {
  782. SERIAL_PROTOCOLPGM("?Unable to enable Unified Bed Leveling.\n");
  783. ubl.state = ubl.pre_initialized;
  784. ubl.reset();
  785. ubl.store_state();
  786. }
  787. if (ubl.state.eeprom_storage_slot >= 0) {
  788. ubl.load_mesh(ubl.state.eeprom_storage_slot);
  789. SERIAL_ECHOPAIR("Mesh ", ubl.state.eeprom_storage_slot);
  790. SERIAL_ECHOLNPGM(" loaded from storage.");
  791. }
  792. else {
  793. ubl.reset();
  794. SERIAL_ECHOLNPGM("UBL System reset()");
  795. }
  796. #endif
  797. }
  798. #if ENABLED(EEPROM_CHITCHAT)
  799. Config_PrintSettings();
  800. #endif
  801. return !eeprom_read_error;
  802. }
  803. #else // !EEPROM_SETTINGS
  804. bool Config_StoreSettings() {
  805. SERIAL_ERROR_START;
  806. SERIAL_ERRORLNPGM("EEPROM disabled");
  807. return false;
  808. }
  809. #endif // !EEPROM_SETTINGS
  810. /**
  811. * M502 - Reset Configuration
  812. */
  813. void Config_ResetDefault() {
  814. const float tmp1[] = DEFAULT_AXIS_STEPS_PER_UNIT, tmp2[] = DEFAULT_MAX_FEEDRATE;
  815. const uint32_t tmp3[] = DEFAULT_MAX_ACCELERATION;
  816. LOOP_XYZE_N(i) {
  817. planner.axis_steps_per_mm[i] = tmp1[i < COUNT(tmp1) ? i : COUNT(tmp1) - 1];
  818. planner.max_feedrate_mm_s[i] = tmp2[i < COUNT(tmp2) ? i : COUNT(tmp2) - 1];
  819. planner.max_acceleration_mm_per_s2[i] = tmp3[i < COUNT(tmp3) ? i : COUNT(tmp3) - 1];
  820. }
  821. planner.acceleration = DEFAULT_ACCELERATION;
  822. planner.retract_acceleration = DEFAULT_RETRACT_ACCELERATION;
  823. planner.travel_acceleration = DEFAULT_TRAVEL_ACCELERATION;
  824. planner.min_feedrate_mm_s = DEFAULT_MINIMUMFEEDRATE;
  825. planner.min_segment_time = DEFAULT_MINSEGMENTTIME;
  826. planner.min_travel_feedrate_mm_s = DEFAULT_MINTRAVELFEEDRATE;
  827. planner.max_jerk[X_AXIS] = DEFAULT_XJERK;
  828. planner.max_jerk[Y_AXIS] = DEFAULT_YJERK;
  829. planner.max_jerk[Z_AXIS] = DEFAULT_ZJERK;
  830. planner.max_jerk[E_AXIS] = DEFAULT_EJERK;
  831. #if DISABLED(NO_WORKSPACE_OFFSETS)
  832. ZERO(home_offset);
  833. #endif
  834. #if HOTENDS > 1
  835. constexpr float tmp4[XYZ][HOTENDS] = {
  836. HOTEND_OFFSET_X,
  837. HOTEND_OFFSET_Y
  838. #ifdef HOTEND_OFFSET_Z
  839. , HOTEND_OFFSET_Z
  840. #else
  841. , { 0 }
  842. #endif
  843. };
  844. static_assert(
  845. tmp4[X_AXIS][0] == 0 && tmp4[Y_AXIS][0] == 0 && tmp4[Z_AXIS][0] == 0,
  846. "Offsets for the first hotend must be 0.0."
  847. );
  848. LOOP_XYZ(i) HOTEND_LOOP() hotend_offset[i][e] = tmp4[i][e];
  849. #endif
  850. // Applies to all MBL and ABL
  851. #if PLANNER_LEVELING
  852. reset_bed_level();
  853. #endif
  854. #if HAS_BED_PROBE
  855. zprobe_zoffset = Z_PROBE_OFFSET_FROM_EXTRUDER;
  856. #endif
  857. #if ENABLED(DELTA)
  858. const float adj[ABC] = DELTA_ENDSTOP_ADJ,
  859. drt[ABC] = { DELTA_DIAGONAL_ROD_TRIM_TOWER_1, DELTA_DIAGONAL_ROD_TRIM_TOWER_2, DELTA_DIAGONAL_ROD_TRIM_TOWER_3 },
  860. dta[ABC] = { DELTA_TOWER_ANGLE_TRIM_1, DELTA_TOWER_ANGLE_TRIM_2, DELTA_TOWER_ANGLE_TRIM_3 };
  861. COPY(endstop_adj, adj);
  862. delta_radius = DELTA_RADIUS;
  863. delta_diagonal_rod = DELTA_DIAGONAL_ROD;
  864. delta_segments_per_second = DELTA_SEGMENTS_PER_SECOND;
  865. COPY(delta_diagonal_rod_trim, drt);
  866. COPY(delta_tower_angle_trim, dta);
  867. #elif ENABLED(Z_DUAL_ENDSTOPS)
  868. #if defined(Z_DUAL_ENDSTOPS_ADJUSTMENT)
  869. float z_endstop_adj = Z_DUAL_ENDSTOPS_ADJUSTMENT;
  870. #else
  871. float z_endstop_adj = 0;
  872. #endif
  873. #endif
  874. #if ENABLED(ULTIPANEL)
  875. lcd_preheat_hotend_temp[0] = PREHEAT_1_TEMP_HOTEND;
  876. lcd_preheat_hotend_temp[1] = PREHEAT_2_TEMP_HOTEND;
  877. lcd_preheat_bed_temp[0] = PREHEAT_1_TEMP_BED;
  878. lcd_preheat_bed_temp[1] = PREHEAT_2_TEMP_BED;
  879. lcd_preheat_fan_speed[0] = PREHEAT_1_FAN_SPEED;
  880. lcd_preheat_fan_speed[1] = PREHEAT_2_FAN_SPEED;
  881. #endif
  882. #if HAS_LCD_CONTRAST
  883. lcd_contrast = DEFAULT_LCD_CONTRAST;
  884. #endif
  885. #if ENABLED(PIDTEMP)
  886. #if ENABLED(PID_PARAMS_PER_HOTEND) && HOTENDS > 1
  887. HOTEND_LOOP()
  888. #endif
  889. {
  890. PID_PARAM(Kp, e) = DEFAULT_Kp;
  891. PID_PARAM(Ki, e) = scalePID_i(DEFAULT_Ki);
  892. PID_PARAM(Kd, e) = scalePID_d(DEFAULT_Kd);
  893. #if ENABLED(PID_EXTRUSION_SCALING)
  894. PID_PARAM(Kc, e) = DEFAULT_Kc;
  895. #endif
  896. }
  897. #if ENABLED(PID_EXTRUSION_SCALING)
  898. lpq_len = 20; // default last-position-queue size
  899. #endif
  900. #endif // PIDTEMP
  901. #if ENABLED(PIDTEMPBED)
  902. thermalManager.bedKp = DEFAULT_bedKp;
  903. thermalManager.bedKi = scalePID_i(DEFAULT_bedKi);
  904. thermalManager.bedKd = scalePID_d(DEFAULT_bedKd);
  905. #endif
  906. #if ENABLED(FWRETRACT)
  907. autoretract_enabled = false;
  908. retract_length = RETRACT_LENGTH;
  909. #if EXTRUDERS > 1
  910. retract_length_swap = RETRACT_LENGTH_SWAP;
  911. #endif
  912. retract_feedrate_mm_s = RETRACT_FEEDRATE;
  913. retract_zlift = RETRACT_ZLIFT;
  914. retract_recover_length = RETRACT_RECOVER_LENGTH;
  915. #if EXTRUDERS > 1
  916. retract_recover_length_swap = RETRACT_RECOVER_LENGTH_SWAP;
  917. #endif
  918. retract_recover_feedrate_mm_s = RETRACT_RECOVER_FEEDRATE;
  919. #endif
  920. volumetric_enabled =
  921. #if ENABLED(VOLUMETRIC_DEFAULT_ON)
  922. true
  923. #else
  924. false
  925. #endif
  926. ;
  927. for (uint8_t q = 0; q < COUNT(filament_size); q++)
  928. filament_size[q] = DEFAULT_NOMINAL_FILAMENT_DIA;
  929. endstops.enable_globally(
  930. #if ENABLED(ENDSTOPS_ALWAYS_ON_DEFAULT)
  931. (true)
  932. #else
  933. (false)
  934. #endif
  935. );
  936. #if ENABLED(HAVE_TMC2130)
  937. #if ENABLED(X_IS_TMC2130)
  938. stepperX.setCurrent(X_MAX_CURRENT, R_SENSE, HOLD_MULTIPLIER);
  939. #endif
  940. #if ENABLED(Y_IS_TMC2130)
  941. stepperY.setCurrent(Y_MAX_CURRENT, R_SENSE, HOLD_MULTIPLIER);
  942. #endif
  943. #if ENABLED(Z_IS_TMC2130)
  944. stepperZ.setCurrent(Z_MAX_CURRENT, R_SENSE, HOLD_MULTIPLIER);
  945. #endif
  946. #if ENABLED(X2_IS_TMC2130)
  947. stepperX2.setCurrent(X2_MAX_CURRENT, R_SENSE, HOLD_MULTIPLIER);
  948. #endif
  949. #if ENABLED(Y2_IS_TMC2130)
  950. stepperY2.setCurrent(Y2_MAX_CURRENT, R_SENSE, HOLD_MULTIPLIER);
  951. #endif
  952. #if ENABLED(Z2_IS_TMC2130)
  953. stepperZ2.setCurrent(Z2_MAX_CURRENT, R_SENSE, HOLD_MULTIPLIER);
  954. #endif
  955. #if ENABLED(E0_IS_TMC2130)
  956. stepperE0.setCurrent(E0_MAX_CURRENT, R_SENSE, HOLD_MULTIPLIER);
  957. #endif
  958. #if ENABLED(E1_IS_TMC2130)
  959. stepperE1.setCurrent(E1_MAX_CURRENT, R_SENSE, HOLD_MULTIPLIER);
  960. #endif
  961. #if ENABLED(E2_IS_TMC2130)
  962. stepperE2.setCurrent(E2_MAX_CURRENT, R_SENSE, HOLD_MULTIPLIER);
  963. #endif
  964. #if ENABLED(E3_IS_TMC2130)
  965. stepperE3.setCurrent(E3_MAX_CURRENT, R_SENSE, HOLD_MULTIPLIER);
  966. #endif
  967. #endif
  968. Config_Postprocess();
  969. SERIAL_ECHO_START;
  970. SERIAL_ECHOLNPGM("Hardcoded Default Settings Loaded");
  971. }
  972. #if DISABLED(DISABLE_M503)
  973. #define CONFIG_ECHO_START do{ if (!forReplay) SERIAL_ECHO_START; }while(0)
  974. /**
  975. * M503 - Print Configuration
  976. */
  977. void Config_PrintSettings(bool forReplay) {
  978. // Always have this function, even with EEPROM_SETTINGS disabled, the current values will be shown
  979. CONFIG_ECHO_START;
  980. if (!forReplay) {
  981. SERIAL_ECHOLNPGM("Steps per unit:");
  982. CONFIG_ECHO_START;
  983. }
  984. SERIAL_ECHOPAIR(" M92 X", planner.axis_steps_per_mm[X_AXIS]);
  985. SERIAL_ECHOPAIR(" Y", planner.axis_steps_per_mm[Y_AXIS]);
  986. SERIAL_ECHOPAIR(" Z", planner.axis_steps_per_mm[Z_AXIS]);
  987. #if DISABLED(DISTINCT_E_FACTORS)
  988. SERIAL_ECHOPAIR(" E", planner.axis_steps_per_mm[E_AXIS]);
  989. #endif
  990. SERIAL_EOL;
  991. #if ENABLED(DISTINCT_E_FACTORS)
  992. for (uint8_t i = 0; i < E_STEPPERS; i++) {
  993. SERIAL_ECHOPAIR(" M92 T", (int)i);
  994. SERIAL_ECHOLNPAIR(" E", planner.axis_steps_per_mm[E_AXIS + i]);
  995. }
  996. #endif
  997. CONFIG_ECHO_START;
  998. if (!forReplay) {
  999. SERIAL_ECHOLNPGM("Maximum feedrates (mm/s):");
  1000. CONFIG_ECHO_START;
  1001. }
  1002. SERIAL_ECHOPAIR(" M203 X", planner.max_feedrate_mm_s[X_AXIS]);
  1003. SERIAL_ECHOPAIR(" Y", planner.max_feedrate_mm_s[Y_AXIS]);
  1004. SERIAL_ECHOPAIR(" Z", planner.max_feedrate_mm_s[Z_AXIS]);
  1005. #if DISABLED(DISTINCT_E_FACTORS)
  1006. SERIAL_ECHOPAIR(" E", planner.max_feedrate_mm_s[E_AXIS]);
  1007. #endif
  1008. SERIAL_EOL;
  1009. #if ENABLED(DISTINCT_E_FACTORS)
  1010. for (uint8_t i = 0; i < E_STEPPERS; i++) {
  1011. SERIAL_ECHOPAIR(" M203 T", (int)i);
  1012. SERIAL_ECHOLNPAIR(" E", planner.max_feedrate_mm_s[E_AXIS + i]);
  1013. }
  1014. #endif
  1015. CONFIG_ECHO_START;
  1016. if (!forReplay) {
  1017. SERIAL_ECHOLNPGM("Maximum Acceleration (mm/s2):");
  1018. CONFIG_ECHO_START;
  1019. }
  1020. SERIAL_ECHOPAIR(" M201 X", planner.max_acceleration_mm_per_s2[X_AXIS]);
  1021. SERIAL_ECHOPAIR(" Y", planner.max_acceleration_mm_per_s2[Y_AXIS]);
  1022. SERIAL_ECHOPAIR(" Z", planner.max_acceleration_mm_per_s2[Z_AXIS]);
  1023. #if DISABLED(DISTINCT_E_FACTORS)
  1024. SERIAL_ECHOPAIR(" E", planner.max_acceleration_mm_per_s2[E_AXIS]);
  1025. #endif
  1026. SERIAL_EOL;
  1027. #if ENABLED(DISTINCT_E_FACTORS)
  1028. for (uint8_t i = 0; i < E_STEPPERS; i++) {
  1029. SERIAL_ECHOPAIR(" M201 T", (int)i);
  1030. SERIAL_ECHOLNPAIR(" E", planner.max_acceleration_mm_per_s2[E_AXIS + i]);
  1031. }
  1032. #endif
  1033. CONFIG_ECHO_START;
  1034. if (!forReplay) {
  1035. SERIAL_ECHOLNPGM("Accelerations: P=printing, R=retract and T=travel");
  1036. CONFIG_ECHO_START;
  1037. }
  1038. SERIAL_ECHOPAIR(" M204 P", planner.acceleration);
  1039. SERIAL_ECHOPAIR(" R", planner.retract_acceleration);
  1040. SERIAL_ECHOPAIR(" T", planner.travel_acceleration);
  1041. SERIAL_EOL;
  1042. CONFIG_ECHO_START;
  1043. if (!forReplay) {
  1044. 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)");
  1045. CONFIG_ECHO_START;
  1046. }
  1047. SERIAL_ECHOPAIR(" M205 S", planner.min_feedrate_mm_s);
  1048. SERIAL_ECHOPAIR(" T", planner.min_travel_feedrate_mm_s);
  1049. SERIAL_ECHOPAIR(" B", planner.min_segment_time);
  1050. SERIAL_ECHOPAIR(" X", planner.max_jerk[X_AXIS]);
  1051. SERIAL_ECHOPAIR(" Y", planner.max_jerk[Y_AXIS]);
  1052. SERIAL_ECHOPAIR(" Z", planner.max_jerk[Z_AXIS]);
  1053. SERIAL_ECHOPAIR(" E", planner.max_jerk[E_AXIS]);
  1054. SERIAL_EOL;
  1055. #if DISABLED(NO_WORKSPACE_OFFSETS)
  1056. CONFIG_ECHO_START;
  1057. if (!forReplay) {
  1058. SERIAL_ECHOLNPGM("Home offset (mm)");
  1059. CONFIG_ECHO_START;
  1060. }
  1061. SERIAL_ECHOPAIR(" M206 X", home_offset[X_AXIS]);
  1062. SERIAL_ECHOPAIR(" Y", home_offset[Y_AXIS]);
  1063. SERIAL_ECHOPAIR(" Z", home_offset[Z_AXIS]);
  1064. SERIAL_EOL;
  1065. #endif
  1066. #if HOTENDS > 1
  1067. CONFIG_ECHO_START;
  1068. if (!forReplay) {
  1069. SERIAL_ECHOLNPGM("Hotend offsets (mm)");
  1070. CONFIG_ECHO_START;
  1071. }
  1072. for (uint8_t e = 1; e < HOTENDS; e++) {
  1073. SERIAL_ECHOPAIR(" M218 T", (int)e);
  1074. SERIAL_ECHOPAIR(" X", hotend_offset[X_AXIS][e]);
  1075. SERIAL_ECHOPAIR(" Y", hotend_offset[Y_AXIS][e]);
  1076. #if ENABLED(DUAL_X_CARRIAGE) || ENABLED(SWITCHING_EXTRUDER)
  1077. SERIAL_ECHOPAIR(" Z", hotend_offset[Z_AXIS][e]);
  1078. #endif
  1079. SERIAL_EOL;
  1080. }
  1081. #endif
  1082. #if ENABLED(MESH_BED_LEVELING)
  1083. if (!forReplay) {
  1084. SERIAL_ECHOLNPGM("Mesh Bed Leveling:");
  1085. CONFIG_ECHO_START;
  1086. }
  1087. SERIAL_ECHOLNPAIR(" M420 S", mbl.has_mesh() ? 1 : 0);
  1088. for (uint8_t py = 1; py <= GRID_MAX_POINTS_Y; py++) {
  1089. for (uint8_t px = 1; px <= GRID_MAX_POINTS_X; px++) {
  1090. CONFIG_ECHO_START;
  1091. SERIAL_ECHOPAIR(" G29 S3 X", (int)px);
  1092. SERIAL_ECHOPAIR(" Y", (int)py);
  1093. SERIAL_ECHOPGM(" Z");
  1094. SERIAL_PROTOCOL_F(mbl.z_values[py-1][px-1], 5);
  1095. SERIAL_EOL;
  1096. }
  1097. }
  1098. #elif ENABLED(AUTO_BED_LEVELING_UBL)
  1099. if (!forReplay) {
  1100. SERIAL_ECHOLNPGM("Unified Bed Leveling:");
  1101. CONFIG_ECHO_START;
  1102. }
  1103. SERIAL_ECHOLNPAIR(" M420 S", ubl.state.active ? 1 : 0);
  1104. if (!forReplay) {
  1105. SERIAL_ECHOPGM("\nUBL is ");
  1106. ubl.state.active ? SERIAL_CHAR('A') : SERIAL_ECHOPGM("Ina");
  1107. SERIAL_ECHOLNPAIR("ctive\n\nActive Mesh Slot: ", ubl.state.eeprom_storage_slot);
  1108. SERIAL_ECHOPGM("z_offset: ");
  1109. SERIAL_ECHO_F(ubl.state.z_offset, 6);
  1110. SERIAL_EOL;
  1111. SERIAL_ECHOPAIR("EEPROM can hold ", (int)((UBL_LAST_EEPROM_INDEX - ubl.eeprom_start) / sizeof(ubl.z_values)));
  1112. SERIAL_ECHOLNPGM(" meshes.\n");
  1113. SERIAL_ECHOLNPGM("GRID_MAX_POINTS_X " STRINGIFY(GRID_MAX_POINTS_X));
  1114. SERIAL_ECHOLNPGM("GRID_MAX_POINTS_Y " STRINGIFY(GRID_MAX_POINTS_Y));
  1115. SERIAL_ECHOLNPGM("UBL_MESH_MIN_X " STRINGIFY(UBL_MESH_MIN_X));
  1116. SERIAL_ECHOLNPGM("UBL_MESH_MIN_Y " STRINGIFY(UBL_MESH_MIN_Y));
  1117. SERIAL_ECHOLNPGM("UBL_MESH_MAX_X " STRINGIFY(UBL_MESH_MAX_X));
  1118. SERIAL_ECHOLNPGM("UBL_MESH_MAX_Y " STRINGIFY(UBL_MESH_MAX_Y));
  1119. SERIAL_ECHOLNPGM("MESH_X_DIST " STRINGIFY(MESH_X_DIST));
  1120. SERIAL_ECHOLNPGM("MESH_Y_DIST " STRINGIFY(MESH_Y_DIST));
  1121. SERIAL_EOL;
  1122. }
  1123. #elif HAS_ABL
  1124. if (!forReplay) {
  1125. SERIAL_ECHOLNPGM("Auto Bed Leveling:");
  1126. CONFIG_ECHO_START;
  1127. }
  1128. SERIAL_ECHOLNPAIR(" M420 S", planner.abl_enabled ? 1 : 0);
  1129. #endif
  1130. #if ENABLED(DELTA)
  1131. CONFIG_ECHO_START;
  1132. if (!forReplay) {
  1133. SERIAL_ECHOLNPGM("Endstop adjustment (mm):");
  1134. CONFIG_ECHO_START;
  1135. }
  1136. SERIAL_ECHOPAIR(" M666 X", endstop_adj[X_AXIS]);
  1137. SERIAL_ECHOPAIR(" Y", endstop_adj[Y_AXIS]);
  1138. SERIAL_ECHOPAIR(" Z", endstop_adj[Z_AXIS]);
  1139. SERIAL_EOL;
  1140. CONFIG_ECHO_START;
  1141. if (!forReplay) {
  1142. SERIAL_ECHOLNPGM("Delta settings: L=diagonal rod, R=radius, S=segments-per-second, ABC=diagonal rod trim, IJK=tower angle trim");
  1143. CONFIG_ECHO_START;
  1144. }
  1145. SERIAL_ECHOPAIR(" M665 L", delta_diagonal_rod);
  1146. SERIAL_ECHOPAIR(" R", delta_radius);
  1147. SERIAL_ECHOPAIR(" S", delta_segments_per_second);
  1148. SERIAL_ECHOPAIR(" A", delta_diagonal_rod_trim[A_AXIS]);
  1149. SERIAL_ECHOPAIR(" B", delta_diagonal_rod_trim[B_AXIS]);
  1150. SERIAL_ECHOPAIR(" C", delta_diagonal_rod_trim[C_AXIS]);
  1151. SERIAL_ECHOPAIR(" I", delta_tower_angle_trim[A_AXIS]);
  1152. SERIAL_ECHOPAIR(" J", delta_tower_angle_trim[B_AXIS]);
  1153. SERIAL_ECHOPAIR(" K", delta_tower_angle_trim[C_AXIS]);
  1154. SERIAL_EOL;
  1155. #elif ENABLED(Z_DUAL_ENDSTOPS)
  1156. CONFIG_ECHO_START;
  1157. if (!forReplay) {
  1158. SERIAL_ECHOLNPGM("Z2 Endstop adjustment (mm):");
  1159. CONFIG_ECHO_START;
  1160. }
  1161. SERIAL_ECHOPAIR(" M666 Z", z_endstop_adj);
  1162. SERIAL_EOL;
  1163. #endif // DELTA
  1164. #if ENABLED(ULTIPANEL)
  1165. CONFIG_ECHO_START;
  1166. if (!forReplay) {
  1167. SERIAL_ECHOLNPGM("Material heatup parameters:");
  1168. CONFIG_ECHO_START;
  1169. }
  1170. for (uint8_t i = 0; i < COUNT(lcd_preheat_hotend_temp); i++) {
  1171. SERIAL_ECHOPAIR(" M145 S", (int)i);
  1172. SERIAL_ECHOPAIR(" H", lcd_preheat_hotend_temp[i]);
  1173. SERIAL_ECHOPAIR(" B", lcd_preheat_bed_temp[i]);
  1174. SERIAL_ECHOPAIR(" F", lcd_preheat_fan_speed[i]);
  1175. SERIAL_EOL;
  1176. }
  1177. #endif // ULTIPANEL
  1178. #if HAS_PID_HEATING
  1179. CONFIG_ECHO_START;
  1180. if (!forReplay) {
  1181. SERIAL_ECHOLNPGM("PID settings:");
  1182. }
  1183. #if ENABLED(PIDTEMP)
  1184. #if HOTENDS > 1
  1185. if (forReplay) {
  1186. HOTEND_LOOP() {
  1187. CONFIG_ECHO_START;
  1188. SERIAL_ECHOPAIR(" M301 E", e);
  1189. SERIAL_ECHOPAIR(" P", PID_PARAM(Kp, e));
  1190. SERIAL_ECHOPAIR(" I", unscalePID_i(PID_PARAM(Ki, e)));
  1191. SERIAL_ECHOPAIR(" D", unscalePID_d(PID_PARAM(Kd, e)));
  1192. #if ENABLED(PID_EXTRUSION_SCALING)
  1193. SERIAL_ECHOPAIR(" C", PID_PARAM(Kc, e));
  1194. if (e == 0) SERIAL_ECHOPAIR(" L", lpq_len);
  1195. #endif
  1196. SERIAL_EOL;
  1197. }
  1198. }
  1199. else
  1200. #endif // HOTENDS > 1
  1201. // !forReplay || HOTENDS == 1
  1202. {
  1203. CONFIG_ECHO_START;
  1204. SERIAL_ECHOPAIR(" M301 P", PID_PARAM(Kp, 0)); // for compatibility with hosts, only echo values for E0
  1205. SERIAL_ECHOPAIR(" I", unscalePID_i(PID_PARAM(Ki, 0)));
  1206. SERIAL_ECHOPAIR(" D", unscalePID_d(PID_PARAM(Kd, 0)));
  1207. #if ENABLED(PID_EXTRUSION_SCALING)
  1208. SERIAL_ECHOPAIR(" C", PID_PARAM(Kc, 0));
  1209. SERIAL_ECHOPAIR(" L", lpq_len);
  1210. #endif
  1211. SERIAL_EOL;
  1212. }
  1213. #endif // PIDTEMP
  1214. #if ENABLED(PIDTEMPBED)
  1215. CONFIG_ECHO_START;
  1216. SERIAL_ECHOPAIR(" M304 P", thermalManager.bedKp);
  1217. SERIAL_ECHOPAIR(" I", unscalePID_i(thermalManager.bedKi));
  1218. SERIAL_ECHOPAIR(" D", unscalePID_d(thermalManager.bedKd));
  1219. SERIAL_EOL;
  1220. #endif
  1221. #endif // PIDTEMP || PIDTEMPBED
  1222. #if HAS_LCD_CONTRAST
  1223. CONFIG_ECHO_START;
  1224. if (!forReplay) {
  1225. SERIAL_ECHOLNPGM("LCD Contrast:");
  1226. CONFIG_ECHO_START;
  1227. }
  1228. SERIAL_ECHOPAIR(" M250 C", lcd_contrast);
  1229. SERIAL_EOL;
  1230. #endif
  1231. #if ENABLED(FWRETRACT)
  1232. CONFIG_ECHO_START;
  1233. if (!forReplay) {
  1234. SERIAL_ECHOLNPGM("Retract: S=Length (mm) F:Speed (mm/m) Z: ZLift (mm)");
  1235. CONFIG_ECHO_START;
  1236. }
  1237. SERIAL_ECHOPAIR(" M207 S", retract_length);
  1238. #if EXTRUDERS > 1
  1239. SERIAL_ECHOPAIR(" W", retract_length_swap);
  1240. #endif
  1241. SERIAL_ECHOPAIR(" F", MMS_TO_MMM(retract_feedrate_mm_s));
  1242. SERIAL_ECHOPAIR(" Z", retract_zlift);
  1243. SERIAL_EOL;
  1244. CONFIG_ECHO_START;
  1245. if (!forReplay) {
  1246. SERIAL_ECHOLNPGM("Recover: S=Extra length (mm) F:Speed (mm/m)");
  1247. CONFIG_ECHO_START;
  1248. }
  1249. SERIAL_ECHOPAIR(" M208 S", retract_recover_length);
  1250. #if EXTRUDERS > 1
  1251. SERIAL_ECHOPAIR(" W", retract_recover_length_swap);
  1252. #endif
  1253. SERIAL_ECHOPAIR(" F", MMS_TO_MMM(retract_recover_feedrate_mm_s));
  1254. SERIAL_EOL;
  1255. CONFIG_ECHO_START;
  1256. if (!forReplay) {
  1257. SERIAL_ECHOLNPGM("Auto-Retract: S=0 to disable, 1 to interpret extrude-only moves as retracts or recoveries");
  1258. CONFIG_ECHO_START;
  1259. }
  1260. SERIAL_ECHOPAIR(" M209 S", autoretract_enabled ? 1 : 0);
  1261. SERIAL_EOL;
  1262. #endif // FWRETRACT
  1263. /**
  1264. * Volumetric extrusion M200
  1265. */
  1266. if (!forReplay) {
  1267. CONFIG_ECHO_START;
  1268. SERIAL_ECHOPGM("Filament settings:");
  1269. if (volumetric_enabled)
  1270. SERIAL_EOL;
  1271. else
  1272. SERIAL_ECHOLNPGM(" Disabled");
  1273. }
  1274. CONFIG_ECHO_START;
  1275. SERIAL_ECHOPAIR(" M200 D", filament_size[0]);
  1276. SERIAL_EOL;
  1277. #if EXTRUDERS > 1
  1278. CONFIG_ECHO_START;
  1279. SERIAL_ECHOPAIR(" M200 T1 D", filament_size[1]);
  1280. SERIAL_EOL;
  1281. #if EXTRUDERS > 2
  1282. CONFIG_ECHO_START;
  1283. SERIAL_ECHOPAIR(" M200 T2 D", filament_size[2]);
  1284. SERIAL_EOL;
  1285. #if EXTRUDERS > 3
  1286. CONFIG_ECHO_START;
  1287. SERIAL_ECHOPAIR(" M200 T3 D", filament_size[3]);
  1288. SERIAL_EOL;
  1289. #if EXTRUDERS > 4
  1290. CONFIG_ECHO_START;
  1291. SERIAL_ECHOPAIR(" M200 T4 D", filament_size[4]);
  1292. SERIAL_EOL;
  1293. #endif // EXTRUDERS > 4
  1294. #endif // EXTRUDERS > 3
  1295. #endif // EXTRUDERS > 2
  1296. #endif // EXTRUDERS > 1
  1297. if (!volumetric_enabled) {
  1298. CONFIG_ECHO_START;
  1299. SERIAL_ECHOLNPGM(" M200 D0");
  1300. }
  1301. /**
  1302. * Auto Bed Leveling
  1303. */
  1304. #if HAS_BED_PROBE
  1305. CONFIG_ECHO_START;
  1306. if (!forReplay) {
  1307. SERIAL_ECHOLNPGM("Z-Probe Offset (mm):");
  1308. CONFIG_ECHO_START;
  1309. }
  1310. SERIAL_ECHOPAIR(" M851 Z", zprobe_zoffset);
  1311. SERIAL_EOL;
  1312. #endif
  1313. /**
  1314. * TMC2130 stepper driver current
  1315. */
  1316. #if ENABLED(HAVE_TMC2130)
  1317. CONFIG_ECHO_START;
  1318. if (!forReplay) {
  1319. SERIAL_ECHOLNPGM("Stepper driver current:");
  1320. CONFIG_ECHO_START;
  1321. }
  1322. SERIAL_ECHO(" M906");
  1323. #if ENABLED(X_IS_TMC2130)
  1324. SERIAL_ECHOPAIR(" X", stepperX.getCurrent());
  1325. #endif
  1326. #if ENABLED(Y_IS_TMC2130)
  1327. SERIAL_ECHOPAIR(" Y", stepperY.getCurrent());
  1328. #endif
  1329. #if ENABLED(Z_IS_TMC2130)
  1330. SERIAL_ECHOPAIR(" Z", stepperZ.getCurrent());
  1331. #endif
  1332. #if ENABLED(X2_IS_TMC2130)
  1333. SERIAL_ECHOPAIR(" X2", stepperX2.getCurrent());
  1334. #endif
  1335. #if ENABLED(Y2_IS_TMC2130)
  1336. SERIAL_ECHOPAIR(" Y2", stepperY2.getCurrent());
  1337. #endif
  1338. #if ENABLED(Z2_IS_TMC2130)
  1339. SERIAL_ECHOPAIR(" Z2", stepperZ2.getCurrent());
  1340. #endif
  1341. #if ENABLED(E0_IS_TMC2130)
  1342. SERIAL_ECHOPAIR(" E0", stepperE0.getCurrent());
  1343. #endif
  1344. #if ENABLED(E1_IS_TMC2130)
  1345. SERIAL_ECHOPAIR(" E1", stepperE1.getCurrent());
  1346. #endif
  1347. #if ENABLED(E2_IS_TMC2130)
  1348. SERIAL_ECHOPAIR(" E2", stepperE2.getCurrent());
  1349. #endif
  1350. #if ENABLED(E3_IS_TMC2130)
  1351. SERIAL_ECHOPAIR(" E3", stepperE3.getCurrent());
  1352. #endif
  1353. SERIAL_EOL;
  1354. #endif
  1355. }
  1356. #endif // !DISABLE_M503