From 2665879d19755948060245792a5ed87b012f0796 Mon Sep 17 00:00:00 2001 From: Nathan Kunicki Date: Wed, 1 Aug 2018 11:10:09 +0100 Subject: [PATCH] Docs for different classes --- DOCS.md | 12 ------------ README.md | 12 ------------ hub.ts | 10 ---------- lpf2hub.ts | 11 +++++++++++ 4 files changed, 11 insertions(+), 34 deletions(-) diff --git a/DOCS.md b/DOCS.md index ddd8f55..458d732 100644 --- a/DOCS.md +++ b/DOCS.md @@ -78,7 +78,6 @@ Emits when a LPF2 Hub device is found. * [.uuid](#Hub+uuid) * [.rssi](#Hub+rssi) * [.batteryLevel](#Hub+batteryLevel) - * [.current](#Hub+current) * [.setLEDColor(color)](#WeDo2Hub+setLEDColor) ⇒ Promise * [.setLEDRGB(red, green, blue)](#WeDo2Hub+setLEDRGB) ⇒ Promise * [.setMotorSpeed(port, speed, [time])](#WeDo2Hub+setMotorSpeed) ⇒ Promise @@ -146,17 +145,6 @@ The WeDo2Hub is emitted if the discovered device is a WeDo 2.0 Smart Hub. | --- | --- | --- | | batteryLevel | number | Battery level of the hub (Percentage between 0-100) | - - -### weDo2Hub.current -**Kind**: instance property of [WeDo2Hub](#WeDo2Hub) -**Read only**: true -**Properties** - -| Name | Type | Description | -| --- | --- | --- | -| current | number | Current usage of the hub (Amps) | - ### weDo2Hub.setLEDColor(color) ⇒ Promise diff --git a/README.md b/README.md index a6f8bf5..2efc7e7 100644 --- a/README.md +++ b/README.md @@ -128,7 +128,6 @@ Emits when a LPF2 Hub device is found. * [.uuid](#Hub+uuid) * [.rssi](#Hub+rssi) * [.batteryLevel](#Hub+batteryLevel) - * [.current](#Hub+current) * [.setLEDColor(color)](#WeDo2Hub+setLEDColor) ⇒ Promise * [.setLEDRGB(red, green, blue)](#WeDo2Hub+setLEDRGB) ⇒ Promise * [.setMotorSpeed(port, speed, [time])](#WeDo2Hub+setMotorSpeed) ⇒ Promise @@ -196,17 +195,6 @@ The WeDo2Hub is emitted if the discovered device is a WeDo 2.0 Smart Hub. | --- | --- | --- | | batteryLevel | number | Battery level of the hub (Percentage between 0-100) | - - -### weDo2Hub.current -**Kind**: instance property of [WeDo2Hub](#WeDo2Hub) -**Read only**: true -**Properties** - -| Name | Type | Description | -| --- | --- | --- | -| current | number | Current usage of the hub (Amps) | - ### weDo2Hub.setLEDColor(color) ⇒ Promise diff --git a/hub.ts b/hub.ts index b1b17cf..01778e1 100644 --- a/hub.ts +++ b/hub.ts @@ -26,7 +26,6 @@ export class Hub extends EventEmitter { protected _name: string; protected _batteryLevel: number = 100; - protected _current: number = 0; private _peripheral: Peripheral; private _uuid: string; @@ -77,15 +76,6 @@ export class Hub extends EventEmitter { } - /** - * @readonly - * @property {number} current Current usage of the hub (Amps) - */ - public get current () { - return this._current; - } - - /** * Connect to the Hub. * @method Hub#connect diff --git a/lpf2hub.ts b/lpf2hub.ts index b4be777..516786b 100644 --- a/lpf2hub.ts +++ b/lpf2hub.ts @@ -17,12 +17,23 @@ const debug = Debug("lpf2hub"); export class LPF2Hub extends Hub { + protected _current: number = 0; + private _lastTiltX: number = 0; private _lastTiltY: number = 0; private _messageBuffer: Buffer = Buffer.alloc(0); + /** + * @readonly + * @property {number} current Current usage of the hub (Amps) + */ + public get current () { + return this._current; + } + + public connect () { return new Promise(async (resolve, reject) => { await super.connect();