mirror of
https://github.com/Doodle3D/doodle3d-client.git
synced 2024-11-25 02:27:56 +01:00
Slight delay for gcode generation so that display is updated first. Hide stop untill gcode is send completely.
This commit is contained in:
parent
e29dd1576c
commit
51e4394491
@ -151,6 +151,7 @@ function Printer() {
|
|||||||
if (completed) {
|
if (completed) {
|
||||||
console.log("Printer:sendPrintPart:gcode sending completed");
|
console.log("Printer:sendPrintPart:gcode sending completed");
|
||||||
this.gcode = [];
|
this.gcode = [];
|
||||||
|
btnStop.css("display","block");
|
||||||
//self.targetTemperature = settings["printer.temperature"]; // slight hack
|
//self.targetTemperature = settings["printer.temperature"]; // slight hack
|
||||||
} else {
|
} else {
|
||||||
// only if the state hasn't bin changed (by for example pressing stop) we send more gcode
|
// only if the state hasn't bin changed (by for example pressing stop) we send more gcode
|
||||||
|
@ -18,6 +18,9 @@ var state;
|
|||||||
var prevState;
|
var prevState;
|
||||||
var hasControl;
|
var hasControl;
|
||||||
|
|
||||||
|
var gcodeGenerateDelayer;
|
||||||
|
var gcodeGenerateDelay = 50;
|
||||||
|
|
||||||
function initButtonBehavior() {
|
function initButtonBehavior() {
|
||||||
console.log("f:initButtonBehavior");
|
console.log("f:initButtonBehavior");
|
||||||
|
|
||||||
@ -207,35 +210,41 @@ function nextDoodle(e) {
|
|||||||
function print(e) {
|
function print(e) {
|
||||||
console.log("f:print() >> sendPrintCommands = " + sendPrintCommands);
|
console.log("f:print() >> sendPrintCommands = " + sendPrintCommands);
|
||||||
|
|
||||||
$(".btnPrint").css("display","none");
|
//$(".btnPrint").css("display","none");
|
||||||
|
|
||||||
|
|
||||||
$("#textdump").text("");
|
|
||||||
if (_points.length > 2) {
|
if (_points.length > 2) {
|
||||||
|
|
||||||
//setState(Printer.BUFFERING_STATE,printer.hasControl);
|
//setState(Printer.BUFFERING_STATE,printer.hasControl);
|
||||||
printer.overruleState(Printer.BUFFERING_STATE);
|
printer.overruleState(Printer.BUFFERING_STATE);
|
||||||
var gcode = generate_gcode();
|
|
||||||
//startPrint(gencode);
|
|
||||||
|
|
||||||
if (sendPrintCommands) {
|
btnStop.css("display","none");
|
||||||
printer.print(gcode);
|
|
||||||
} else {
|
|
||||||
console.log("sendPrintCommands is false: not sending print command to 3dprinter");
|
|
||||||
}
|
|
||||||
|
|
||||||
//if (debugMode) {
|
// we put the gcode generation in a little delay
|
||||||
//console.log("f:print() >> debugMode is true, dumping gcode to textarea #textdump");
|
// so that for example the print button is disabled right away
|
||||||
$("#textdump").text(gcode.join("\n"));
|
clearTimeout(gcodeGenerateDelayer);
|
||||||
//}
|
gcodeGenerateDelayer = setTimeout(function() {
|
||||||
|
var gcode = generate_gcode();
|
||||||
|
//startPrint(gencode);
|
||||||
|
|
||||||
// copyToClipboard(gencode);
|
if (sendPrintCommands) {
|
||||||
//*/
|
printer.print(gcode);
|
||||||
|
} else {
|
||||||
|
console.log("sendPrintCommands is false: not sending print command to 3dprinter");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (debugMode) {
|
||||||
|
$("#textdump").text("");
|
||||||
|
$("#textdump").text(gcode.join("\n"));
|
||||||
|
}
|
||||||
|
|
||||||
|
}, gcodeGenerateDelay);
|
||||||
} else {
|
} else {
|
||||||
console.log("f:print >> not enough points!");
|
console.log("f:print >> not enough points!");
|
||||||
}
|
}
|
||||||
|
|
||||||
alert("Je tekening zal nu geprint worden");
|
//alert("Je tekening zal nu geprint worden");
|
||||||
$(".btnPrint").css("display","block");
|
//$(".btnPrint").css("display","block");
|
||||||
|
|
||||||
|
|
||||||
// $.post("/doodle3d.of", { data:output }, function(data) {
|
// $.post("/doodle3d.of", { data:output }, function(data) {
|
||||||
|
Loading…
Reference in New Issue
Block a user