Added sanity check for extruder selection in gcode files
Any T command targeting a number higher than the value specified in the settings for gcodeAnalysis.maxExtruders (defaults to 10) will be ignored and trigger a warning in the log file. Fix for #539
This commit is contained in:
parent
4d434d36be
commit
7d5c55fc95
2 changed files with 20 additions and 14 deletions
|
|
@ -73,6 +73,9 @@ default_settings = {
|
||||||
"mobileSizeThreshold": 2 * 1024 * 1024, # 2MB
|
"mobileSizeThreshold": 2 * 1024 * 1024, # 2MB
|
||||||
"sizeThreshold": 20 * 1024 * 1024, # 20MB
|
"sizeThreshold": 20 * 1024 * 1024, # 20MB
|
||||||
},
|
},
|
||||||
|
"gcodeAnalysis": {
|
||||||
|
"maxExtruders": 10
|
||||||
|
},
|
||||||
"feature": {
|
"feature": {
|
||||||
"temperatureGraph": True,
|
"temperatureGraph": True,
|
||||||
"waitForStartOnConnect": False,
|
"waitForStartOnConnect": False,
|
||||||
|
|
|
||||||
|
|
@ -195,6 +195,9 @@ class gcode(object):
|
||||||
absoluteE = False
|
absoluteE = False
|
||||||
|
|
||||||
elif T is not None:
|
elif T is not None:
|
||||||
|
if T > settings().getInt(["gcodeAnalysis", "maxExtruders"]):
|
||||||
|
self._logger.warn("GCODE tried to select tool %d, that looks wrong, ignoring for GCODE analysis" % T)
|
||||||
|
else:
|
||||||
posOffset[0] -= offsets[currentExtruder]["x"] if currentExtruder < len(offsets) else 0
|
posOffset[0] -= offsets[currentExtruder]["x"] if currentExtruder < len(offsets) else 0
|
||||||
posOffset[1] -= offsets[currentExtruder]["y"] if currentExtruder < len(offsets) else 0
|
posOffset[1] -= offsets[currentExtruder]["y"] if currentExtruder < len(offsets) else 0
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue