From 0b49256fd5fe0e5309684765e7a7d193c615c78f Mon Sep 17 00:00:00 2001 From: peteruithoven Date: Wed, 18 Sep 2013 16:59:48 +0200 Subject: [PATCH] objectHeight and twist fix and temp display fix --- js/Printer.js | 3 +++ js/gcodeGenerating_v01.js | 22 +++++++++++++++------- 2 files changed, 18 insertions(+), 7 deletions(-) diff --git a/js/Printer.js b/js/Printer.js index 8a089d1..6368615 100644 --- a/js/Printer.js +++ b/js/Printer.js @@ -106,6 +106,8 @@ function Printer() { return; } + this.targetTemperature = settings["printer.temperature"]; // slight hack + this.sendPrintPart(this.sendIndex, this.sendLength); } this.byteSize = function(s){ @@ -139,6 +141,7 @@ function Printer() { if (lastOne) { console.log("Printer:sendPrintPart:gcode sending completed"); this.gcode = []; + self.targetTemperature = settings["printer.temperature"]; // slight hack } else { self.sendPrintPart(sendIndex + sendLength, sendLength); } diff --git a/js/gcodeGenerating_v01.js b/js/gcodeGenerating_v01.js index 7a4908f..9fe21c5 100755 --- a/js/gcodeGenerating_v01.js +++ b/js/gcodeGenerating_v01.js @@ -90,9 +90,19 @@ function generate_gcode(callback) { console.log(""); //*/ - 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 + // 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 + objectHeight = Math.round(numLayers/maxNumLayers*maxObjectHeight); + // translate preview rotation (per layer) to real world rotation + 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 @@ -109,8 +119,7 @@ function generate_gcode(callback) { 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 + var extruder = 0.0; var prev = new Point(); prev.set(0, 0); @@ -147,7 +156,8 @@ function generate_gcode(callback) { // sort-of in de buurt van (360/2.5) // // -> aight.. er zijn 750 lines vs 1000 in de d3d app. 135 = .75 * 180... dit kan je nog rechttrekken als je NET wat slimmer nadenkt :) // update: NEE, het is niet .75 * 180 want 135 was niet de beste value. //TODO dus. - pointsRotate(p, rStep * progress * 139); + //pointsRotate(p, rStep * progress * 139); + pointsRotate(p, rStepGCode * layer); if (layer == 0) { //gcode.push("M107"); //fan off @@ -224,8 +234,6 @@ function generate_gcode(callback) { console.log("f:generategcode() >> (layer/layers) > (objectHeight/maxObjectHeight) is true -> breaking at layer " + (layer + 1)); break; } - - } // add gcode end commands