Also recognize F as standalone GCODE command

While 3D printers usually don't support that, at least Smoothieware
does combined with CNC operations.
This commit is contained in:
Gina Häußge 2015-12-16 16:49:00 +01:00
parent 8c85ed8ce5
commit dd843c8f67
2 changed files with 9 additions and 4 deletions

View file

@ -17,10 +17,10 @@ from octoprint.settings import settings
from octoprint.plugin import plugin_manager
class VirtualPrinter(object):
command_regex = re.compile("^([GMT])(\d+)")
command_regex = re.compile("^([GMTF])(\d+)")
sleep_regex = re.compile("sleep (\d+)")
sleep_after_regex = re.compile("sleep_after ([GMT]\d+) (\d+)")
sleep_after_next_regex = re.compile("sleep_after_next ([GMT]\d+) (\d+)")
sleep_after_regex = re.compile("sleep_after ([GMTF]\d+) (\d+)")
sleep_after_next_regex = re.compile("sleep_after_next ([GMTF]\d+) (\d+)")
custom_action_regex = re.compile("action_custom ([a-zA-Z0-9_]+)(\s+.*)?")
def __init__(self, seriallog_handler=None, read_timeout=5.0, write_timeout=10.0):
@ -240,6 +240,9 @@ class VirtualPrinter(object):
self.currentExtruder = int(code)
self._send("Active Extruder: %d" % self.currentExtruder)
def _gcode_F(self, code, data):
self._send("echo:changed F value")
def _gcode_M104(self, data):
self._parseHotendCommand(data)
_gcode_M109 = _gcode_M104

View file

@ -39,7 +39,7 @@ regex_float_pattern = "[-+]?[0-9]*\.?[0-9]+"
regex_positive_float_pattern = "[+]?[0-9]*\.?[0-9]+"
regex_int_pattern = "\d+"
regex_command = re.compile("^\s*((?P<commandGM>[GM]\d+)|(?P<commandT>T)\d+)")
regex_command = re.compile("^\s*((?P<commandGM>[GM]\d+)|(?P<commandT>T)\d+|(?P<commandF>F)\d+)")
"""Regex for a GCODE command."""
regex_float = re.compile(regex_float_pattern)
@ -2499,6 +2499,8 @@ def gcode_command_for_cmd(cmd):
return values["commandGM"]
elif "commandT" in values and values["commandT"]:
return values["commandT"]
elif "commandF" in values and values["commandF"]:
return values["commandF"]
else:
# this should never happen
return None