Permalink
Browse files

Merge branch 'merge_wdc_alison_jetty'

Conflicts:
	src/replicatorg/drivers/gen3/MightyBoard.java
  • Loading branch information...
2 parents e988f26 + 8986708 commit 1f217aa5e2cacdf978788914f37aba19a51789b0 @aleonard aleonard committed Sep 28, 2012
Showing with 945 additions and 405 deletions.
  1. +1 −0 .gitignore
  2. +39 −39 scripts/s3g-decompiler.py
  3. +159 −0 skein_engines/skeinforge-35/skeinforge_application/skeinforge_plugins/craft_plugins/altshell.py
  4. +1 −1 skein_engines/skeinforge-35/skeinforge_application/skeinforge_plugins/profile_plugins/extrusion.py
  5. +159 −0 skein_engines/skeinforge-47/skeinforge_application/skeinforge_plugins/craft_plugins/altshell.py
  6. +1 −1 skein_engines/skeinforge-47/skeinforge_application/skeinforge_plugins/profile_plugins/extrusion.py
  7. +6 −0 ...e-50/skeinforge_application/prefs/Replicator slicing defaults/profiles/extrusion/ABS/altshell.csv
  8. +2 −2 ...forge-50/skeinforge_application/prefs/Replicator slicing defaults/profiles/extrusion/ABS/fill.csv
  9. +2 −1 ...inforge_application/prefs/Replicator slicing defaults/profiles/extrusion/ABS/skeinforge_craft.csv
  10. +159 −0 skein_engines/skeinforge-50/skeinforge_application/skeinforge_plugins/craft_plugins/altshell.py
  11. +1 −1 skein_engines/skeinforge-50/skeinforge_application/skeinforge_plugins/profile_plugins/extrusion.py
  12. +14 −8 src/replicatorg/app/ui/MainWindow.java
  13. +53 −50 src/replicatorg/app/ui/onboard/MachineOnboardParameters.java
  14. +8 −0 src/replicatorg/app/ui/onboard/OnboardParametersWindow.java
  15. +4 −3 src/replicatorg/drivers/Driver.java
  16. +7 −3 src/replicatorg/drivers/DriverBaseImplementation.java
  17. +9 −0 src/replicatorg/drivers/OnboardParameters.java
  18. +9 −2 src/replicatorg/drivers/VirtualPrinter.java
  19. +1 −1 src/replicatorg/drivers/gen3/Makerbot4GDriver.java
  20. +292 −293 src/replicatorg/drivers/gen3/MightyBoard.java
  21. +1 −0 src/replicatorg/drivers/gen3/Replicator2.java
  22. +17 −0 src/replicatorg/drivers/gen3/Sanguino3GDriver.java
