diff --git a/pkgs/applications/misc/octoprint/0002-Try-to-create-connection-several-times-if-printer-is.patch b/pkgs/applications/misc/octoprint/0002-Try-to-create-connection-several-times-if-printer-is.patch deleted file mode 100644 index 63495fd6db9..00000000000 --- a/pkgs/applications/misc/octoprint/0002-Try-to-create-connection-several-times-if-printer-is.patch +++ /dev/null @@ -1,57 +0,0 @@ -From b99fc3fd012765c5b3d8ac7a3f64762af5121b4a Mon Sep 17 00:00:00 2001 -From: Nikolay Amiantov -Date: Wed, 17 Feb 2016 15:47:34 +0300 -Subject: [PATCH 2/2] Try to create connection several times if printer is not - yet available - ---- - octoprint_m3dfio/__init__.py | 25 ++++++++++++++++++++++--- - 1 file changed, 22 insertions(+), 3 deletions(-) - -diff --git a/octoprint_m3dfio/__init__.py b/octoprint_m3dfio/__init__.py -index 9f59768..e7d97eb 100644 ---- a/octoprint_m3dfio/__init__.py -+++ b/octoprint_m3dfio/__init__.py -@@ -3421,8 +3421,16 @@ class M3DFioPlugin( - # Set updated port - currentPort = self.getPort() - -- # Re-connect -- connection = serial.Serial(currentPort, currentBaudrate) -+ # Re-connect; wait for the device to be available -+ connection = None -+ for i in range(1, 5): -+ try: -+ connection = serial.Serial(currentPort, currentBaudrate) -+ break -+ except OSError: -+ time.sleep(1) -+ if connection is None: -+ raise Exception("Couldn't reconnect to the printer") - - # Check if getting EEPROM was successful - if self.getEeprom(connection) : -@@ -6799,8 +6807,19 @@ class M3DFioPlugin( - # Set state to connecting - comm_instance._log("Connecting to: " + str(port)) - -+ # Create a connection -+ connection = None -+ for i in range(1, 5): -+ try: -+ connection = serial.Serial(str(port), baudrate) -+ # If printer has just power-cycled it may not yet be ready -+ except OSError: -+ time.sleep(1) -+ if connection is None: -+ raise Exception("Couldn't reconnect to the printer") -+ - # Return connection -- return serial.Serial(str(port), baudrate) -+ return connection - - # Disable sleep - def disableSleep(self) : --- -2.7.0 - diff --git a/pkgs/applications/misc/octoprint/plugins.nix b/pkgs/applications/misc/octoprint/plugins.nix index 801be43220d..33f4561598a 100644 --- a/pkgs/applications/misc/octoprint/plugins.nix +++ b/pkgs/applications/misc/octoprint/plugins.nix @@ -8,18 +8,17 @@ in { m3d-fio = buildPlugin rec { name = "M3D-Fio-${version}"; - version = "0.26"; + version = "0.27"; src = fetchFromGitHub { owner = "donovan6000"; repo = "M3D-Fio"; rev = "V${version}"; - sha256 = "1dl8m0cxp2vzla2a729r3jrq5ahxkj10pygp7m9bblj5nn2s0rll"; + sha256 = "14zva61dhnsyapapw8q2qadfq5hzv5ykb7qxlz8a3x5j6wfhjn6h"; }; patches = [ ./0001-Don-t-use-static-library.patch - ./0002-Try-to-create-connection-several-times-if-printer-is.patch ]; postInstall = ''