From 27de546624d16553be394593bb8011e9bf81a5c0 Mon Sep 17 00:00:00 2001 From: Lars Brubaker Date: Fri, 4 Dec 2015 13:43:07 -0800 Subject: [PATCH] Moved baby steps to 10 after first layer. Made the emulator return temp based on the temp that it gets set to. --- PrinterCommunication/Io/BabyStepsStream.cs | 2 +- PrinterEmulator.py | 18 +++++++++++++++--- Submodules/agg-sharp | 2 +- 3 files changed, 17 insertions(+), 5 deletions(-) diff --git a/PrinterCommunication/Io/BabyStepsStream.cs b/PrinterCommunication/Io/BabyStepsStream.cs index 9cc42068e..98fc7a5e0 100644 --- a/PrinterCommunication/Io/BabyStepsStream.cs +++ b/PrinterCommunication/Io/BabyStepsStream.cs @@ -83,7 +83,7 @@ namespace MatterHackers.MatterControl.PrinterCommunication.Io layerCount++; if(layerCount == 1) { - maxLengthStream.MaxSegmentLength = 5; + maxLengthStream.MaxSegmentLength = 10; } } return processedLine; diff --git a/PrinterEmulator.py b/PrinterEmulator.py index f4740e505..e5d93d734 100644 --- a/PrinterEmulator.py +++ b/PrinterEmulator.py @@ -34,10 +34,12 @@ import serial import time import random +extruderGoalTemperature = 0 + """Add response callbacks here""" def randomTemp(command): # temp commands look like this: ok T:19.4 /0.0 B:0.0 /0.0 @:0 B@:0 - return "ok T:%s\n" % random.randrange(202,215) + return "ok T:%s\n" % (extruderGoalTemperature + random.randrange(-2,2)) def getPosition(command): # temp commands look like this: X:0.00 Y:0.00 Z0.00 E:0.00 Count X: 0.00 Y:0.00 Z:0.00 then an ok on the next line @@ -69,15 +71,25 @@ def getCorrectResponse(command): return 'ok\n' +def setExtruderTemperature(command): + try: + #M104 S210 + sIndex = command.find('S') + 1 + extruderGoalTemperature = int(command[sIndex:]) + except Exception, e: + print e + + return 'ok\n' + """Dictionary of command and response callback""" -responses = { "M105" : randomTemp, "A" : echo, "M114" : getPosition , "N" : parseChecksumLine, "M115" : reportMarlinFirmware } +responses = { "M105" : randomTemp, "A" : echo, "M114" : getPosition , "N" : parseChecksumLine, "M115" : reportMarlinFirmware, "M104" : setExtruderTemperature } def main(argv): parser = argparse.ArgumentParser(description='Set up a printer emulation.') if len(argv) > 0: ser = serial.Serial(argv[0], 250000, timeout=1) else: - ser = serial.Serial('COM4', 250000, timeout=1) + ser = serial.Serial('COM14', 250000, timeout=1) waitForKey = True print "Initializing emulator..." while True: diff --git a/Submodules/agg-sharp b/Submodules/agg-sharp index 50412169a..7ffbb0c62 160000 --- a/Submodules/agg-sharp +++ b/Submodules/agg-sharp @@ -1 +1 @@ -Subproject commit 50412169a979bac55dbdde6b0066e72c1dd8c4cc +Subproject commit 7ffbb0c6226b67742ceff004cc48cef078028e15