Park fix?

This commit is contained in:
Ruben van de Ven 2019-11-01 17:48:37 +01:00
parent d58abf161f
commit 777920a456
1 changed files with 7 additions and 3 deletions

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,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