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 } } };