From 19fc40b3a426556a6e2ff7e86aaa51a527873242 Mon Sep 17 00:00:00 2001 From: Jake <jake.read@cba.mit.edu> Date: Mon, 26 Nov 2018 23:11:00 -0500 Subject: [PATCH] more verbose --- modules/hardware/atkseriallink.js | 5 ++++- modules/hardware/atkstepper.js | 2 +- modules/parsing/gcode.js | 7 +++++-- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/modules/hardware/atkseriallink.js b/modules/hardware/atkseriallink.js index 549c12a..4c637fe 100644 --- a/modules/hardware/atkseriallink.js +++ b/modules/hardware/atkseriallink.js @@ -21,6 +21,9 @@ function ATKSerialLink() { routes: new Array() } + // log more + var verbose = false + atkSerialLink.state = State() var state = atkSerialLink.state @@ -104,7 +107,7 @@ function ATKSerialLink() { atkSerialLink.send = function(msg, route) { // it would be responsible to check this over now, but hey - console.log('send', msg, 'on', route.route) + if(verbose) console.log('send', msg, 'on', route.route) // dereference this var pckt = JSON.parse(JSON.stringify(msg)) if (Array.isArray(pckt)) { diff --git a/modules/hardware/atkstepper.js b/modules/hardware/atkstepper.js index 683b972..e17e81c 100644 --- a/modules/hardware/atkstepper.js +++ b/modules/hardware/atkstepper.js @@ -103,7 +103,7 @@ function Stepper() { } } if (altAxis != null) { - console.log('ALTAXIS', altAxis) + if(verbose) console.log('ALTAXIS', altAxis) var axisMove = pullAxis(move, i) axisMove.isWait = true sendToHardware(axisMove) diff --git a/modules/parsing/gcode.js b/modules/parsing/gcode.js index ac118fb..9c67f1a 100644 --- a/modules/parsing/gcode.js +++ b/modules/parsing/gcode.js @@ -13,6 +13,9 @@ function Gcode() { } } + // log more + var verbose = false + // one caveat here is that we can't dynamically add objects to this, // or they don't get getter / settered when we do gcode.state = State() @@ -33,10 +36,10 @@ function Gcode() { function onLineIn(str){ var instruction = parseGcode(str) if (instruction.hasMove) { - console.log('GCODE:', instruction) + if(verbose) console.log('GCODE:', instruction) gcode.outputs.instructionOut.emit(instruction) } else { - console.log('GCODE:', gcode.state.mode) + if(verbose) console.log('GCODE:', gcode.state.mode) gcode.outputs.modeChange.emit(gcode.state.mode) } } -- GitLab