0
0
mirror of https://github.com/Doodle3D/doodle3d-client.git synced 2024-11-25 02:27:56 +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; return;
} }
this.targetTemperature = settings["printer.temperature"]; // slight hack //this.targetTemperature = settings["printer.temperature"]; // slight hack
this.sendPrintPart(this.sendIndex, this.sendLength); this.sendPrintPart(this.sendIndex, this.sendLength);
} }
@ -122,15 +122,18 @@ function Printer() {
console.log("Printer:sendPrintPart sendIndex: " + sendIndex + "/" + this.gcode.length + ", sendLength: " + sendLength); console.log("Printer:sendPrintPart sendIndex: " + sendIndex + "/" + this.gcode.length + ", sendLength: " + sendLength);
var firstOne = (sendIndex == 0)? true : false; 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)) { if (this.gcode.length < (sendIndex + sendLength)) {
console.log(" sending less than max sendLength (and last)"); console.log(" sending less than max sendLength (and last)");
sendLength = this.gcode.length - sendIndex; sendLength = this.gcode.length - sendIndex;
lastOne = true; //lastOne = true;
completed = true;
} }
var gcodePart = this.gcode.slice(sendIndex, sendIndex+sendLength); 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; var self = this;
if (communicateWithWifibox) { if (communicateWithWifibox) {
$.ajax({ $.ajax({
@ -143,11 +146,12 @@ function Printer() {
console.log("Printer:sendPrintPart response: ",data); console.log("Printer:sendPrintPart response: ",data);
if(data.status == "success") { if(data.status == "success") {
if (lastOne) { if (completed) {
console.log("Printer:sendPrintPart:gcode sending completed"); console.log("Printer:sendPrintPart:gcode sending completed");
this.gcode = []; this.gcode = [];
self.targetTemperature = settings["printer.temperature"]; // slight hack //self.targetTemperature = settings["printer.temperature"]; // slight hack
} else { } else {
console.log("sending next part");
self.sendPrintPart(sendIndex + sendLength, sendLength); self.sendPrintPart(sendIndex + sendLength, sendLength);
} }
} }
@ -155,7 +159,10 @@ function Printer() {
}).fail(function() { }).fail(function() {
console.log("Printer:sendPrintPart: failed"); console.log("Printer:sendPrintPart: failed");
clearTimeout(self.retrySendPrintPartDelay); 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 { } 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");
@ -173,8 +180,6 @@ 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);
setTimeout(function() { console.log("send: ",gcodeEnd); self.print(gcodeEnd) },self.sendStopGCodeDelay);
} }
}).fail(function() { }).fail(function() {
console.log("Printer:stop: failed"); 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). //TODO 2013-09-18 allow displaying temperatures HIGHER than the targTemp (it's now being capped at targTemp).
function Thermometer() { function Thermometer() {
this.currentTemperature = 0; // default val this.currentTemperature = 0; // default val
this.targetTemperature = 180; // default val this.targetTemperature = 0; // default val
this.thermoOverlayImg = new Image(); this.thermoOverlayImg = new Image();
this.thermoOverlayImgSrc = "img/thermometer_fg_overlay.png"; // ../img/thermometer_fg_overlay.png this.thermoOverlayImgSrc = "img/thermometer_fg_overlay.png"; // ../img/thermometer_fg_overlay.png