Do not attempt to "zero-phase" the microstep counter

If the motors are off-phase, this is more likely to "bump" them to an
incorrect/reverse full-step, doing worse.

We need to ensure the motors are already positioned on a fullstep
during power panic instead.

Remove the PSU_DELTA exception: Z _always_ needs to be powered here.
This commit is contained in:
Yuri D'Elia 2020-01-26 14:01:18 +01:00
parent 5310181970
commit ec8b5aaa34

View File

@ -1327,29 +1327,12 @@ void setup()
SET_OUTPUT(CONTROLLERFAN_PIN); //Set pin used for driver cooling fan
#endif
setup_homepin();
#ifdef TMC2130
if (1) {
// try to run to zero phase before powering the Z motor.
// Move in negative direction
WRITE(Z_DIR_PIN,INVERT_Z_DIR);
// Round the current micro-micro steps to micro steps.
for (uint16_t phase = (tmc2130_rd_MSCNT(Z_AXIS) + 8) >> 4; phase > 0; -- phase) {
// Until the phase counter is reset to zero.
WRITE(Z_STEP_PIN, !INVERT_Z_STEP_PIN);
_delay(2);
WRITE(Z_STEP_PIN, INVERT_Z_STEP_PIN);
_delay(2);
}
}
#endif //TMC2130
#if defined(Z_AXIS_ALWAYS_ON) && !defined(PSU_Delta)
#if defined(Z_AXIS_ALWAYS_ON)
enable_z();
#endif
farm_mode = eeprom_read_byte((uint8_t*)EEPROM_FARM_MODE);
EEPROM_read_B(EEPROM_FARM_NUMBER, &farm_no);
if ((farm_mode == 0xFF && farm_no == 0) || (farm_no == static_cast<int>(0xFFFF))) farm_mode = false; //if farm_mode has not been stored to eeprom yet and farm number is set to zero or EEPROM is fresh, deactivate farm mode