delete onEventDisconnected unregister it
delete it, remove it, make it gone. I dunno what's right anymore
This commit is contained in:
parent
a236450cb5
commit
c8ae6e7dde
@ -54,21 +54,11 @@ $(function() {
|
|||||||
self.updateSettingsValues();
|
self.updateSettingsValues();
|
||||||
}
|
}
|
||||||
|
|
||||||
self.updateSettingsValues = function () { //lazy way of making sure we have the latest version of the settings
|
self.updateSettingsValues = function () {
|
||||||
self.estopCommand(self.settings.settings.plugins.estop.estopCommand());
|
self.estopCommand(self.settings.settings.plugins.estop.estopCommand());
|
||||||
self.estopReconnect(self.settings.settings.plugins.estop.estopReconnect());
|
self.estopReconnect(self.settings.settings.plugins.estop.estopReconnect());
|
||||||
}
|
}
|
||||||
|
|
||||||
self.onEventDisconnected = function () {
|
|
||||||
if (self.estopReconnect() && self.emergencyCalled()) {
|
|
||||||
self.timedReconnect = setTimeout(function() { //reconnect 3 seconds after detecting the printer is offline
|
|
||||||
self.emergencyCalled(false);
|
|
||||||
OctoPrint.connection.connect();
|
|
||||||
|
|
||||||
}, 3*1000); //3 seconds
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
self.sendEstopCommand = function () {
|
self.sendEstopCommand = function () {
|
||||||
if (self.enableEstop()) {
|
if (self.enableEstop()) {
|
||||||
self.estopCommand(self.settings.settings.plugins.estop.estopCommand());
|
self.estopCommand(self.settings.settings.plugins.estop.estopCommand());
|
||||||
@ -76,7 +66,15 @@ $(function() {
|
|||||||
|
|
||||||
if (self.estopReconnect()) {
|
if (self.estopReconnect()) {
|
||||||
self.emergencyCalled(true);
|
self.emergencyCalled(true);
|
||||||
OctoPrint.connection.disconnect(); //normally octoprint would probably disconnect anyway, just calling this here in case the printer is in a blocking loop
|
OctoPrint.connection.disconnect();
|
||||||
|
self.onEventDisconnected = function () {
|
||||||
|
self.timedReconnect = setTimeout(function() {
|
||||||
|
self.emergencyCalled(false);
|
||||||
|
delete self.onEventDisconnected;
|
||||||
|
OctoPrint.connection.connect();
|
||||||
|
|
||||||
|
}, 3*1000); //3 seconds
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user