Use fallback without time-out if preheating bed on old firmware

It manually sets the temperature just like what happens when you print via USB.

Contributes to issue CURA-3161.
This commit is contained in:
Ghostkeeper 2017-02-08 11:38:03 +01:00
parent 28e488dad7
commit da4574cb32
No known key found for this signature in database
GPG key ID: C5F96EE2BC0F7E75

View file

@ -9,6 +9,7 @@ from UM.Signal import signalemitter
from UM.Message import Message
import UM.Settings
import UM.Version #To compare firmware version numbers.
from cura.PrinterOutputDevice import PrinterOutputDevice, ConnectionState
import cura.Settings.ExtruderManager
@ -250,6 +251,9 @@ class NetworkPrinterOutputDevice(PrinterOutputDevice):
def preheatBed(self, temperature, duration):
temperature = round(temperature) #The API doesn't allow floating point.
duration = round(duration)
if UM.Version(self.firmwareVersion) < UM.Version("3.5.92"): #Real bed pre-heating support is implemented from 3.5.92 and up.
self.setTargetBedTemperature(temperature = temperature) #No firmware-side duration support then.
return
url = QUrl("http://" + self._address + self._api_prefix + "printer/bed/pre_heat")
if duration > 0:
data = """{"temperature": "%i", "timeout": "%i"}""" % (temperature, duration)