endstop_phase: Fix endstop_phase on trinamic drivers that aren't inverted
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
committed by
KevinOConnor
parent
0b02d7a1f2
commit
80194a7e18
@@ -66,6 +66,8 @@ class EndstopPhase:
|
||||
msg = "Unable to get stepper %s phase: %s" % (self.name, str(e))
|
||||
logging.exception(msg)
|
||||
raise homing.EndstopError(msg)
|
||||
if stepper.is_dir_inverted():
|
||||
phase = (self.phases - 1) - phase
|
||||
else:
|
||||
phase = stepper.get_mcu_position() % self.phases
|
||||
self.phase_history[phase] += 1
|
||||
|
||||
@@ -227,7 +227,7 @@ class TMCMicrostepHelper:
|
||||
field_name = "MSTEP"
|
||||
reg = self.mcu_tmc.get_register(self.fields.lookup_register(field_name))
|
||||
mscnt = self.fields.get_field(field_name, reg)
|
||||
return mscnt >> self.fields.get_field("MRES")
|
||||
return (1023 - mscnt) >> self.fields.get_field("MRES")
|
||||
|
||||
# Helper to configure "stealthchop" mode
|
||||
def TMCStealthchopHelper(config, mcu_tmc, tmc_freq):
|
||||
|
||||
Reference in New Issue
Block a user