Browse Source

Save 88b PROGMEM, 48 bytes SRAM in settings.reset

Scott Lahteine 7 years ago
parent
commit
4134a6b526
1 changed files with 7 additions and 7 deletions
  1. 7
    7
      Marlin/configuration_store.cpp

+ 7
- 7
Marlin/configuration_store.cpp View File

@@ -1125,12 +1125,12 @@ void MarlinSettings::postprocess() {
1125 1125
  * M502 - Reset Configuration
1126 1126
  */
1127 1127
 void MarlinSettings::reset() {
1128
-  const float tmp1[] = DEFAULT_AXIS_STEPS_PER_UNIT, tmp2[] = DEFAULT_MAX_FEEDRATE;
1129
-  const uint32_t tmp3[] = DEFAULT_MAX_ACCELERATION;
1128
+  static const float tmp1[] PROGMEM = DEFAULT_AXIS_STEPS_PER_UNIT, tmp2[] PROGMEM = DEFAULT_MAX_FEEDRATE;
1129
+  static const uint32_t tmp3[] PROGMEM = DEFAULT_MAX_ACCELERATION;
1130 1130
   LOOP_XYZE_N(i) {
1131
-    planner.axis_steps_per_mm[i]          = tmp1[i < COUNT(tmp1) ? i : COUNT(tmp1) - 1];
1132
-    planner.max_feedrate_mm_s[i]          = tmp2[i < COUNT(tmp2) ? i : COUNT(tmp2) - 1];
1133
-    planner.max_acceleration_mm_per_s2[i] = tmp3[i < COUNT(tmp3) ? i : COUNT(tmp3) - 1];
1131
+    planner.axis_steps_per_mm[i]          = pgm_read_float(&tmp1[i < COUNT(tmp1) ? i : COUNT(tmp1) - 1]);
1132
+    planner.max_feedrate_mm_s[i]          = pgm_read_float(&tmp2[i < COUNT(tmp2) ? i : COUNT(tmp2) - 1]);
1133
+    planner.max_acceleration_mm_per_s2[i] = pgm_read_float(&tmp3[i < COUNT(tmp3) ? i : COUNT(tmp3) - 1]);
1134 1134
   }
1135 1135
 
1136 1136
   planner.acceleration = DEFAULT_ACCELERATION;
@@ -1265,9 +1265,9 @@ void MarlinSettings::reset() {
1265 1265
 
1266 1266
   endstops.enable_globally(
1267 1267
     #if ENABLED(ENDSTOPS_ALWAYS_ON_DEFAULT)
1268
-      (true)
1268
+      true
1269 1269
     #else
1270
-      (false)
1270
+      false
1271 1271
     #endif
1272 1272
   );
1273 1273
 

Loading…
Cancel
Save