|
|
@@ -15,7 +15,7 @@ class MagDistributor:
|
|
|
gpio_conf = config.gpio
|
|
|
self.linear_dir_pin = gpio_conf.mag_dist_pos_dir_pin
|
|
|
self.linear_step_pin = gpio_conf.mag_dist_pos_step_pin
|
|
|
- #self.linear_en_pin = gpio_conf.mag_dist_pos_en_pin
|
|
|
+ self.linear_en_pin = gpio_conf.mag_dist_pos_en_pin
|
|
|
#self.rot_dir_pin = gpio_conf.mag_dist_rot_dir_pin
|
|
|
#self.rot_step_pin = gpio_conf.mag_dist_rot_step_pin
|
|
|
#self.rot_en_pin = gpio_conf.mag_dist_rot_en_pin
|
|
|
@@ -86,13 +86,13 @@ class MagDistributor:
|
|
|
self.logger.info("Homing linear axis...")
|
|
|
max_linear_steps = int(self.linear_length_mm * self.steps_per_mm)
|
|
|
home_step_delay = self._speed_to_step_delay(self.home_speed_mmmin)
|
|
|
- await self._home_axis(self.linear_dir_pin, self.linear_step_pin, self.linear_limit_pin, axis='linear', max_steps=max_linear_steps, step_delay=home_step_delay)
|
|
|
+ await self._home_axis(self.linear_en_pin, self.linear_dir_pin, self.linear_step_pin, self.linear_limit_pin, axis='linear', max_steps=max_linear_steps, step_delay=home_step_delay)
|
|
|
#await self._home_axis(self.rot_dir_pin, self.rot_step_pin, self.rot_limit_pin, axis='rotational', max_steps=self.full_rot_steps, step_delay=home_step_delay)
|
|
|
self.curr_pos_mm = 0
|
|
|
self.curr_rot_deg = 0
|
|
|
self.logger.info("Mag distributor homed successfully.")
|
|
|
|
|
|
- async def _home_axis(self, dir_pin, step_pin, endstop_pin, axis='linear', max_steps = 10000, step_delay=50):
|
|
|
+ async def _home_axis(self, en_pin, dir_pin, step_pin, endstop_pin, axis='linear', max_steps = 10000, step_delay=50):
|
|
|
"""
|
|
|
Home a single axis by moving until the endstop is triggered.
|
|
|
"""
|
|
|
@@ -104,7 +104,7 @@ class MagDistributor:
|
|
|
for _ in range(max_steps):
|
|
|
if not self.gpio.get_pin(endstop_pin):
|
|
|
break
|
|
|
- self.gpio.do_step(dir_pin, step_pin, 1, step_delay, True)
|
|
|
+ self.gpio.do_step(en_pin, dir_pin, step_pin, 1, step_delay, True)
|
|
|
await asyncio.sleep(0.001)
|
|
|
else:
|
|
|
raise RuntimeError(f"{axis} axis homing failed")
|
|
|
@@ -125,7 +125,7 @@ class MagDistributor:
|
|
|
linear_steps = int(abs(pos_target - self.curr_pos_mm) * self.steps_per_mm)
|
|
|
linear_dir = False if pos_target > self.curr_pos_mm else True
|
|
|
if linear_steps > 0:
|
|
|
- self.gpio.do_step(self.linear_dir_pin, self.linear_step_pin, linear_steps, step_delay, linear_dir)
|
|
|
+ self.gpio.do_step(self.linear_en_pin, self.linear_dir_pin, self.linear_step_pin, linear_steps, step_delay, linear_dir)
|
|
|
self.curr_pos_mm = pos_target
|
|
|
|
|
|
|