diff --git a/docs/SUMMARY.md b/docs/SUMMARY.md index aeefb6b3..9792ecba 100644 --- a/docs/SUMMARY.md +++ b/docs/SUMMARY.md @@ -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) diff --git a/docs/reference/motors.md b/docs/reference/motors.md index 9883aaa3..7d9a5d66 100644 --- a/docs/reference/motors.md +++ b/docs/reference/motors.md @@ -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() diff --git a/docs/reference/motors/motor/set-reversed.md b/docs/reference/motors/motor/set-inverted.md similarity index 91% rename from docs/reference/motors/motor/set-reversed.md rename to docs/reference/motors/motor/set-inverted.md index 1ca799f1..de77c280 100644 --- a/docs/reference/motors/motor/set-reversed.md +++ b/docs/reference/motors/motor/set-inverted.md @@ -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() diff --git a/libs/core/output.ts b/libs/core/output.ts index 54e00659..6f4563b2 100644 --- a/libs/core/output.ts +++ b/libs/core/output.ts @@ -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) } diff --git a/tests/motors.ts b/tests/motors.ts index 22301027..df87a956 100644 --- a/tests/motors.ts +++ b/tests/motors.ts @@ -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)