예제 #1
0
	def _process_temperatures(self, line):
		if RepetierTextualProtocol.MESSAGE_TARGET_TEMPERATURE(line):
			match_extr = RepetierTextualProtocol.REGEX_TARGET_EXTRUDER_TEMPERATURE.match(line)
			match_bed = RepetierTextualProtocol.REGEX_TARGET_BED_TEMPERATURE.match(line)

			current_temperatures = self.get_current_temperatures()
			key = None
			target = None
			try:
				if match_extr is not None:
					tool_num = int(match_extr.group(1))
					key = "tool%d" % tool_num
					target = float(match_extr.group(2))
				elif match_bed is not None:
					key = "bed"
					target = float(match_bed.group(1))
			except ValueError:
				pass

			if key is None:
				return False

			if key in current_temperatures and current_temperatures[key] is not None and isinstance(current_temperatures[key], tuple):
				(actual, old_target) = current_temperatures[key]
				current_temperatures[key] = (actual, target)
			else:
				current_temperatures[key] = (None, target)
			self._updateTemperature(current_temperatures)
		else:
			RepRapProtocol._process_temperatures(self, line)
예제 #2
0
    def _process_temperatures(self, line):
        if RepetierTextualProtocol.MESSAGE_TARGET_TEMPERATURE(line):
            match_extr = RepetierTextualProtocol.REGEX_TARGET_EXTRUDER_TEMPERATURE.match(
                line)
            match_bed = RepetierTextualProtocol.REGEX_TARGET_BED_TEMPERATURE.match(
                line)

            current_temperatures = self.get_current_temperatures()
            key = None
            target = None
            try:
                if match_extr is not None:
                    tool_num = int(match_extr.group(1))
                    key = "tool%d" % tool_num
                    target = float(match_extr.group(2))
                elif match_bed is not None:
                    key = "bed"
                    target = float(match_bed.group(1))
            except ValueError:
                pass

            if key is None:
                return False

            if key in current_temperatures and current_temperatures[
                    key] is not None and isinstance(current_temperatures[key],
                                                    tuple):
                (actual, old_target) = current_temperatures[key]
                current_temperatures[key] = (actual, target)
            else:
                current_temperatures[key] = (None, target)
            self._updateTemperature(current_temperatures)
        else:
            RepRapProtocol._process_temperatures(self, line)
예제 #3
0
class RepetierTextualProtocol(RepRapProtocol):

    __protocolinfo__ = ("repetier", "RepRap (Repetier Flavor)", False)

    MESSAGE_TARGET_TEMPERATURE = staticmethod(
        lambda line: "TargetExtr" in line or "TargetBed" in line)
    MESSAGE_TEMPERATURE = staticmethod(
        lambda line: RepRapProtocol.MESSAGE_TEMPERATURE(
            line) or RepetierTextualProtocol.MESSAGE_TARGET_TEMPERATURE(line))

    REGEX_POSITIVE_FLOAT = "[+]?[0-9]*\.?[0-9]+"
    REGEX_TARGET_EXTRUDER_TEMPERATURE = re.compile("TargetExtr([0-9]+):(%s)" %
                                                   REGEX_POSITIVE_FLOAT)
    REGEX_TARGET_BED_TEMPERATURE = re.compile("TargetBed:(%s)" %
                                              REGEX_POSITIVE_FLOAT)

    def __init__(self, transport_factory, protocol_listener=None):
        RepRapProtocol.__init__(self, transport_factory, protocol_listener)
        self._sd_available = True

    def _reset(self, from_start=False):
        RepRapProtocol._reset(self, from_start=from_start)
        self._sd_available = True

    def _process_temperatures(self, line):
        if RepetierTextualProtocol.MESSAGE_TARGET_TEMPERATURE(line):
            match_extr = RepetierTextualProtocol.REGEX_TARGET_EXTRUDER_TEMPERATURE.match(
                line)
            match_bed = RepetierTextualProtocol.REGEX_TARGET_BED_TEMPERATURE.match(
                line)

            current_temperatures = self.get_current_temperatures()
            key = None
            target = None
            try:
                if match_extr is not None:
                    tool_num = int(match_extr.group(1))
                    key = "tool%d" % tool_num
                    target = float(match_extr.group(2))
                elif match_bed is not None:
                    key = "bed"
                    target = float(match_bed.group(1))
            except ValueError:
                pass

            if key is None:
                return False

            if key in current_temperatures and current_temperatures[
                    key] is not None and isinstance(current_temperatures[key],
                                                    tuple):
                (actual, old_target) = current_temperatures[key]
                current_temperatures[key] = (actual, target)
            else:
                current_temperatures[key] = (None, target)
            self._updateTemperature(current_temperatures)
        else:
            RepRapProtocol._process_temperatures(self, line)
예제 #4
0
 def _reset(self, from_start=False):
     RepRapProtocol._reset(self, from_start=from_start)
     self._sd_available = True
예제 #5
0
 def __init__(self, transport_factory, protocol_listener=None):
     RepRapProtocol.__init__(self, transport_factory, protocol_listener)
     self._sd_available = True
예제 #6
0
	def _reset(self, from_start=False):
		RepRapProtocol._reset(self, from_start=from_start)
		self._sd_available = True
예제 #7
0
	def __init__(self, transport_factory, protocol_listener=None):
		RepRapProtocol.__init__(self, transport_factory, protocol_listener)
		self._sd_available = True