Commits

Trammell Hudson committed 41b975f

Limit min/max speeds

Comments (0)

Files changed (1)

 		if delta < 0:
 			delta = -delta
 		if ms != 0:
-			moveto(i+1, new_pos, delta * 1000 / ms)
+			moveto(i+1, new_pos, delta * 1000 / ms + 1)
 		else:
 			moveto(i+1, new_pos, 0)
 
 
 	def moveto(self, count, speed=0):
 		if speed is not None and speed != 0:
+			if speed > 40000:
+				speed = 40000
+			if speed < 100:
+				speed = 100
 			self.mdc.send("!S " + self.channel + " " + str(int(speed)))
 		print str(self.axis) + ": " + str(int(count)) + " @ " + str(int(speed))
 		self.mdc.send("!P " + self.channel + " " + str(int(count)))