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: if not connected:
raise Exception("Cannot connect to Axidraw") 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.accel = 100;
self.ad.options.speed_penup = 100 self.ad.options.speed_penup = 100
self.ad.options.speed_pendown = 100 self.ad.options.speed_pendown = 100
@ -94,7 +94,11 @@ class Plotter:
coordinates.append(coordinate) coordinates.append(coordinate)
self.logger.debug(f"Plot: {coordinates}") self.logger.debug(f"Plot: {coordinates}")
if self.ad: if self.ad:
self.ad.plan_trajectory(coordinates) 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.ad.moveto(move[0]* plotterWidth, move[1]*plotterHeight)
# self.logger.debug(f'handler! {move}') # self.logger.debug(f'handler! {move}')
pass pass
@ -128,7 +132,7 @@ class Plotter:
# change of pen state? draw previous segments! # 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 (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) self.draw_segments(segments)
plotterRan = True plotterRan = True
segments = [] #reset segments = [] #reset