reversed => Inverted (#308)

* renaming "setReversed" to "setInverted" to match LabView

* fixing samples

* typo
This commit is contained in:
Peli de Halleux 2018-02-06 23:18:36 -08:00 committed by GitHub
parent e94ac6f6f1
commit fd9d118fa4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 10 additions and 10 deletions

View File

@ -59,7 +59,7 @@
* [stop](/reference/motors/motor/stop)
* [reset](/reference/motors/motor/reset)
* [set brake](/reference/motors/motor/set-brake)
* [set reversed](/reference/motors/motor/set-reversed)
* [set inverted](/reference/motors/motor/set-inverted)
* [set regulated](/reference/motors/motor/set-regulated)
* [tank](/reference/motors/synced/tank)
* [steer](/reference/motors/synced/steer)

View File

@ -8,7 +8,7 @@ motors.largeAB.tank(50, 50)
motors.largeAB.steer(0, 50)
motors.largeA.pauseUntilReady()
motors.largeA.setBrake(false)
motors.largeA.setReversed(false)
motors.largeA.setInverted(true)
motors.largeA.setRegulated(false)
motors.largeA.stop()
motors.largeA.reset()

View File

@ -3,7 +3,7 @@
Change the direction of rotation for a motor.
```sig
motors.largeA.setReversed(true)
motors.largeA.setInverted(true)
```
You use a positive value (some number greater than `0`) to drive you motor in the default direction. If you're using a motor in a way that makes more sense for your program to use a negative speed setting for that direction, you can reverse the speed range.
@ -21,7 +21,7 @@ motors.largeA.setSpeed(30)
loops.pause(2000)
motors.largeA.stop()
loops.pause(2000)
motors.largeA.setReversed(true)
motors.largeA.setInverted(true)
motors.largeA.setSpeed(-30)
loops.pause(2000)
motors.largeA.stop()

View File

@ -172,16 +172,16 @@ namespace motors {
}
/**
* Reverses the motor polarity
* Inverts the motor polarity
*/
//% blockId=motorSetReversed block="set %motor|reversed %reversed=toggleOnOff"
//% blockId=motorSetInverted block="set %motor|inverted %reversed=toggleOnOff"
//% weight=59 blockGap=8
//% group="Move"
//% help=motors/motor/set-reversed
setReversed(reversed: boolean) {
//% help=motors/motor/set-inverted
setInverted(inverted: boolean) {
this.init();
const b = mkCmd(this._port, DAL.opOutputPolarity, 1)
b.setNumber(NumberFormat.Int8LE, 2, reversed ? 0 : 1);
b.setNumber(NumberFormat.Int8LE, 2, inverted ? 0 : 1);
writePWM(b)
}

View File

@ -5,7 +5,7 @@ tests.test("lgB set speed 10", () => {
tests.assertClose("speedB", 10, motors.largeB.speed(), 2)
});
tests.test("lgB set speed 25 (reversed)", () => {
motors.largeB.setReversed(true)
motors.largeB.setInverted(true)
motors.largeB.setSpeed(25)
loops.pause(500)
tests.assertClose("speedB", -25, motors.largeB.speed(), 2)