diff --git a/js/buttonbehaviors.js b/js/buttonbehaviors.js index 23306ed..16fcfb8 100644 --- a/js/buttonbehaviors.js +++ b/js/buttonbehaviors.js @@ -189,6 +189,7 @@ function initButtonBehavior() { } function stopPrint() { console.log("f:stopPrint() >> sendPrintCommands = " + sendPrintCommands); + if (!confirm("Weet je zeker dat je de huidige print wilt stoppen?")) return; if (sendPrintCommands) printer.stop(); setState(Printer.STOPPING_STATE,printer.hasControl); } @@ -229,6 +230,7 @@ function print(e) { console.log("f:print >> not enough points!"); } + alert("Je tekening zal nu geprint worden."); // $.post("/doodle3d.of", { data:output }, function(data) { // btnPrint.disabled = false; @@ -295,17 +297,17 @@ function previewTwistRight(redrawLess) { function update() { setState(printer.state,printer.hasControl); - + thermometer.update(printer.temperature, printer.targetTemperature); //TODO: update progress } -function setState(newState,newHasControl) { //TODO add hasControl +function setState(newState,newHasControl) { //TODO add hasControl if(newState == state && newHasControl == hasControl) return; - + console.log("setState: ",state," > ",newState," ( ",newHasControl,")"); setDebugText("State: "+newState); - + // print button var printEnabled = (newState == Printer.IDLE_STATE && newHasControl); if(printEnabled) { @@ -316,7 +318,7 @@ function setState(newState,newHasControl) { //TODO add hasControl btnPrint.addClass("disabled"); // disable print button btnPrint.unbind('touchstart mousedown'); } - + // stop button var stopEnabled = ((newState == Printer.PRINTING_STATE || newState == Printer.BUFFERING_STATE) && newHasControl); if(stopEnabled) { @@ -327,7 +329,7 @@ function setState(newState,newHasControl) { //TODO add hasControl btnStop.addClass("disabled"); btnStop.unbind('touchstart mousedown'); } - + // thermometer switch(newState) { case Printer.UNKNOWN_STATE: @@ -338,18 +340,18 @@ function setState(newState,newHasControl) { //TODO add hasControl thermometer.show(); break; } - + // progress indicator switch(newState) { - case Printer.PRINTING_STATE: + case Printer.PRINTING_STATE: displayProgress.show(); // TODO: Show progress break; default: displayProgress.hide(); // TODO: hide progress break; } - + prevState = state; state = newState; hasControl = newHasControl; -} \ No newline at end of file +} diff --git a/js/gcodeGenerating.js b/js/gcodeGenerating.js index 68cc3dc..3b4db6b 100644 --- a/js/gcodeGenerating.js +++ b/js/gcodeGenerating.js @@ -10,7 +10,7 @@ gcodeStart.push("G92 E0"); // zero the extruded length gcodeStart.push("G1 F200 E10"); // extrude 10mm of feed stock gcodeStart.push("G92 E0"); // zero the extruded length again //gcodeStart.push("G92 X-100 Y-100 E0"); // zero the extruded length again and make center the start position -gcodeStart.push("G1 F9000"); +gcodeStart.push("G1 F9000"); gcodeStart.push("G90"); // absolute positioning gcodeStart.push("M117 Printing Doodle... "); // display message (20 characters to clear whole screen) @@ -101,9 +101,9 @@ function generate_gcode(callback) { console.log(""); //*/ - // max amount of real world layers + // max amount of real world layers var layers = maxObjectHeight / layerHeight; //maxObjectHeight instead of objectHeight - + // translate numLayers in preview to objectHeight in real world //objectHeight = Math.ceil(numLayers / 5); // in settings objectHeight = 20, in previewRendering_v01.js numLayers is 100, hence the / 5 //objectHeight = numLayers; // in settings objectHeight = 20, in previewRendering_v01.js numLayers is 100, hence the / 5 @@ -113,7 +113,7 @@ function generate_gcode(callback) { var rStepGCode = rStep * maxNumLayers/layers; ///maxNumLayers*maxObjectHeight; // correct direction rStepGCode = -rStepGCode; - + // todo hier een array van PATHS maken wat de losse paths zijn // copy array without reference -> http://stackoverflow.com/questions/9885821/copying-of-an-array-of-objects-to-another-array-without-object-reference-in-java @@ -125,10 +125,11 @@ function generate_gcode(callback) { // return; console.log("printer temperature: ",temperature); - gcode.push("M109 S" + temperature); // set target temperature and wait for the extruder to reach it + gcode.push("M104 S" + temperature); // set target temperature and do not wait for the extruder to reach it + //gcode.push("M109 S" + temperature); // set target temperature and wait for the extruder to reach it // add gcode begin commands gcode = gcode.concat(startGcode); - + //gcode.push("M109 S" + temperature); // set target temperature and wait for the extruder to reach it var layers = maxObjectHeight / layerHeight; //maxObjectHeight instead of objectHeight @@ -204,7 +205,7 @@ function generate_gcode(callback) { } } // console.log("f:generategcode() >> paths.length: " + paths.length); - + // loop over the subpaths (the separately drawn lines) for (var j = 0; j < paths.length; j++) { // TODO paths > subpaths // this line is probably for drawing efficiency, alternating going from 0->end and end->0 (i.e. to and fro) @@ -234,7 +235,7 @@ function generate_gcode(callback) { // console.log("enableTraveling && isTraveling >> doRetract: " + doRetract + ", retractionspeed: " + retractionspeed); if (doRetract) gcode.push("G0 E" + (extruder - retractionamount).toFixed(3) + " F" + (retractionspeed * 60).toFixed(3)); //retract gcode.push("G0 X" + to.x.toFixed(3) + " Y" + to.y.toFixed(3) + " Z" + z.toFixed(3) + " F" + (travelSpeed * 60).toFixed(3)); - if (doRetract) gcode.push("G0 E" + extruder.toFixed(3) + " F" + (retractionspeed * 60).toFixed(3)); // return to normal + if (doRetract) gcode.push("G0 E" + extruder.toFixed(3) + " F" + (retractionspeed * 60).toFixed(3)); // return to normal } else { // console.log(" else"); extruder += prev.distance(to) * wallThickness * layerHeight / filamentThickness; @@ -343,4 +344,4 @@ Point.prototype = { toString: function() { console.log("x:" + this.x + ", y:" + this.y); } -} \ No newline at end of file +}