diff --git a/docs/AbsoluteMotor.html b/docs/AbsoluteMotor.html
index 8a0bab1..7674814 100644
--- a/docs/AbsoluteMotor.html
+++ b/docs/AbsoluteMotor.html
@@ -1319,7 +1319,7 @@
Documentation generated by JSDoc 3.6.3
- on Mon Feb 24th 2020
+ on Sat Apr 4th 2020
using the DocStrap template.
diff --git a/docs/BaseHub.html b/docs/BaseHub.html
index 5ee6147..988bdb0 100644
--- a/docs/BaseHub.html
+++ b/docs/BaseHub.html
@@ -1325,7 +1325,7 @@
Documentation generated by JSDoc 3.6.3
- on Mon Feb 24th 2020
+ on Sat Apr 4th 2020
using the DocStrap template.
diff --git a/docs/BasicMotor.html b/docs/BasicMotor.html
index 7409e88..92e1e75 100644
--- a/docs/BasicMotor.html
+++ b/docs/BasicMotor.html
@@ -1031,7 +1031,7 @@
@@ -1241,7 +1241,7 @@
@@ -1515,7 +1515,7 @@
@@ -1622,7 +1622,7 @@
Documentation generated by JSDoc 3.6.3
- on Mon Feb 24th 2020
+ on Sat Apr 4th 2020
using the DocStrap template.
diff --git a/docs/BoostMoveHub.html b/docs/BoostMoveHub.html
index 5209d0d..1505eb3 100644
--- a/docs/BoostMoveHub.html
+++ b/docs/BoostMoveHub.html
@@ -475,7 +475,7 @@
@@ -596,7 +596,7 @@
@@ -767,7 +767,7 @@
@@ -891,7 +891,7 @@
@@ -1062,7 +1062,7 @@
@@ -1233,7 +1233,7 @@
@@ -1354,7 +1354,7 @@
@@ -1526,7 +1526,7 @@
@@ -1698,7 +1698,7 @@
@@ -1870,7 +1870,7 @@
@@ -2042,7 +2042,7 @@
@@ -2221,7 +2221,7 @@
@@ -2392,7 +2392,7 @@
@@ -2539,7 +2539,7 @@
@@ -2715,7 +2715,7 @@
Documentation generated by JSDoc 3.6.3
- on Mon Feb 24th 2020
+ on Sat Apr 4th 2020
using the DocStrap template.
diff --git a/docs/ColorDistanceSensor.html b/docs/ColorDistanceSensor.html
index 7db693e..ee1c091 100644
--- a/docs/ColorDistanceSensor.html
+++ b/docs/ColorDistanceSensor.html
@@ -970,6 +970,918 @@
+ Methods
+
+
+
+
+-
+
sendPFIRMessage(message)
+
+
+
+-
+
+
+
+
Send a raw Power Functions IR command
+
+
+
+
+
+
+
+
+
+ Parameters:
+
+
+
+
+
+
+ Name |
+
+
+ Type |
+
+
+
+
+
+ Description |
+
+
+
+
+
+
+
+
+ message |
+
+
+
+
+
+Buffer
+
+
+
+
+ |
+
+
+
+
+
+ 2 byte payload making up a Power Functions protocol command. NOTE: Only specify nibbles 1-3, nibble 4 should be zeroed. |
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ - Source:
+ -
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Returns:
+
+
+
+
Resolved upon successful issuance of the command.
+
+
+
+
+
+ -
+ Type
+
+ -
+
+Promise
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+-
+
setColor(color)
+
+
+
+-
+
+
+
+
Set the color of the LED on the sensor via a color value.
+
+
+
+
+
+
+
+
+
+ Parameters:
+
+
+
+
+
+
+ Name |
+
+
+ Type |
+
+
+
+
+
+ Description |
+
+
+
+
+
+
+
+
+ color |
+
+
+
+
+
+Color
+
+
+
+
+ |
+
+
+
+
+
+ |
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ - Source:
+ -
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Returns:
+
+
+
+
Resolved upon successful issuance of the command.
+
+
+
+
+
+ -
+ Type
+
+ -
+
+Promise
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+-
+
setPFExtendedChannel(channel)
+
+
+
+-
+
+
+
+
Switches the IR receiver into extended channel mode. After setting this, use channels 5-8 instead of 1-4 for this receiver.
+
NOTE: Calling this with channel 5-8 with switch off extended channel mode for this receiver.
+
+
+
+
+
+
+
+
+
+ Parameters:
+
+
+
+
+
+
+ Name |
+
+
+ Type |
+
+
+
+
+
+ Description |
+
+
+
+
+
+
+
+
+ channel |
+
+
+
+
+
+number
+
+
+
+
+ |
+
+
+
+
+
+ Channel number, between 1-8 |
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ - Source:
+ -
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Returns:
+
+
+
+
Resolved upon successful issuance of the command.
+
+
+
+
+
+ -
+ Type
+
+ -
+
+Promise
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+-
+
setPFPower(channel, output, power)
+
+
+
+-
+
+
+
+
Set the power of a Power Functions motor via IR
+
+
+
+
+
+
+
+
+
+ Parameters:
+
+
+
+
+
+
+ Name |
+
+
+ Type |
+
+
+
+
+
+ Description |
+
+
+
+
+
+
+
+
+ channel |
+
+
+
+
+
+number
+
+
+
+
+ |
+
+
+
+
+
+ Channel number, between 1-4 |
+
+
+
+
+
+
+ output |
+
+
+
+
+
+string
+
+
+
+
+ |
+
+
+
+
+
+ Outport port, "RED" (A) or "BLUE" (B) |
+
+
+
+
+
+
+ power |
+
+
+
+
+
+number
+
+
+
+
+ |
+
+
+
+
+
+ 7 (full reverse) to 7 (full forward). 0 is stop. 8 is brake. |
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ - Source:
+ -
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Returns:
+
+
+
+
Resolved upon successful issuance of the command.
+
+
+
+
+
+ -
+ Type
+
+ -
+
+Promise
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+-
+
startPFMotors(channel, powerA, powerB)
+
+
+
+-
+
+
+
+
Start Power Functions motors running via IR
+
NOTE: This command is designed for bang-bang style operation. To keep the motors running, the sensor needs to be within range of the IR receiver constantly.
+
+
+
+
+
+
+
+
+
+ Parameters:
+
+
+
+
+
+
+ Name |
+
+
+ Type |
+
+
+
+
+
+ Description |
+
+
+
+
+
+
+
+
+ channel |
+
+
+
+
+
+Buffer
+
+
+
+
+ |
+
+
+
+
+
+ Channel number, between 1-4 |
+
+
+
+
+
+
+ powerA |
+
+
+
+
+
+Buffer
+
+
+
+
+ |
+
+
+
+
+
+ 7 (full reverse) to 7 (full forward). 0 is stop. 8 is brake. |
+
+
+
+
+
+
+ powerB |
+
+
+
+
+
+Buffer
+
+
+
+
+ |
+
+
+
+
+
+ 7 (full reverse) to 7 (full forward). 0 is stop. 8 is brake. |
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ - Source:
+ -
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Returns:
+
+
+
+
Resolved upon successful issuance of the command.
+
+
+
+
+
+ -
+ Type
+
+ -
+
+Promise
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -1482,7 +2394,7 @@
Documentation generated by JSDoc 3.6.3
- on Mon Feb 24th 2020
+ on Sat Apr 4th 2020
using the DocStrap template.
diff --git a/docs/ControlPlusHub.html b/docs/ControlPlusHub.html
index 8bb50a1..647f20b 100644
--- a/docs/ControlPlusHub.html
+++ b/docs/ControlPlusHub.html
@@ -475,7 +475,7 @@
@@ -596,7 +596,7 @@
@@ -767,7 +767,7 @@
@@ -891,7 +891,7 @@
@@ -1062,7 +1062,7 @@
@@ -1233,7 +1233,7 @@
@@ -1354,7 +1354,7 @@
@@ -1526,7 +1526,7 @@
@@ -1698,7 +1698,7 @@
@@ -1870,7 +1870,7 @@
@@ -2042,7 +2042,7 @@
@@ -2221,7 +2221,7 @@
@@ -2392,7 +2392,7 @@
@@ -2539,7 +2539,7 @@
@@ -2715,7 +2715,7 @@
Documentation generated by JSDoc 3.6.3
- on Mon Feb 24th 2020
+ on Sat Apr 4th 2020
using the DocStrap template.
diff --git a/docs/CurrentSensor.html b/docs/CurrentSensor.html
index c4137ad..c3496b3 100644
--- a/docs/CurrentSensor.html
+++ b/docs/CurrentSensor.html
@@ -1170,7 +1170,7 @@
Documentation generated by JSDoc 3.6.3
- on Mon Feb 24th 2020
+ on Sat Apr 4th 2020
using the DocStrap template.
diff --git a/docs/Device.html b/docs/Device.html
index 9c0aea0..69c22d5 100644
--- a/docs/Device.html
+++ b/docs/Device.html
@@ -968,7 +968,7 @@
Documentation generated by JSDoc 3.6.3
- on Mon Feb 24th 2020
+ on Sat Apr 4th 2020
using the DocStrap template.
diff --git a/docs/DuploTrainBase.html b/docs/DuploTrainBase.html
index 29b8e30..bb7a9ce 100644
--- a/docs/DuploTrainBase.html
+++ b/docs/DuploTrainBase.html
@@ -1505,7 +1505,7 @@
@@ -1676,7 +1676,7 @@
@@ -1797,7 +1797,7 @@
@@ -2000,7 +2000,7 @@
@@ -2079,7 +2079,7 @@
Documentation generated by JSDoc 3.6.3
- on Mon Feb 24th 2020
+ on Sat Apr 4th 2020
using the DocStrap template.
diff --git a/docs/DuploTrainBaseColorSensor.html b/docs/DuploTrainBaseColorSensor.html
index ac04757..2bea0cd 100644
--- a/docs/DuploTrainBaseColorSensor.html
+++ b/docs/DuploTrainBaseColorSensor.html
@@ -1506,7 +1506,7 @@
Documentation generated by JSDoc 3.6.3
- on Mon Feb 24th 2020
+ on Sat Apr 4th 2020
using the DocStrap template.
diff --git a/docs/DuploTrainBaseMotor.html b/docs/DuploTrainBaseMotor.html
index 766d5b4..838517a 100644
--- a/docs/DuploTrainBaseMotor.html
+++ b/docs/DuploTrainBaseMotor.html
@@ -1040,7 +1040,7 @@
@@ -1259,7 +1259,7 @@
@@ -1551,7 +1551,7 @@
@@ -1658,7 +1658,7 @@
Documentation generated by JSDoc 3.6.3
- on Mon Feb 24th 2020
+ on Sat Apr 4th 2020
using the DocStrap template.
diff --git a/docs/DuploTrainBaseSpeaker.html b/docs/DuploTrainBaseSpeaker.html
index b899c44..6a6069d 100644
--- a/docs/DuploTrainBaseSpeaker.html
+++ b/docs/DuploTrainBaseSpeaker.html
@@ -1350,7 +1350,7 @@
Documentation generated by JSDoc 3.6.3
- on Mon Feb 24th 2020
+ on Sat Apr 4th 2020
using the DocStrap template.
diff --git a/docs/DuploTraniBaseSpeedometer.html b/docs/DuploTraniBaseSpeedometer.html
index edb6c29..84e25ca 100644
--- a/docs/DuploTraniBaseSpeedometer.html
+++ b/docs/DuploTraniBaseSpeedometer.html
@@ -1022,7 +1022,7 @@
Documentation generated by JSDoc 3.6.3
- on Mon Feb 24th 2020
+ on Sat Apr 4th 2020
using the DocStrap template.
diff --git a/docs/Hub.html b/docs/Hub.html
index 568eaa6..792ca5d 100644
--- a/docs/Hub.html
+++ b/docs/Hub.html
@@ -1617,7 +1617,7 @@
@@ -1729,7 +1729,7 @@
@@ -1891,7 +1891,7 @@
@@ -2006,7 +2006,7 @@
@@ -2168,7 +2168,7 @@
@@ -2339,7 +2339,7 @@
@@ -2460,7 +2460,7 @@
@@ -2623,7 +2623,7 @@
@@ -2786,7 +2786,7 @@
@@ -2949,7 +2949,7 @@
@@ -3112,7 +3112,7 @@
@@ -3282,7 +3282,7 @@
@@ -3453,7 +3453,7 @@
@@ -3591,7 +3591,7 @@
@@ -3758,7 +3758,7 @@
Documentation generated by JSDoc 3.6.3
- on Mon Feb 24th 2020
+ on Sat Apr 4th 2020
using the DocStrap template.
diff --git a/docs/HubLED.html b/docs/HubLED.html
index 76ae88f..c81fe41 100644
--- a/docs/HubLED.html
+++ b/docs/HubLED.html
@@ -1398,7 +1398,7 @@
Documentation generated by JSDoc 3.6.3
- on Mon Feb 24th 2020
+ on Sat Apr 4th 2020
using the DocStrap template.
diff --git a/docs/LPF2Hub.html b/docs/LPF2Hub.html
index fdff9e3..0112a1a 100644
--- a/docs/LPF2Hub.html
+++ b/docs/LPF2Hub.html
@@ -1490,7 +1490,7 @@
@@ -1652,7 +1652,7 @@
@@ -1764,7 +1764,7 @@
@@ -1958,7 +1958,7 @@
@@ -2037,7 +2037,7 @@
Documentation generated by JSDoc 3.6.3
- on Mon Feb 24th 2020
+ on Sat Apr 4th 2020
using the DocStrap template.
diff --git a/docs/Light.html b/docs/Light.html
index 7882395..884fb02 100644
--- a/docs/Light.html
+++ b/docs/Light.html
@@ -1398,7 +1398,7 @@
Documentation generated by JSDoc 3.6.3
- on Mon Feb 24th 2020
+ on Sat Apr 4th 2020
using the DocStrap template.
diff --git a/docs/MediumLinearMotor.html b/docs/MediumLinearMotor.html
index 6abfde9..b002b43 100644
--- a/docs/MediumLinearMotor.html
+++ b/docs/MediumLinearMotor.html
@@ -957,7 +957,7 @@
Documentation generated by JSDoc 3.6.3
- on Mon Feb 24th 2020
+ on Sat Apr 4th 2020
using the DocStrap template.
diff --git a/docs/MotionSensor.html b/docs/MotionSensor.html
index fee58b9..88f9e24 100644
--- a/docs/MotionSensor.html
+++ b/docs/MotionSensor.html
@@ -1170,7 +1170,7 @@
Documentation generated by JSDoc 3.6.3
- on Mon Feb 24th 2020
+ on Sat Apr 4th 2020
using the DocStrap template.
diff --git a/docs/MoveHub.html b/docs/MoveHub.html
index b6be234..17cd9e9 100644
--- a/docs/MoveHub.html
+++ b/docs/MoveHub.html
@@ -1550,7 +1550,7 @@
@@ -1721,7 +1721,7 @@
@@ -1842,7 +1842,7 @@
@@ -2045,7 +2045,7 @@
@@ -2124,7 +2124,7 @@
Documentation generated by JSDoc 3.6.3
- on Mon Feb 24th 2020
+ on Sat Apr 4th 2020
using the DocStrap template.
diff --git a/docs/MoveHubMediumLinearMotor.html b/docs/MoveHubMediumLinearMotor.html
index 8cfbf68..ce990a4 100644
--- a/docs/MoveHubMediumLinearMotor.html
+++ b/docs/MoveHubMediumLinearMotor.html
@@ -957,7 +957,7 @@
Documentation generated by JSDoc 3.6.3
- on Mon Feb 24th 2020
+ on Sat Apr 4th 2020
using the DocStrap template.
diff --git a/docs/MoveHubTiltSensor.html b/docs/MoveHubTiltSensor.html
index ea3e9d2..edc6485 100644
--- a/docs/MoveHubTiltSensor.html
+++ b/docs/MoveHubTiltSensor.html
@@ -1194,7 +1194,7 @@
Documentation generated by JSDoc 3.6.3
- on Mon Feb 24th 2020
+ on Sat Apr 4th 2020
using the DocStrap template.
diff --git a/docs/PUPHub.html b/docs/PUPHub.html
index 21f0117..3c6ef4e 100644
--- a/docs/PUPHub.html
+++ b/docs/PUPHub.html
@@ -1681,7 +1681,7 @@
@@ -1802,7 +1802,7 @@
@@ -1973,7 +1973,7 @@
@@ -2097,7 +2097,7 @@
@@ -2268,7 +2268,7 @@
@@ -2444,7 +2444,7 @@
@@ -2570,7 +2570,7 @@
@@ -2742,7 +2742,7 @@
@@ -2914,7 +2914,7 @@
@@ -3086,7 +3086,7 @@
@@ -3258,7 +3258,7 @@
@@ -3437,7 +3437,7 @@
@@ -3613,7 +3613,7 @@
@@ -3760,7 +3760,7 @@
@@ -3936,7 +3936,7 @@
Documentation generated by JSDoc 3.6.3
- on Mon Feb 24th 2020
+ on Sat Apr 4th 2020
using the DocStrap template.
diff --git a/docs/PUPRemote.html b/docs/PUPRemote.html
index 290051c..8845d83 100644
--- a/docs/PUPRemote.html
+++ b/docs/PUPRemote.html
@@ -1681,7 +1681,7 @@
@@ -1802,7 +1802,7 @@
@@ -1973,7 +1973,7 @@
@@ -2097,7 +2097,7 @@
@@ -2268,7 +2268,7 @@
@@ -2444,7 +2444,7 @@
@@ -2570,7 +2570,7 @@
@@ -2742,7 +2742,7 @@
@@ -2914,7 +2914,7 @@
@@ -3086,7 +3086,7 @@
@@ -3258,7 +3258,7 @@
@@ -3437,7 +3437,7 @@
@@ -3613,7 +3613,7 @@
@@ -3760,7 +3760,7 @@
@@ -3936,7 +3936,7 @@
Documentation generated by JSDoc 3.6.3
- on Mon Feb 24th 2020
+ on Sat Apr 4th 2020
using the DocStrap template.
diff --git a/docs/PiezoBuzzer.html b/docs/PiezoBuzzer.html
index bf700ae..11981de 100644
--- a/docs/PiezoBuzzer.html
+++ b/docs/PiezoBuzzer.html
@@ -1212,7 +1212,7 @@
Documentation generated by JSDoc 3.6.3
- on Mon Feb 24th 2020
+ on Sat Apr 4th 2020
using the DocStrap template.
diff --git a/docs/RemoteControl.html b/docs/RemoteControl.html
index baa185e..88b4203 100644
--- a/docs/RemoteControl.html
+++ b/docs/RemoteControl.html
@@ -1550,7 +1550,7 @@
@@ -1721,7 +1721,7 @@
@@ -1842,7 +1842,7 @@
@@ -2045,7 +2045,7 @@
@@ -2124,7 +2124,7 @@
Documentation generated by JSDoc 3.6.3
- on Mon Feb 24th 2020
+ on Sat Apr 4th 2020
using the DocStrap template.
diff --git a/docs/RemoteControlButton.html b/docs/RemoteControlButton.html
index 93c6137..e17c171 100644
--- a/docs/RemoteControlButton.html
+++ b/docs/RemoteControlButton.html
@@ -1170,7 +1170,7 @@
Documentation generated by JSDoc 3.6.3
- on Mon Feb 24th 2020
+ on Sat Apr 4th 2020
using the DocStrap template.
diff --git a/docs/SimpleMediumLinearMotor.html b/docs/SimpleMediumLinearMotor.html
index 60f7205..f743102 100644
--- a/docs/SimpleMediumLinearMotor.html
+++ b/docs/SimpleMediumLinearMotor.html
@@ -1022,7 +1022,7 @@
Documentation generated by JSDoc 3.6.3
- on Mon Feb 24th 2020
+ on Sat Apr 4th 2020
using the DocStrap template.
diff --git a/docs/TachoMotor.html b/docs/TachoMotor.html
index 967adff..e44fe3f 100644
--- a/docs/TachoMotor.html
+++ b/docs/TachoMotor.html
@@ -1040,7 +1040,7 @@
@@ -1259,7 +1259,7 @@
@@ -2070,7 +2070,7 @@
@@ -2325,7 +2325,7 @@
Documentation generated by JSDoc 3.6.3
- on Mon Feb 24th 2020
+ on Sat Apr 4th 2020
using the DocStrap template.
diff --git a/docs/TechnicColorSensor.html b/docs/TechnicColorSensor.html
index 83f854b..81cb7f2 100644
--- a/docs/TechnicColorSensor.html
+++ b/docs/TechnicColorSensor.html
@@ -1458,7 +1458,7 @@
Documentation generated by JSDoc 3.6.3
- on Mon Feb 24th 2020
+ on Sat Apr 4th 2020
using the DocStrap template.
diff --git a/docs/TechnicDistanceSensor.html b/docs/TechnicDistanceSensor.html
index 83569c3..3e917e5 100644
--- a/docs/TechnicDistanceSensor.html
+++ b/docs/TechnicDistanceSensor.html
@@ -1552,7 +1552,7 @@
Documentation generated by JSDoc 3.6.3
- on Mon Feb 24th 2020
+ on Sat Apr 4th 2020
using the DocStrap template.
diff --git a/docs/TechnicForceSensor.html b/docs/TechnicForceSensor.html
index d82d696..6448d6f 100644
--- a/docs/TechnicForceSensor.html
+++ b/docs/TechnicForceSensor.html
@@ -1458,7 +1458,7 @@
Documentation generated by JSDoc 3.6.3
- on Mon Feb 24th 2020
+ on Sat Apr 4th 2020
using the DocStrap template.
diff --git a/docs/TechnicLargeAngularMotor.html b/docs/TechnicLargeAngularMotor.html
index 5c6ff15..88999c0 100644
--- a/docs/TechnicLargeAngularMotor.html
+++ b/docs/TechnicLargeAngularMotor.html
@@ -1337,7 +1337,7 @@
Documentation generated by JSDoc 3.6.3
- on Mon Feb 24th 2020
+ on Sat Apr 4th 2020
using the DocStrap template.
diff --git a/docs/TechnicLargeLinearMotor.html b/docs/TechnicLargeLinearMotor.html
index ea5f77c..88817f9 100644
--- a/docs/TechnicLargeLinearMotor.html
+++ b/docs/TechnicLargeLinearMotor.html
@@ -1337,7 +1337,7 @@
Documentation generated by JSDoc 3.6.3
- on Mon Feb 24th 2020
+ on Sat Apr 4th 2020
using the DocStrap template.
diff --git a/docs/TechnicMediumAngularMotor.html b/docs/TechnicMediumAngularMotor.html
index 9201004..5a27e1a 100644
--- a/docs/TechnicMediumAngularMotor.html
+++ b/docs/TechnicMediumAngularMotor.html
@@ -1337,7 +1337,7 @@
Documentation generated by JSDoc 3.6.3
- on Mon Feb 24th 2020
+ on Sat Apr 4th 2020
using the DocStrap template.
diff --git a/docs/TechnicMediumHub.html b/docs/TechnicMediumHub.html
index ae18d0e..e72c392 100644
--- a/docs/TechnicMediumHub.html
+++ b/docs/TechnicMediumHub.html
@@ -1550,7 +1550,7 @@
@@ -1721,7 +1721,7 @@
@@ -1842,7 +1842,7 @@
@@ -2045,7 +2045,7 @@
@@ -2124,7 +2124,7 @@
Documentation generated by JSDoc 3.6.3
- on Mon Feb 24th 2020
+ on Sat Apr 4th 2020
using the DocStrap template.
diff --git a/docs/TechnicMediumHubAccelerometerSensor.html b/docs/TechnicMediumHubAccelerometerSensor.html
index eda09c3..fba2a6c 100644
--- a/docs/TechnicMediumHubAccelerometerSensor.html
+++ b/docs/TechnicMediumHubAccelerometerSensor.html
@@ -1218,7 +1218,7 @@
Documentation generated by JSDoc 3.6.3
- on Mon Feb 24th 2020
+ on Sat Apr 4th 2020
using the DocStrap template.
diff --git a/docs/TechnicMediumHubGyroSensor.html b/docs/TechnicMediumHubGyroSensor.html
index b2c7736..9ed58af 100644
--- a/docs/TechnicMediumHubGyroSensor.html
+++ b/docs/TechnicMediumHubGyroSensor.html
@@ -1218,7 +1218,7 @@
Documentation generated by JSDoc 3.6.3
- on Mon Feb 24th 2020
+ on Sat Apr 4th 2020
using the DocStrap template.
diff --git a/docs/TechnicMediumHubTiltSensor.html b/docs/TechnicMediumHubTiltSensor.html
index 7dba8d9..10b264f 100644
--- a/docs/TechnicMediumHubTiltSensor.html
+++ b/docs/TechnicMediumHubTiltSensor.html
@@ -1218,7 +1218,7 @@
Documentation generated by JSDoc 3.6.3
- on Mon Feb 24th 2020
+ on Sat Apr 4th 2020
using the DocStrap template.
diff --git a/docs/TechnicXLargeLinearMotor.html b/docs/TechnicXLargeLinearMotor.html
index ef77666..e10fa3d 100644
--- a/docs/TechnicXLargeLinearMotor.html
+++ b/docs/TechnicXLargeLinearMotor.html
@@ -1337,7 +1337,7 @@
Documentation generated by JSDoc 3.6.3
- on Mon Feb 24th 2020
+ on Sat Apr 4th 2020
using the DocStrap template.
diff --git a/docs/TiltSensor.html b/docs/TiltSensor.html
index 545a26c..6cb1be1 100644
--- a/docs/TiltSensor.html
+++ b/docs/TiltSensor.html
@@ -1194,7 +1194,7 @@
Documentation generated by JSDoc 3.6.3
- on Mon Feb 24th 2020
+ on Sat Apr 4th 2020
using the DocStrap template.
diff --git a/docs/TrainMotor.html b/docs/TrainMotor.html
index 87d16af..cd6c31e 100644
--- a/docs/TrainMotor.html
+++ b/docs/TrainMotor.html
@@ -1040,7 +1040,7 @@
@@ -1259,7 +1259,7 @@
@@ -1551,7 +1551,7 @@
@@ -1658,7 +1658,7 @@
Documentation generated by JSDoc 3.6.3
- on Mon Feb 24th 2020
+ on Sat Apr 4th 2020
using the DocStrap template.
diff --git a/docs/VoltageSensor.html b/docs/VoltageSensor.html
index f0e5419..5a26009 100644
--- a/docs/VoltageSensor.html
+++ b/docs/VoltageSensor.html
@@ -1170,7 +1170,7 @@
Documentation generated by JSDoc 3.6.3
- on Mon Feb 24th 2020
+ on Sat Apr 4th 2020
using the DocStrap template.
diff --git a/docs/WeDo2SmartHub.html b/docs/WeDo2SmartHub.html
index 1e810f0..362f787 100644
--- a/docs/WeDo2SmartHub.html
+++ b/docs/WeDo2SmartHub.html
@@ -1469,7 +1469,7 @@
@@ -1775,7 +1775,7 @@
@@ -1854,7 +1854,7 @@
Documentation generated by JSDoc 3.6.3
- on Mon Feb 24th 2020
+ on Sat Apr 4th 2020
using the DocStrap template.
diff --git a/docs/classes.list.html b/docs/classes.list.html
index 1c88563..77aa70f 100644
--- a/docs/classes.list.html
+++ b/docs/classes.list.html
@@ -704,7 +704,7 @@
@@ -875,7 +875,7 @@
@@ -1022,7 +1022,7 @@
@@ -1722,7 +1722,7 @@
@@ -1893,7 +1893,7 @@
@@ -2040,7 +2040,7 @@
@@ -2452,7 +2452,7 @@
@@ -3214,7 +3214,7 @@
@@ -3385,7 +3385,7 @@
@@ -3523,7 +3523,7 @@
@@ -3773,7 +3773,7 @@
@@ -4241,7 +4241,7 @@
@@ -4709,7 +4709,7 @@
@@ -4885,7 +4885,7 @@
@@ -5032,7 +5032,7 @@
@@ -5276,7 +5276,7 @@
@@ -5452,7 +5452,7 @@
@@ -5599,7 +5599,7 @@
@@ -5867,7 +5867,7 @@
@@ -8396,7 +8396,7 @@
@@ -9752,7 +9752,7 @@
@@ -9831,7 +9831,7 @@
Documentation generated by JSDoc 3.6.3
- on Mon Feb 24th 2020
+ on Sat Apr 4th 2020
using the DocStrap template.
diff --git a/docs/devices_absolutemotor.js.html b/docs/devices_absolutemotor.js.html
index 86e00e8..feb9e98 100644
--- a/docs/devices_absolutemotor.js.html
+++ b/docs/devices_absolutemotor.js.html
@@ -207,7 +207,7 @@ exports.ModeMap = {
Documentation generated by JSDoc 3.6.3
- on Mon Feb 24th 2020
+ on Sat Apr 4th 2020
using the DocStrap template.
diff --git a/docs/devices_basicmotor.js.html b/docs/devices_basicmotor.js.html
index 33943d4..9f832b8 100644
--- a/docs/devices_basicmotor.js.html
+++ b/docs/devices_basicmotor.js.html
@@ -107,10 +107,7 @@ class BasicMotor extends device_1.Device {
if (interrupt) {
this.cancelEventTimer();
}
- return new Promise((resolve) => {
- this.writeDirect(0x00, Buffer.from([utils_1.mapSpeed(power)]));
- return resolve();
- });
+ return this.writeDirect(0x00, Buffer.from([utils_1.mapSpeed(power)]));
}
/**
* Ramp the motor power.
@@ -195,7 +192,7 @@ exports.BasicMotor = BasicMotor;
Documentation generated by JSDoc 3.6.3
- on Mon Feb 24th 2020
+ on Sat Apr 4th 2020
using the DocStrap template.
diff --git a/docs/devices_colordistancesensor.js.html b/docs/devices_colordistancesensor.js.html
index f4afb81..16aa2a3 100644
--- a/docs/devices_colordistancesensor.js.html
+++ b/docs/devices_colordistancesensor.js.html
@@ -150,12 +150,118 @@ class ColorDistanceSensor extends device_1.Device {
break;
}
}
+ /**
+ * Switches the IR receiver into extended channel mode. After setting this, use channels 5-8 instead of 1-4 for this receiver.
+ *
+ * NOTE: Calling this with channel 5-8 with switch off extended channel mode for this receiver.
+ * @method ColorDistanceSensor#setPFExtendedChannel
+ * @param {number} channel Channel number, between 1-8
+ * @returns {Promise} Resolved upon successful issuance of the command.
+ */
+ setPFExtendedChannel(channel) {
+ let address = 0;
+ if (channel >= 4) {
+ channel -= 4;
+ address = 1;
+ }
+ const message = Buffer.alloc(2);
+ // Send "Extended toggle address command"
+ message[0] = ((channel - 1) << 4) + (address << 3);
+ message[1] = 6 << 4;
+ return this.sendPFIRMessage(message);
+ }
+ /**
+ * Set the power of a Power Functions motor via IR
+ * @method ColorDistanceSensor#setPFPower
+ * @param {number} channel Channel number, between 1-4
+ * @param {string} output Outport port, "RED" (A) or "BLUE" (B)
+ * @param {number} power -7 (full reverse) to 7 (full forward). 0 is stop. 8 is brake.
+ * @returns {Promise} Resolved upon successful issuance of the command.
+ */
+ setPFPower(channel, output, power) {
+ let address = 0;
+ if (channel > 4) {
+ channel -= 4;
+ address = 1;
+ }
+ const message = Buffer.alloc(2);
+ // Send "Single output mode"
+ message[0] = ((channel - 1) << 4) + (address << 3) + (output === "RED" ? 4 : 5);
+ message[1] = this._pfPowerToPWM(power) << 4;
+ return this.sendPFIRMessage(message);
+ }
+ /**
+ * Start Power Functions motors running via IR
+ *
+ * NOTE: This command is designed for bang-bang style operation. To keep the motors running, the sensor needs to be within range of the IR receiver constantly.
+ * @method ColorDistanceSensor#startPFMotors
+ * @param {Buffer} channel Channel number, between 1-4
+ * @param {Buffer} powerA -7 (full reverse) to 7 (full forward). 0 is stop. 8 is brake.
+ * @param {Buffer} powerB -7 (full reverse) to 7 (full forward). 0 is stop. 8 is brake.
+ * @returns {Promise} Resolved upon successful issuance of the command.
+ */
+ startPFMotors(channel, powerBlue, powerRed) {
+ let address = 0;
+ if (channel > 4) {
+ channel -= 4;
+ address = 1;
+ }
+ const message = Buffer.alloc(2);
+ // Send "Combo PWM mode"
+ message[0] = (((channel - 1) + 4 + (address << 3)) << 4) + this._pfPowerToPWM(powerBlue);
+ message[1] = this._pfPowerToPWM(powerRed) << 4;
+ return this.sendPFIRMessage(message);
+ }
+ /**
+ * Send a raw Power Functions IR command
+ * @method ColorDistanceSensor#sendPFIRMessage
+ * @param {Buffer} message 2 byte payload making up a Power Functions protocol command. NOTE: Only specify nibbles 1-3, nibble 4 should be zeroed.
+ * @returns {Promise} Resolved upon successful issuance of the command.
+ */
+ sendPFIRMessage(message) {
+ if (this.isWeDo2SmartHub) {
+ throw new Error("Power Functions IR is not available on the WeDo 2.0 Smart Hub");
+ }
+ else {
+ const payload = Buffer.alloc(2);
+ payload[0] = (message[0] << 4) + (message[1] >> 4);
+ payload[1] = message[0] >> 4;
+ this.subscribe(Mode.PF_IR);
+ return this.writeDirect(0x07, payload);
+ }
+ }
+ /**
+ * Set the color of the LED on the sensor via a color value.
+ * @method ColorDistanceSensor#setColor
+ * @param {Color} color
+ * @returns {Promise} Resolved upon successful issuance of the command.
+ */
+ setColor(color) {
+ return new Promise((resolve, reject) => {
+ if (color === false) {
+ color = 0;
+ }
+ if (this.isWeDo2SmartHub) {
+ throw new Error("Setting LED color is not available on the WeDo 2.0 Smart Hub");
+ }
+ else {
+ this.subscribe(Mode.LED);
+ this.writeDirect(0x05, Buffer.from([color]));
+ }
+ return resolve();
+ });
+ }
+ _pfPowerToPWM(power) {
+ return power & 15;
+ }
}
exports.ColorDistanceSensor = ColorDistanceSensor;
var Mode;
(function (Mode) {
Mode[Mode["COLOR"] = 0] = "COLOR";
Mode[Mode["DISTANCE"] = 1] = "DISTANCE";
+ Mode[Mode["LED"] = 5] = "LED";
+ Mode[Mode["PF_IR"] = 7] = "PF_IR";
Mode[Mode["COLOR_AND_DISTANCE"] = 8] = "COLOR_AND_DISTANCE";
})(Mode = exports.Mode || (exports.Mode = {}));
exports.ModeMap = {
@@ -163,6 +269,11 @@ exports.ModeMap = {
"distance": Mode.DISTANCE,
"colorAndDistance": Mode.COLOR_AND_DISTANCE
};
+var Output;
+(function (Output) {
+ Output["RED"] = "RED";
+ Output["BLUE"] = "BLUE";
+})(Output = exports.Output || (exports.Output = {}));
//# sourceMappingURL=colordistancesensor.js.map
@@ -208,7 +319,7 @@ exports.ModeMap = {
Documentation generated by JSDoc 3.6.3
- on Mon Feb 24th 2020
+ on Sat Apr 4th 2020
using the DocStrap template.
diff --git a/docs/devices_currentsensor.js.html b/docs/devices_currentsensor.js.html
index d03a2ad..57011ba 100644
--- a/docs/devices_currentsensor.js.html
+++ b/docs/devices_currentsensor.js.html
@@ -186,7 +186,7 @@ const MaxCurrentRaw = {
Documentation generated by JSDoc 3.6.3
- on Mon Feb 24th 2020
+ on Sat Apr 4th 2020
using the DocStrap template.
diff --git a/docs/devices_device.js.html b/docs/devices_device.js.html
index 29459d1..d2c51e9 100644
--- a/docs/devices_device.js.html
+++ b/docs/devices_device.js.html
@@ -185,17 +185,17 @@ class Device extends events_1.EventEmitter {
get isVirtualPort() {
return this._isVirtualPort;
}
- writeDirect(mode, data, callback) {
+ writeDirect(mode, data) {
if (this.isWeDo2SmartHub) {
- this.send(Buffer.concat([Buffer.from([this.portId, 0x01, 0x02]), data]), Consts.BLECharacteristic.WEDO2_MOTOR_VALUE_WRITE);
+ return this.send(Buffer.concat([Buffer.from([this.portId, 0x01, 0x02]), data]), Consts.BLECharacteristic.WEDO2_MOTOR_VALUE_WRITE);
}
else {
- this.send(Buffer.concat([Buffer.from([0x81, this.portId, 0x11, 0x51, mode]), data]), Consts.BLECharacteristic.LPF2_ALL, callback);
+ return this.send(Buffer.concat([Buffer.from([0x81, this.portId, 0x11, 0x51, mode]), data]), Consts.BLECharacteristic.LPF2_ALL);
}
}
- send(data, characteristic = Consts.BLECharacteristic.LPF2_ALL, callback) {
+ send(data, characteristic = Consts.BLECharacteristic.LPF2_ALL) {
this._ensureConnected();
- this.hub.send(data, characteristic, callback);
+ return this.hub.send(data, characteristic);
}
subscribe(mode) {
this._ensureConnected();
@@ -285,7 +285,7 @@ exports.Device = Device;
Documentation generated by JSDoc 3.6.3
- on Mon Feb 24th 2020
+ on Sat Apr 4th 2020
using the DocStrap template.
diff --git a/docs/devices_duplotrainbasecolorsensor.js.html b/docs/devices_duplotrainbasecolorsensor.js.html
index 78076a8..f98e0fc 100644
--- a/docs/devices_duplotrainbasecolorsensor.js.html
+++ b/docs/devices_duplotrainbasecolorsensor.js.html
@@ -195,7 +195,7 @@ exports.ModeMap = {
Documentation generated by JSDoc 3.6.3
- on Mon Feb 24th 2020
+ on Sat Apr 4th 2020
using the DocStrap template.
diff --git a/docs/devices_duplotrainbasemotor.js.html b/docs/devices_duplotrainbasemotor.js.html
index 67d83c4..a841c79 100644
--- a/docs/devices_duplotrainbasemotor.js.html
+++ b/docs/devices_duplotrainbasemotor.js.html
@@ -143,7 +143,7 @@ exports.DuploTrainBaseMotor = DuploTrainBaseMotor;
Documentation generated by JSDoc 3.6.3
- on Mon Feb 24th 2020
+ on Sat Apr 4th 2020
using the DocStrap template.
diff --git a/docs/devices_duplotrainbasespeaker.js.html b/docs/devices_duplotrainbasespeaker.js.html
index 842cfdc..e38a42b 100644
--- a/docs/devices_duplotrainbasespeaker.js.html
+++ b/docs/devices_duplotrainbasespeaker.js.html
@@ -171,7 +171,7 @@ var Mode;
Documentation generated by JSDoc 3.6.3
- on Mon Feb 24th 2020
+ on Sat Apr 4th 2020
using the DocStrap template.
diff --git a/docs/devices_duplotrainbasespeedometer.js.html b/docs/devices_duplotrainbasespeedometer.js.html
index 7dcd78c..49e7916 100644
--- a/docs/devices_duplotrainbasespeedometer.js.html
+++ b/docs/devices_duplotrainbasespeedometer.js.html
@@ -165,7 +165,7 @@ exports.ModeMap = {
Documentation generated by JSDoc 3.6.3
- on Mon Feb 24th 2020
+ on Sat Apr 4th 2020
using the DocStrap template.
diff --git a/docs/devices_hubled.js.html b/docs/devices_hubled.js.html
index 8e2cfa7..362deb2 100644
--- a/docs/devices_hubled.js.html
+++ b/docs/devices_hubled.js.html
@@ -191,7 +191,7 @@ var Mode;
Documentation generated by JSDoc 3.6.3
- on Mon Feb 24th 2020
+ on Sat Apr 4th 2020
using the DocStrap template.
diff --git a/docs/devices_light.js.html b/docs/devices_light.js.html
index 2a28e4a..e0d0b2f 100644
--- a/docs/devices_light.js.html
+++ b/docs/devices_light.js.html
@@ -177,7 +177,7 @@ exports.Light = Light;
Documentation generated by JSDoc 3.6.3
- on Mon Feb 24th 2020
+ on Sat Apr 4th 2020
using the DocStrap template.
diff --git a/docs/devices_mediumlinearmotor.js.html b/docs/devices_mediumlinearmotor.js.html
index c7fe1d7..2f01b15 100644
--- a/docs/devices_mediumlinearmotor.js.html
+++ b/docs/devices_mediumlinearmotor.js.html
@@ -143,7 +143,7 @@ exports.MediumLinearMotor = MediumLinearMotor;
Documentation generated by JSDoc 3.6.3
- on Mon Feb 24th 2020
+ on Sat Apr 4th 2020
using the DocStrap template.
diff --git a/docs/devices_motionsensor.js.html b/docs/devices_motionsensor.js.html
index 28ef61a..93d2393 100644
--- a/docs/devices_motionsensor.js.html
+++ b/docs/devices_motionsensor.js.html
@@ -169,7 +169,7 @@ exports.ModeMap = {
Documentation generated by JSDoc 3.6.3
- on Mon Feb 24th 2020
+ on Sat Apr 4th 2020
using the DocStrap template.
diff --git a/docs/devices_movehubmediumlinearmotor.js.html b/docs/devices_movehubmediumlinearmotor.js.html
index bae7f27..2a8aea6 100644
--- a/docs/devices_movehubmediumlinearmotor.js.html
+++ b/docs/devices_movehubmediumlinearmotor.js.html
@@ -143,7 +143,7 @@ exports.MoveHubMediumLinearMotor = MoveHubMediumLinearMotor;
Documentation generated by JSDoc 3.6.3
- on Mon Feb 24th 2020
+ on Sat Apr 4th 2020
using the DocStrap template.
diff --git a/docs/devices_movehubtiltsensor.js.html b/docs/devices_movehubtiltsensor.js.html
index 7dfe5f4..819f891 100644
--- a/docs/devices_movehubtiltsensor.js.html
+++ b/docs/devices_movehubtiltsensor.js.html
@@ -167,7 +167,7 @@ exports.ModeMap = {
Documentation generated by JSDoc 3.6.3
- on Mon Feb 24th 2020
+ on Sat Apr 4th 2020
using the DocStrap template.
diff --git a/docs/devices_piezobuzzer.js.html b/docs/devices_piezobuzzer.js.html
index c94232f..ee23dcb 100644
--- a/docs/devices_piezobuzzer.js.html
+++ b/docs/devices_piezobuzzer.js.html
@@ -159,7 +159,7 @@ exports.PiezoBuzzer = PiezoBuzzer;
Documentation generated by JSDoc 3.6.3
- on Mon Feb 24th 2020
+ on Sat Apr 4th 2020
using the DocStrap template.
diff --git a/docs/devices_remotecontrolbutton.js.html b/docs/devices_remotecontrolbutton.js.html
index b9fefad..d5a7eff 100644
--- a/docs/devices_remotecontrolbutton.js.html
+++ b/docs/devices_remotecontrolbutton.js.html
@@ -171,7 +171,7 @@ exports.ButtonState = {
Documentation generated by JSDoc 3.6.3
- on Mon Feb 24th 2020
+ on Sat Apr 4th 2020
using the DocStrap template.
diff --git a/docs/devices_simplemediumlinearmotor.js.html b/docs/devices_simplemediumlinearmotor.js.html
index aca97f7..110005f 100644
--- a/docs/devices_simplemediumlinearmotor.js.html
+++ b/docs/devices_simplemediumlinearmotor.js.html
@@ -143,7 +143,7 @@ exports.SimpleMediumLinearMotor = SimpleMediumLinearMotor;
Documentation generated by JSDoc 3.6.3
- on Mon Feb 24th 2020
+ on Sat Apr 4th 2020
using the DocStrap template.
diff --git a/docs/devices_tachomotor.js.html b/docs/devices_tachomotor.js.html
index cc35032..b0ff030 100644
--- a/docs/devices_tachomotor.js.html
+++ b/docs/devices_tachomotor.js.html
@@ -254,7 +254,7 @@ exports.ModeMap = {
Documentation generated by JSDoc 3.6.3
- on Mon Feb 24th 2020
+ on Sat Apr 4th 2020
using the DocStrap template.
diff --git a/docs/devices_techniccolorsensor.js.html b/docs/devices_techniccolorsensor.js.html
index c11d85e..04a6034 100644
--- a/docs/devices_techniccolorsensor.js.html
+++ b/docs/devices_techniccolorsensor.js.html
@@ -191,7 +191,7 @@ exports.ModeMap = {
Documentation generated by JSDoc 3.6.3
- on Mon Feb 24th 2020
+ on Sat Apr 4th 2020
using the DocStrap template.
diff --git a/docs/devices_technicdistancesensor.js.html b/docs/devices_technicdistancesensor.js.html
index f496ce4..c6e80a2 100644
--- a/docs/devices_technicdistancesensor.js.html
+++ b/docs/devices_technicdistancesensor.js.html
@@ -189,7 +189,7 @@ exports.ModeMap = {
Documentation generated by JSDoc 3.6.3
- on Mon Feb 24th 2020
+ on Sat Apr 4th 2020
using the DocStrap template.
diff --git a/docs/devices_technicforcesensor.js.html b/docs/devices_technicforcesensor.js.html
index 7717df7..d2e46e9 100644
--- a/docs/devices_technicforcesensor.js.html
+++ b/docs/devices_technicforcesensor.js.html
@@ -189,7 +189,7 @@ exports.ModeMap = {
Documentation generated by JSDoc 3.6.3
- on Mon Feb 24th 2020
+ on Sat Apr 4th 2020
using the DocStrap template.
diff --git a/docs/devices_techniclargeangularmotor.js.html b/docs/devices_techniclargeangularmotor.js.html
index 4496b5e..de02ab6 100644
--- a/docs/devices_techniclargeangularmotor.js.html
+++ b/docs/devices_techniclargeangularmotor.js.html
@@ -143,7 +143,7 @@ exports.TechnicLargeAngularMotor = TechnicLargeAngularMotor;
Documentation generated by JSDoc 3.6.3
- on Mon Feb 24th 2020
+ on Sat Apr 4th 2020
using the DocStrap template.
diff --git a/docs/devices_techniclargelinearmotor.js.html b/docs/devices_techniclargelinearmotor.js.html
index 66bf54b..2649a51 100644
--- a/docs/devices_techniclargelinearmotor.js.html
+++ b/docs/devices_techniclargelinearmotor.js.html
@@ -143,7 +143,7 @@ exports.TechnicLargeLinearMotor = TechnicLargeLinearMotor;
Documentation generated by JSDoc 3.6.3
- on Mon Feb 24th 2020
+ on Sat Apr 4th 2020
using the DocStrap template.
diff --git a/docs/devices_technicmediumangularmotor.js.html b/docs/devices_technicmediumangularmotor.js.html
index 29b1c09..dc02c76 100644
--- a/docs/devices_technicmediumangularmotor.js.html
+++ b/docs/devices_technicmediumangularmotor.js.html
@@ -143,7 +143,7 @@ exports.TechnicMediumAngularMotor = TechnicMediumAngularMotor;
Documentation generated by JSDoc 3.6.3
- on Mon Feb 24th 2020
+ on Sat Apr 4th 2020
using the DocStrap template.
diff --git a/docs/devices_technicmediumhubaccelerometersensor.js.html b/docs/devices_technicmediumhubaccelerometersensor.js.html
index 78f1415..78d6df9 100644
--- a/docs/devices_technicmediumhubaccelerometersensor.js.html
+++ b/docs/devices_technicmediumhubaccelerometersensor.js.html
@@ -169,7 +169,7 @@ exports.ModeMap = {
Documentation generated by JSDoc 3.6.3
- on Mon Feb 24th 2020
+ on Sat Apr 4th 2020
using the DocStrap template.
diff --git a/docs/devices_technicmediumhubgyrosensor.js.html b/docs/devices_technicmediumhubgyrosensor.js.html
index df5c560..2470ea2 100644
--- a/docs/devices_technicmediumhubgyrosensor.js.html
+++ b/docs/devices_technicmediumhubgyrosensor.js.html
@@ -169,7 +169,7 @@ exports.ModeMap = {
Documentation generated by JSDoc 3.6.3
- on Mon Feb 24th 2020
+ on Sat Apr 4th 2020
using the DocStrap template.
diff --git a/docs/devices_technicmediumhubtiltsensor.js.html b/docs/devices_technicmediumhubtiltsensor.js.html
index 6a6b01b..6584e16 100644
--- a/docs/devices_technicmediumhubtiltsensor.js.html
+++ b/docs/devices_technicmediumhubtiltsensor.js.html
@@ -169,7 +169,7 @@ exports.ModeMap = {
Documentation generated by JSDoc 3.6.3
- on Mon Feb 24th 2020
+ on Sat Apr 4th 2020
using the DocStrap template.
diff --git a/docs/devices_technicxlargelinearmotor.js.html b/docs/devices_technicxlargelinearmotor.js.html
index 69c2baf..7d584f1 100644
--- a/docs/devices_technicxlargelinearmotor.js.html
+++ b/docs/devices_technicxlargelinearmotor.js.html
@@ -143,7 +143,7 @@ exports.TechnicXLargeLinearMotor = TechnicXLargeLinearMotor;
Documentation generated by JSDoc 3.6.3
- on Mon Feb 24th 2020
+ on Sat Apr 4th 2020
using the DocStrap template.
diff --git a/docs/devices_tiltsensor.js.html b/docs/devices_tiltsensor.js.html
index e5a40c1..f8e1abc 100644
--- a/docs/devices_tiltsensor.js.html
+++ b/docs/devices_tiltsensor.js.html
@@ -167,7 +167,7 @@ exports.ModeMap = {
Documentation generated by JSDoc 3.6.3
- on Mon Feb 24th 2020
+ on Sat Apr 4th 2020
using the DocStrap template.
diff --git a/docs/devices_trainmotor.js.html b/docs/devices_trainmotor.js.html
index 499a7ad..9ee0826 100644
--- a/docs/devices_trainmotor.js.html
+++ b/docs/devices_trainmotor.js.html
@@ -143,7 +143,7 @@ exports.TrainMotor = TrainMotor;
Documentation generated by JSDoc 3.6.3
- on Mon Feb 24th 2020
+ on Sat Apr 4th 2020
using the DocStrap template.
diff --git a/docs/devices_voltagesensor.js.html b/docs/devices_voltagesensor.js.html
index ec04501..f62cda4 100644
--- a/docs/devices_voltagesensor.js.html
+++ b/docs/devices_voltagesensor.js.html
@@ -190,7 +190,7 @@ const MaxVoltageRaw = {
Documentation generated by JSDoc 3.6.3
- on Mon Feb 24th 2020
+ on Sat Apr 4th 2020
using the DocStrap template.
diff --git a/docs/hubs_basehub.js.html b/docs/hubs_basehub.js.html
index 2df9b5f..9004895 100644
--- a/docs/hubs_basehub.js.html
+++ b/docs/hubs_basehub.js.html
@@ -217,16 +217,13 @@ class BaseHub extends events_1.EventEmitter {
* @returns {Promise} Resolved upon successful connect.
*/
connect() {
- return new Promise(async (connectResolve, connectReject) => {
- if (this._bleDevice.connecting) {
- return connectReject("Already connecting");
- }
- else if (this._bleDevice.connected) {
- return connectReject("Already connected");
- }
- await this._bleDevice.connect();
- return connectResolve();
- });
+ if (this._bleDevice.connecting) {
+ throw new Error("Already connecting");
+ }
+ else if (this._bleDevice.connected) {
+ throw new Error("Already connected");
+ }
+ return this._bleDevice.connect();
}
/**
* Disconnect the Hub.
@@ -353,10 +350,8 @@ class BaseHub extends events_1.EventEmitter {
wait(commands) {
return Promise.all(commands);
}
- send(message, uuid, callback) {
- if (callback) {
- callback();
- }
+ send(message, uuid) {
+ return Promise.resolve();
}
subscribe(portId, deviceType, mode) {
// NK Do nothing here
@@ -482,7 +477,7 @@ exports.BaseHub = BaseHub;
Documentation generated by JSDoc 3.6.3
- on Mon Feb 24th 2020
+ on Sat Apr 4th 2020
using the DocStrap template.
diff --git a/docs/hubs_boostmovehub.js.html b/docs/hubs_boostmovehub.js.html
index 2c3b967..defb546 100644
--- a/docs/hubs_boostmovehub.js.html
+++ b/docs/hubs_boostmovehub.js.html
@@ -182,7 +182,7 @@ exports.BoostMoveHub = BoostMoveHub;
Documentation generated by JSDoc 3.6.3
- on Mon Feb 24th 2020
+ on Sat Apr 4th 2020
using the DocStrap template.
diff --git a/docs/hubs_controlplushub.js.html b/docs/hubs_controlplushub.js.html
index fcb26cc..c12e457 100644
--- a/docs/hubs_controlplushub.js.html
+++ b/docs/hubs_controlplushub.js.html
@@ -179,7 +179,7 @@ exports.ControlPlusHub = ControlPlusHub;
Documentation generated by JSDoc 3.6.3
- on Mon Feb 24th 2020
+ on Sat Apr 4th 2020
using the DocStrap template.
diff --git a/docs/hubs_duplotrainbase.js.html b/docs/hubs_duplotrainbase.js.html
index 71d68f5..8320f60 100644
--- a/docs/hubs_duplotrainbase.js.html
+++ b/docs/hubs_duplotrainbase.js.html
@@ -109,13 +109,10 @@ class DuploTrainBase extends lpf2hub_1.LPF2Hub {
super(device, exports.PortMap, Consts.HubType.DUPLO_TRAIN_BASE);
debug("Discovered Duplo Train Base");
}
- connect() {
- return new Promise(async (resolve, reject) => {
- debug("Connecting to Duplo Train Base");
- await super.connect();
- debug("Connect completed");
- return resolve();
- });
+ async connect() {
+ debug("Connecting to Duplo Train Base");
+ await super.connect();
+ debug("Connect completed");
}
}
exports.DuploTrainBase = DuploTrainBase;
@@ -169,7 +166,7 @@ exports.PortMap = {
Documentation generated by JSDoc 3.6.3
- on Mon Feb 24th 2020
+ on Sat Apr 4th 2020
using the DocStrap template.
diff --git a/docs/hubs_hub.js.html b/docs/hubs_hub.js.html
index 061d1dd..c6235dd 100644
--- a/docs/hubs_hub.js.html
+++ b/docs/hubs_hub.js.html
@@ -114,13 +114,10 @@ class Hub extends lpf2hub_1.LPF2Hub {
peripheral.advertisement.manufacturerData.length > 3 &&
peripheral.advertisement.manufacturerData[3] === Consts.BLEManufacturerData.HUB_ID);
}
- connect() {
- return new Promise(async (resolve, reject) => {
- debug("Connecting to Powered UP Hub");
- await super.connect();
- debug("Connect completed");
- return resolve();
- });
+ async connect() {
+ debug("Connecting to Powered UP Hub");
+ await super.connect();
+ debug("Connect completed");
}
_checkFirmware(version) {
if (compare_versions_1.default("1.1.00.0004", version) === 1) {
@@ -181,7 +178,7 @@ exports.PortMap = {
Documentation generated by JSDoc 3.6.3
- on Mon Feb 24th 2020
+ on Sat Apr 4th 2020
using the DocStrap template.
diff --git a/docs/hubs_lpf2hub.js.html b/docs/hubs_lpf2hub.js.html
index 0189f19..03405cf 100644
--- a/docs/hubs_lpf2hub.js.html
+++ b/docs/hubs_lpf2hub.js.html
@@ -102,23 +102,19 @@ class LPF2Hub extends basehub_1.BaseHub {
this._messageBuffer = Buffer.alloc(0);
this._propertyRequestCallbacks = {};
}
- connect() {
- return new Promise(async (resolve, reject) => {
- debug("LPF2Hub connecting");
- await super.connect();
- await this._bleDevice.discoverCharacteristicsForService(Consts.BLEService.LPF2_HUB);
- this._bleDevice.subscribeToCharacteristic(Consts.BLECharacteristic.LPF2_ALL, this._parseMessage.bind(this));
- await this.sleep(500);
- this._requestHubPropertyReports(0x02); // Activate button reports
- await this._requestHubPropertyValue(0x03); // Request firmware version
- await this._requestHubPropertyValue(0x04); // Request hardware version
- this._requestHubPropertyReports(0x05); // Activate RSSI updates
- this._requestHubPropertyReports(0x06); // Activate battery level reports
- await this._requestHubPropertyValue(0x0d); // Request primary MAC address
- this.emit("connect");
- debug("LPF2Hub connected");
- resolve();
- });
+ async connect() {
+ debug("LPF2Hub connecting");
+ await super.connect();
+ await this._bleDevice.discoverCharacteristicsForService(Consts.BLEService.LPF2_HUB);
+ this._bleDevice.subscribeToCharacteristic(Consts.BLECharacteristic.LPF2_ALL, this._parseMessage.bind(this));
+ await this._requestHubPropertyReports(0x02); // Activate button reports
+ await this._requestHubPropertyValue(0x03); // Request firmware version
+ await this._requestHubPropertyValue(0x04); // Request hardware version
+ await this._requestHubPropertyReports(0x05); // Activate RSSI updates
+ await this._requestHubPropertyReports(0x06); // Activate battery level reports
+ await this._requestHubPropertyValue(0x0d); // Request primary MAC address
+ this.emit("connect");
+ debug("LPF2Hub connected");
}
/**
* Shutdown the Hub.
@@ -126,11 +122,7 @@ class LPF2Hub extends basehub_1.BaseHub {
* @returns {Promise} Resolved upon successful disconnect.
*/
shutdown() {
- return new Promise((resolve, reject) => {
- this.send(Buffer.from([0x02, 0x01]), Consts.BLECharacteristic.LPF2_ALL, () => {
- return resolve();
- });
- });
+ return this.send(Buffer.from([0x02, 0x01]), Consts.BLECharacteristic.LPF2_ALL);
}
/**
* Set the name of the Hub.
@@ -138,31 +130,28 @@ class LPF2Hub extends basehub_1.BaseHub {
* @param {string} name New name of the hub (14 characters or less, ASCII only).
* @returns {Promise} Resolved upon successful issuance of command.
*/
- setName(name) {
+ async setName(name) {
if (name.length > 14) {
throw new Error("Name must be 14 characters or less");
}
- return new Promise((resolve, reject) => {
- let data = Buffer.from([0x01, 0x01, 0x01]);
- data = Buffer.concat([data, Buffer.from(name, "ascii")]);
- // Send this twice, as sometimes the first time doesn't take
- this.send(data, Consts.BLECharacteristic.LPF2_ALL);
- this.send(data, Consts.BLECharacteristic.LPF2_ALL);
- this._name = name;
- return resolve();
- });
+ let data = Buffer.from([0x01, 0x01, 0x01]);
+ data = Buffer.concat([data, Buffer.from(name, "ascii")]);
+ // Send this twice, as sometimes the first time doesn't take
+ await this.send(data, Consts.BLECharacteristic.LPF2_ALL);
+ await this.send(data, Consts.BLECharacteristic.LPF2_ALL);
+ this._name = name;
}
- send(message, uuid, callback) {
+ send(message, uuid) {
message = Buffer.concat([Buffer.alloc(2), message]);
message[0] = message.length;
debug("Sent Message (LPF2_ALL)", message);
- this._bleDevice.writeToCharacteristic(uuid, message, callback);
+ return this._bleDevice.writeToCharacteristic(uuid, message);
}
subscribe(portId, deviceType, mode) {
- this.send(Buffer.from([0x41, portId, mode, 0x01, 0x00, 0x00, 0x00, 0x01]), Consts.BLECharacteristic.LPF2_ALL);
+ return this.send(Buffer.from([0x41, portId, mode, 0x01, 0x00, 0x00, 0x00, 0x01]), Consts.BLECharacteristic.LPF2_ALL);
}
unsubscribe(portId, mode) {
- this.send(Buffer.from([0x41, portId, mode, 0x01, 0x00, 0x00, 0x00, 0x00]), Consts.BLECharacteristic.LPF2_ALL);
+ return this.send(Buffer.from([0x41, portId, mode, 0x01, 0x00, 0x00, 0x00, 0x00]), Consts.BLECharacteristic.LPF2_ALL);
}
/**
* Combines two ports with into a single virtual port.
@@ -185,7 +174,7 @@ class LPF2Hub extends basehub_1.BaseHub {
if (firstDevice.type !== secondDevice.type) {
throw new Error(`Both devices must be of the same type to create a virtual port`);
}
- this.send(Buffer.from([0x61, 0x01, firstDevice.portId, secondDevice.portId]), Consts.BLECharacteristic.LPF2_ALL);
+ return this.send(Buffer.from([0x61, 0x01, firstDevice.portId, secondDevice.portId]), Consts.BLECharacteristic.LPF2_ALL);
}
_checkFirmware(version) {
return;
@@ -251,7 +240,7 @@ class LPF2Hub extends basehub_1.BaseHub {
});
}
_requestHubPropertyReports(property) {
- this.send(Buffer.from([0x01, property, 0x02]), Consts.BLECharacteristic.LPF2_ALL);
+ return this.send(Buffer.from([0x01, property, 0x02]), Consts.BLECharacteristic.LPF2_ALL);
}
_parseHubPropertyResponse(message) {
// Button press reports
@@ -301,7 +290,7 @@ class LPF2Hub extends basehub_1.BaseHub {
}
}
}
- _parsePortMessage(message) {
+ async _parsePortMessage(message) {
const portId = message[3];
const event = message[4];
const deviceType = event ? message.readUInt16LE(5) : 0;
@@ -313,7 +302,7 @@ class LPF2Hub extends basehub_1.BaseHub {
const hwVersion = utils_1.decodeVersion(message.readInt32LE(7));
const swVersion = utils_1.decodeVersion(message.readInt32LE(11));
modeInfoDebug(`Port ${utils_1.toHex(portId)}, hardware version ${hwVersion}, software version ${swVersion}`);
- this._sendPortInformationRequest(portId);
+ await this._sendPortInformationRequest(portId);
}
const device = this._createDevice(deviceType, portId);
this._attachDevice(device);
@@ -345,11 +334,11 @@ class LPF2Hub extends basehub_1.BaseHub {
this._attachDevice(device);
}
}
- _sendPortInformationRequest(port) {
- this.send(Buffer.from([0x21, port, 0x01]), Consts.BLECharacteristic.LPF2_ALL);
- this.send(Buffer.from([0x21, port, 0x02]), Consts.BLECharacteristic.LPF2_ALL); // Mode combinations
+ async _sendPortInformationRequest(port) {
+ await this.send(Buffer.from([0x21, port, 0x01]), Consts.BLECharacteristic.LPF2_ALL);
+ await this.send(Buffer.from([0x21, port, 0x02]), Consts.BLECharacteristic.LPF2_ALL); // Mode combinations
}
- _parsePortInformationResponse(message) {
+ async _parsePortInformationResponse(message) {
const port = message[3];
if (message[4] === 2) {
const modeCombinationMasks = [];
@@ -364,16 +353,16 @@ class LPF2Hub extends basehub_1.BaseHub {
const output = utils_1.toBin(message.readUInt16LE(9), count);
modeInfoDebug(`Port ${utils_1.toHex(port)}, total modes ${count}, input modes ${input}, output modes ${output}`);
for (let i = 0; i < count; i++) {
- this._sendModeInformationRequest(port, i, 0x00); // Mode Name
- this._sendModeInformationRequest(port, i, 0x01); // RAW Range
- this._sendModeInformationRequest(port, i, 0x02); // PCT Range
- this._sendModeInformationRequest(port, i, 0x03); // SI Range
- this._sendModeInformationRequest(port, i, 0x04); // SI Symbol
- this._sendModeInformationRequest(port, i, 0x80); // Value Format
+ await this._sendModeInformationRequest(port, i, 0x00); // Mode Name
+ await this._sendModeInformationRequest(port, i, 0x01); // RAW Range
+ await this._sendModeInformationRequest(port, i, 0x02); // PCT Range
+ await this._sendModeInformationRequest(port, i, 0x03); // SI Range
+ await this._sendModeInformationRequest(port, i, 0x04); // SI Symbol
+ await this._sendModeInformationRequest(port, i, 0x80); // Value Format
}
}
_sendModeInformationRequest(port, mode, type) {
- this.send(Buffer.from([0x22, port, mode, type]), Consts.BLECharacteristic.LPF2_ALL);
+ return this.send(Buffer.from([0x22, port, mode, type]), Consts.BLECharacteristic.LPF2_ALL);
}
_parseModeInformationResponse(message) {
const port = utils_1.toHex(message[3]);
@@ -467,7 +456,7 @@ exports.LPF2Hub = LPF2Hub;
Documentation generated by JSDoc 3.6.3
- on Mon Feb 24th 2020
+ on Sat Apr 4th 2020
using the DocStrap template.
diff --git a/docs/hubs_movehub.js.html b/docs/hubs_movehub.js.html
index 65cf59e..1cc9b47 100644
--- a/docs/hubs_movehub.js.html
+++ b/docs/hubs_movehub.js.html
@@ -113,13 +113,10 @@ class MoveHub extends lpf2hub_1.LPF2Hub {
super(device, exports.PortMap, Consts.HubType.MOVE_HUB);
debug("Discovered Move Hub");
}
- connect() {
- return new Promise(async (resolve, reject) => {
- debug("Connecting to Move Hub");
- await super.connect();
- debug("Connect completed");
- return resolve();
- });
+ async connect() {
+ debug("Connecting to Move Hub");
+ await super.connect();
+ debug("Connect completed");
}
_checkFirmware(version) {
if (compare_versions_1.default("2.0.00.0017", version) === 1) {
@@ -183,7 +180,7 @@ exports.PortMap = {
Documentation generated by JSDoc 3.6.3
- on Mon Feb 24th 2020
+ on Sat Apr 4th 2020
using the DocStrap template.
diff --git a/docs/hubs_puphub.js.html b/docs/hubs_puphub.js.html
index 0d749eb..c5e26c0 100644
--- a/docs/hubs_puphub.js.html
+++ b/docs/hubs_puphub.js.html
@@ -179,7 +179,7 @@ exports.PUPHub = PUPHub;
Documentation generated by JSDoc 3.6.3
- on Mon Feb 24th 2020
+ on Sat Apr 4th 2020
using the DocStrap template.
diff --git a/docs/hubs_pupremote.js.html b/docs/hubs_pupremote.js.html
index 525a59a..9403083 100644
--- a/docs/hubs_pupremote.js.html
+++ b/docs/hubs_pupremote.js.html
@@ -172,7 +172,7 @@ exports.PUPRemote = PUPRemote;
Documentation generated by JSDoc 3.6.3
- on Mon Feb 24th 2020
+ on Sat Apr 4th 2020
using the DocStrap template.
diff --git a/docs/hubs_remotecontrol.js.html b/docs/hubs_remotecontrol.js.html
index cb5f467..4f14058 100644
--- a/docs/hubs_remotecontrol.js.html
+++ b/docs/hubs_remotecontrol.js.html
@@ -109,13 +109,10 @@ class RemoteControl extends lpf2hub_1.LPF2Hub {
super(device, exports.PortMap, Consts.HubType.REMOTE_CONTROL);
debug("Discovered Powered UP Remote");
}
- connect() {
- return new Promise(async (resolve, reject) => {
- debug("Connecting to Powered UP Remote");
- await super.connect();
- debug("Connect completed");
- return resolve();
- });
+ async connect() {
+ debug("Connecting to Powered UP Remote");
+ await super.connect();
+ debug("Connect completed");
}
}
exports.RemoteControl = RemoteControl;
@@ -171,7 +168,7 @@ exports.PortMap = {
Documentation generated by JSDoc 3.6.3
- on Mon Feb 24th 2020
+ on Sat Apr 4th 2020
using the DocStrap template.
diff --git a/docs/hubs_technicmediumhub.js.html b/docs/hubs_technicmediumhub.js.html
index f208bae..473df7a 100644
--- a/docs/hubs_technicmediumhub.js.html
+++ b/docs/hubs_technicmediumhub.js.html
@@ -109,14 +109,11 @@ class TechnicMediumHub extends lpf2hub_1.LPF2Hub {
super(device, exports.PortMap, Consts.HubType.TECHNIC_MEDIUM_HUB);
debug("Discovered Control+ Hub");
}
- connect() {
- return new Promise(async (resolve, reject) => {
- debug("Connecting to Control+ Hub");
- await super.connect();
- this.send(Buffer.from([0x41, 0x3d, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x01]), Consts.BLECharacteristic.LPF2_ALL); // Temperature
- debug("Connect completed");
- return resolve();
- });
+ async connect() {
+ debug("Connecting to Control+ Hub");
+ await super.connect();
+ await this.send(Buffer.from([0x41, 0x3d, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x01]), Consts.BLECharacteristic.LPF2_ALL); // Temperature
+ debug("Connect completed");
}
}
exports.TechnicMediumHub = TechnicMediumHub;
@@ -177,7 +174,7 @@ exports.PortMap = {
Documentation generated by JSDoc 3.6.3
- on Mon Feb 24th 2020
+ on Sat Apr 4th 2020
using the DocStrap template.
diff --git a/docs/hubs_wedo2smarthub.js.html b/docs/hubs_wedo2smarthub.js.html
index 89ebc50..3b9c84e 100644
--- a/docs/hubs_wedo2smarthub.js.html
+++ b/docs/hubs_wedo2smarthub.js.html
@@ -168,11 +168,7 @@ class WeDo2SmartHub extends basehub_1.BaseHub {
* @returns {Promise} Resolved upon successful disconnect.
*/
shutdown() {
- return new Promise((resolve, reject) => {
- this.send(Buffer.from([0x00]), Consts.BLECharacteristic.WEDO2_DISCONNECT, () => {
- return resolve();
- });
- });
+ return this.send(Buffer.from([0x00]), Consts.BLECharacteristic.WEDO2_DISCONNECT);
}
/**
* Set the name of the Hub.
@@ -193,11 +189,11 @@ class WeDo2SmartHub extends basehub_1.BaseHub {
return resolve();
});
}
- send(message, uuid, callback) {
+ send(message, uuid) {
if (debug.enabled) {
debug(`Sent Message (${this._getCharacteristicNameFromUUID(uuid)})`, message);
}
- this._bleDevice.writeToCharacteristic(uuid, message, callback);
+ return this._bleDevice.writeToCharacteristic(uuid, message);
}
subscribe(portId, deviceType, mode) {
this.send(Buffer.from([0x01, 0x02, portId, deviceType, mode, 0x01, 0x00, 0x00, 0x00, 0x00, 0x01]), Consts.BLECharacteristic.WEDO2_PORT_TYPE_WRITE);
@@ -323,7 +319,7 @@ exports.PortMap = {
Documentation generated by JSDoc 3.6.3
- on Mon Feb 24th 2020
+ on Sat Apr 4th 2020
using the DocStrap template.
diff --git a/docs/index.html b/docs/index.html
index 71d39a8..46d981d 100644
--- a/docs/index.html
+++ b/docs/index.html
@@ -410,7 +410,7 @@ console.log("Scanning for Hubs...");
Documentation generated by JSDoc 3.6.3
- on Mon Feb 24th 2020
+ on Sat Apr 4th 2020
using the DocStrap template.
diff --git a/docs/quicksearch.html b/docs/quicksearch.html
index e4b37d1..bc1c6f0 100644
--- a/docs/quicksearch.html
+++ b/docs/quicksearch.html
@@ -7,7 +7,7 @@