mirror of
https://github.com/Doodle3D/doodle3d-client.git
synced 2024-11-22 09:17:56 +01:00
Merge branch 'feature/printerdriver' of https://github.com/Doodle3D/doodle3d-client into feature/printerdriver
# By peteruithoven # Via peteruithoven * 'feature/printerdriver' of https://github.com/Doodle3D/doodle3d-client: Fixing double printer.print call Starting print right away, remove some target temp display hacks
This commit is contained in:
commit
d61b9cb0d8
@ -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");
|
||||
|
@ -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
|
||||
|
@ -309,6 +309,7 @@ function setState(newState) { //TODO add hasControl
|
||||
switch(newState) {
|
||||
case Printer.IDLE_STATE:
|
||||
btnPrint.removeClass("disabled"); // enable print button
|
||||
btnPrint.unbind('touchstart mousedown');
|
||||
btnPrint.bind('touchstart mousedown',print);
|
||||
break;
|
||||
default:
|
||||
|
Loading…
Reference in New Issue
Block a user