created v0.3 functional software prototype
This commit is contained in:
30
Software/motion.py
Normal file
30
Software/motion.py
Normal file
@@ -0,0 +1,30 @@
|
||||
from TMC2130 import TMC2130_Rotate
|
||||
from config import *
|
||||
|
||||
steps_mm = 0
|
||||
|
||||
def Motion_Init():
|
||||
global steps_mm
|
||||
|
||||
steps_mm = (MOTOR_STEPS * MICROSTEPPING) / SCREW_PITCH
|
||||
|
||||
def Motion_Move(distance, speed): #distance in mm, speed in mm/min
|
||||
global steps_mm
|
||||
|
||||
steps = steps_mm * abs(distance)
|
||||
|
||||
direction = 0
|
||||
if distance < 0:
|
||||
if AXIS_REVERSE == False:
|
||||
direction = 0
|
||||
else:
|
||||
direction = 1
|
||||
else:
|
||||
if AXIS_REVERSE == False:
|
||||
direction = 1
|
||||
else:
|
||||
direction = 0
|
||||
|
||||
rpm = speed / SCREW_PITCH
|
||||
|
||||
TMC2130_Rotate(direction, steps, rpm)
|
||||
Reference in New Issue
Block a user