Skip to content

Commit

Permalink
improve documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
Debenben committed Aug 14, 2022
1 parent 815231a commit cc5f74a
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 16 deletions.
10 changes: 5 additions & 5 deletions src/devices/absolutemotor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ export class AbsoluteMotor extends TachoMotor {
* @method AbsoluteMotor#gotoAngle
* @param {number} angle Absolute position the motor should go to (degrees from 0).
* @param {number} [speed=100] For forward, a value between 1 - 100 should be set. For reverse, a value between -1 to -100.
* @param {boolean} interrupt If true, previous commands are discarded.
* @returns {Promise<CommandFeedback>} Resolved upon completion of command (ie. once the motor is finished).
* @param {boolean} [interrupt=false] If true, previous commands are discarded.
* @returns {Promise<CommandFeedback>} Resolved upon completion of command (i.e. once the motor is finished).
*/
public gotoAngle (angle: [number, number] | number, speed: number = 100, interrupt: boolean = false) {
if (!this.isVirtualPort && angle instanceof Array) {
Expand Down Expand Up @@ -72,7 +72,7 @@ export class AbsoluteMotor extends TachoMotor {
* Real zero is marked on Technic angular motors (SPIKE Prime). It is also available on Technic linear motors (Control+) but is unmarked.
* @method AbsoluteMotor#gotoRealZero
* @param {number} [speed=100] Speed between 1 - 100. Note that this will always take the shortest path to zero.
* @returns {Promise<CommandFeedback>} Resolved upon completion of command (ie. once the motor is finished).
* @returns {Promise<CommandFeedback>} Resolved upon completion of command (i.e. once the motor is finished).
*/
public gotoRealZero (speed: number = 100) {
return new Promise<Consts.CommandFeedback>((resolve) => {
Expand Down Expand Up @@ -101,8 +101,8 @@ export class AbsoluteMotor extends TachoMotor {
/**
* Reset zero to current position
* @method AbsoluteMotor#resetZero
* @param {boolean} interrupt If true, previous commands are discarded.
* @returns {Promise<CommandFeedback>} Resolved upon completion of command (ie. once the motor is finished).
* @param {boolean} [interrupt=false] If true, previous commands are discarded.
* @returns {Promise<CommandFeedback>} Resolved upon completion of command (i.e. once the motor is finished).
*/
public resetZero (interrupt: boolean = false) {
const data = Buffer.from([0x51, 0x02, 0x00, 0x00, 0x00, 0x00]);
Expand Down
2 changes: 1 addition & 1 deletion src/devices/basicmotor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export class BasicMotor extends Device {
* Set the motor power.
* @method BasicMotor#setPower
* @param {number} power For forward, a value between 1 - 100 should be set. For reverse, a value between -1 to -100. Stop is 0.
* @param {boolean} interrupt If true, previous commands are discarded.
* @param {boolean} [interrupt=false] If true, previous commands are discarded.
* @returns {Promise<CommandFeedback>} Resolved upon completion of command.
*/
public setPower (power: number, interrupt: boolean = false) {
Expand Down
2 changes: 1 addition & 1 deletion src/devices/light.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export class Light extends Device {
* @method Light#setBrightness
* @param {number} brightness Brightness value between 0-100 (0 is off)
* @param {number} brightness Brightness value between 0-100 (0 is off)
* @param {boolean} interrupt If true, previous commands are discarded.
* @param {boolean} [interrupt=false] If true, previous commands are discarded.
* @returns {Promise<CommandFeedback>} Resolved upon completion of command.
*/
public setBrightness (brightness: number, interrupt: boolean = false) {
Expand Down
2 changes: 1 addition & 1 deletion src/devices/piezobuzzer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export class PiezoBuzzer extends Device {
* @method PiezoBuzzer#playTone
* @param {number} frequency
* @param {number} time How long the tone should play for (in milliseconds).
* @returns {Promise<CommandFeedback>} Resolved upon completion of command (ie. once the tone has finished playing).
* @returns {Promise<CommandFeedback>} Resolved upon completion of command (i.e. once the tone has finished playing).
*/
public playTone (frequency: number, time: number) {
return new Promise<Consts.CommandFeedback>((resolve) => {
Expand Down
16 changes: 8 additions & 8 deletions src/devices/tachomotor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,8 @@ export class TachoMotor extends BasicMotor {
* @method TachoMotor#setAccelerationTime
* @param {number} time How long acceleration should last (in milliseconds).
* @param {number} profile 0 by default
* @param {boolean} interrupt If true, previous commands are discarded.
* @returns {Promise<CommandFeedback>} Resolved upon completion of command (ie. once the motor is finished).
* @param {boolean} [interrupt=false] If true, previous commands are discarded.
* @returns {Promise<CommandFeedback>} Resolved upon completion of command (i.e. once the motor is finished).
*/
public setAccelerationTime (time: number, profile: number = 0x00, interrupt: boolean = false) {
const message = Buffer.from([0x05, 0x00, 0x00, profile]);
Expand All @@ -82,8 +82,8 @@ export class TachoMotor extends BasicMotor {
* @method TachoMotor#setDecelerationTime
* @param {number} time How long deceleration should last (in milliseconds).
* @param {number} profile 0 by default
* @param {boolean} interrupt If true, previous commands are discarded.
* @returns {Promise<CommandFeedback>} Resolved upon completion of command (ie. once the motor is finished).
* @param {boolean} [interrupt=false] If true, previous commands are discarded.
* @returns {Promise<CommandFeedback>} Resolved upon completion of command (i.e. once the motor is finished).
*/
public setDecelerationTime (time: number, profile: number = 0x00, interrupt: boolean = true) {
const message = Buffer.from([0x06, 0x00, 0x00, profile]);
Expand All @@ -97,8 +97,8 @@ export class TachoMotor extends BasicMotor {
* @method TachoMotor#setSpeed
* @param {number} speed For forward, a value between 1 - 100 should be set. For reverse, a value between -1 to -100. Stop is 0.
* @param {number} time How long the motor should run for (in milliseconds).
* @param {boolean} interrupt If true, previous commands are discarded.
* @returns {Promise<CommandFeedback>} Resolved upon completion of command (ie. once the motor is finished).
* @param {boolean} [interrupt=false] If true, previous commands are discarded.
* @returns {Promise<CommandFeedback>} Resolved upon completion of command (i.e. once the motor is finished).
*/
public setSpeed (speed: [number, number] | number, time: number | undefined, interrupt: boolean = false) {
if (!this.isVirtualPort && speed instanceof Array) {
Expand Down Expand Up @@ -133,8 +133,8 @@ export class TachoMotor extends BasicMotor {
* @method TachoMotor#rotateByDegrees
* @param {number} degrees How much the motor should be rotated (in degrees).
* @param {number} [speed=100] For forward, a value between 1 - 100 should be set. For reverse, a value between -1 to -100.
* @param {boolean} interrupt If true, previous commands are discarded.
* @returns {Promise<CommandFeedback>} Resolved upon completion of command (ie. once the motor is finished).
* @param {boolean} [interrupt=false] If true, previous commands are discarded.
* @returns {Promise<CommandFeedback>} Resolved upon completion of command (i.e. once the motor is finished).
*/
public rotateByDegrees (degrees: number, speed: [number, number] | number, interrupt: boolean = false) {
if (!this.isVirtualPort && speed instanceof Array) {
Expand Down

0 comments on commit cc5f74a

Please sign in to comment.