0
0
mirror of https://github.com/Doodle3D/doodle3d-client.git synced 2024-12-26 14:43:49 +01:00

Starting print right away, remove some target temp display hacks

This commit is contained in:
peteruithoven 2013-10-11 15:33:37 +02:00
parent 58b3a12c6b
commit 1c930efdf5
2 changed files with 15 additions and 10 deletions

View File

@ -111,7 +111,7 @@ function Printer() {
return;
}
this.targetTemperature = settings["printer.temperature"]; // slight hack
//this.targetTemperature = settings["printer.temperature"]; // slight hack
this.sendPrintPart(this.sendIndex, this.sendLength);
}
@ -122,15 +122,18 @@ function Printer() {
console.log("Printer:sendPrintPart sendIndex: " + sendIndex + "/" + this.gcode.length + ", sendLength: " + sendLength);
var firstOne = (sendIndex == 0)? true : false;
var lastOne = false;
var start = true; // start printing right away
var completed = false;
if (this.gcode.length < (sendIndex + sendLength)) {
console.log(" sending less than max sendLength (and last)");
sendLength = this.gcode.length - sendIndex;
lastOne = true;
//lastOne = true;
completed = true;
}
var gcodePart = this.gcode.slice(sendIndex, sendIndex+sendLength);
var postData = { gcode: gcodePart.join("\n"), first: firstOne, last: lastOne};
var postData = { gcode: gcodePart.join("\n"), first: firstOne, start: start};
var self = this;
if (communicateWithWifibox) {
$.ajax({
@ -143,11 +146,12 @@ function Printer() {
console.log("Printer:sendPrintPart response: ",data);
if(data.status == "success") {
if (lastOne) {
if (completed) {
console.log("Printer:sendPrintPart:gcode sending completed");
this.gcode = [];
self.targetTemperature = settings["printer.temperature"]; // slight hack
//self.targetTemperature = settings["printer.temperature"]; // slight hack
} else {
console.log("sending next part");
self.sendPrintPart(sendIndex + sendLength, sendLength);
}
}
@ -155,7 +159,10 @@ function Printer() {
}).fail(function() {
console.log("Printer:sendPrintPart: failed");
clearTimeout(self.retrySendPrintPartDelay);
self.retrySendPrintPartDelay = setTimeout(function() { self.sendPrintPart(sendIndex, sendLength) },self.retryDelay); // retry after delay
self.retrySendPrintPartDelay = setTimeout(function() {
console.log("request printer:sendPrintPart failed retry");
self.sendPrintPart(sendIndex, sendLength)
},self.retryDelay); // retry after delay
});
} else {
console.log ("Printer >> f:sendPrintPart() >> communicateWithWifibox is false, so not executing this function");
@ -173,8 +180,6 @@ function Printer() {
timeout: this.timeoutTime,
success: function(data){
console.log("Printer:stop response: ", data);
setTimeout(function() { console.log("send: ",gcodeEnd); self.print(gcodeEnd) },self.sendStopGCodeDelay);
}
}).fail(function() {
console.log("Printer:stop: failed");

View File

@ -5,7 +5,7 @@ var $displayThermometer = $("#thermometerContainer");
//TODO 2013-09-18 allow displaying temperatures HIGHER than the targTemp (it's now being capped at targTemp).
function Thermometer() {
this.currentTemperature = 0; // default val
this.targetTemperature = 180; // default val
this.targetTemperature = 0; // default val
this.thermoOverlayImg = new Image();
this.thermoOverlayImgSrc = "img/thermometer_fg_overlay.png"; // ../img/thermometer_fg_overlay.png