mirror of
https://github.com/Doodle3D/doodle3d-client.git
synced 2024-11-22 09:17:56 +01:00
stop status checks on override and start them again when there is a first response
This commit is contained in:
parent
9ab36d999e
commit
d5aef3bf95
@ -61,7 +61,7 @@ function Printer() {
|
|||||||
console.log(" wifiboxURL: ",this.wifiboxURL);
|
console.log(" wifiboxURL: ",this.wifiboxURL);
|
||||||
|
|
||||||
if(autoUpdate) {
|
if(autoUpdate) {
|
||||||
this.checkStatus();
|
this.startStatusCheckInterval();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -162,6 +162,12 @@ function Printer() {
|
|||||||
self.sendPrintPart(sendIndex + sendLength, sendLength);
|
self.sendPrintPart(sendIndex + sendLength, sendLength);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
// after we know the first gcode packed has bin received or failed
|
||||||
|
// (and the driver had time to update the printer.state)
|
||||||
|
// we start checking the status again
|
||||||
|
if(sendIndex == 0) {
|
||||||
|
self.startStatusCheckInterval();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}).fail(function() {
|
}).fail(function() {
|
||||||
@ -171,6 +177,11 @@ function Printer() {
|
|||||||
console.log("request printer:sendPrintPart failed retry");
|
console.log("request printer:sendPrintPart failed retry");
|
||||||
self.sendPrintPart(sendIndex, sendLength)
|
self.sendPrintPart(sendIndex, sendLength)
|
||||||
},self.retryDelay); // retry after delay
|
},self.retryDelay); // retry after delay
|
||||||
|
|
||||||
|
// after we know the gcode packed has bin received or failed
|
||||||
|
// (and the driver had time to update the printer.state)
|
||||||
|
// we start checking the status again
|
||||||
|
self.startStatusCheckInterval();
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
console.log ("Printer >> f:sendPrintPart() >> communicateWithWifibox is false, so not executing this function");
|
console.log ("Printer >> f:sendPrintPart() >> communicateWithWifibox is false, so not executing this function");
|
||||||
@ -188,17 +199,38 @@ function Printer() {
|
|||||||
timeout: this.timeoutTime,
|
timeout: this.timeoutTime,
|
||||||
success: function(data){
|
success: function(data){
|
||||||
console.log("Printer:stop response: ", data);
|
console.log("Printer:stop response: ", data);
|
||||||
|
|
||||||
|
// after we know the stop has bin received or failed
|
||||||
|
// (and the driver had time to update the printer.state)
|
||||||
|
// we start checking the status again
|
||||||
|
self.startStatusCheckInterval();
|
||||||
}
|
}
|
||||||
}).fail(function() {
|
}).fail(function() {
|
||||||
console.log("Printer:stop: failed");
|
console.log("Printer:stop: failed");
|
||||||
clearTimeout(self.retryStopDelay);
|
clearTimeout(self.retryStopDelay);
|
||||||
self.retryStopDelay = setTimeout(function() { self.stop() },self.retryDelay); // retry after delay
|
self.retryStopDelay = setTimeout(function() { self.stop() },self.retryDelay); // retry after delay
|
||||||
|
|
||||||
|
// after we know the stop has bin received or failed
|
||||||
|
// (and the driver had time to update the printer.state)
|
||||||
|
// we start checking the status again
|
||||||
|
self.startStatusCheckInterval();
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
console.log ("Printer >> f:communicateWithWifibox() >> communicateWithWifibox is false, so not executing this function");
|
console.log ("Printer >> f:communicateWithWifibox() >> communicateWithWifibox is false, so not executing this function");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
this.startStatusCheckInterval = function() {
|
||||||
|
console.log("Printer:startStatusCheckInterval");
|
||||||
|
self.checkStatus();
|
||||||
|
clearTimeout(self.checkStatusDelay);
|
||||||
|
clearTimeout(self.retryCheckStatusDelay);
|
||||||
|
self.checkStatusDelay = setTimeout(function() { self.checkStatus() }, self.checkStatusInterval);
|
||||||
|
}
|
||||||
|
this.stopStatusCheckInterval = function() {
|
||||||
|
console.log("Printer:stopStatusCheckInterval");
|
||||||
|
clearTimeout(self.checkStatusDelay);
|
||||||
|
clearTimeout(self.retryCheckStatusDelay);
|
||||||
|
}
|
||||||
this.checkStatus = function() {
|
this.checkStatus = function() {
|
||||||
console.log("Printer:checkStatus");
|
console.log("Printer:checkStatus");
|
||||||
this.stateOverruled = false;
|
this.stateOverruled = false;
|
||||||
@ -268,12 +300,6 @@ function Printer() {
|
|||||||
|
|
||||||
$(document).trigger(Printer.UPDATE);
|
$(document).trigger(Printer.UPDATE);
|
||||||
|
|
||||||
this.resetStatusCheckInterval();
|
this.stopStatusCheckInterval();
|
||||||
}
|
|
||||||
this.resetStatusCheckInterval = function() {
|
|
||||||
console.log("resetStatusCheckInterval");
|
|
||||||
clearTimeout(self.checkStatusDelay);
|
|
||||||
clearTimeout(self.retryCheckStatusDelay);
|
|
||||||
self.checkStatusDelay = setTimeout(function() { self.checkStatus() }, self.checkStatusInterval);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user