🐛 Don't apply settings during validation (#26935)
Check the `validating` variable before applying settings for several features. This specifically avoids settings corruption for BACKLASH_PREVENTION, which has side-effects when first applied using incorrect values.
This commit is contained in:
@@ -1940,7 +1940,7 @@ void MarlinSettings::postprocess() {
|
|||||||
_FIELD_TEST(runout_sensor_enabled);
|
_FIELD_TEST(runout_sensor_enabled);
|
||||||
EEPROM_READ(runout_sensor_enabled);
|
EEPROM_READ(runout_sensor_enabled);
|
||||||
#if HAS_FILAMENT_SENSOR
|
#if HAS_FILAMENT_SENSOR
|
||||||
runout.enabled = runout_sensor_enabled < 0 ? FIL_RUNOUT_ENABLED_DEFAULT : runout_sensor_enabled;
|
if (!validating) runout.enabled = runout_sensor_enabled < 0 ? FIL_RUNOUT_ENABLED_DEFAULT : runout_sensor_enabled;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
TERN_(HAS_FILAMENT_SENSOR, if (runout.enabled) runout.reset());
|
TERN_(HAS_FILAMENT_SENSOR, if (runout.enabled) runout.reset());
|
||||||
@@ -2121,7 +2121,7 @@ void MarlinSettings::postprocess() {
|
|||||||
#if ENABLED(PTC_HOTEND)
|
#if ENABLED(PTC_HOTEND)
|
||||||
EEPROM_READ(ptc.z_offsets_hotend);
|
EEPROM_READ(ptc.z_offsets_hotend);
|
||||||
#endif
|
#endif
|
||||||
ptc.reset_index();
|
if (!validating) ptc.reset_index();
|
||||||
#else
|
#else
|
||||||
// No placeholder data for this feature
|
// No placeholder data for this feature
|
||||||
#endif
|
#endif
|
||||||
@@ -2681,11 +2681,13 @@ void MarlinSettings::postprocess() {
|
|||||||
EEPROM_READ(backlash_smoothing_mm);
|
EEPROM_READ(backlash_smoothing_mm);
|
||||||
|
|
||||||
#if ENABLED(BACKLASH_GCODE)
|
#if ENABLED(BACKLASH_GCODE)
|
||||||
|
if (!validating) {
|
||||||
LOOP_NUM_AXES(axis) backlash.set_distance_mm((AxisEnum)axis, backlash_distance_mm[axis]);
|
LOOP_NUM_AXES(axis) backlash.set_distance_mm((AxisEnum)axis, backlash_distance_mm[axis]);
|
||||||
backlash.set_correction_uint8(backlash_correction);
|
backlash.set_correction_uint8(backlash_correction);
|
||||||
#ifdef BACKLASH_SMOOTHING_MM
|
#ifdef BACKLASH_SMOOTHING_MM
|
||||||
backlash.set_smoothing_mm(backlash_smoothing_mm);
|
backlash.set_smoothing_mm(backlash_smoothing_mm);
|
||||||
#endif
|
#endif
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
#endif // NUM_AXES
|
#endif // NUM_AXES
|
||||||
@@ -2787,7 +2789,7 @@ void MarlinSettings::postprocess() {
|
|||||||
uint8_t ui_language;
|
uint8_t ui_language;
|
||||||
EEPROM_READ(ui_language);
|
EEPROM_READ(ui_language);
|
||||||
if (ui_language >= NUM_LANGUAGES) ui_language = 0;
|
if (ui_language >= NUM_LANGUAGES) ui_language = 0;
|
||||||
ui.set_language(ui_language);
|
if (!validating) ui.set_language(ui_language);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -2813,18 +2815,22 @@ void MarlinSettings::postprocess() {
|
|||||||
{
|
{
|
||||||
float _data[2];
|
float _data[2];
|
||||||
EEPROM_READ(_data);
|
EEPROM_READ(_data);
|
||||||
|
if (!validating) {
|
||||||
stepper.set_shaping_frequency(X_AXIS, _data[0]);
|
stepper.set_shaping_frequency(X_AXIS, _data[0]);
|
||||||
stepper.set_shaping_damping_ratio(X_AXIS, _data[1]);
|
stepper.set_shaping_damping_ratio(X_AXIS, _data[1]);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if ENABLED(INPUT_SHAPING_Y)
|
#if ENABLED(INPUT_SHAPING_Y)
|
||||||
{
|
{
|
||||||
float _data[2];
|
float _data[2];
|
||||||
EEPROM_READ(_data);
|
EEPROM_READ(_data);
|
||||||
|
if (!validating) {
|
||||||
stepper.set_shaping_frequency(Y_AXIS, _data[0]);
|
stepper.set_shaping_frequency(Y_AXIS, _data[0]);
|
||||||
stepper.set_shaping_damping_ratio(Y_AXIS, _data[1]);
|
stepper.set_shaping_damping_ratio(Y_AXIS, _data[1]);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//
|
//
|
||||||
|
Reference in New Issue
Block a user