0
0
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:
peteruithoven 2013-10-14 18:51:37 +02:00
parent e29dd1576c
commit 51e4394491
2 changed files with 29 additions and 19 deletions

View File

@ -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

View File

@ -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,13 +210,20 @@ 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);
btnStop.css("display","none");
// we put the gcode generation in a little delay
// so that for example the print button is disabled right away
clearTimeout(gcodeGenerateDelayer);
gcodeGenerateDelayer = setTimeout(function() {
var gcode = generate_gcode(); var gcode = generate_gcode();
//startPrint(gencode); //startPrint(gencode);
@ -223,19 +233,18 @@ function print(e) {
console.log("sendPrintCommands is false: not sending print command to 3dprinter"); console.log("sendPrintCommands is false: not sending print command to 3dprinter");
} }
//if (debugMode) { if (debugMode) {
//console.log("f:print() >> debugMode is true, dumping gcode to textarea #textdump"); $("#textdump").text("");
$("#textdump").text(gcode.join("\n")); $("#textdump").text(gcode.join("\n"));
//} }
// copyToClipboard(gencode); }, 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) {