fxing leading / in docs

This commit is contained in:
Peli de Halleux 2018-09-21 14:07:11 -07:00
parent 83b64c1e54
commit dfc9ca1db4
3 changed files with 27 additions and 11 deletions

View File

@ -82,12 +82,12 @@
* [reset](/reference/sensors/gyro/reset) * [reset](/reference/sensors/gyro/reset)
* [Ultrasonic](/reference/sensors/ultrasonic) * [Ultrasonic](/reference/sensors/ultrasonic)
* [on event](/reference/sensors/ultrasonic/on-event) * [on event](/reference/sensors/ultrasonic/on-event)
* [distance](reference/sensors/ultrasonic/distance) * [distance](/reference/sensors/ultrasonic/distance)
* [pause until](reference/sensors/ultrasonic/pause-until) * [pause until](/reference/sensors/ultrasonic/pause-until)
* [Infrared](/reference/sensors/infrared) * [Infrared](/reference/sensors/infrared)
* [on event](/reference/sensors/infrared/on-event) * [on event](/reference/sensors/infrared/on-event)
* [distance](reference/sensors/infrared/proximity) * [distance](/reference/sensors/infrared/proximity)
* [pause until](reference/sensors/infrared/pause-until) * [pause until](/reference/sensors/infrared/pause-until)
* [Infrared beacon](/reference/sensors/beacon) * [Infrared beacon](/reference/sensors/beacon)
* [on event](/reference/sensors/beacon/on-event) * [on event](/reference/sensors/beacon/on-event)
* [pause until](/reference/sensors/beacon/pause-until) * [pause until](/reference/sensors/beacon/pause-until)

View File

@ -368,7 +368,8 @@ namespace motors {
} }
private __move(steps: boolean, stepsOrTime: number, speed: number) { private __move(steps: boolean, stepsOrTime: number, speed: number) {
step(this._port, { control.dmesg("motor.__move")
const p = {
useSteps: steps, useSteps: steps,
step1: 0, step1: 0,
step2: stepsOrTime, step2: stepsOrTime,
@ -376,7 +377,10 @@ namespace motors {
speed: this._regulated ? speed : undefined, speed: this._regulated ? speed : undefined,
power: this._regulated ? undefined : speed, power: this._regulated ? undefined : speed,
useBrake: this._brake useBrake: this._brake
}) };
control.dmesg("motor.1")
step(this._port, p)
control.dmesg("motor.__move end")
} }
/** /**
@ -706,24 +710,36 @@ namespace motors {
} }
function step(out: Output, opts: StepOptions) { function step(out: Output, opts: StepOptions) {
control.dmesg('step')
let op = opts.useSteps ? DAL.opOutputStepSpeed : DAL.opOutputTimeSpeed let op = opts.useSteps ? DAL.opOutputStepSpeed : DAL.opOutputTimeSpeed
let speed = opts.speed let speed = opts.speed
if (speed == null) { if (undefined == speed) {
speed = opts.power speed = opts.power
op = opts.useSteps ? DAL.opOutputStepPower : DAL.opOutputTimePower op = opts.useSteps ? DAL.opOutputStepPower : DAL.opOutputTimePower
if (speed == null) if (undefined == speed)
return return
} }
speed = Math.clamp(-100, 100, speed) speed = Math.clamp(-100, 100, speed)
control.dmesg('speed: ' + speed)
let b = mkCmd(out, op, 15) let b = mkCmd(out, op, 15)
control.dmesg('STEP 5')
b.setNumber(NumberFormat.Int8LE, 2, speed) b.setNumber(NumberFormat.Int8LE, 2, speed)
// note that b[3] is padding // note that b[3] is padding
control.dmesg('STEP 1')
b.setNumber(NumberFormat.Int32LE, 4 + 4 * 0, opts.step1) b.setNumber(NumberFormat.Int32LE, 4 + 4 * 0, opts.step1)
control.dmesg('STEP 2')
b.setNumber(NumberFormat.Int32LE, 4 + 4 * 1, opts.step2) b.setNumber(NumberFormat.Int32LE, 4 + 4 * 1, opts.step2)
control.dmesg('STEP 3')
b.setNumber(NumberFormat.Int32LE, 4 + 4 * 2, opts.step3) b.setNumber(NumberFormat.Int32LE, 4 + 4 * 2, opts.step3)
b.setNumber(NumberFormat.Int8LE, 4 + 4 * 3, opts.useBrake ? 1 : 0) control.dmesg('STEP 4')
control.dmesg('br ' + opts.useBrake);
const br = !!opts.useBrake ? 1 : 0;
control.dmesg('Step 4.5 ' + br)
b.setNumber(NumberFormat.Int8LE, 4 + 4 * 3, br)
control.dmesg('STEP 5')
writePWM(b) writePWM(b)
control.dmesg('end step')
} }
const types = [0, 0, 0, 0] const types = [0, 0, 0, 0]

View File

@ -9,5 +9,5 @@ sensors.ultrasonic1.pauseUntil(UltrasonicSensorEvent.ObjectDetected);
## See Also ## See Also
[on event](/reference/sensors/ultrasonic/on-event), [on event](/reference/sensors/ultrasonic/on-event),
[distance](reference/sensors/ultrasonic/distance), [distance](/reference/sensors/ultrasonic/distance),
[pause until](reference/sensors/ultrasonic/pause-until) [pause until](/reference/sensors/ultrasonic/pause-until)