From 15889e0dc78067bd0a548aab67c549eea6477b30 Mon Sep 17 00:00:00 2001 From: ntoff Date: Thu, 8 Mar 2018 10:45:58 +1000 Subject: [PATCH] unregister event disconnect https://github.com/ntoff/OctoPrint-Estop/issues/4#issuecomment-371146397 --- octoprint_estop/static/js/estop.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/octoprint_estop/static/js/estop.js b/octoprint_estop/static/js/estop.js index 356b7b7..b976f73 100644 --- a/octoprint_estop/static/js/estop.js +++ b/octoprint_estop/static/js/estop.js @@ -54,8 +54,9 @@ $(function() { if (self.estopReconnect()) { //cycle the connection (if enabled) to reset the control board OctoPrint.connection.disconnect(); //send a disconnect, maybe useful for breaking out of blocking commands. - self.onEventDisconnected =function () { //wait until octoprint has disconnected - OctoPrint.connection.connect(); //reconnect + self.onEventDisconnected = function () { //wait until octoprint has disconnected + self.onEventDisconnected = null; //unregister event handler + OctoPrint.connection.connect(); //reconnect } } };