From 777920a456ed9b6d03ebf15a05fa8ff1bbdf4fce Mon Sep 17 00:00:00 2001 From: Ruben van de Ven Date: Fri, 1 Nov 2019 17:48:37 +0100 Subject: [PATCH] Park fix? --- sorteerhoed/plotter.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/sorteerhoed/plotter.py b/sorteerhoed/plotter.py index d3ff5af..2b953b8 100644 --- a/sorteerhoed/plotter.py +++ b/sorteerhoed/plotter.py @@ -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,7 +94,11 @@ class Plotter: coordinates.append(coordinate) self.logger.debug(f"Plot: {coordinates}") 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.logger.debug(f'handler! {move}') pass @@ -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