Always re-init the TMC drivers after leaving linearity correction menu
Change in memory: Flash: -22 bytes SRAM: 0 bytes
This commit is contained in:
parent
312f79c5f5
commit
b3a682d330
|
|
@ -4495,20 +4495,17 @@ static void lcd_settings_menu()
|
||||||
|
|
||||||
#ifdef TMC2130
|
#ifdef TMC2130
|
||||||
static void lcd_settings_linearity_correction_menu_save() {
|
static void lcd_settings_linearity_correction_menu_save() {
|
||||||
bool changed = false;
|
|
||||||
for (uint8_t axis = 0; axis < NUM_AXIS; axis++) {
|
for (uint8_t axis = 0; axis < NUM_AXIS; axis++) {
|
||||||
// Constrain the value
|
|
||||||
if (tmc2130_wave_fac[axis] < TMC2130_WAVE_FAC1000_MIN) tmc2130_wave_fac[axis] = 0;
|
|
||||||
|
|
||||||
// Has the value changed?
|
if (tmc2130_wave_fac[axis] < TMC2130_WAVE_FAC1000_MIN) {
|
||||||
changed |= (eeprom_read_byte((uint8_t*)EEPROM_TMC2130_WAVE_X_FAC - axis) != tmc2130_wave_fac[axis]);
|
tmc2130_wave_fac[axis] = 0;
|
||||||
|
}
|
||||||
|
|
||||||
// If the value is changed, then write to EEPROM
|
|
||||||
eeprom_update_byte_notify((uint8_t*)EEPROM_TMC2130_WAVE_X_FAC - axis, tmc2130_wave_fac[axis]);
|
eeprom_update_byte_notify((uint8_t*)EEPROM_TMC2130_WAVE_X_FAC - axis, tmc2130_wave_fac[axis]);
|
||||||
}
|
}
|
||||||
|
|
||||||
// If any of the values changed, then re-init the TMC2130 driver
|
// Re-init the TMC2130 driver to apply changes, if any
|
||||||
if (changed) tmc2130_init(TMCInitParams(false, FarmOrUserECool()));
|
tmc2130_init(TMCInitParams(false, FarmOrUserECool()));
|
||||||
}
|
}
|
||||||
#endif //TMC2130
|
#endif //TMC2130
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue