From 254c2b118b53023099377fb937bd74e86904af8d Mon Sep 17 00:00:00 2001 From: Wouter R Date: Fri, 31 Jan 2014 22:34:40 +0100 Subject: [PATCH] Quick test to improve adhesion by printing a circle with brim. --- js/Keyboard.js | 26 ++++++++++++++++++++------ js/gcodeGenerating.js | 2 ++ 2 files changed, 22 insertions(+), 6 deletions(-) diff --git a/js/Keyboard.js b/js/Keyboard.js index 825e514..52c7e92 100644 --- a/js/Keyboard.js +++ b/js/Keyboard.js @@ -1,15 +1,16 @@ var keyboardShortcutsEnabled = true; var keyboardEscapeEnterEnabled = false; var wordBuffer = ""; +var charOffset = -1; var wordFuncs = { - "idbeholdl": function() { + "idbeholdl": function() { //a flashlight for when times get dark... alert("Light!"); }, - "idspispopd": function() { + "idspispopd": function() { //I live! drawTextOnCanvas("Im in ur kanvas drawin' ur stuffz."); }, - "dia": function() { + "dia": function() { //draw a diamond with a cross onto the sketch shape for calibration purposes var cx = canvasWidth / 2; var cy = canvasHeight /2; drawCircle(cx, cy, 50, 4); @@ -18,11 +19,22 @@ var wordFuncs = { shapeMoveTo(cx, cy - 20); shapeLineTo(cx, cy + 20); }, - "stats": function() { + "btest": function() { //brim test (in conjunction with) + var cx = canvasWidth / 2; + var cy = canvasHeight /2; + //for (var i = 45; i <= 51; i += 3) { drawCircle(cx, cy, i, 4); } + var base = 75; + drawCircle(cx, cy, base, 6); + drawCircle(cx, cy, base -3, 6); + drawCircle(cx, cy, base + 3, 6); +// drawCircle(cx, cy, base + 9, 6); +// drawCircle(cx, cy, base + 12, 6); + }, + "stats": function() { //show statistics? var text = "Shape statistics:\nNumber of points: " + _points.length; alert(text); }, - "pdump": function() { + "pdump": function() { //dump points array console.log("points array: " + _points); } }; @@ -84,7 +96,9 @@ function initKeyboard() { } function processWords(e) { - wordBuffer += String.fromCharCode(e.which); + //chrome fills e.which with an alphabetical index somehow, so we add a lowercase 'a' + if (charOffset < 0) charOffset = window.chrome ? 96 : 0; + wordBuffer += String.fromCharCode(charOffset + e.which); var match = false; for (var k in wordFuncs) { diff --git a/js/gcodeGenerating.js b/js/gcodeGenerating.js index 93f4cba..659c851 100644 --- a/js/gcodeGenerating.js +++ b/js/gcodeGenerating.js @@ -140,8 +140,10 @@ function generate_gcode() { } } + console.log("num paths: " + j); // loop over the subpaths (the separately drawn lines) for (var j = 0; j < paths.length; j++) { // TODO paths > subpaths + //if (layer > 2 && j > 0) continue; //used as rudimentary brim test in conjunction with the 'btest' keyword (see Keyboard.js) var commands = paths[j]; // loop over the coordinates of the subpath