Park fix?

This commit is contained in:
Ruben van de Ven 2019-11-01 17:48:37 +01:00
parent d58abf161f
commit 777920a456

View file

@ -43,7 +43,7 @@ class Plotter:
if not connected:
raise Exception("Cannot connect to Axidraw")
self.ad.options.units = 1 # set to use centimeters instead of inches
# self.ad.options.units = 1 # set to use centimeters instead of inches
self.ad.options.accel = 100;
self.ad.options.speed_penup = 100
self.ad.options.speed_pendown = 100
@ -94,6 +94,10 @@ class Plotter:
coordinates.append(coordinate)
self.logger.debug(f"Plot: {coordinates}")
if self.ad:
if len(coordinates) < 2:
self.info("Plot single point (park?)")
self.ad.moveto(coordinates[0][0], coordinates[0][1])
else:
self.ad.plan_trajectory(coordinates)
# self.ad.moveto(move[0]* plotterWidth, move[1]*plotterHeight)
# self.logger.debug(f'handler! {move}')
@ -128,7 +132,7 @@ class Plotter:
# change of pen state? draw previous segments!
if (segment[2] == 1 and not self.pen_down) or (segment[2] == 0 and self.pen_down) or len(segments) > 150:
if len(segments) > 1:
if len(segments):
self.draw_segments(segments)
plotterRan = True
segments = [] #reset