From 445fb59c120de6d2d7e30da1c542c6c1a7573102 Mon Sep 17 00:00:00 2001 From: ChrisTerBeke Date: Mon, 12 Aug 2019 23:22:16 +0200 Subject: [PATCH] Fix setting connection state after re-connect, don't re-register output device --- .../src/UltimakerNetworkedPrinterOutputDevice.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/plugins/UM3NetworkPrinting/src/UltimakerNetworkedPrinterOutputDevice.py b/plugins/UM3NetworkPrinting/src/UltimakerNetworkedPrinterOutputDevice.py index 698995c664..f2c24e4802 100644 --- a/plugins/UM3NetworkPrinting/src/UltimakerNetworkedPrinterOutputDevice.py +++ b/plugins/UM3NetworkPrinting/src/UltimakerNetworkedPrinterOutputDevice.py @@ -44,7 +44,8 @@ class UltimakerNetworkedPrinterOutputDevice(NetworkedPrinterOutputDevice): QUEUED_PRINT_JOBS_STATES = {"queued", "error"} # Time in seconds since last network response after which we consider this device offline. - NETWORK_RESPONSE_CONSIDER_OFFLINE = 10.0 + # We set this a bit higher than some of the other intervals to make sure they don't overlap. + NETWORK_RESPONSE_CONSIDER_OFFLINE = 12.0 def __init__(self, device_id: str, address: str, properties: Dict[bytes, bytes], connection_type: ConnectionType, parent=None) -> None: @@ -216,6 +217,13 @@ class UltimakerNetworkedPrinterOutputDevice(NetworkedPrinterOutputDevice): if not active_machine: return + # Indicate this device is now connected again. + self.setConnectionState(ConnectionState.Connected) + + # If the device was already registered we don't need to register it again. + if self.key in CuraApplication.getInstance().getOutputDeviceManager().getOutputDeviceIds(): + return + # Try for local network device. stored_device_id = active_machine.getMetaDataEntry(self.META_NETWORK_KEY) if self.key == stored_device_id: