EEPROM parity with 1.1.x

This commit is contained in:
Scott Lahteine 2018-02-25 21:02:22 -06:00
parent 2228dff3ea
commit 8d5a77001e

View file

@ -220,7 +220,7 @@ typedef struct SettingsDataStruct {
// HAS_TRINAMIC // HAS_TRINAMIC
// //
uint16_t tmc_stepper_current[11]; // M906 X Y Z X2 Y2 Z2 E0 E1 E2 E3 E4 uint16_t tmc_stepper_current[11]; // M906 X Y Z X2 Y2 Z2 E0 E1 E2 E3 E4
int16_t tmc_sgt[3]; // M914 X Y Z int16_t tmc_sgt[XYZ]; // M914 X Y Z
// //
// LIN_ADVANCE // LIN_ADVANCE
@ -721,30 +721,28 @@ void MarlinSettings::postprocess() {
// //
// TMC2130 Sensorless homing threshold // TMC2130 Sensorless homing threshold
// //
int16_t thrs; int16_t thrs[XYZ] = {
#if ENABLED(SENSORLESS_HOMING) #if ENABLED(SENSORLESS_HOMING)
#if ENABLED(X_IS_TMC2130) && defined(X_HOMING_SENSITIVITY) #if ENABLED(X_IS_TMC2130) && defined(X_HOMING_SENSITIVITY)
thrs = stepperX.sgt(); stepperX.sgt(),
#else #else
thrs = 0; 0,
#endif #endif
EEPROM_WRITE(thrs);
#if ENABLED(Y_IS_TMC2130) && defined(Y_HOMING_SENSITIVITY) #if ENABLED(Y_IS_TMC2130) && defined(Y_HOMING_SENSITIVITY)
thrs = stepperY.sgt(); stepperY.sgt(),
#else #else
thrs = 0; 0
#endif #endif
EEPROM_WRITE(thrs);
#if ENABLED(Z_IS_TMC2130) && defined(Z_HOMING_SENSITIVITY) #if ENABLED(Z_IS_TMC2130) && defined(Z_HOMING_SENSITIVITY)
thrs = stepperZ.sgt(); stepperZ.sgt()
#else #else
thrs = 0; 0
#endif #endif
#else
0
#endif
};
EEPROM_WRITE(thrs); EEPROM_WRITE(thrs);
#else
thrs = 0;
for (uint8_t q = 3; q--;) EEPROM_WRITE(thrs);
#endif
// //
// Linear Advance // Linear Advance
@ -762,10 +760,10 @@ void MarlinSettings::postprocess() {
_FIELD_TEST(motor_current_setting); _FIELD_TEST(motor_current_setting);
#if HAS_MOTOR_CURRENT_PWM #if HAS_MOTOR_CURRENT_PWM
for (uint8_t q = 3; q--;) EEPROM_WRITE(stepper.motor_current_setting[q]); for (uint8_t q = XYZ; q--;) EEPROM_WRITE(stepper.motor_current_setting[q]);
#else #else
const uint32_t dummyui32 = 0; const uint32_t dummyui32[XYZ] = { 0 };
for (uint8_t q = 3; q--;) EEPROM_WRITE(dummyui32); EEPROM_WRITE(dummyui32);
#endif #endif
// //
@ -793,7 +791,7 @@ void MarlinSettings::postprocess() {
EEPROM_WRITE(planner.yz_skew_factor); EEPROM_WRITE(planner.yz_skew_factor);
#else #else
dummy = 0.0f; dummy = 0.0f;
for (uint8_t q = 3; q--;) EEPROM_WRITE(dummy); for (uint8_t q = XYZ; q--;) EEPROM_WRITE(dummy);
#endif #endif
// //
@ -1254,45 +1252,38 @@ void MarlinSettings::postprocess() {
* TMC2130 Sensorless homing threshold. * TMC2130 Sensorless homing threshold.
* X and X2 use the same value * X and X2 use the same value
* Y and Y2 use the same value * Y and Y2 use the same value
* Z and Z2 use the same value
*/ */
int16_t thrs; int16_t thrs[XYZ];
#if ENABLED(SENSORLESS_HOMING)
EEPROM_READ(thrs); EEPROM_READ(thrs);
#ifdef X_HOMING_SENSITIVITY #if ENABLED(SENSORLESS_HOMING)
if (!validating) { if (!validating) {
#ifdef X_HOMING_SENSITIVITY
#if ENABLED(X_IS_TMC2130) #if ENABLED(X_IS_TMC2130)
stepperX.sgt(thrs); stepperX.sgt(thrs[0]);
#endif #endif
#if ENABLED(X2_IS_TMC2130) #if ENABLED(X2_IS_TMC2130)
stepperX2.sgt(thrs); stepperX2.sgt(thrs[0]);
#endif #endif
}
#endif #endif
EEPROM_READ(thrs);
#ifdef Y_HOMING_SENSITIVITY #ifdef Y_HOMING_SENSITIVITY
if (!validating) {
#if ENABLED(Y_IS_TMC2130) #if ENABLED(Y_IS_TMC2130)
stepperY.sgt(thrs); stepperY.sgt(thrs[1]);
#endif #endif
#if ENABLED(Y2_IS_TMC2130) #if ENABLED(Y2_IS_TMC2130)
stepperY2.sgt(thrs); stepperY2.sgt(thrs[1]);
#endif #endif
}
#endif #endif
EEPROM_READ(thrs);
#ifdef Z_HOMING_SENSITIVITY #ifdef Z_HOMING_SENSITIVITY
if (!validating) {
#if ENABLED(Z_IS_TMC2130) #if ENABLED(Z_IS_TMC2130)
stepperZ.sgt(thrs); stepperZ.sgt(thrs[2]);
#endif #endif
#if ENABLED(Z2_IS_TMC2130) #if ENABLED(Z2_IS_TMC2130)
stepperZ2.sgt(thrs); stepperZ2.sgt(thrs[2]);
#endif
#endif #endif
} }
#endif #endif
#else
for (uint8_t q = 0; q < 3; q++) EEPROM_READ(thrs);
#endif
// //
// Linear Advance // Linear Advance
@ -1313,10 +1304,10 @@ void MarlinSettings::postprocess() {
_FIELD_TEST(motor_current_setting); _FIELD_TEST(motor_current_setting);
#if HAS_MOTOR_CURRENT_PWM #if HAS_MOTOR_CURRENT_PWM
for (uint8_t q = 3; q--;) EEPROM_READ(stepper.motor_current_setting[q]); for (uint8_t q = XYZ; q--;) EEPROM_READ(stepper.motor_current_setting[q]);
#else #else
uint32_t dummyui32; uint32_t dummyui32[XYZ];
for (uint8_t q = 3; q--;) EEPROM_READ(dummyui32); EEPROM_READ(dummyui32);
#endif #endif
// //
@ -1348,7 +1339,7 @@ void MarlinSettings::postprocess() {
EEPROM_READ(dummy); EEPROM_READ(dummy);
#endif #endif
#else #else
for (uint8_t q = 3; q--;) EEPROM_READ(dummy); for (uint8_t q = XYZ; q--;) EEPROM_READ(dummy);
#endif #endif
// //
@ -1831,8 +1822,8 @@ void MarlinSettings::reset(
#endif #endif
#if HAS_MOTOR_CURRENT_PWM #if HAS_MOTOR_CURRENT_PWM
uint32_t tmp_motor_current_setting[3] = PWM_MOTOR_CURRENT; uint32_t tmp_motor_current_setting[XYZ] = PWM_MOTOR_CURRENT;
for (uint8_t q = 3; q--;) for (uint8_t q = XYZ; q--;)
stepper.digipot_current(q, (stepper.motor_current_setting[q] = tmp_motor_current_setting[q])); stepper.digipot_current(q, (stepper.motor_current_setting[q] = tmp_motor_current_setting[q]));
#endif #endif