From 4ccadc6208796ea98aa5611621deaa6877e58c98 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Tue, 7 Feb 2017 16:57:20 +0100 Subject: [PATCH] Round pre-heat temperature and duration to integer but allow floats We want to allow floats in the interface since the interface needs to be agnostic of what device it is connected to. But the UM3 API only allows integers, so we still need to round it to the nearest integer. Contributes to issue CURA-3161. --- plugins/UM3NetworkPrinting/NetworkPrinterOutputDevice.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/plugins/UM3NetworkPrinting/NetworkPrinterOutputDevice.py b/plugins/UM3NetworkPrinting/NetworkPrinterOutputDevice.py index 074bc92cda..3694ada361 100644 --- a/plugins/UM3NetworkPrinting/NetworkPrinterOutputDevice.py +++ b/plugins/UM3NetworkPrinting/NetworkPrinterOutputDevice.py @@ -247,8 +247,10 @@ class NetworkPrinterOutputDevice(PrinterOutputDevice): # Celsius. # \param duration How long the bed should stay warm, in seconds. Defaults # to a quarter hour. - @pyqtSlot(int, int) + @pyqtSlot(float, float) def preheatBed(self, temperature, duration): + temperature = round(temperature) #The API doesn't allow floating point. + duration = round(duration) url = QUrl("http://" + self._address + self._api_prefix + "printer/bed/pre_heat") if duration > 0: data = """{"temperature": "%i", "timeout": "%i"}""" % (temperature, duration)