Moved baby steps to 10 after first layer.

Made the emulator return temp based on the temp that it gets set to.
This commit is contained in:
Lars Brubaker 2015-12-04 13:43:07 -08:00
parent 4933f997ed
commit 27de546624
3 changed files with 17 additions and 5 deletions

View file

@ -83,7 +83,7 @@ namespace MatterHackers.MatterControl.PrinterCommunication.Io
layerCount++;
if(layerCount == 1)
{
maxLengthStream.MaxSegmentLength = 5;
maxLengthStream.MaxSegmentLength = 10;
}
}
return processedLine;

View file

@ -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:

@ -1 +1 @@
Subproject commit 50412169a979bac55dbdde6b0066e72c1dd8c4cc
Subproject commit 7ffbb0c6226b67742ceff004cc48cef078028e15