Skip to content

Commit

Permalink
Add delay to prevent comm error during long pen moves
Browse files Browse the repository at this point in the history
Add time.sleep delay to prevent communication error during long pen-up
and pen-down moves. We already have a delay like this in place for long
stepper moves, but it turns out that for sufficiently long
pen-up/pen-down movements -- a rare case -- the same problem can
result.  See #46.
  • Loading branch information
oskay committed Oct 29, 2016
1 parent 268ee73 commit 5633059
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions inkscape_driver/eggbot.py
Original file line number Diff line number Diff line change
Expand Up @@ -235,8 +235,6 @@ def effect( self ):
else:
self.manualCommand()



if self.serialPort is not None:
ebb_motion.doTimedPause(self.serialPort, 10) #Pause a moment for underway commands to finish...
ebb_serial.closePort(self.serialPort)
Expand Down Expand Up @@ -917,7 +915,6 @@ def DoWePlotLayer( self, strLayerName ):
self.LayersPlotted += 1
#Note: this function is only called if we are NOT plotting all layers.


def getDocProps( self ):
'''
Get the document's height and width attributes from the <svg> tag.
Expand All @@ -931,7 +928,6 @@ def getDocProps( self ):
else:
return True


def plotPath( self, path, matTransform ):
'''
Plot the path while applying the transformation defined
Expand Down Expand Up @@ -993,20 +989,21 @@ def plotPath( self, path, matTransform ):
self.fPrevX = self.fX
self.fPrevY = self.fY


def sendDisableMotors( self ):
# Insist on turning the engraver off. Otherwise, if it is on
# and the pen is down, then the engraver's vibration may cause
# the loose pen arm to start moving or the egg to start turning.
self.engraverOffManual()
ebb_motion.sendDisableMotors(self.serialPort)


def penUp( self ):
self.virtualPenIsUp = True # Virtual pen keeps track of state for resuming plotting.
if (self.bPenIsUp != True): # Continue only if pen state is down (or unknown)
if ( not self.resumeMode): # or if we're resuming.
ebb_motion.sendPenUp(self.serialPort, self.options.penUpDelay )
if (self.options.penUpDelay > 15):
if self.options.tab != '"manual"':
time.sleep(float(self.options.penUpDelay - 10)/1000.0) #pause before issuing next command
self.bPenIsUp = True

def penDown( self ):
Expand All @@ -1017,7 +1014,9 @@ def penDown( self ):
if self.penDownActivatesEngraver:
self.engraverOn() # will check self.enableEngraver
ebb_motion.sendPenDown(self.serialPort, self.options.penDownDelay )

if (self.options.penUpDelay > 15):
if self.options.tab != '"manual"':
time.sleep(float(self.options.penDownDelay - 10)/1000.0) #pause before issuing next command

def engraverOff( self ):
# Note: we don't bother checking self.engraverIsOn -- turn it off regardless
Expand Down

0 comments on commit 5633059

Please sign in to comment.