Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f9a9a405cd | ||
|
|
fa564c6029 | ||
|
|
36d1522f01 | ||
|
|
536e17eac4 | ||
|
|
887ec45b6b | ||
|
|
deb38f8455 | ||
|
|
293611287e | ||
|
|
7ebbf5911c | ||
|
|
d7e37cf658 | ||
|
|
e068012cfb | ||
|
|
d7f2075b1d | ||
|
|
e5ac94a16f | ||
|
|
f09d44d8a0 | ||
|
|
89cae22b91 | ||
|
|
0747336c0f | ||
|
|
bba625a68f | ||
|
|
b282a18f6b |
No files matched your search
@@ -0,0 +1,13 @@
|
||||
Bug Reports
|
||||
-----------
|
||||
|
||||
**READ [How to file a bug report](https://github.com/foosel/OctoPrint/wiki/How-to-file-a-bug-report)!**.
|
||||
|
||||
Pull Requests
|
||||
-------------
|
||||
|
||||
1. Please create all pull requests against the `devel` branch.
|
||||
2. Create **one pull request per feature/bug fix**.
|
||||
3. Create a custom branch for your feature/bug fix and use that as base for your pull request. Pull requests directly against your version of `devel` will be closed.
|
||||
4. In your pull request's description, state what your pull request is doing, as in, what feature does it implement, what bug does it fix.
|
||||
|
||||
@@ -1,13 +1,5 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
print """
|
||||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
!!! You are using an old startup method for OctoPrint. !!!
|
||||
!!! Please perform 'sudo python setup.py install' and !!!
|
||||
!!! use the 'octoprint' executable instead. !!!
|
||||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
"""
|
||||
|
||||
import os
|
||||
import sys
|
||||
|
||||
@@ -24,7 +16,7 @@ I don't know anything about).
|
||||
"""
|
||||
os.rename(old, os.path.join(basedir, "octoprint.backup"))
|
||||
|
||||
sys.path.append(os.path.join(basedir, "src"))
|
||||
sys.path.insert(0, os.path.join(basedir, "src"))
|
||||
|
||||
import octoprint
|
||||
octoprint.main()
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
from setuptools import setup, find_packages
|
||||
|
||||
VERSION = "1.0.0-rc2"
|
||||
VERSION = "1.0.0"
|
||||
|
||||
def params():
|
||||
name = "OctoPrint"
|
||||
|
||||
@@ -3,8 +3,9 @@ import sys
|
||||
from octoprint.daemon import Daemon
|
||||
from octoprint.server import Server
|
||||
|
||||
|
||||
class Main(Daemon):
|
||||
def __init__(self, pidfile, configfile, basedir, host, port, debug):
|
||||
def __init__(self, pidfile, configfile, basedir, host, port, debug, allowRoot):
|
||||
Daemon.__init__(self, pidfile)
|
||||
|
||||
self._configfile = configfile
|
||||
@@ -12,9 +13,10 @@ class Main(Daemon):
|
||||
self._host = host
|
||||
self._port = port
|
||||
self._debug = debug
|
||||
self._allowRoot = allowRoot
|
||||
|
||||
def run(self):
|
||||
octoprint = Server(self._configfile, self._basedir, self._host, self._port, self._debug)
|
||||
octoprint = Server(self._configfile, self._basedir, self._host, self._port, self._debug, self._allowRoot)
|
||||
octoprint.run()
|
||||
|
||||
def main():
|
||||
@@ -50,7 +52,7 @@ def main():
|
||||
print >> sys.stderr, "Sorry, daemon mode is only supported under Linux right now"
|
||||
sys.exit(2)
|
||||
|
||||
daemon = Main(args.pidfile, args.config, args.basedir, args.host, args.port, args.debug)
|
||||
daemon = Main(args.pidfile, args.config, args.basedir, args.host, args.port, args.debug, args.allowRoot)
|
||||
if "start" == args.daemon:
|
||||
daemon.start()
|
||||
elif "stop" == args.daemon:
|
||||
|
||||
@@ -486,8 +486,6 @@ class MetadataAnalyzer:
|
||||
def _work(self):
|
||||
aborted = None
|
||||
while True:
|
||||
self._active.wait()
|
||||
|
||||
if aborted is not None:
|
||||
filename = aborted
|
||||
aborted = None
|
||||
@@ -496,6 +494,8 @@ class MetadataAnalyzer:
|
||||
(priority, filename) = self._queue.get()
|
||||
self._logger.debug("Processing file %s from queue (priority %d)" % (filename, priority))
|
||||
|
||||
self._active.wait()
|
||||
|
||||
try:
|
||||
self._analyzeGcode(filename)
|
||||
self._queue.task_done()
|
||||
|
||||
@@ -145,38 +145,6 @@ def jog():
|
||||
length = request.values["extrude"]
|
||||
printer.commands(["G91", "G1 E%s F%d" % (length, movementSpeedE), "G90"])
|
||||
|
||||
movementSpeed = settings().get(["printerParameters", "movementSpeed", ["x", "y", "z"]], asdict=True)
|
||||
|
||||
valid_axes = ["x", "y", "z"]
|
||||
##~~ jog command
|
||||
if command == "jog":
|
||||
# validate all jog instructions, make sure that the values are numbers
|
||||
validated_values = {}
|
||||
for axis in valid_axes:
|
||||
if axis in data:
|
||||
value = data[axis]
|
||||
if not isinstance(value, (int, long, float)):
|
||||
return make_response("Not a number for axis %s: %r" % (axis, value), 400)
|
||||
validated_values[axis] = value
|
||||
|
||||
# execute the jog commands
|
||||
for axis, value in validated_values.iteritems():
|
||||
# TODO make this a generic method call (printer.jog(axis, value)) to get rid of gcode here
|
||||
printer.commands(["G91", "G1 %s%.4f F%d" % (axis.upper(), value, movementSpeed[axis]), "G90"])
|
||||
|
||||
##~~ home command
|
||||
elif command == "home":
|
||||
validated_values = []
|
||||
axes = data["axes"]
|
||||
for axis in axes:
|
||||
if not axis in valid_axes:
|
||||
return make_response("Invalid axis: %s" % axis, 400)
|
||||
validated_values.append(axis)
|
||||
|
||||
# execute the home command
|
||||
# TODO make this a generic method call (printer.home(axis, ...)) to get rid of gcode here
|
||||
printer.commands(["G91", "G28 %s" % " ".join(map(lambda x: "%s0" % x.upper(), validated_values)), "G90"])
|
||||
|
||||
return jsonify(SUCCESS)
|
||||
|
||||
|
||||
|
||||
@@ -56,6 +56,7 @@ def getSettings():
|
||||
"waitForStart": s.getBoolean(["feature", "waitForStartOnConnect"]),
|
||||
"alwaysSendChecksum": s.getBoolean(["feature", "alwaysSendChecksum"]),
|
||||
"sdSupport": s.getBoolean(["feature", "sdSupport"]),
|
||||
"sdAlwaysAvailable": s.getBoolean(["feature", "sdAlwaysAvailable"]),
|
||||
"swallowOkAfterResend": s.getBoolean(["feature", "swallowOkAfterResend"])
|
||||
},
|
||||
"serial": {
|
||||
@@ -129,6 +130,7 @@ def setSettings():
|
||||
if "waitForStart" in data["feature"].keys(): s.setBoolean(["feature", "waitForStartOnConnect"], data["feature"]["waitForStart"])
|
||||
if "alwaysSendChecksum" in data["feature"].keys(): s.setBoolean(["feature", "alwaysSendChecksum"], data["feature"]["alwaysSendChecksum"])
|
||||
if "sdSupport" in data["feature"].keys(): s.setBoolean(["feature", "sdSupport"], data["feature"]["sdSupport"])
|
||||
if "sdAlwaysAvailable" in data["feature"].keys(): s.setBoolean(["feature", "sdAlwaysAvailable"], data["feature"]["sdAlwaysAvailable"])
|
||||
if "swallowOkAfterResend" in data["feature"].keys(): s.setBoolean(["feature", "swallowOkAfterResend"], data["feature"]["swallowOkAfterResend"])
|
||||
|
||||
if "serial" in data.keys():
|
||||
|
||||
@@ -61,6 +61,7 @@ default_settings = {
|
||||
"waitForStartOnConnect": False,
|
||||
"alwaysSendChecksum": False,
|
||||
"sdSupport": True,
|
||||
"sdAlwaysAvailable": False,
|
||||
"swallowOkAfterResend": True
|
||||
},
|
||||
"folder": {
|
||||
|
||||
@@ -43,10 +43,10 @@ function GcodeFilesViewModel(printerStateViewModel, loginStateViewModel) {
|
||||
return !(file["prints"] && file["prints"]["success"] && file["prints"]["success"] > 0);
|
||||
},
|
||||
"sd": function(file) {
|
||||
return file["origin"] && file["origin"] == "sdcard";
|
||||
return file["origin"] && file["origin"] == "sd";
|
||||
},
|
||||
"local": function(file) {
|
||||
return !(file["origin"] && file["origin"] == "sdcard");
|
||||
return !(file["origin"] && file["origin"] == "sd");
|
||||
}
|
||||
},
|
||||
"name",
|
||||
|
||||
@@ -32,6 +32,7 @@ function SettingsViewModel(loginStateViewModel, usersViewModel) {
|
||||
self.feature_waitForStart = ko.observable(undefined);
|
||||
self.feature_alwaysSendChecksum = ko.observable(undefined);
|
||||
self.feature_sdSupport = ko.observable(undefined);
|
||||
self.feature_sdAlwaysAvailable = ko.observable(undefined);
|
||||
self.feature_swallowOkAfterResend = ko.observable(undefined);
|
||||
|
||||
self.serial_port = ko.observable();
|
||||
@@ -135,6 +136,7 @@ function SettingsViewModel(loginStateViewModel, usersViewModel) {
|
||||
self.feature_waitForStart(response.feature.waitForStart);
|
||||
self.feature_alwaysSendChecksum(response.feature.alwaysSendChecksum);
|
||||
self.feature_sdSupport(response.feature.sdSupport);
|
||||
self.feature_sdAlwaysAvailable(response.feature.sdAlwaysAvailable);
|
||||
self.feature_swallowOkAfterResend(response.feature.swallowOkAfterResend);
|
||||
|
||||
self.serial_port(response.serial.port);
|
||||
@@ -195,6 +197,7 @@ function SettingsViewModel(loginStateViewModel, usersViewModel) {
|
||||
"waitForStart": self.feature_waitForStart(),
|
||||
"alwaysSendChecksum": self.feature_alwaysSendChecksum(),
|
||||
"sdSupport": self.feature_sdSupport(),
|
||||
"sdAlwaysAvailable": self.feature_sdAlwaysAvailable(),
|
||||
"swallowOkAfterResend": self.feature_swallowOkAfterResend()
|
||||
},
|
||||
"serial": {
|
||||
|
||||
@@ -204,6 +204,13 @@
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="control-group">
|
||||
<div class="controls">
|
||||
<label class="checkbox">
|
||||
<input type="checkbox" data-bind="checked: feature_sdAlwaysAvailable" id="settings-featureSdAlwaysAvailable"> Always assume SD card is present <span class="label">Repetier</span>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="control-group">
|
||||
<div class="controls">
|
||||
<label class="checkbox">
|
||||
|
||||
@@ -8,6 +8,7 @@ import sys
|
||||
import time
|
||||
import re
|
||||
import tempfile
|
||||
from flask import make_response
|
||||
|
||||
from octoprint.settings import settings
|
||||
|
||||
@@ -188,3 +189,38 @@ def silentRemove(file):
|
||||
os.remove(file)
|
||||
except OSError:
|
||||
pass
|
||||
|
||||
|
||||
def sanitizeAscii(line):
|
||||
return unicode(line, 'ascii', 'replace').encode('ascii', 'replace').rstrip()
|
||||
|
||||
|
||||
def filterNonAscii(line):
|
||||
"""
|
||||
Returns True if the line contains non-ascii characters, false otherwise
|
||||
|
||||
@param line the line to test
|
||||
"""
|
||||
|
||||
try:
|
||||
unicode(line, 'ascii').encode('ascii')
|
||||
return False
|
||||
except ValueError:
|
||||
return True
|
||||
|
||||
|
||||
def getJsonCommandFromRequest(request, valid_commands):
|
||||
if not "application/json" in request.headers["Content-Type"]:
|
||||
return None, None, make_response("Expected content-type JSON", 400)
|
||||
|
||||
data = request.json
|
||||
if not "command" in data.keys() or not data["command"] in valid_commands.keys():
|
||||
return None, None, make_response("Expected valid command", 400)
|
||||
|
||||
command = data["command"]
|
||||
for parameter in valid_commands[command]:
|
||||
if not parameter in data:
|
||||
return None, None, make_response("Mandatory parameter %s missing for command %s" % (parameter, command), 400)
|
||||
|
||||
return command, data, None
|
||||
|
||||
+57
-29
@@ -20,7 +20,7 @@ from octoprint.util.avr_isp import ispBase
|
||||
from octoprint.settings import settings
|
||||
from octoprint.events import eventManager
|
||||
from octoprint.gcodefiles import isGcodeFileName
|
||||
from octoprint.util import getExceptionString, getNewTimeout
|
||||
from octoprint.util import getExceptionString, getNewTimeout, sanitizeAscii, filterNonAscii
|
||||
from octoprint.util.virtual import VirtualPrinter
|
||||
|
||||
try:
|
||||
@@ -150,6 +150,18 @@ class MachineCom(object):
|
||||
# print job
|
||||
self._currentFile = None
|
||||
|
||||
# regexes
|
||||
floatPattern = "[-+]?[0-9]*\.?[0-9]+"
|
||||
intPattern = "[0-9]+"
|
||||
self._regex_command = re.compile("^\s*([GM]\d+)")
|
||||
self._regex_float = re.compile(floatPattern)
|
||||
self._regex_paramZFloat = re.compile("Z(%s)" % floatPattern)
|
||||
self._regex_paramSInt = re.compile("S(%s)" % intPattern)
|
||||
self._regex_paramNInt = re.compile("N(%s)" % intPattern)
|
||||
self._regex_minMaxError = re.compile("Error:[0-9]\n")
|
||||
self._regex_sdPrintingByte = re.compile("([0-9]*)/([0-9]*)")
|
||||
self._regex_sdFileOpened = re.compile("File opened:\s*(.*?)\s+Size:\s*([0-9]*)")
|
||||
|
||||
def __del__(self):
|
||||
self.close()
|
||||
|
||||
@@ -330,14 +342,14 @@ class MachineCom(object):
|
||||
|
||||
if self._currentFile is None:
|
||||
raise ValueError("No file selected for printing")
|
||||
|
||||
wasPaused = self.isPaused()
|
||||
self._printSection = "CUSTOM"
|
||||
self._changeState(self.STATE_PRINTING)
|
||||
eventManager().fire("PrintStarted", self._currentFile.getFilename())
|
||||
|
||||
try:
|
||||
self._currentFile.start()
|
||||
|
||||
self._changeState(self.STATE_PRINTING)
|
||||
eventManager().fire("PrintStarted", self._currentFile.getFilename())
|
||||
|
||||
if self.isSdFileSelected():
|
||||
if wasPaused:
|
||||
self.sendCommand("M26 S0")
|
||||
@@ -451,6 +463,10 @@ class MachineCom(object):
|
||||
if not self.isOperational():
|
||||
return
|
||||
self.sendCommand("M21")
|
||||
if settings().getBoolean(["feature", "sdAlwaysAvailable"]):
|
||||
self._sdAvailable = True
|
||||
self.refreshSdFiles()
|
||||
self._callback.mcSdStateChange(self._sdAvailable)
|
||||
|
||||
def releaseSdCard(self):
|
||||
if not self.isOperational() or (self.isBusy() and self.isSdFileSelected()):
|
||||
@@ -501,15 +517,19 @@ class MachineCom(object):
|
||||
##~~ SD file list
|
||||
# if we are currently receiving an sd file list, each line is just a filename, so just read it and abort processing
|
||||
if self._sdFileList and isGcodeFileName(line.strip().lower()) and not 'End file list' in line:
|
||||
self._sdFiles.append(line.strip().lower())
|
||||
filename = line.strip().lower()
|
||||
if filterNonAscii(filename):
|
||||
self._logger.warn("Got a file from printer's SD that has a non-ascii filename (%s), that shouldn't happen according to the protocol" % filename)
|
||||
else:
|
||||
self._sdFiles.append(filename)
|
||||
continue
|
||||
|
||||
##~~ Temperature processing
|
||||
if ' T:' in line or line.startswith('T:'):
|
||||
try:
|
||||
self._temp = float(re.search("-?[0-9\.]*", line.split('T:')[1]).group(0))
|
||||
self._temp = float(self._regex_float.search(line.split('T:')[1]).group(0))
|
||||
if ' B:' in line:
|
||||
self._bedTemp = float(re.search("-?[0-9\.]*", line.split(' B:')[1]).group(0))
|
||||
self._bedTemp = float(self._regex_float.search(line.split(' B:')[1]).group(0))
|
||||
|
||||
self._callback.mcTempUpdate(self._temp, self._bedTemp, self._targetTemp, self._bedTargetTemp)
|
||||
except ValueError:
|
||||
@@ -534,7 +554,7 @@ class MachineCom(object):
|
||||
# something went wrong, printer is reporting that we actually are not printing right now...
|
||||
self._sdFilePos = 0
|
||||
self._changeState(self.STATE_OPERATIONAL)
|
||||
elif 'SD card ok' in line:
|
||||
elif 'SD card ok' in line and not self._sdAvailable:
|
||||
self._sdAvailable = True
|
||||
self.refreshSdFiles()
|
||||
self._callback.mcSdStateChange(self._sdAvailable)
|
||||
@@ -546,12 +566,12 @@ class MachineCom(object):
|
||||
self._callback.mcSdFiles(self._sdFiles)
|
||||
elif 'SD printing byte' in line:
|
||||
# answer to M27, at least on Marlin, Repetier and Sprinter: "SD printing byte %d/%d"
|
||||
match = re.search("([0-9]*)/([0-9]*)", line)
|
||||
match = self._regex_sdPrintingByte.search(line)
|
||||
self._currentFile.setFilepos(int(match.group(1)))
|
||||
self._callback.mcProgress()
|
||||
elif 'File opened' in line:
|
||||
# answer to M23, at least on Marlin, Repetier and Sprinter: "File opened:%s Size:%d"
|
||||
match = re.search("File opened:\s*(.*?)\s+Size:\s*([0-9]*)", line)
|
||||
match = self._regex_sdFileOpened.search(line)
|
||||
self._currentFile = PrintingSdFileInformation(match.group(1), int(match.group(2)))
|
||||
elif 'File selected' in line:
|
||||
# final answer to M23, at least on Marlin, Repetier and Sprinter: "File selected"
|
||||
@@ -560,7 +580,6 @@ class MachineCom(object):
|
||||
eventManager().fire("FileSelected", self._currentFile.getFilename())
|
||||
elif 'Writing to file' in line:
|
||||
# anwer to M28, at least on Marlin, Repetier and Sprinter: "Writing to file: %s"
|
||||
self._printSection = "CUSTOM"
|
||||
self._changeState(self.STATE_PRINTING)
|
||||
line = "ok"
|
||||
elif 'Done printing file' in line:
|
||||
@@ -654,6 +673,8 @@ class MachineCom(object):
|
||||
self._changeState(self.STATE_OPERATIONAL)
|
||||
if self._sdAvailable:
|
||||
self.refreshSdFiles()
|
||||
else:
|
||||
self.initSdCard()
|
||||
eventManager().fire("Connected", "%s at %s baud" % (self._port, self._baudrate))
|
||||
else:
|
||||
self._testingBaudrate = False
|
||||
@@ -666,7 +687,9 @@ class MachineCom(object):
|
||||
startSeen = True
|
||||
elif "ok" in line and startSeen:
|
||||
self._changeState(self.STATE_OPERATIONAL)
|
||||
if not self._sdAvailable:
|
||||
if self._sdAvailable:
|
||||
self.refreshSdFiles()
|
||||
else:
|
||||
self.initSdCard()
|
||||
eventManager().fire("Connected", "%s at %s baud" % (self._port, self._baudrate))
|
||||
elif time.time() > timeout:
|
||||
@@ -785,7 +808,7 @@ class MachineCom(object):
|
||||
# Marlin reports an MIN/MAX temp error as "Error:x\n: Extruder switched off. MAXTEMP triggered !\n"
|
||||
# But a bed temp error is reported as "Error: Temperature heated bed switched off. MAXTEMP triggered !!"
|
||||
# So we can have an extra newline in the most common case. Awesome work people.
|
||||
if re.match('Error:[0-9]\n', line):
|
||||
if self._regex_minMaxError.match(line):
|
||||
line = line.rstrip() + self._readline()
|
||||
#Skip the communication errors, as those get corrected.
|
||||
if 'checksum mismatch' in line \
|
||||
@@ -815,7 +838,7 @@ class MachineCom(object):
|
||||
if ret == '':
|
||||
#self._log("Recv: TIMEOUT")
|
||||
return ''
|
||||
self._log("Recv: %s" % (unicode(ret, 'ascii', 'replace').encode('ascii', 'replace').rstrip()))
|
||||
self._log("Recv: %s" % sanitizeAscii(ret))
|
||||
return ret
|
||||
|
||||
def _sendNext(self):
|
||||
@@ -882,7 +905,7 @@ class MachineCom(object):
|
||||
return
|
||||
|
||||
if not self.isStreaming():
|
||||
gcode = re.search("^\s*([GM]\d+)", cmd)
|
||||
gcode = self._regex_command.search(cmd)
|
||||
if gcode:
|
||||
gcode = gcode.group(1)
|
||||
|
||||
@@ -932,13 +955,15 @@ class MachineCom(object):
|
||||
|
||||
def _gcode_G0(self, cmd):
|
||||
if 'Z' in cmd:
|
||||
try:
|
||||
z = float(re.search('Z([0-9\.]*)', cmd).group(1))
|
||||
if self._currentZ != z:
|
||||
self._currentZ = z
|
||||
self._callback.mcZChange(z)
|
||||
except ValueError:
|
||||
pass
|
||||
match = self._regex_paramZFloat.search(cmd)
|
||||
if match:
|
||||
try:
|
||||
z = float(match.group(1))
|
||||
if self._currentZ != z:
|
||||
self._currentZ = z
|
||||
self._callback.mcZChange(z)
|
||||
except ValueError:
|
||||
pass
|
||||
return cmd
|
||||
_gcode_G1 = _gcode_G0
|
||||
|
||||
@@ -948,7 +973,7 @@ class MachineCom(object):
|
||||
_gcode_M1 = _gcode_M0
|
||||
|
||||
def _gcode_M104(self, cmd):
|
||||
match = re.search('S([0-9]+)', cmd)
|
||||
match = self._regex_paramSInt.search(cmd)
|
||||
if match:
|
||||
try:
|
||||
self._targetTemp = float(match.group(1))
|
||||
@@ -957,7 +982,7 @@ class MachineCom(object):
|
||||
return cmd
|
||||
|
||||
def _gcode_M140(self, cmd):
|
||||
match = re.search('S([0-9]+)', cmd)
|
||||
match = self._regex_paramSInt.search(cmd)
|
||||
if match:
|
||||
try:
|
||||
self._bedTargetTemp = float(match.group(1))
|
||||
@@ -975,7 +1000,7 @@ class MachineCom(object):
|
||||
|
||||
def _gcode_M110(self, cmd):
|
||||
newLineNumber = None
|
||||
match = re.search("N([0-9]+)", cmd)
|
||||
match = self._regex_paramNInt.search(cmd)
|
||||
if match:
|
||||
try:
|
||||
newLineNumber = int(match.group(1))
|
||||
@@ -993,6 +1018,9 @@ class MachineCom(object):
|
||||
self._resendDelta = None
|
||||
|
||||
return None
|
||||
def _gcode_M112(self, cmd): # It's an emergency what todo? Canceling the print should be the minimum
|
||||
self.cancelPrint()
|
||||
return cmd
|
||||
|
||||
### MachineCom callback ################################################################################################
|
||||
|
||||
@@ -1110,7 +1138,7 @@ class PrintingGcodeFileInformation(PrintingFileInformation):
|
||||
self._firstLine = None
|
||||
|
||||
self._offsetCallback = offsetCallback
|
||||
self._tempCommandPattern = re.compile("^\s*M(104|109|140|190)\s+S([0-9\.]+)")
|
||||
self._regex_tempCommand = re.compile("^\s*M(104|109|140|190)\s+S([0-9\.]+)")
|
||||
|
||||
if not os.path.exists(self._filename) or not os.path.isfile(self._filename):
|
||||
raise IOError("File %s does not exist" % self._filename)
|
||||
@@ -1167,7 +1195,7 @@ class PrintingGcodeFileInformation(PrintingFileInformation):
|
||||
if self._offsetCallback is not None:
|
||||
(tempOffset, bedTempOffset) = self._offsetCallback()
|
||||
if tempOffset != 0 or bedTempOffset != 0:
|
||||
tempMatch = self._tempCommandPattern.match(line)
|
||||
tempMatch = self._regex_tempCommand.match(line)
|
||||
if tempMatch is not None:
|
||||
if tempMatch.group(1) == "104" or tempMatch.group(1) == "109":
|
||||
offset = tempOffset
|
||||
@@ -1189,4 +1217,4 @@ class PrintingGcodeFileInformation(PrintingFileInformation):
|
||||
|
||||
class StreamingGcodeFileInformation(PrintingGcodeFileInformation):
|
||||
def __init__(self, filename):
|
||||
PrintingGcodeFileInformation.__init__(self, filename, None)
|
||||
PrintingGcodeFileInformation.__init__(self, filename, None)
|
||||
Reference in new issue
Block a user