fxing leading / in docs
This commit is contained in:
parent
83b64c1e54
commit
dfc9ca1db4
@ -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)
|
||||
|
@ -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]
|
||||
|
@ -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)
|
||||
[distance](/reference/sensors/ultrasonic/distance),
|
||||
[pause until](/reference/sensors/ultrasonic/pause-until)
|
Loading…
Reference in New Issue
Block a user