View
@@ -19,3 +19,4 @@ ReplicatorG.app
*.diff
.DS_Store
*.tmp
+*.svn
View
@@ -40,41 +40,37 @@ def printToolAction(tuple):
if type(disp) == type(""):
print disp % parsed
-def parseBuildStart():
+def parseDisplayMessageAction():
global s3gFile
packetStr = s3gFile.read(4)
- if len(packetStr) != 4:
- raise "Incomplete s3g file during tool parse build start"
- (stepCount,) = struct.unpack("<I",packetStr)
- buildName = ""
- while (1):
- nextChar = s3gFile.read(1)
- if nextChar == "\0":
- break
- buildName += nextChar
- return (stepCount, buildName)
+ if len(packetStr) < 4:
+ raise "Incomplete s3g file during tool command parse"
+ (options,offsetX,offsetY,timeout) = struct.unpack("<BBBB",packetStr)
+ message = "";
+ while True:
+ c = s3gFile.read(1);
+ if c == '\0':
+ break;
+ else:
+ message += c;
-def printBuildStart(tuple):
- # pp.pprint(tuple)
- print "Build start (%i): %s" % (0, tuple[1])
+ return (options,offsetX,offsetY,timeout,message)
-def parseMessage():
+def parseBuildStartNotificationAction():
global s3gFile
packetStr = s3gFile.read(4)
- if len(packetStr) != 4:
- raise "Incomplete s3g file during tool parse build start"
- (options,x,y,seconds) = struct.unpack("<bbbb",packetStr)
- message = ""
- while (1):
- nextChar = s3gFile.read(1)
- if nextChar == "\0":
- break
- message += nextChar
- return (options,x,y,seconds, message)
+ if len(packetStr) < 4:
+ raise "Incomplete s3g file during tool command parse"
+ (steps) = struct.unpack("<i",packetStr)
+ buildName = "";
+ while True:
+ c = s3gFile.read(1);
+ if c == '\0':
+ break;
+ else:
+ buildName += c;
-def printMessage(tuple):
- # pp.pprint(tuple)
- print "Display message (options %d, x: %d y: %d for %d seconds):\n %s" % (tuple[0], tuple[1], tuple[2], tuple[3], tuple[4])
+ return (steps[0],buildName)
# Command table entries consist of:
# * The key: the integer command code
@@ -106,15 +102,18 @@ def printMessage(tuple):
142: ("<iiiiiIB","Move to (%i,%i,%i,%i,%i) in %i us (relative: %X)"),
143: ("<b","Store home position for axes %d"),
144: ("<b","Recall home position for axes %d"),
- 145: ("<bb","Set stepper #%ddigital pot value to %d"),
- 146: ("<bbbb","Set LED strip color to R:%d G:%d B:%d Blink rate:%d Reserved:%d"),
- 147: ("<HHb","Beep at %iHz for %i ms with Effect ID:%d"),
- 148: ("<bHb","Pause for button with mask %X, timout in %i seconds, with options %d"),
- 149: (parseMessage,printMessage),
- 150: ("<bb","Set build to %d%% (%d)"),
- 151: ("<b","Queue song id %d"),
- 153: (parseBuildStart,printBuildStart),
- 154: ("<b","End build (%d)"),
+ 145: ("<BB","Set pot axis %i to %i"),
+ 146: ("<BBBBB","Set RGB led red %i, green %i, blue %i, blink rate %i, effect %i"),
+ 147: ("<HHB","Set beep, frequency %i, length %i, effect %i"),
+ 148: ("<BHB","Pause for button 0x%X, timeout %i s, timeout_bevavior %i"),
+ 149: (parseDisplayMessageAction, "Display message, options 0x%X at %i,%i timeout %i s: %s"),
+ 150: ("<BB","Set build percent %i%%, ignore %i"),
+ 151: ("<B","Queue song %i"),
+ 152: ("<B","Reset to factory, options 0x%X"),
+ 153: (parseBuildStartNotificationAction, "Start build, steps %i: %s"),
+ 154: ("<B","End build, flags 0x%X"),
+ 155: ("<iiiiiIBfh","Move to (%i,%i,%i,%i,%i) dda_rate: %i (relative: %X) distance: %f feedrateX64: %i"),
+ 156: ("<B","Set acceleration to %i"),
}
def parseNextCommand():
@@ -126,6 +125,7 @@ def parseNextCommand():
if len(commandStr) == 0:
print "EOF"
return False
+ sys.stdout.write(str(lineNumber) + ': ')
(command) = struct.unpack("B",commandStr)
# print command[0]
(parse, disp) = commandTable[command[0]]
@@ -144,6 +144,6 @@ def parseNextCommand():
return True
s3gFile = open(sys.argv[1],'rb')
+lineNumber = 0
while parseNextCommand():
- pass
-
+ lineNumber = lineNumber + 1
@@ -0,0 +1,159 @@
+"""
+Dan Newman
+10 April 2012
+dan dot newman at mtbaldy dot us
+
+Altshell is a script to cause the outside perimeter of an object to be printed
+with the valve closed. The purpose is to allow downstream processing to
+identify gcode for the outside shells of an object by spotting segments to be
+printed with a closed valve state.
+
+To install the altshell script, move altshell.py to the directory
+
+ skein_engines/skeinforge-VERSION/skeinforge_application/skeinforge_plugins/craft_plugins/
+
+Then edit the file
+
+ skein_engines/skeinforge-VERSION/skeinforge_application/skeinforge_plugins/profile_plugins/extrusion.py
+
+and add the altshell script to the tool chain sequence by inserting 'altshell'
+into the plugin sequence in getCraftSequence(). Place 'altshell' before the
+'outline' and 'skirt' plugins as they may inject themselves into the perimeter
+without marking themselves as not being part of the perimeter.
+
+==Operation==
+The default 'Activate Altshell' checkbox is off, enable it if you would like an outline printed.
+
+==Settings==
+
+===Use M320/M321 Commands===
+
+Use M320/M321 to enable / disable acceleration if checked.
+When unchecked, uses Open/Close Valve (M126/M127).
+Newer firmwares require M320/M321.
+"""
+
+from __future__ import absolute_import
+#Init has to be imported first because it has code to workaround the python bug where relative imports don't work if the module is imported as a main module.
+import __init__
+
+from skeinforge_application.skeinforge_utilities import skeinforge_profile
+from skeinforge_application.skeinforge_utilities import skeinforge_polyfile
+from fabmetheus_utilities.vector3 import Vector3
+from fabmetheus_utilities import euclidean
+from fabmetheus_utilities import gcodec
+from fabmetheus_utilities import archive
+from fabmetheus_utilities.fabmetheus_tools import fabmetheus_interpret
+from fabmetheus_utilities import settings
+from skeinforge_application.skeinforge_utilities import skeinforge_craft
+import sys
+
+__author__ = "Len Trigg (lenbok@gmail.com)"
+__date__ = "$Date: 2010/11/20 $"
+__license__ = "GPL 3.0"
+
+def getCraftedText( fileName, text='', repository=None ):
+ "Alternate shell text."
+ return getCraftedTextFromText( archive.getTextIfEmpty( fileName, text ), repository )
+
+def getCraftedTextFromText( gcodeText, repository=None ):
+ "Alternate shell text."
+ if gcodec.isProcedureDoneOrFileIsEmpty( gcodeText, 'altshell' ):
+ return gcodeText
+ if repository == None:
+ repository = settings.getReadRepository( AltshellRepository() )
+ if not repository.activateAltshell.value:
+ return gcodeText
+ return AltshellSkein().getCraftedGcode( gcodeText, repository )
+
+def getNewRepository():
+ "Get the repository constructor."
+ return AltshellRepository()
+
+def writeOutput( fileName = ''):
+ "Alternate shell file."
+ fileName = fabmetheus_interpret.getFirstTranslatorFileNameUnmodified(fileName)
+ if fileName == '':
+ return
+ skeinforge_craft.writeChainTextWithNounMessage( fileName, 'altshell')
+
+class AltshellRepository:
+ "A class to handle the altshell settings."
+ def __init__( self ):
+ "Set the default settings, execute title & settings fileName."
+ skeinforge_profile.addListsToCraftTypeRepository( 'skeinforge_tools.craft_plugins.altshell.html', self )
+ self.fileNameInput = settings.FileNameInput().getFromFileName( fabmetheus_interpret.getGNUTranslatorGcodeFileTypeTuples(), 'Open File for Altshell', self, '' )
+ self.activateAltshell = settings.BooleanSetting().getFromValue( 'Activate Altshell', self, True )
+ self.useM320M321 = settings.BooleanSetting().getFromValue( 'Use M320/M321', self, True )
+ self.executeTitle = 'Altshell'
+
+ def execute( self ):
+ "Altshell button has been clicked."
+ fileNames = skeinforge_polyfile.getFileOrDirectoryTypesUnmodifiedGcode( self.fileNameInput.value, fabmetheus_interpret.getImportPluginFilenames(), self.fileNameInput.wasCancelled )
+ for fileName in fileNames:
+ writeOutput( fileName )
+
+class AltshellSkein:
+ "A class to print the outermost shell with the valve closed."
+ def __init__( self ):
+ self.distanceFeedRate = gcodec.DistanceFeedRate()
+ self.state = 0
+
+ def getCraftedGcode( self, gcodeText, repository ):
+ "Parse gcode text and add the altshell gcode."
+ self.repository = repository
+ self.lines = archive.getTextLines( gcodeText )
+ for line in self.lines:
+ self.parseLine( line )
+ return self.distanceFeedRate.output.getvalue()
+
+ def parseLine( self, line ):
+ """"
+ Parse a gcode line and add it to the altshell skein.
+
+ We want to place the close valve (M321/M127) command after the first M101 command.
+ So doing ensures that any outline or skirt is printed before the valve is
+ closed.
+ """
+
+ splitLine = line.split()
+ if len( splitLine ) < 1:
+ return
+
+ firstWord = splitLine[ 0 ]
+
+ if line == '(<perimeter> outer )' or line == '(<perimeter> inner )':
+ self.state = 1
+
+ elif firstWord == '(</perimeter>)':
+ if self.state == 3:
+ # Open valve command
+ if self.repository.useM320M321.value:
+ self.distanceFeedRate.addLine( 'M320' )
+ else:
+ self.distanceFeedRate.addLine( 'M126' )
+ self.state = 0
+
+ elif firstWord == 'M101':
+ if self.state == 1:
+ # Found first M101 for outer perimeter
+ self.state = 2
+
+ self.distanceFeedRate.addLine( line )
+ if self.state == 2:
+ # Close valve command
+ if self.repository.useM320M321.value:
+ self.distanceFeedRate.addLine( 'M321' )
+ else:
+ self.distanceFeedRate.addLine( 'M127' )
+ self.state = 3
+
+def main():
+ "Display the altshell dialog."
+ if len( sys.argv ) > 1:
+ writeOutput( ' '.join( sys.argv[ 1 : ] ) )
+ else:
+ settings.startMainLoopFromConstructor( getRepositoryConstructor() )
+
+if __name__ == "__main__":
+ main()
@@ -39,7 +39,7 @@
def getCraftSequence():
'Get the extrusion craft sequence.'
- return 'carve,bottom,preface,widen,inset,fill,multiply,speed,temperature,raft,chamber,tower,jitter,clip,stretch,comb,cool,hop,wipe,oozebane,outline,splodge,home,lash,fillet,limit,reversal,dimension,unpause,export'.split(',')
+ return 'carve,bottom,preface,widen,inset,fill,multiply,speed,temperature,raft,chamber,tower,jitter,clip,stretch,comb,cool,hop,wipe,oozebane,altshell,outline,splodge,home,lash,fillet,limit,reversal,dimension,unpause,export'.split(',')
def getNewRepository():
'Get the repository constructor.'
Oops, something went wrong.

0 comments on commit 1f217aa

Please sign in to comment.