ConfigurationStore.cpp 17 KB

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