changig directions mid movement fix

master
Marek Baczynski 6 years ago
parent c4fd668de7
commit 4c906a71e9

@ -201,7 +201,10 @@ def adjustSpeed(motor, adjustment):
global nowTime, stopTime, currentMotor, speed, motorcfg, movement_time, max_speed, max_movement_time global nowTime, stopTime, currentMotor, speed, motorcfg, movement_time, max_speed, max_movement_time
if currentMotor==motor: if currentMotor==motor:
if (adjustment>0 and speed>0) or (adjustment<0 and speed<0):
speed += adjustment * (abs(speed)/max_speed) speed += adjustment * (abs(speed)/max_speed)
else:
stopMotorFunctions()
stopTime += movement_time/2 * max_movement_time/(stopTime - nowTime) stopTime += movement_time/2 * max_movement_time/(stopTime - nowTime)
else: else:
currentMotor = motor currentMotor = motor

Loading…
Cancel
Save