created v0.3 functional software prototype

This commit is contained in:
2024-07-20 09:46:59 +02:00
parent b2597a60c7
commit fafa874b43
15 changed files with 377 additions and 0 deletions

30
Software/motion.py Normal file
View 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)