ConfigurationStore.cpp 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442
  1. #include "Marlin.h"
  2. #include "planner.h"
  3. #include "temperature.h"
  4. #include "ultralcd.h"
  5. #include "ConfigurationStore.h"
  6. #include "Configuration_prusa.h"
  7. #ifdef MESH_BED_LEVELING
  8. #include "mesh_bed_leveling.h"
  9. #endif
  10. #ifdef DEBUG_EEPROM_WRITE
  11. #define EEPROM_WRITE_VAR(pos, value) _EEPROM_writeData(pos, (uint8_t*)&value, sizeof(value), #value)
  12. static void _EEPROM_writeData(int &pos, uint8_t* value, uint8_t size, char* name)
  13. #else //DEBUG_EEPROM_WRITE
  14. #define EEPROM_WRITE_VAR(pos, value) _EEPROM_writeData(pos, (uint8_t*)&value, sizeof(value))
  15. static void _EEPROM_writeData(int &pos, uint8_t* value, uint8_t size)
  16. #endif //DEBUG_EEPROM_WRITE
  17. {
  18. #ifdef DEBUG_EEPROM_WRITE
  19. printf_P(PSTR("EEPROM_WRITE_VAR addr=0x%04x size=0x%02hhx name=%s\n"), pos, size, name);
  20. #endif //DEBUG_EEPROM_WRITE
  21. while (size--) {
  22. uint8_t * const p = (uint8_t * const)pos;
  23. uint8_t v = *value;
  24. // EEPROM has only ~100,000 write cycles,
  25. // so only write bytes that have changed!
  26. if (v != eeprom_read_byte(p)) {
  27. eeprom_write_byte(p, v);
  28. if (eeprom_read_byte(p) != v) {
  29. SERIAL_ECHOLNPGM("EEPROM Error");
  30. return;
  31. }
  32. }
  33. pos++;
  34. value++;
  35. };
  36. }
  37. #ifdef DEBUG_EEPROM_READ
  38. #define EEPROM_READ_VAR(pos, value) _EEPROM_readData(pos, (uint8_t*)&value, sizeof(value), #value)
  39. static void _EEPROM_readData(int &pos, uint8_t* value, uint8_t size, char* name)
  40. #else //DEBUG_EEPROM_READ
  41. #define EEPROM_READ_VAR(pos, value) _EEPROM_readData(pos, (uint8_t*)&value, sizeof(value))
  42. static void _EEPROM_readData(int &pos, uint8_t* value, uint8_t size)
  43. #endif //DEBUG_EEPROM_READ
  44. {
  45. #ifdef DEBUG_EEPROM_READ
  46. printf_P(PSTR("EEPROM_READ_VAR addr=0x%04x size=0x%02hhx name=%s\n"), pos, size, name);
  47. #endif //DEBUG_EEPROM_READ
  48. do
  49. {
  50. *value = eeprom_read_byte((unsigned char*)pos);
  51. pos++;
  52. value++;
  53. }while(--size);
  54. }
  55. //======================================================================================
  56. #define EEPROM_OFFSET 20
  57. // IMPORTANT: Whenever there are changes made to the variables stored in EEPROM
  58. // in the functions below, also increment the version number. This makes sure that
  59. // the default values are used whenever there is a change to the data, to prevent
  60. // wrong data being written to the variables.
  61. // ALSO: always make sure the variables in the Store and retrieve sections are in the same order.
  62. #define EEPROM_VERSION "V2"
  63. #ifdef EEPROM_SETTINGS
  64. void Config_StoreSettings(uint16_t offset)
  65. {
  66. char ver[4]= "000";
  67. int i = offset;
  68. EEPROM_WRITE_VAR(i,ver); // invalidate data first
  69. EEPROM_WRITE_VAR(i,axis_steps_per_unit);
  70. EEPROM_WRITE_VAR(i,max_feedrate_normal);
  71. EEPROM_WRITE_VAR(i,max_acceleration_units_per_sq_second_normal);
  72. EEPROM_WRITE_VAR(i,acceleration);
  73. EEPROM_WRITE_VAR(i,retract_acceleration);
  74. EEPROM_WRITE_VAR(i,minimumfeedrate);
  75. EEPROM_WRITE_VAR(i,mintravelfeedrate);
  76. EEPROM_WRITE_VAR(i,minsegmenttime);
  77. EEPROM_WRITE_VAR(i,max_jerk[X_AXIS]);
  78. EEPROM_WRITE_VAR(i,max_jerk[Y_AXIS]);
  79. EEPROM_WRITE_VAR(i,max_jerk[Z_AXIS]);
  80. EEPROM_WRITE_VAR(i,max_jerk[E_AXIS]);
  81. EEPROM_WRITE_VAR(i,add_homing);
  82. /* EEPROM_WRITE_VAR(i,plaPreheatHotendTemp);
  83. EEPROM_WRITE_VAR(i,plaPreheatHPBTemp);
  84. EEPROM_WRITE_VAR(i,plaPreheatFanSpeed);
  85. EEPROM_WRITE_VAR(i,absPreheatHotendTemp);
  86. EEPROM_WRITE_VAR(i,absPreheatHPBTemp);
  87. EEPROM_WRITE_VAR(i,absPreheatFanSpeed);
  88. */
  89. EEPROM_WRITE_VAR(i,zprobe_zoffset);
  90. #ifdef PIDTEMP
  91. EEPROM_WRITE_VAR(i,Kp);
  92. EEPROM_WRITE_VAR(i,Ki);
  93. EEPROM_WRITE_VAR(i,Kd);
  94. #else
  95. float dummy = 3000.0f;
  96. EEPROM_WRITE_VAR(i,dummy);
  97. dummy = 0.0f;
  98. EEPROM_WRITE_VAR(i,dummy);
  99. EEPROM_WRITE_VAR(i,dummy);
  100. #endif
  101. #ifdef PIDTEMPBED
  102. EEPROM_WRITE_VAR(i, bedKp);
  103. EEPROM_WRITE_VAR(i, bedKi);
  104. EEPROM_WRITE_VAR(i, bedKd);
  105. #endif
  106. int lcd_contrast = 0;
  107. EEPROM_WRITE_VAR(i,lcd_contrast);
  108. #ifdef FWRETRACT
  109. EEPROM_WRITE_VAR(i,autoretract_enabled);
  110. EEPROM_WRITE_VAR(i,retract_length);
  111. #if EXTRUDERS > 1
  112. EEPROM_WRITE_VAR(i,retract_length_swap);
  113. #endif
  114. EEPROM_WRITE_VAR(i,retract_feedrate);
  115. EEPROM_WRITE_VAR(i,retract_zlift);
  116. EEPROM_WRITE_VAR(i,retract_recover_length);
  117. #if EXTRUDERS > 1
  118. EEPROM_WRITE_VAR(i,retract_recover_length_swap);
  119. #endif
  120. EEPROM_WRITE_VAR(i,retract_recover_feedrate);
  121. #endif
  122. // Save filament sizes
  123. EEPROM_WRITE_VAR(i, volumetric_enabled);
  124. EEPROM_WRITE_VAR(i, filament_size[0]);
  125. #if EXTRUDERS > 1
  126. EEPROM_WRITE_VAR(i, filament_size[1]);
  127. #if EXTRUDERS > 2
  128. EEPROM_WRITE_VAR(i, filament_size[2]);
  129. #endif
  130. #endif
  131. EEPROM_WRITE_VAR(i,max_feedrate_silent);
  132. EEPROM_WRITE_VAR(i,max_acceleration_units_per_sq_second_silent);
  133. char ver2[4]=EEPROM_VERSION;
  134. i=offset;
  135. EEPROM_WRITE_VAR(i,ver2); // validate data
  136. SERIAL_ECHO_START;
  137. SERIAL_ECHOLNPGM("Settings Stored");
  138. }
  139. #endif //EEPROM_SETTINGS
  140. #ifndef DISABLE_M503
  141. void Config_PrintSettings(uint8_t level)
  142. { // Always have this function, even with EEPROM_SETTINGS disabled, the current values will be shown
  143. #ifdef TMC2130
  144. printf_P(PSTR(
  145. "%SSteps per unit:\n%S M92 X%.2f Y%.2f Z%.2f E%.2f\n"
  146. "%SMaximum feedrates - normal (mm/s):\n%S M203 X%.2f Y%.2f Z%.2f E%.2f\n"
  147. "%SMaximum feedrates - stealth (mm/s):\n%S M203 X%.2f Y%.2f Z%.2f E%.2f\n"
  148. "%SMaximum acceleration - normal (mm/s2):\n%S M201 X%lu Y%lu Z%lu E%lu\n"
  149. "%SMaximum acceleration - stealth (mm/s2):\n%S M201 X%lu Y%lu Z%lu E%lu\n"
  150. "%SAcceleration: S=acceleration, T=retract acceleration\n%S M204 S%.2f T%.2f\n"
  151. "%SAdvanced 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)\n%S M205 S%.2f T%.2f B%.2f X%.2f Y%.2f Z%.2f E%.2f\n"
  152. "%SHome offset (mm):\n%S M206 X%.2f Y%.2f Z%.2f\n"
  153. ),
  154. echomagic, echomagic, axis_steps_per_unit[X_AXIS], axis_steps_per_unit[Y_AXIS], axis_steps_per_unit[Z_AXIS], axis_steps_per_unit[E_AXIS],
  155. echomagic, echomagic, max_feedrate_normal[X_AXIS], max_feedrate_normal[Y_AXIS], max_feedrate_normal[Z_AXIS], max_feedrate_normal[E_AXIS],
  156. echomagic, echomagic, max_feedrate_silent[X_AXIS], max_feedrate_silent[Y_AXIS], max_feedrate_silent[Z_AXIS], max_feedrate_silent[E_AXIS],
  157. echomagic, echomagic, max_acceleration_units_per_sq_second_normal[X_AXIS], max_acceleration_units_per_sq_second_normal[Y_AXIS], max_acceleration_units_per_sq_second_normal[Z_AXIS], max_acceleration_units_per_sq_second_normal[E_AXIS],
  158. echomagic, echomagic, max_acceleration_units_per_sq_second_silent[X_AXIS], max_acceleration_units_per_sq_second_silent[Y_AXIS], max_acceleration_units_per_sq_second_silent[Z_AXIS], max_acceleration_units_per_sq_second_silent[E_AXIS],
  159. echomagic, echomagic, acceleration, retract_acceleration,
  160. echomagic, echomagic, minimumfeedrate, mintravelfeedrate, minsegmenttime, max_jerk[X_AXIS], max_jerk[Y_AXIS], max_jerk[Z_AXIS], max_jerk[E_AXIS],
  161. echomagic, echomagic, add_homing[X_AXIS], add_homing[Y_AXIS], add_homing[Z_AXIS]
  162. #else //TMC2130
  163. printf_P(PSTR(
  164. "%SSteps per unit:\n%S M92 X%.2f Y%.2f Z%.2f E%.2f\n"
  165. "%SMaximum feedrates (mm/s):\n%S M203 X%.2f Y%.2f Z%.2f E%.2f\n"
  166. "%SMaximum acceleration (mm/s2):\n%S M201 X%lu Y%lu Z%lu E%lu\n"
  167. "%SAcceleration: S=acceleration, T=retract acceleration\n%S M204 S%.2f T%.2f\n"
  168. "%SAdvanced 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)\n%S M205 S%.2f T%.2f B%.2f X%.2f Y%.2f Z%.2f E%.2f\n"
  169. "%SHome offset (mm):\n%S M206 X%.2f Y%.2f Z%.2f\n"
  170. ),
  171. echomagic, echomagic, axis_steps_per_unit[X_AXIS], axis_steps_per_unit[Y_AXIS], axis_steps_per_unit[Z_AXIS], axis_steps_per_unit[E_AXIS],
  172. echomagic, echomagic, max_feedrate[X_AXIS], max_feedrate[Y_AXIS], max_feedrate[Z_AXIS], max_feedrate[E_AXIS],
  173. echomagic, echomagic, max_acceleration_units_per_sq_second[X_AXIS], max_acceleration_units_per_sq_second[Y_AXIS], max_acceleration_units_per_sq_second[Z_AXIS], max_acceleration_units_per_sq_second[E_AXIS],
  174. echomagic, echomagic, acceleration, retract_acceleration,
  175. echomagic, echomagic, minimumfeedrate, mintravelfeedrate, minsegmenttime, max_jerk[X_AXIS], max_jerk[Y_AXIS], max_jerk[Z_AXIS], max_jerk[E_AXIS],
  176. echomagic, echomagic, add_homing[X_AXIS], add_homing[Y_AXIS], add_homing[Z_AXIS]
  177. #endif //TMC2130
  178. );
  179. #ifdef PIDTEMP
  180. printf_P(PSTR("%SPID settings:\n%S M301 P%.2f I%.2f D%.2f\n"),
  181. echomagic, echomagic, Kp, unscalePID_i(Ki), unscalePID_d(Kd));
  182. #endif
  183. #ifdef PIDTEMPBED
  184. printf_P(PSTR("%SPID heatbed settings:\n%S M304 P%.2f I%.2f D%.2f\n"),
  185. echomagic, echomagic, bedKp, unscalePID_i(bedKi), unscalePID_d(bedKd));
  186. #endif
  187. #ifdef FWRETRACT
  188. printf_P(PSTR(
  189. "%SRetract: S=Length (mm) F:Speed (mm/m) Z: ZLift (mm)\n%S M207 S%.2f F%.2f Z%.2f\n"
  190. "%SRecover: S=Extra length (mm) F:Speed (mm/m)\n%S M208 S%.2f F%.2f\n"
  191. "%SAuto-Retract: S=0 to disable, 1 to interpret extrude-only moves as retracts or recoveries\n%S M209 S%d\n"
  192. ),
  193. echomagic, echomagic, retract_length, retract_feedrate*60, retract_zlift,
  194. echomagic, echomagic, retract_recover_length, retract_recover_feedrate*60,
  195. echomagic, echomagic, (autoretract_enabled ? 1 : 0)
  196. );
  197. #if EXTRUDERS > 1
  198. printf_P(PSTR("%SMulti-extruder settings:\n%S Swap retract length (mm): %.2f\n%S Swap rec. addl. length (mm): %.2f\n"),
  199. echomagic, echomagic, retract_length_swap, echomagic, retract_recover_length_swap);
  200. #endif
  201. if (volumetric_enabled) {
  202. printf_P(PSTR("%SFilament settings:\n%S M200 D%.2f\n"),
  203. echomagic, echomagic, filament_size[0]);
  204. #if EXTRUDERS > 1
  205. printf_P(PSTR("%S M200 T1 D%.2f\n"),
  206. echomagic, echomagic, filament_size[1]);
  207. #if EXTRUDERS > 2
  208. printf_P(PSTR("%S M200 T1 D%.2f\n"),
  209. echomagic, echomagic, filament_size[2]);
  210. #endif
  211. #endif
  212. } else {
  213. printf_P(PSTR("%SFilament settings: Disabled\n"), echomagic);
  214. }
  215. #endif
  216. if (level >= 10) {
  217. #ifdef LIN_ADVANCE
  218. printf_P(PSTR("%SLinear advance settings:\n M900 K%.2f E/D = %.2f\n"),
  219. echomagic, extruder_advance_k, advance_ed_ratio);
  220. #endif //LIN_ADVANCE
  221. }
  222. }
  223. #endif
  224. #ifdef EEPROM_SETTINGS
  225. bool Config_RetrieveSettings(uint16_t offset)
  226. {
  227. int i=offset;
  228. bool previous_settings_retrieved = true;
  229. char stored_ver[4];
  230. char ver[4]=EEPROM_VERSION;
  231. EEPROM_READ_VAR(i,stored_ver); //read stored version
  232. // SERIAL_ECHOLN("Version: [" << ver << "] Stored version: [" << stored_ver << "]");
  233. if (strncmp(ver,stored_ver,3) == 0)
  234. {
  235. // version number match
  236. EEPROM_READ_VAR(i,axis_steps_per_unit);
  237. EEPROM_READ_VAR(i,max_feedrate_normal);
  238. EEPROM_READ_VAR(i,max_acceleration_units_per_sq_second_normal);
  239. // steps per sq second need to be updated to agree with the units per sq second (as they are what is used in the planner)
  240. EEPROM_READ_VAR(i,acceleration);
  241. EEPROM_READ_VAR(i,retract_acceleration);
  242. EEPROM_READ_VAR(i,minimumfeedrate);
  243. EEPROM_READ_VAR(i,mintravelfeedrate);
  244. EEPROM_READ_VAR(i,minsegmenttime);
  245. EEPROM_READ_VAR(i,max_jerk[X_AXIS]);
  246. EEPROM_READ_VAR(i,max_jerk[Y_AXIS]);
  247. EEPROM_READ_VAR(i,max_jerk[Z_AXIS]);
  248. EEPROM_READ_VAR(i,max_jerk[E_AXIS]);
  249. if (max_jerk[X_AXIS] > DEFAULT_XJERK) max_jerk[X_AXIS] = DEFAULT_XJERK;
  250. if (max_jerk[Y_AXIS] > DEFAULT_YJERK) max_jerk[Y_AXIS] = DEFAULT_YJERK;
  251. EEPROM_READ_VAR(i,add_homing);
  252. /*
  253. EEPROM_READ_VAR(i,plaPreheatHotendTemp);
  254. EEPROM_READ_VAR(i,plaPreheatHPBTemp);
  255. EEPROM_READ_VAR(i,plaPreheatFanSpeed);
  256. EEPROM_READ_VAR(i,absPreheatHotendTemp);
  257. EEPROM_READ_VAR(i,absPreheatHPBTemp);
  258. EEPROM_READ_VAR(i,absPreheatFanSpeed);
  259. */
  260. EEPROM_READ_VAR(i,zprobe_zoffset);
  261. #ifndef PIDTEMP
  262. float Kp,Ki,Kd;
  263. #endif
  264. // do not need to scale PID values as the values in EEPROM are already scaled
  265. EEPROM_READ_VAR(i,Kp);
  266. EEPROM_READ_VAR(i,Ki);
  267. EEPROM_READ_VAR(i,Kd);
  268. #ifdef PIDTEMPBED
  269. EEPROM_READ_VAR(i, bedKp);
  270. EEPROM_READ_VAR(i, bedKi);
  271. EEPROM_READ_VAR(i, bedKd);
  272. #endif
  273. int lcd_contrast;
  274. EEPROM_READ_VAR(i,lcd_contrast);
  275. #ifdef FWRETRACT
  276. EEPROM_READ_VAR(i,autoretract_enabled);
  277. EEPROM_READ_VAR(i,retract_length);
  278. #if EXTRUDERS > 1
  279. EEPROM_READ_VAR(i,retract_length_swap);
  280. #endif
  281. EEPROM_READ_VAR(i,retract_feedrate);
  282. EEPROM_READ_VAR(i,retract_zlift);
  283. EEPROM_READ_VAR(i,retract_recover_length);
  284. #if EXTRUDERS > 1
  285. EEPROM_READ_VAR(i,retract_recover_length_swap);
  286. #endif
  287. EEPROM_READ_VAR(i,retract_recover_feedrate);
  288. #endif
  289. EEPROM_READ_VAR(i, volumetric_enabled);
  290. EEPROM_READ_VAR(i, filament_size[0]);
  291. #if EXTRUDERS > 1
  292. EEPROM_READ_VAR(i, filament_size[1]);
  293. #if EXTRUDERS > 2
  294. EEPROM_READ_VAR(i, filament_size[2]);
  295. #endif
  296. #endif
  297. calculate_extruder_multipliers();
  298. EEPROM_READ_VAR(i,max_feedrate_silent);
  299. EEPROM_READ_VAR(i,max_acceleration_units_per_sq_second_silent);
  300. #ifdef TMC2130
  301. for (uint8_t j = X_AXIS; j <= Y_AXIS; j++)
  302. {
  303. if (max_feedrate_normal[j] > NORMAL_MAX_FEEDRATE_XY)
  304. max_feedrate_normal[j] = NORMAL_MAX_FEEDRATE_XY;
  305. if (max_feedrate_silent[j] > SILENT_MAX_FEEDRATE_XY)
  306. max_feedrate_silent[j] = SILENT_MAX_FEEDRATE_XY;
  307. if (max_acceleration_units_per_sq_second_normal[j] > NORMAL_MAX_ACCEL_XY)
  308. max_acceleration_units_per_sq_second_normal[j] = NORMAL_MAX_ACCEL_XY;
  309. if (max_acceleration_units_per_sq_second_silent[j] > SILENT_MAX_ACCEL_XY)
  310. max_acceleration_units_per_sq_second_silent[j] = SILENT_MAX_ACCEL_XY;
  311. }
  312. #endif //TMC2130
  313. reset_acceleration_rates();
  314. // Call updatePID (similar to when we have processed M301)
  315. updatePID();
  316. SERIAL_ECHO_START;
  317. SERIAL_ECHOLNPGM("Stored settings retrieved");
  318. }
  319. else
  320. {
  321. Config_ResetDefault();
  322. //Return false to inform user that eeprom version was changed and firmware is using default hardcoded settings now.
  323. //In case that storing to eeprom was not used yet, do not inform user that hardcoded settings are used.
  324. if (eeprom_read_byte((uint8_t *)offset) != 0xFF ||
  325. eeprom_read_byte((uint8_t *)offset + 1) != 0xFF ||
  326. eeprom_read_byte((uint8_t *)offset + 2) != 0xFF) {
  327. previous_settings_retrieved = false;
  328. }
  329. }
  330. #ifdef EEPROM_CHITCHAT
  331. Config_PrintSettings();
  332. #endif
  333. return previous_settings_retrieved;
  334. }
  335. #endif
  336. void Config_ResetDefault()
  337. {
  338. float tmp1[]=DEFAULT_AXIS_STEPS_PER_UNIT;
  339. float tmp2[]=DEFAULT_MAX_FEEDRATE;
  340. long tmp3[]=DEFAULT_MAX_ACCELERATION;
  341. float tmp4[]=DEFAULT_MAX_FEEDRATE_SILENT;
  342. long tmp5[]=DEFAULT_MAX_ACCELERATION_SILENT;
  343. for (short i=0;i<4;i++)
  344. {
  345. axis_steps_per_unit[i]=tmp1[i];
  346. max_feedrate_normal[i]=tmp2[i];
  347. max_acceleration_units_per_sq_second_normal[i]=tmp3[i];
  348. max_feedrate_silent[i]=tmp4[i];
  349. max_acceleration_units_per_sq_second_silent[i]=tmp5[i];
  350. }
  351. // steps per sq second need to be updated to agree with the units per sq second
  352. reset_acceleration_rates();
  353. acceleration=DEFAULT_ACCELERATION;
  354. retract_acceleration=DEFAULT_RETRACT_ACCELERATION;
  355. minimumfeedrate=DEFAULT_MINIMUMFEEDRATE;
  356. minsegmenttime=DEFAULT_MINSEGMENTTIME;
  357. mintravelfeedrate=DEFAULT_MINTRAVELFEEDRATE;
  358. max_jerk[X_AXIS] = DEFAULT_XJERK;
  359. max_jerk[Y_AXIS] = DEFAULT_YJERK;
  360. max_jerk[Z_AXIS] = DEFAULT_ZJERK;
  361. max_jerk[E_AXIS] = DEFAULT_EJERK;
  362. add_homing[X_AXIS] = add_homing[Y_AXIS] = add_homing[Z_AXIS] = 0;
  363. #ifdef ENABLE_AUTO_BED_LEVELING
  364. zprobe_zoffset = -Z_PROBE_OFFSET_FROM_EXTRUDER;
  365. #endif
  366. #ifdef PIDTEMP
  367. Kp = DEFAULT_Kp;
  368. Ki = scalePID_i(DEFAULT_Ki);
  369. Kd = scalePID_d(DEFAULT_Kd);
  370. // call updatePID (similar to when we have processed M301)
  371. updatePID();
  372. #ifdef PID_ADD_EXTRUSION_RATE
  373. Kc = DEFAULT_Kc;
  374. #endif//PID_ADD_EXTRUSION_RATE
  375. #endif//PIDTEMP
  376. #ifdef FWRETRACT
  377. autoretract_enabled = false;
  378. retract_length = RETRACT_LENGTH;
  379. #if EXTRUDERS > 1
  380. retract_length_swap = RETRACT_LENGTH_SWAP;
  381. #endif
  382. retract_feedrate = RETRACT_FEEDRATE;
  383. retract_zlift = RETRACT_ZLIFT;
  384. retract_recover_length = RETRACT_RECOVER_LENGTH;
  385. #if EXTRUDERS > 1
  386. retract_recover_length_swap = RETRACT_RECOVER_LENGTH_SWAP;
  387. #endif
  388. retract_recover_feedrate = RETRACT_RECOVER_FEEDRATE;
  389. #endif
  390. volumetric_enabled = false;
  391. filament_size[0] = DEFAULT_NOMINAL_FILAMENT_DIA;
  392. #if EXTRUDERS > 1
  393. filament_size[1] = DEFAULT_NOMINAL_FILAMENT_DIA;
  394. #if EXTRUDERS > 2
  395. filament_size[2] = DEFAULT_NOMINAL_FILAMENT_DIA;
  396. #endif
  397. #endif
  398. calculate_extruder_multipliers();
  399. SERIAL_ECHO_START;
  400. SERIAL_ECHOLNPGM("Hardcoded Default Settings Loaded");
  401. }