Skip to content
Snippets Groups Projects
Commit 67c86147 authored by Jake Read's avatar Jake Read
Browse files

verbose flag for less logging on stepper and planner

parent c96e76cb
No related branches found
No related tags found
No related merge requests found
......@@ -15,6 +15,9 @@ function Stepper() {
var stepper = Hardware()
// log more
var verbose = false
stepper.description.name = 'ATKStepper'
stepper.description.alt = 'software representation of stepper motor'
......@@ -184,7 +187,7 @@ function Stepper() {
console.log(dMove)
}
console.log('------------------- DMOVE', state.axis, dMove.steps)
if(verbose) console.log('------------------- DMOVE', state.axis, dMove.steps)
var packet = new Array()
// step blocks are #131
......@@ -195,7 +198,7 @@ function Stepper() {
packet.push(131)
}
packet = packet.concat(PCKT.pack32(dMove.steps))
console.log('------------------- PMOVE', packet)
if(verbose) console.log('------------------- PMOVE', packet)
packet = packet.concat(PCKT.pack32(dMove.entry))
packet = packet.concat(PCKT.pack32(dMove.accel))
packet = packet.concat(PCKT.pack32(dMove.accelLen))
......@@ -227,7 +230,7 @@ function Stepper() {
axis: state.axis,
increment: unitsMade
}
console.log("STEPPER ACK MOVE", state.axis, stepsMade)
if(verbose) console.log("STEPPER ACK MOVE", state.axis, stepsMade)
stepper.outputs.ack.emit(ack)
stepper.outputs.position.emit(state.position)
}
......@@ -240,7 +243,7 @@ function Stepper() {
axis: state.axis,
increment: 0
}
console.log("STEPPER ACK WAIT", state.axis)
if(verbose) console.log("STEPPER ACK WAIT", state.axis)
stepper.outputs.ack.emit(ack)
}
......
......@@ -23,6 +23,9 @@ function Planner() {
}
}
// log more
var verbose = false
planner.state = State()
var state = planner.state // reference pass attempt?
......@@ -92,9 +95,9 @@ function Planner() {
var newNetState = state.netState.slice(0)
newNetState[match] -= 1
state.netState = newNetState
console.log('NEW NET STATE', newNetState)
if(verbose) console.log('NEW NET STATE', newNetState)
} else {
console.log('ERR: missed axis on ack from stepper')
console.log('ERR in PLANNER: missed axis on ack from stepper')
}
netStateRefresh()
}
......@@ -181,7 +184,7 @@ function Planner() {
state.netState = state.netState
// dereference
var move = JSON.parse(JSON.stringify(mq.shift()))
console.log("MOVE FROM PLANNER", move)
if(verbose) console.log("MOVE FROM PLANNER", move)
planner.outputs.moves.emit(move)
planner.outputs.moveComplete.emit(1)
} else {
......@@ -284,7 +287,7 @@ function Planner() {
// to maximum permissible by JD
// because we know the final exit speed, we'll run the pass from
// back to start
console.log('REV PASS')
if(verbose) console.log('REV PASS')
for (var i = mq.length - 1; i > 0; i--) {
// the moves we're junctioning around / transitioning between
var mqi = mq[i - 1]
......@@ -313,7 +316,7 @@ function Planner() {
// we've swept backwards to make sure we can decelerate into the end point,
// now we need to make sure we can accelerate up to these cornering velocities
// and if not, set the exit speeds appropriately, so that we can get there
console.log('FWD PASS')
if(verbose) console.log('FWD PASS')
for (var i = 0; i < mq.length - 1; i++) {
var mqi = mq[i]
var mqn = mq[i + 1]
......@@ -333,7 +336,7 @@ function Planner() {
// this becomes very useful for turning moves over to stepper motors
// and will give us a time estimate for each move as well,
// we need / want that so that we can set a network buffer length
console.log('TRAPEZOIDS')
if(verbose) console.log('TRAPEZOIDS')
for (var i = 0; i < mq.length; i++) {
calcTrap(mq[i], accel, false)
if (moveTime(mq[i]) < 0.1) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment