Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix s3g-decompiler.py #279

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion changelog.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
0036-Beta ReplicatorG
0036 ReplicatorG
* Updated for acceleration behavior
* Updated to have temperature as part of PrintOMatic settings
* Updated for smarter acceleration related configuration
Expand All @@ -9,6 +9,16 @@
0034-Beta ReplicatorG
* Updated t0 to t1 tolerance code

0034 ReplicatorG
* Updated toolhead offset t0 to t1 code to store offset of out of tolerance
* Tools directory location sourcing updated to fix avr-dude on mac problems.
* Toolhead start heating gcode updates for faster heating-up on slow HBP's
* Fixes and updates to alternative preferences system.
* Ant run command line commands support
* Expected Toolhead offset stored as part of machine settings
* Spelling mistake fixes
* Updated print anchor code

0033 ReplicatorG
* Updated version number to avoid confusion
* Minor UI changes
Expand Down
48 changes: 48 additions & 0 deletions scripts/s3g-decompiler.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#!/usr/bin/python
import struct
import sys
import pprint
pp = pprint.PrettyPrinter(indent=4)

toolCommandTable = {
3: ("<H", "Set target temperature to %i"),
Expand Down Expand Up @@ -38,6 +40,42 @@ def printToolAction(tuple):
if type(disp) == type(""):
print disp % parsed

def parseBuildStart():
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)

def printBuildStart(tuple):
# pp.pprint(tuple)
print "Build start (%i): %s" % (0, tuple[1])

def parseMessage():
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)

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])

# Command table entries consist of:
# * The key: the integer command code
# * A tuple:
Expand Down Expand Up @@ -68,6 +106,15 @@ def printToolAction(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)"),
}

def parseNextCommand():
Expand All @@ -80,6 +127,7 @@ def parseNextCommand():
print "EOF"
return False
(command) = struct.unpack("B",commandStr)
# print command[0]
(parse, disp) = commandTable[command[0]]
if type(parse) == type(""):
packetLen = struct.calcsize(parse)
Expand Down
2 changes: 1 addition & 1 deletion src/replicatorg/app/Base.java
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ public enum InitialOpenBehavior {
/**
* The textual representation of this version (4 digits, zero padded).
*/
public static final String VERSION_NAME = String.format("%04d-Beta",VERSION);
public static final String VERSION_NAME = String.format("%04d",VERSION);

/**
* The machine controller in use.
Expand Down
2 changes: 1 addition & 1 deletion src/replicatorg/drivers/gen3/MightyBoard.java
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ public MightyBoard() {
// Make sure this accurately reflects the minimum preferred
// firmware version we want this driver to support.
minimumVersion = new Version(5,2);
preferredVersion = new Version(5,2);
preferredVersion = new Version(5,4);
minimumAccelerationVersion = new Version(5,3);

}
Expand Down