mirror of
https://github.com/Doodle3D/doodle3d-client.git
synced 2024-11-22 01:07: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);
|
||||
|
||||
if(autoUpdate) {
|
||||
this.checkStatus();
|
||||
this.startStatusCheckInterval();
|
||||
}
|
||||
}
|
||||
|
||||
@ -162,6 +162,12 @@ function Printer() {
|
||||
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() {
|
||||
@ -171,6 +177,11 @@ function Printer() {
|
||||
console.log("request printer:sendPrintPart failed retry");
|
||||
self.sendPrintPart(sendIndex, sendLength)
|
||||
},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 {
|
||||
console.log ("Printer >> f:sendPrintPart() >> communicateWithWifibox is false, so not executing this function");
|
||||
@ -188,17 +199,38 @@ function Printer() {
|
||||
timeout: this.timeoutTime,
|
||||
success: function(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() {
|
||||
console.log("Printer:stop: failed");
|
||||
clearTimeout(self.retryStopDelay);
|
||||
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 {
|
||||
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() {
|
||||
console.log("Printer:checkStatus");
|
||||
this.stateOverruled = false;
|
||||
@ -268,12 +300,6 @@ function Printer() {
|
||||
|
||||
$(document).trigger(Printer.UPDATE);
|
||||
|
||||
this.resetStatusCheckInterval();
|
||||
}
|
||||
this.resetStatusCheckInterval = function() {
|
||||
console.log("resetStatusCheckInterval");
|
||||
clearTimeout(self.checkStatusDelay);
|
||||
clearTimeout(self.retryCheckStatusDelay);
|
||||
self.checkStatusDelay = setTimeout(function() { self.checkStatus() }, self.checkStatusInterval);
|
||||
this.stopStatusCheckInterval();
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user