Added resetAngle
This commit is contained in:
parent
a8126b2f3e
commit
e526e32146
@ -209,7 +209,7 @@ export enum BLECharacteristic {
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @typedef MessageTypes
|
* @typedef MessageType
|
||||||
* @property {number} HUB_PROPERTIES 0x01
|
* @property {number} HUB_PROPERTIES 0x01
|
||||||
* @property {number} HUB_ACTIONS 0x02
|
* @property {number} HUB_ACTIONS 0x02
|
||||||
* @property {number} HUB_ALERTS 0x03
|
* @property {number} HUB_ALERTS 0x03
|
||||||
@ -235,7 +235,7 @@ export enum BLECharacteristic {
|
|||||||
* @property {number} PORT_OUTPUT_COMMAND_FEEDBACK 0x82
|
* @property {number} PORT_OUTPUT_COMMAND_FEEDBACK 0x82
|
||||||
* @description https://lego.github.io/lego-ble-wireless-protocol-docs/index.html#message-types
|
* @description https://lego.github.io/lego-ble-wireless-protocol-docs/index.html#message-types
|
||||||
*/
|
*/
|
||||||
export enum MessageTypes {
|
export enum MessageType {
|
||||||
HUB_PROPERTIES = 0x01,
|
HUB_PROPERTIES = 0x01,
|
||||||
HUB_ACTIONS = 0x02,
|
HUB_ACTIONS = 0x02,
|
||||||
HUB_ALERTS = 0x03,
|
HUB_ALERTS = 0x03,
|
||||||
@ -359,7 +359,7 @@ export enum HubPropertyPayload {
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @typedef ActionTypes
|
* @typedef ActionType
|
||||||
* @param {number} SWITCH_OFF_HUB 0x01
|
* @param {number} SWITCH_OFF_HUB 0x01
|
||||||
* @param {number} DISCONNECT 0x02
|
* @param {number} DISCONNECT 0x02
|
||||||
* @param {number} VCC_PORT_CONTROL_ON 0x03
|
* @param {number} VCC_PORT_CONTROL_ON 0x03
|
||||||
@ -372,7 +372,7 @@ export enum HubPropertyPayload {
|
|||||||
* @param {number} HUB_WILL_GO_INTO_BOOT_MODE 0x32
|
* @param {number} HUB_WILL_GO_INTO_BOOT_MODE 0x32
|
||||||
* @description https://lego.github.io/lego-ble-wireless-protocol-docs/index.html#action-types
|
* @description https://lego.github.io/lego-ble-wireless-protocol-docs/index.html#action-types
|
||||||
*/
|
*/
|
||||||
export enum ActionTypes {
|
export enum ActionType {
|
||||||
SWITCH_OFF_HUB = 0x01,
|
SWITCH_OFF_HUB = 0x01,
|
||||||
DISCONNECT = 0x02,
|
DISCONNECT = 0x02,
|
||||||
VCC_PORT_CONTROL_ON = 0x03,
|
VCC_PORT_CONTROL_ON = 0x03,
|
||||||
@ -587,7 +587,7 @@ export enum HWNetworkSubFamily {
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @typedef ModeInformationTypes
|
* @typedef ModeInformationType
|
||||||
* @param {number} NAME 0x00
|
* @param {number} NAME 0x00
|
||||||
* @param {number} RAW 0x01
|
* @param {number} RAW 0x01
|
||||||
* @param {number} PCT 0x02
|
* @param {number} PCT 0x02
|
||||||
@ -600,7 +600,7 @@ export enum HWNetworkSubFamily {
|
|||||||
* @param {number} VALUE_FORMAT 0x80
|
* @param {number} VALUE_FORMAT 0x80
|
||||||
* @description https://lego.github.io/lego-ble-wireless-protocol-docs/index.html#mode-information-types
|
* @description https://lego.github.io/lego-ble-wireless-protocol-docs/index.html#mode-information-types
|
||||||
*/
|
*/
|
||||||
export enum ModeInformationTypes {
|
export enum ModeInformationType {
|
||||||
NAME = 0x00,
|
NAME = 0x00,
|
||||||
RAW = 0x01,
|
RAW = 0x01,
|
||||||
PCT = 0x02,
|
PCT = 0x02,
|
||||||
|
@ -71,6 +71,20 @@ export class AbsoluteMotor extends TachoMotor {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reset the current position as angle 0
|
||||||
|
* @method AbsoluteMotor#resetAngle
|
||||||
|
* @returns {Promise} Resolved upon successful completion of command (ie. once the motor is finished).
|
||||||
|
*/
|
||||||
|
public resetAngle () {
|
||||||
|
return new Promise((resolve) => {
|
||||||
|
const data = Buffer.from([0x81, this.portId, 0x11, 0x51, 0x02, 0x00, 0x00, 0x00, 0x00]);
|
||||||
|
this.send(data);
|
||||||
|
return resolve();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export enum Mode {
|
export enum Mode {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user