From dfc9ca1db4f3ba8928e4682ba2031fe8b17901d3 Mon Sep 17 00:00:00 2001 From: Peli de Halleux Date: Fri, 21 Sep 2018 14:07:11 -0700 Subject: [PATCH] fxing leading / in docs --- docs/SUMMARY.md | 8 +++--- libs/core/output.ts | 26 +++++++++++++++---- .../docs/reference/sensors/ultrasonic.md | 4 +-- 3 files changed, 27 insertions(+), 11 deletions(-) diff --git a/docs/SUMMARY.md b/docs/SUMMARY.md index 46ed75cb..1ea2449f 100644 --- a/docs/SUMMARY.md +++ b/docs/SUMMARY.md @@ -82,12 +82,12 @@ * [reset](/reference/sensors/gyro/reset) * [Ultrasonic](/reference/sensors/ultrasonic) * [on event](/reference/sensors/ultrasonic/on-event) - * [distance](reference/sensors/ultrasonic/distance) - * [pause until](reference/sensors/ultrasonic/pause-until) + * [distance](/reference/sensors/ultrasonic/distance) + * [pause until](/reference/sensors/ultrasonic/pause-until) * [Infrared](/reference/sensors/infrared) * [on event](/reference/sensors/infrared/on-event) - * [distance](reference/sensors/infrared/proximity) - * [pause until](reference/sensors/infrared/pause-until) + * [distance](/reference/sensors/infrared/proximity) + * [pause until](/reference/sensors/infrared/pause-until) * [Infrared beacon](/reference/sensors/beacon) * [on event](/reference/sensors/beacon/on-event) * [pause until](/reference/sensors/beacon/pause-until) diff --git a/libs/core/output.ts b/libs/core/output.ts index 3cf2b273..e3cd45c2 100644 --- a/libs/core/output.ts +++ b/libs/core/output.ts @@ -368,7 +368,8 @@ namespace motors { } private __move(steps: boolean, stepsOrTime: number, speed: number) { - step(this._port, { + control.dmesg("motor.__move") + const p = { useSteps: steps, step1: 0, step2: stepsOrTime, @@ -376,7 +377,10 @@ namespace motors { speed: this._regulated ? speed : undefined, power: this._regulated ? undefined : speed, 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) { + control.dmesg('step') let op = opts.useSteps ? DAL.opOutputStepSpeed : DAL.opOutputTimeSpeed let speed = opts.speed - if (speed == null) { + if (undefined == speed) { speed = opts.power op = opts.useSteps ? DAL.opOutputStepPower : DAL.opOutputTimePower - if (speed == null) + if (undefined == speed) return } speed = Math.clamp(-100, 100, speed) + control.dmesg('speed: ' + speed) let b = mkCmd(out, op, 15) + control.dmesg('STEP 5') b.setNumber(NumberFormat.Int8LE, 2, speed) // note that b[3] is padding + control.dmesg('STEP 1') b.setNumber(NumberFormat.Int32LE, 4 + 4 * 0, opts.step1) + control.dmesg('STEP 2') 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.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) + control.dmesg('end step') } const types = [0, 0, 0, 0] diff --git a/libs/ultrasonic-sensor/docs/reference/sensors/ultrasonic.md b/libs/ultrasonic-sensor/docs/reference/sensors/ultrasonic.md index 86462fb5..d6274e29 100644 --- a/libs/ultrasonic-sensor/docs/reference/sensors/ultrasonic.md +++ b/libs/ultrasonic-sensor/docs/reference/sensors/ultrasonic.md @@ -9,5 +9,5 @@ sensors.ultrasonic1.pauseUntil(UltrasonicSensorEvent.ObjectDetected); ## See Also [on event](/reference/sensors/ultrasonic/on-event), -[distance](reference/sensors/ultrasonic/distance), -[pause until](reference/sensors/ultrasonic/pause-until) \ No newline at end of file +[distance](/reference/sensors/ultrasonic/distance), +[pause until](/reference/sensors/ultrasonic/pause-until) \ No newline at end of file