Browse Source

Add shared Config_Postprocess for Read and Reset

Scott Lahteine 9 years ago
parent
commit
bc3748b7bc
1 changed files with 15 additions and 16 deletions
  1. 15
    16
      Marlin/configuration_store.cpp

+ 15
- 16
Marlin/configuration_store.cpp View File

@@ -163,10 +163,22 @@ void _EEPROM_readData(int &pos, uint8_t* value, uint8_t size) {
163 163
 }
164 164
 
165 165
 /**
166
- * Store Configuration Settings - M500
166
+ * Post-process after Retrieve or Reset
167 167
  */
168
+void Config_Postprocess() {
169
+  // steps per s2 needs to be updated to agree with units per s2
170
+  planner.reset_acceleration_rates();
171
+
172
+  #if ENABLED(DELTA)
173
+    recalc_delta_settings(delta_radius, delta_diagonal_rod);
174
+  #endif
168 175
 
176
+  #if ENABLED(PIDTEMP)
177
+    thermalManager.updatePID();
178
+  #endif
169 179
 
180
+  calculate_volumetric_multipliers();
181
+}
170 182
 
171 183
 #if ENABLED(EEPROM_SETTINGS)
172 184
 
@@ -376,9 +388,6 @@ void Config_RetrieveSettings() {
376 388
     EEPROM_READ_VAR(i, planner.max_feedrate);
377 389
     EEPROM_READ_VAR(i, planner.max_acceleration_mm_per_s2);
378 390
 
379
-    // 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)
380
-    planner.reset_acceleration_rates();
381
-
382 391
     EEPROM_READ_VAR(i, planner.acceleration);
383 392
     EEPROM_READ_VAR(i, planner.retract_acceleration);
384 393
     EEPROM_READ_VAR(i, planner.travel_acceleration);
@@ -421,7 +430,6 @@ void Config_RetrieveSettings() {
421 430
       EEPROM_READ_VAR(i, delta_diagonal_rod_trim_tower_1);  // 1 float
422 431
       EEPROM_READ_VAR(i, delta_diagonal_rod_trim_tower_2);  // 1 float
423 432
       EEPROM_READ_VAR(i, delta_diagonal_rod_trim_tower_3);  // 1 float
424
-      recalc_delta_settings(delta_radius, delta_diagonal_rod);
425 433
     #elif ENABLED(Z_DUAL_ENDSTOPS)
426 434
       EEPROM_READ_VAR(i, z_endstop_adj);
427 435
       dummy = 0.0f;
@@ -519,10 +527,6 @@ void Config_RetrieveSettings() {
519 527
       if (q < EXTRUDERS) filament_size[q] = dummy;
520 528
     }
521 529
 
522
-    calculate_volumetric_multipliers();
523
-    // Call thermalManager.updatePID (similar to when we have processed M301)
524
-    thermalManager.updatePID();
525
-
526 530
     if (eeprom_checksum == stored_checksum) {
527 531
       Config_Postprocess();
528 532
       SERIAL_ECHO_START;
@@ -561,9 +565,6 @@ void Config_ResetDefault() {
561 565
     #endif
562 566
   }
563 567
 
564
-  // steps per sq second need to be updated to agree with the units per sq second
565
-  planner.reset_acceleration_rates();
566
-
567 568
   planner.acceleration = DEFAULT_ACCELERATION;
568 569
   planner.retract_acceleration = DEFAULT_RETRACT_ACCELERATION;
569 570
   planner.travel_acceleration = DEFAULT_TRAVEL_ACCELERATION;
@@ -591,7 +592,6 @@ void Config_ResetDefault() {
591 592
     delta_diagonal_rod_trim_tower_1 = DELTA_DIAGONAL_ROD_TRIM_TOWER_1;
592 593
     delta_diagonal_rod_trim_tower_2 = DELTA_DIAGONAL_ROD_TRIM_TOWER_2;
593 594
     delta_diagonal_rod_trim_tower_3 = DELTA_DIAGONAL_ROD_TRIM_TOWER_3;
594
-    recalc_delta_settings(delta_radius, delta_diagonal_rod);
595 595
   #elif ENABLED(Z_DUAL_ENDSTOPS)
596 596
     z_endstop_adj = 0;
597 597
   #endif
@@ -626,8 +626,6 @@ void Config_ResetDefault() {
626 626
     #if ENABLED(PID_ADD_EXTRUSION_RATE)
627 627
       lpq_len = 20; // default last-position-queue size
628 628
     #endif
629
-    // call thermalManager.updatePID (similar to when we have processed M301)
630
-    thermalManager.updatePID();
631 629
   #endif // PIDTEMP
632 630
 
633 631
   #if ENABLED(PIDTEMPBED)
@@ -654,7 +652,8 @@ void Config_ResetDefault() {
654 652
   volumetric_enabled = false;
655 653
   for (uint8_t q = 0; q < COUNT(filament_size); q++)
656 654
     filament_size[q] = DEFAULT_NOMINAL_FILAMENT_DIA;
657
-  calculate_volumetric_multipliers();
655
+
656
+  Config_Postprocess();
658 657
 
659 658
   SERIAL_ECHO_START;
660 659
   SERIAL_ECHOLNPGM("Hardcoded Default Settings Loaded");

Loading…
Cancel
Save