feat: improved driver controll

This commit is contained in:
xGlc
2026-05-10 13:03:17 +02:00
parent f94073e1ea
commit f852c1a2b5

View File

@@ -1,6 +1,6 @@
from time import sleep_us
from time import sleep
from machine import Pin
from machine import PWM, Pin
class DRV8825:
@@ -16,7 +16,7 @@ class DRV8825:
# microstep_pins: tuple[Pin, Pin, Pin],
) -> None:
self.sleep_pin = sleep_pin
self.step_pin = step_pin
self.step_pin = PWM(step_pin, freq=1000, duty_u16=0)
self.dir_pin = dir_pin
self.rst_pin = rst_pin
# self.microstep_pins = microstep_pins
@@ -33,8 +33,7 @@ class DRV8825:
self.dir_pin.on()
def make_step(self, delay: int = 1000) -> None:
self.step_pin.on()
sleep_us(delay)
self.step_pin.off()
sleep_us(delay)
pass
self.step_pin.init(freq=delay, duty_u16=32768)
sleep(1)
self.step_pin.init(freq=500, duty_u16=0)
sleep(1)