mirror of
https://github.com/Doodle3D/doodle3d-client.git
synced 2024-11-22 09:17:56 +01:00
Added timeout & retry to preheat/heatup
This commit is contained in:
parent
c6818eae45
commit
6ea0dd6a84
@ -32,11 +32,24 @@ function Printer() {
|
|||||||
this.preheat = function() {
|
this.preheat = function() {
|
||||||
console.log("Printer:preheat");
|
console.log("Printer:preheat");
|
||||||
var postData = { id: 0 };
|
var postData = { id: 0 };
|
||||||
$.post( this.wifiboxURL + "/printer/heatup", postData , function(e) {
|
var self = this;
|
||||||
console.log("Printer:preheat response: " + e);
|
$.ajax({
|
||||||
|
url: this.wifiboxURL + "/printer/heatup",
|
||||||
if (e.success = true) {
|
type: "POST",
|
||||||
console.log(" success");
|
data: postData,
|
||||||
|
dataType: 'json',
|
||||||
|
timeout: this.timeoutTime,
|
||||||
|
success: function(data){
|
||||||
|
console.log("Printer:preheat response: " + data);
|
||||||
|
},
|
||||||
|
error: function(jqXHR, status, errorThrown){ //the status returned will be "timeout"
|
||||||
|
//console.log("Printer:temperature error. Status: ",status,' errorThrown: ',errorThrown);
|
||||||
|
switch(status) {
|
||||||
|
case 'timeout':
|
||||||
|
console.log("retrieving printer/heatup timeout");
|
||||||
|
self.preheat();
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -83,6 +96,7 @@ function Printer() {
|
|||||||
//console.log("Printer:temperature error. Status: ",status,' errorThrown: ',errorThrown);
|
//console.log("Printer:temperature error. Status: ",status,' errorThrown: ',errorThrown);
|
||||||
switch(status) {
|
switch(status) {
|
||||||
case 'timeout':
|
case 'timeout':
|
||||||
|
console.log("retrieving printer/temperature timeout");
|
||||||
self.checkTemperature();
|
self.checkTemperature();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -119,6 +133,7 @@ function Printer() {
|
|||||||
switch(status) {
|
switch(status) {
|
||||||
case 'timeout':
|
case 'timeout':
|
||||||
self.checkProgress();
|
self.checkProgress();
|
||||||
|
console.log("retrieving printer/progress timeout");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user