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

2.0.x
Scott Lahteine 8 years ago
parent 36cc03a9b4
commit 4134a6b526

@ -1125,12 +1125,12 @@ void MarlinSettings::postprocess() {
* M502 - Reset Configuration * M502 - Reset Configuration
*/ */
void MarlinSettings::reset() { void MarlinSettings::reset() {
const float tmp1[] = DEFAULT_AXIS_STEPS_PER_UNIT, tmp2[] = DEFAULT_MAX_FEEDRATE; static const float tmp1[] PROGMEM = DEFAULT_AXIS_STEPS_PER_UNIT, tmp2[] PROGMEM = DEFAULT_MAX_FEEDRATE;
const uint32_t tmp3[] = DEFAULT_MAX_ACCELERATION; static const uint32_t tmp3[] PROGMEM = DEFAULT_MAX_ACCELERATION;
LOOP_XYZE_N(i) { LOOP_XYZE_N(i) {
planner.axis_steps_per_mm[i] = tmp1[i < COUNT(tmp1) ? i : COUNT(tmp1) - 1]; planner.axis_steps_per_mm[i] = pgm_read_float(&tmp1[i < COUNT(tmp1) ? i : COUNT(tmp1) - 1]);
planner.max_feedrate_mm_s[i] = tmp2[i < COUNT(tmp2) ? i : COUNT(tmp2) - 1]; planner.max_feedrate_mm_s[i] = pgm_read_float(&tmp2[i < COUNT(tmp2) ? i : COUNT(tmp2) - 1]);
planner.max_acceleration_mm_per_s2[i] = tmp3[i < COUNT(tmp3) ? i : COUNT(tmp3) - 1]; planner.max_acceleration_mm_per_s2[i] = pgm_read_float(&tmp3[i < COUNT(tmp3) ? i : COUNT(tmp3) - 1]);
} }
planner.acceleration = DEFAULT_ACCELERATION; planner.acceleration = DEFAULT_ACCELERATION;
@ -1265,9 +1265,9 @@ void MarlinSettings::reset() {
endstops.enable_globally( endstops.enable_globally(
#if ENABLED(ENDSTOPS_ALWAYS_ON_DEFAULT) #if ENABLED(ENDSTOPS_ALWAYS_ON_DEFAULT)
(true) true
#else #else
(false) false
#endif #endif
); );

Loading…
Cancel
Save