Provide pre-heat command with integer parameters

The firmware only accepts integers, apparently.

Contributes to issue CURA-3161.
This commit is contained in:
Ghostkeeper 2017-02-07 14:39:56 +01:00
parent b27a9e6535
commit d751285713
No known key found for this signature in database
GPG key ID: C5F96EE2BC0F7E75

View file

@ -247,10 +247,10 @@ class NetworkPrinterOutputDevice(PrinterOutputDevice):
# Celsius.
# \param duration How long the bed should stay warm, in seconds. Defaults
# to a quarter hour.
@pyqtSlot(float, float)
@pyqtSlot(int, int)
def preheatBed(self, temperature, duration=900):
url = QUrl("http://" + self._address + self._api_prefix + "printer/bed/pre_heat")
data = """{"temperature": "%0.3f", "timeout": "%0.3f"}""" % (temperature, duration)
data = """{"temperature": "%i", "timeout": "%i"}""" % (temperature, duration)
put_request = QNetworkRequest(url)
put_request.setHeader(QNetworkRequest.ContentTypeHeader, "application/json")
self._manager.put(put_request, data.encode())