node-poweredup 6.10.0 → 8.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.drone.yml +1 -0
- package/.gitmodules +3 -0
- package/{jsdoc.conf.json → .jsdoc.json} +14 -1
- package/README.md +47 -42
- package/dist/browser/poweredup.js +1 -1
- package/dist/browser/poweredup.js.map +1 -1
- package/dist/node/color.d.ts +6 -0
- package/dist/node/color.js +38 -0
- package/dist/node/color.js.map +1 -0
- package/dist/node/consts.d.ts +48 -27
- package/dist/node/consts.js +53 -31
- package/dist/node/consts.js.map +1 -1
- package/dist/node/devices/absolutemotor.js +8 -9
- package/dist/node/devices/absolutemotor.js.map +1 -1
- package/dist/node/devices/basicmotor.js +2 -2
- package/dist/node/devices/basicmotor.js.map +1 -1
- package/dist/node/devices/colordistancesensor.d.ts +11 -0
- package/dist/node/devices/colordistancesensor.js +95 -2
- package/dist/node/devices/colordistancesensor.js.map +1 -1
- package/dist/node/devices/device.d.ts +2 -2
- package/dist/node/devices/device.js +10 -5
- package/dist/node/devices/device.js.map +1 -1
- package/dist/node/devices/duplotrainbasecolorsensor.d.ts +2 -1
- package/dist/node/devices/duplotrainbasecolorsensor.js +15 -2
- package/dist/node/devices/duplotrainbasecolorsensor.js.map +1 -1
- package/dist/node/devices/light.js +1 -1
- package/dist/node/devices/light.js.map +1 -1
- package/dist/node/devices/tachomotor.js +10 -12
- package/dist/node/devices/tachomotor.js.map +1 -1
- package/dist/node/devices/technic3x3colorlightmatrix.d.ts +22 -0
- package/dist/node/devices/technic3x3colorlightmatrix.js +77 -0
- package/dist/node/devices/technic3x3colorlightmatrix.js.map +1 -0
- package/dist/node/devices/techniccolorsensor.js +2 -1
- package/dist/node/devices/techniccolorsensor.js.map +1 -1
- package/dist/node/devices/technicmediumhubtiltsensor.d.ts +25 -1
- package/dist/node/devices/technicmediumhubtiltsensor.js +70 -2
- package/dist/node/devices/technicmediumhubtiltsensor.js.map +1 -1
- package/dist/node/devices/technicsmallangularmotor.d.ts +12 -0
- package/dist/node/devices/technicsmallangularmotor.js +35 -0
- package/dist/node/devices/technicsmallangularmotor.js.map +1 -0
- package/dist/node/hubs/basehub.js +4 -0
- package/dist/node/hubs/basehub.js.map +1 -1
- package/dist/node/hubs/hub.js +1 -1
- package/dist/node/hubs/hub.js.map +1 -1
- package/dist/node/hubs/lpf2hub.js +19 -21
- package/dist/node/hubs/lpf2hub.js.map +1 -1
- package/dist/node/hubs/movehub.js +1 -1
- package/dist/node/hubs/movehub.js.map +1 -1
- package/dist/node/hubs/technicmediumhub.js +1 -1
- package/dist/node/hubs/technicmediumhub.js.map +1 -1
- package/dist/node/hubs/technicsmallhub.d.ts +18 -0
- package/dist/node/hubs/technicsmallhub.js +64 -0
- package/dist/node/hubs/technicsmallhub.js.map +1 -0
- package/dist/node/index-browser.js +6 -0
- package/dist/node/index-browser.js.map +1 -1
- package/dist/node/index-node.d.ts +4 -1
- package/dist/node/index-node.js +7 -1
- package/dist/node/index-node.js.map +1 -1
- package/dist/node/poweredup-browser.js +8 -1
- package/dist/node/poweredup-browser.js.map +1 -1
- package/dist/node/poweredup-node.js +28 -1
- package/dist/node/poweredup-node.js.map +1 -1
- package/dist/node/utils.d.ts +1 -1
- package/dist/node/utils.js +10 -3
- package/dist/node/utils.js.map +1 -1
- package/docs/AbsoluteMotor.html +1220 -1405
- package/docs/BaseHub.html +787 -872
- package/docs/BasicMotor.html +923 -1078
- package/docs/ColorDistanceSensor.html +2188 -1540
- package/docs/CurrentSensor.html +711 -800
- package/docs/Device.html +574 -665
- package/docs/DuploTrainBase.html +1255 -1375
- package/docs/DuploTrainBaseColorSensor.html +1049 -978
- package/docs/DuploTrainBaseMotor.html +958 -1113
- package/docs/DuploTrainBaseSpeaker.html +793 -916
- package/docs/DuploTraniBaseSpeedometer.html +628 -719
- package/docs/Hub.html +5621 -2397
- package/docs/HubLED.html +831 -944
- package/docs/LPF2Hub.html +1215 -1335
- package/docs/Light.html +831 -944
- package/docs/Mario.html +1255 -1420
- package/docs/MarioAccelerometer.html +834 -911
- package/docs/MarioBarcodeSensor.html +834 -911
- package/docs/MarioPantsSensor.html +711 -800
- package/docs/MediumLinearMotor.html +861 -1000
- package/docs/MotionSensor.html +711 -800
- package/docs/MoveHub.html +1255 -1420
- package/docs/MoveHubMediumLinearMotor.html +861 -1000
- package/docs/MoveHubTiltSensor.html +730 -814
- package/docs/PiezoBuzzer.html +732 -834
- package/docs/PoweredUP.html +4322 -0
- package/docs/RemoteControl.html +1255 -1420
- package/docs/RemoteControlButton.html +711 -800
- package/docs/SimpleMediumLinearMotor.html +628 -719
- package/docs/TachoMotor.html +1644 -1835
- package/docs/Technic3x3ColorLightMatrix.html +1181 -0
- package/docs/TechnicColorSensor.html +1008 -1099
- package/docs/TechnicDistanceSensor.html +939 -1027
- package/docs/TechnicForceSensor.html +883 -968
- package/docs/TechnicLargeAngularMotor.html +1254 -1439
- package/docs/TechnicLargeLinearMotor.html +1254 -1439
- package/docs/TechnicMediumAngularMotor.html +1254 -1439
- package/docs/TechnicMediumHub.html +1255 -1420
- package/docs/TechnicMediumHubAccelerometerSensor.html +749 -828
- package/docs/TechnicMediumHubGyroSensor.html +749 -828
- package/docs/TechnicMediumHubTiltSensor.html +1340 -831
- package/docs/TechnicSmallAngularMotor.html +2073 -0
- package/docs/TechnicXLargeLinearMotor.html +1254 -1439
- package/docs/TiltSensor.html +730 -814
- package/docs/TrainMotor.html +958 -1113
- package/docs/VoltageSensor.html +711 -800
- package/docs/WeDo2SmartHub.html +1112 -1221
- package/docs/consts.js.html +791 -0
- package/docs/devices_absolutemotor.js.html +97 -200
- package/docs/devices_basicmotor.js.html +91 -193
- package/docs/devices_colordistancesensor.js.html +184 -193
- package/docs/devices_currentsensor.js.html +89 -191
- package/docs/devices_device.js.html +99 -196
- package/docs/devices_duplotrainbasecolorsensor.js.html +104 -193
- package/docs/devices_duplotrainbasemotor.js.html +92 -194
- package/docs/devices_duplotrainbasespeaker.js.html +89 -191
- package/docs/devices_duplotrainbasespeedometer.js.html +89 -191
- package/docs/devices_hubled.js.html +89 -191
- package/docs/devices_light.js.html +90 -192
- package/docs/devices_marioaccelerometer.js.html +89 -191
- package/docs/devices_mariobarcodesensor.js.html +89 -191
- package/docs/devices_mariopantssensor.js.html +89 -191
- package/docs/devices_mediumlinearmotor.js.html +92 -194
- package/docs/devices_motionsensor.js.html +89 -191
- package/docs/devices_movehubmediumlinearmotor.js.html +92 -194
- package/docs/devices_movehubtiltsensor.js.html +89 -191
- package/docs/devices_piezobuzzer.js.html +89 -191
- package/docs/devices_remotecontrolbutton.js.html +89 -191
- package/docs/devices_simplemediumlinearmotor.js.html +92 -194
- package/docs/devices_tachomotor.js.html +99 -203
- package/docs/devices_technic3x3colorlightmatrix.js.html +190 -0
- package/docs/devices_techniccolorsensor.js.html +91 -192
- package/docs/devices_technicdistancesensor.js.html +89 -191
- package/docs/devices_technicforcesensor.js.html +89 -191
- package/docs/devices_techniclargeangularmotor.js.html +92 -194
- package/docs/devices_techniclargelinearmotor.js.html +92 -194
- package/docs/devices_technicmediumangularmotor.js.html +92 -194
- package/docs/devices_technicmediumhubaccelerometersensor.js.html +89 -191
- package/docs/devices_technicmediumhubgyrosensor.js.html +89 -191
- package/docs/devices_technicmediumhubtiltsensor.js.html +159 -193
- package/docs/devices_technicsmallangularmotor.js.html +148 -0
- package/docs/devices_technicxlargelinearmotor.js.html +92 -194
- package/docs/devices_tiltsensor.js.html +89 -191
- package/docs/devices_trainmotor.js.html +92 -194
- package/docs/devices_voltagesensor.js.html +89 -191
- package/docs/fonts/OpenSans-Bold-webfont.eot +0 -0
- package/docs/fonts/OpenSans-Bold-webfont.svg +1830 -0
- package/docs/fonts/OpenSans-Bold-webfont.woff +0 -0
- package/docs/fonts/OpenSans-BoldItalic-webfont.eot +0 -0
- package/docs/fonts/OpenSans-BoldItalic-webfont.svg +1830 -0
- package/docs/fonts/OpenSans-BoldItalic-webfont.woff +0 -0
- package/docs/fonts/OpenSans-Italic-webfont.eot +0 -0
- package/docs/fonts/OpenSans-Italic-webfont.svg +1830 -0
- package/docs/fonts/OpenSans-Italic-webfont.woff +0 -0
- package/docs/fonts/OpenSans-Light-webfont.eot +0 -0
- package/docs/fonts/OpenSans-Light-webfont.svg +1831 -0
- package/docs/fonts/OpenSans-Light-webfont.woff +0 -0
- package/docs/fonts/OpenSans-LightItalic-webfont.eot +0 -0
- package/docs/fonts/OpenSans-LightItalic-webfont.svg +1835 -0
- package/docs/fonts/OpenSans-LightItalic-webfont.woff +0 -0
- package/docs/fonts/OpenSans-Regular-webfont.eot +0 -0
- package/docs/fonts/OpenSans-Regular-webfont.svg +1831 -0
- package/docs/fonts/OpenSans-Regular-webfont.woff +0 -0
- package/docs/fonts/OpenSans-Semibold-webfont.eot +0 -0
- package/docs/fonts/OpenSans-Semibold-webfont.svg +1830 -0
- package/docs/fonts/OpenSans-Semibold-webfont.ttf +0 -0
- package/docs/fonts/OpenSans-Semibold-webfont.woff +0 -0
- package/docs/fonts/OpenSans-SemiboldItalic-webfont.eot +0 -0
- package/docs/fonts/OpenSans-SemiboldItalic-webfont.svg +1830 -0
- package/docs/fonts/OpenSans-SemiboldItalic-webfont.ttf +0 -0
- package/docs/fonts/OpenSans-SemiboldItalic-webfont.woff +0 -0
- package/docs/global.html +9829 -0
- package/docs/hubs_basehub.js.html +93 -191
- package/docs/hubs_duplotrainbase.js.html +89 -191
- package/docs/hubs_hub.js.html +90 -192
- package/docs/hubs_lpf2hub.js.html +108 -212
- package/docs/hubs_mario.js.html +89 -191
- package/docs/hubs_movehub.js.html +90 -192
- package/docs/hubs_remotecontrol.js.html +89 -191
- package/docs/hubs_technicmediumhub.js.html +90 -192
- package/docs/hubs_technicsmallhub.js.html +177 -0
- package/docs/hubs_wedo2smarthub.js.html +89 -191
- package/docs/icons/home.svg +4 -0
- package/docs/icons/search.svg +4 -0
- package/docs/index.html +143 -236
- package/docs/poweredup-browser.js.html +348 -0
- package/docs/poweredup-node.js.html +312 -0
- package/docs/scripts/linenumber.js +23 -0
- package/docs/scripts/pagelocation.js +89 -0
- package/docs/styles/collapse.css +27 -0
- package/docs/styles/jsdoc-default.css +953 -0
- package/docs/styles/prettify-jsdoc.css +111 -0
- package/docs/styles/prettify-tomorrow.css +15 -9
- package/jsdoc-template/braintree/CHANGELOG.md +31 -0
- package/jsdoc-template/braintree/LICENSE +27 -0
- package/jsdoc-template/braintree/README.md +90 -0
- package/jsdoc-template/braintree/package.json +39 -0
- package/jsdoc-template/braintree/publish.js +675 -0
- package/jsdoc-template/braintree/static/fonts/OpenSans-Bold-webfont.eot +0 -0
- package/jsdoc-template/braintree/static/fonts/OpenSans-Bold-webfont.svg +1830 -0
- package/jsdoc-template/braintree/static/fonts/OpenSans-Bold-webfont.woff +0 -0
- package/jsdoc-template/braintree/static/fonts/OpenSans-BoldItalic-webfont.eot +0 -0
- package/jsdoc-template/braintree/static/fonts/OpenSans-BoldItalic-webfont.svg +1830 -0
- package/jsdoc-template/braintree/static/fonts/OpenSans-BoldItalic-webfont.woff +0 -0
- package/jsdoc-template/braintree/static/fonts/OpenSans-Italic-webfont.eot +0 -0
- package/jsdoc-template/braintree/static/fonts/OpenSans-Italic-webfont.svg +1830 -0
- package/jsdoc-template/braintree/static/fonts/OpenSans-Italic-webfont.woff +0 -0
- package/jsdoc-template/braintree/static/fonts/OpenSans-Light-webfont.eot +0 -0
- package/jsdoc-template/braintree/static/fonts/OpenSans-Light-webfont.svg +1831 -0
- package/jsdoc-template/braintree/static/fonts/OpenSans-Light-webfont.woff +0 -0
- package/jsdoc-template/braintree/static/fonts/OpenSans-LightItalic-webfont.eot +0 -0
- package/jsdoc-template/braintree/static/fonts/OpenSans-LightItalic-webfont.svg +1835 -0
- package/jsdoc-template/braintree/static/fonts/OpenSans-LightItalic-webfont.woff +0 -0
- package/jsdoc-template/braintree/static/fonts/OpenSans-Regular-webfont.eot +0 -0
- package/jsdoc-template/braintree/static/fonts/OpenSans-Regular-webfont.svg +1831 -0
- package/jsdoc-template/braintree/static/fonts/OpenSans-Regular-webfont.woff +0 -0
- package/jsdoc-template/braintree/static/fonts/OpenSans-Semibold-webfont.eot +0 -0
- package/jsdoc-template/braintree/static/fonts/OpenSans-Semibold-webfont.svg +1830 -0
- package/jsdoc-template/braintree/static/fonts/OpenSans-Semibold-webfont.ttf +0 -0
- package/jsdoc-template/braintree/static/fonts/OpenSans-Semibold-webfont.woff +0 -0
- package/jsdoc-template/braintree/static/fonts/OpenSans-SemiboldItalic-webfont.eot +0 -0
- package/jsdoc-template/braintree/static/fonts/OpenSans-SemiboldItalic-webfont.svg +1830 -0
- package/jsdoc-template/braintree/static/fonts/OpenSans-SemiboldItalic-webfont.ttf +0 -0
- package/jsdoc-template/braintree/static/fonts/OpenSans-SemiboldItalic-webfont.woff +0 -0
- package/jsdoc-template/braintree/static/icons/home.svg +4 -0
- package/jsdoc-template/braintree/static/icons/search.svg +4 -0
- package/jsdoc-template/braintree/static/scripts/linenumber.js +23 -0
- package/jsdoc-template/braintree/static/scripts/pagelocation.js +89 -0
- package/jsdoc-template/braintree/static/styles/collapse.css +27 -0
- package/jsdoc-template/braintree/static/styles/jsdoc-default.css +953 -0
- package/jsdoc-template/braintree/static/styles/prettify-jsdoc.css +111 -0
- package/jsdoc-template/braintree/static/styles/prettify-tomorrow.css +138 -0
- package/jsdoc-template/braintree/tmpl/augments.tmpl +10 -0
- package/jsdoc-template/braintree/tmpl/container.tmpl +213 -0
- package/jsdoc-template/braintree/tmpl/details.tmpl +223 -0
- package/jsdoc-template/braintree/tmpl/example.tmpl +2 -0
- package/jsdoc-template/braintree/tmpl/examples.tmpl +14 -0
- package/jsdoc-template/braintree/tmpl/exceptions.tmpl +28 -0
- package/jsdoc-template/braintree/tmpl/layout.tmpl +150 -0
- package/jsdoc-template/braintree/tmpl/mainpage.tmpl +9 -0
- package/jsdoc-template/braintree/tmpl/members.tmpl +38 -0
- package/jsdoc-template/braintree/tmpl/method.tmpl +128 -0
- package/jsdoc-template/braintree/tmpl/params.tmpl +125 -0
- package/jsdoc-template/braintree/tmpl/properties.tmpl +111 -0
- package/jsdoc-template/braintree/tmpl/returns.tmpl +17 -0
- package/jsdoc-template/braintree/tmpl/source.tmpl +9 -0
- package/jsdoc-template/braintree/tmpl/tutorial.tmpl +23 -0
- package/jsdoc-template/braintree/tmpl/type.tmpl +11 -0
- package/package.json +14 -15
- package/src/color.ts +20 -0
- package/src/consts.ts +47 -26
- package/src/devices/absolutemotor.ts +2 -3
- package/src/devices/colordistancesensor.ts +98 -3
- package/src/devices/device.ts +9 -6
- package/src/devices/duplotrainbasecolorsensor.ts +17 -2
- package/src/devices/tachomotor.ts +4 -6
- package/src/devices/technic3x3colorlightmatrix.ts +64 -0
- package/src/devices/techniccolorsensor.ts +2 -1
- package/src/devices/technicmediumhubtiltsensor.ts +75 -3
- package/src/devices/technicsmallangularmotor.ts +17 -0
- package/src/hubs/basehub.ts +4 -0
- package/src/hubs/lpf2hub.ts +7 -11
- package/src/hubs/technicmediumhub.ts +1 -1
- package/src/hubs/technicsmallhub.ts +60 -0
- package/src/index-browser.ts +6 -0
- package/src/index-node.ts +6 -0
- package/src/poweredup-browser.ts +8 -1
- package/src/poweredup-node.ts +7 -1
- package/src/utils.ts +7 -0
- package/docs/classes.list.html +0 -8654
- package/docs/fonts/glyphicons-halflings-regular.eot +0 -0
- package/docs/fonts/glyphicons-halflings-regular.svg +0 -288
- package/docs/fonts/glyphicons-halflings-regular.ttf +0 -0
- package/docs/fonts/glyphicons-halflings-regular.woff +0 -0
- package/docs/fonts/glyphicons-halflings-regular.woff2 +0 -0
- package/docs/img/glyphicons-halflings-white.png +0 -0
- package/docs/img/glyphicons-halflings.png +0 -0
- package/docs/quicksearch.html +0 -31
- package/docs/scripts/docstrap.lib.js +0 -11
- package/docs/scripts/fulltext-search-ui.js +0 -89
- package/docs/scripts/fulltext-search.js +0 -36
- package/docs/scripts/lunr.min.js +0 -6
- package/docs/scripts/prettify/Apache-License-2.0.txt +0 -202
- package/docs/scripts/prettify/jquery.min.js +0 -6
- package/docs/scripts/prettify/lang-css.js +0 -21
- package/docs/scripts/prettify/prettify.js +0 -496
- package/docs/scripts/sunlight.js +0 -1157
- package/docs/scripts/toc.js +0 -203
- package/docs/styles/darkstrap.css +0 -960
- package/docs/styles/site.cerulean.css +0 -7008
- package/docs/styles/site.cosmo.css +0 -7061
- package/docs/styles/site.cyborg.css +0 -7048
- package/docs/styles/site.darkly.css +0 -7171
- package/docs/styles/site.darkstrap.css +0 -5638
- package/docs/styles/site.dibs-bootstrap.css +0 -5899
- package/docs/styles/site.flatly.css +0 -7147
- package/docs/styles/site.journal.css +0 -6973
- package/docs/styles/site.lumen.css +0 -7298
- package/docs/styles/site.paper.css +0 -7623
- package/docs/styles/site.readable.css +0 -6997
- package/docs/styles/site.sandstone.css +0 -7035
- package/docs/styles/site.simplex.css +0 -7023
- package/docs/styles/site.slate.css +0 -7343
- package/docs/styles/site.spacelab.css +0 -7055
- package/docs/styles/site.superhero.css +0 -7131
- package/docs/styles/site.united.css +0 -6895
- package/docs/styles/site.yeti.css +0 -7195
- package/docs/styles/sunlight.dark.css +0 -345
- package/docs/styles/sunlight.default.css +0 -344
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { AbsoluteMotor } from "./absolutemotor";
|
|
2
|
+
|
|
3
|
+
import { IDeviceInterface } from "../interfaces";
|
|
4
|
+
|
|
5
|
+
import * as Consts from "../consts";
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* @class TechnicSmallAngularMotor
|
|
9
|
+
* @extends AbsoluteMotor
|
|
10
|
+
*/
|
|
11
|
+
export class TechnicSmallAngularMotor extends AbsoluteMotor {
|
|
12
|
+
|
|
13
|
+
constructor (hub: IDeviceInterface, portId: number, modeMap: {[event: string]: number} = {}, type: Consts.DeviceType = Consts.DeviceType.TECHNIC_SMALL_ANGULAR_MOTOR) {
|
|
14
|
+
super(hub, portId, {}, type);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
}
|
package/src/hubs/basehub.ts
CHANGED
|
@@ -28,6 +28,7 @@ import { TechnicDistanceSensor } from "../devices/technicdistancesensor";
|
|
|
28
28
|
import { TechnicForceSensor } from "../devices/technicforcesensor";
|
|
29
29
|
import { TechnicLargeAngularMotor } from "../devices/techniclargeangularmotor";
|
|
30
30
|
import { TechnicLargeLinearMotor } from "../devices/techniclargelinearmotor";
|
|
31
|
+
import { TechnicSmallAngularMotor } from "../devices/technicsmallangularmotor";
|
|
31
32
|
import { TechnicMediumAngularMotor } from "../devices/technicmediumangularmotor";
|
|
32
33
|
import { TechnicMediumHubAccelerometerSensor } from "../devices/technicmediumhubaccelerometersensor";
|
|
33
34
|
import { TechnicMediumHubGyroSensor } from "../devices/technicmediumhubgyrosensor";
|
|
@@ -40,6 +41,7 @@ import { VoltageSensor } from "../devices/voltagesensor";
|
|
|
40
41
|
import * as Consts from "../consts";
|
|
41
42
|
|
|
42
43
|
import Debug = require("debug");
|
|
44
|
+
import { Technic3x3ColorLightMatrix } from "../devices/technic3x3colorlightmatrix";
|
|
43
45
|
const debug = Debug("basehub");
|
|
44
46
|
|
|
45
47
|
|
|
@@ -407,6 +409,7 @@ export class BaseHub extends EventEmitter {
|
|
|
407
409
|
[Consts.DeviceType.TECHNIC_MEDIUM_HUB_GYRO_SENSOR]: TechnicMediumHubGyroSensor,
|
|
408
410
|
[Consts.DeviceType.TECHNIC_MEDIUM_HUB_ACCELEROMETER]: TechnicMediumHubAccelerometerSensor,
|
|
409
411
|
[Consts.DeviceType.MEDIUM_LINEAR_MOTOR]: MediumLinearMotor,
|
|
412
|
+
[Consts.DeviceType.TECHNIC_SMALL_ANGULAR_MOTOR]: TechnicSmallAngularMotor,
|
|
410
413
|
[Consts.DeviceType.TECHNIC_MEDIUM_ANGULAR_MOTOR]: TechnicMediumAngularMotor,
|
|
411
414
|
[Consts.DeviceType.TECHNIC_LARGE_ANGULAR_MOTOR]: TechnicLargeAngularMotor,
|
|
412
415
|
[Consts.DeviceType.TECHNIC_LARGE_LINEAR_MOTOR]: TechnicLargeLinearMotor,
|
|
@@ -425,6 +428,7 @@ export class BaseHub extends EventEmitter {
|
|
|
425
428
|
[Consts.DeviceType.MARIO_PANTS_SENSOR]: MarioPantsSensor,
|
|
426
429
|
[Consts.DeviceType.TECHNIC_MEDIUM_ANGULAR_MOTOR_GREY]: TechnicMediumAngularMotor,
|
|
427
430
|
[Consts.DeviceType.TECHNIC_LARGE_ANGULAR_MOTOR_GREY]: TechnicLargeAngularMotor,
|
|
431
|
+
[Consts.DeviceType.TECHNIC_3X3_COLOR_LIGHT_MATRIX]: Technic3x3ColorLightMatrix,
|
|
428
432
|
};
|
|
429
433
|
|
|
430
434
|
constructor = deviceConstructors[deviceType as Consts.DeviceType];
|
package/src/hubs/lpf2hub.ts
CHANGED
|
@@ -238,7 +238,7 @@ export class LPF2Hub extends BaseHub {
|
|
|
238
238
|
const event = message[4];
|
|
239
239
|
const deviceType = event ? message.readUInt16LE(5) : 0;
|
|
240
240
|
|
|
241
|
-
if (event === Consts.
|
|
241
|
+
if (event === Consts.Event.ATTACHED_IO) {
|
|
242
242
|
|
|
243
243
|
if (modeInfoDebug.enabled) {
|
|
244
244
|
const deviceTypeName = Consts.DeviceTypeNames[message[5]] || "Unknown";
|
|
@@ -252,7 +252,7 @@ export class LPF2Hub extends BaseHub {
|
|
|
252
252
|
const device = this._createDevice(deviceType, portId);
|
|
253
253
|
this._attachDevice(device);
|
|
254
254
|
|
|
255
|
-
} else if (event === Consts.
|
|
255
|
+
} else if (event === Consts.Event.DETACHED_IO) {
|
|
256
256
|
const device = this._getDeviceByPortId(portId);
|
|
257
257
|
if (device) {
|
|
258
258
|
this._detachDevice(device);
|
|
@@ -265,7 +265,7 @@ export class LPF2Hub extends BaseHub {
|
|
|
265
265
|
}
|
|
266
266
|
}
|
|
267
267
|
|
|
268
|
-
} else if (event === Consts.
|
|
268
|
+
} else if (event === Consts.Event.ATTACHED_VIRTUAL_IO) {
|
|
269
269
|
const firstPortName = this.getPortNameForPortId(message[7]);
|
|
270
270
|
const secondPortName = this.getPortNameForPortId(message[8]);
|
|
271
271
|
// @ts-ignore NK These should never be undefined
|
|
@@ -348,17 +348,13 @@ export class LPF2Hub extends BaseHub {
|
|
|
348
348
|
|
|
349
349
|
|
|
350
350
|
private _parsePortAction (message: Buffer) {
|
|
351
|
+
for (let offset = 3; offset < message.length; offset += 2) {
|
|
352
|
+
const device = this._getDeviceByPortId(message[offset]);
|
|
351
353
|
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
if (device) {
|
|
356
|
-
const finished = (message[4] === 0x0a);
|
|
357
|
-
if (finished) {
|
|
358
|
-
device.finish();
|
|
354
|
+
if (device) {
|
|
355
|
+
device.finish(message[offset+1]);
|
|
359
356
|
}
|
|
360
357
|
}
|
|
361
|
-
|
|
362
358
|
}
|
|
363
359
|
|
|
364
360
|
|
|
@@ -26,7 +26,7 @@ export class TechnicMediumHub extends LPF2Hub {
|
|
|
26
26
|
peripheral.advertisement.serviceUuids.indexOf(Consts.BLEService.LPF2_HUB.replace(/-/g, "")) >= 0 &&
|
|
27
27
|
peripheral.advertisement.manufacturerData &&
|
|
28
28
|
peripheral.advertisement.manufacturerData.length > 3 &&
|
|
29
|
-
peripheral.advertisement.manufacturerData[3] === Consts.BLEManufacturerData.
|
|
29
|
+
peripheral.advertisement.manufacturerData[3] === Consts.BLEManufacturerData.TECHNIC_MEDIUM_HUB_ID
|
|
30
30
|
);
|
|
31
31
|
}
|
|
32
32
|
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { Peripheral } from "@abandonware/noble";
|
|
2
|
+
import compareVersion from "compare-versions";
|
|
3
|
+
|
|
4
|
+
import { IBLEAbstraction } from "../interfaces";
|
|
5
|
+
|
|
6
|
+
import { LPF2Hub } from "./lpf2hub";
|
|
7
|
+
|
|
8
|
+
import * as Consts from "../consts";
|
|
9
|
+
|
|
10
|
+
import Debug = require("debug");
|
|
11
|
+
const debug = Debug("hub");
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* The TechnicSmallHub is emitted if the discovered device is a Technic Small Hub.
|
|
16
|
+
* @class Hub
|
|
17
|
+
* @extends LPF2Hub
|
|
18
|
+
* @extends BaseHub
|
|
19
|
+
*/
|
|
20
|
+
export class TechnicSmallHub extends LPF2Hub {
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
public static IsTechnicSmallHub (peripheral: Peripheral) {
|
|
24
|
+
return (
|
|
25
|
+
peripheral.advertisement &&
|
|
26
|
+
peripheral.advertisement.serviceUuids &&
|
|
27
|
+
peripheral.advertisement.serviceUuids.indexOf(Consts.BLEService.LPF2_HUB.replace(/-/g, "")) >= 0 &&
|
|
28
|
+
peripheral.advertisement.manufacturerData &&
|
|
29
|
+
peripheral.advertisement.manufacturerData.length > 3 &&
|
|
30
|
+
peripheral.advertisement.manufacturerData[3] === Consts.BLEManufacturerData.TECHNIC_SMALL_HUB_ID
|
|
31
|
+
);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
protected _currentPort = 0x3b;
|
|
35
|
+
|
|
36
|
+
constructor (device: IBLEAbstraction) {
|
|
37
|
+
super(device, PortMap, Consts.HubType.TECHNIC_SMALL_HUB);
|
|
38
|
+
debug("Discovered Spike Essential Hub");
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
public async connect () {
|
|
43
|
+
debug("Connecting to Spike Essential Hub");
|
|
44
|
+
await super.connect();
|
|
45
|
+
debug("Connect completed");
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export const PortMap: {[portName: string]: number} = {
|
|
52
|
+
"A": 0,
|
|
53
|
+
"B": 1,
|
|
54
|
+
"HUB_LED": 49,
|
|
55
|
+
"CURRENT_SENSOR": 59,
|
|
56
|
+
"VOLTAGE_SENSOR": 60,
|
|
57
|
+
"ACCELEROMETER": 97,
|
|
58
|
+
"GYRO_SENSOR": 98,
|
|
59
|
+
"TILT_SENSOR": 99
|
|
60
|
+
};
|
package/src/index-browser.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as Consts from "./consts";
|
|
2
2
|
|
|
3
3
|
import { PoweredUP } from "./poweredup-browser";
|
|
4
|
+
import { Color } from "./color";
|
|
4
5
|
|
|
5
6
|
import { BaseHub } from "./hubs/basehub";
|
|
6
7
|
import { DuploTrainBase } from "./hubs/duplotrainbase";
|
|
@@ -32,11 +33,13 @@ import { TechnicDistanceSensor } from "./devices/technicdistancesensor";
|
|
|
32
33
|
import { TechnicForceSensor } from "./devices/technicforcesensor";
|
|
33
34
|
import { TechnicLargeAngularMotor } from "./devices/techniclargeangularmotor";
|
|
34
35
|
import { TechnicLargeLinearMotor } from "./devices/techniclargelinearmotor";
|
|
36
|
+
import { TechnicSmallAngularMotor } from "./devices/technicsmallangularmotor";
|
|
35
37
|
import { TechnicMediumAngularMotor } from "./devices/technicmediumangularmotor";
|
|
36
38
|
import { TechnicMediumHubAccelerometerSensor } from "./devices/technicmediumhubaccelerometersensor";
|
|
37
39
|
import { TechnicMediumHubGyroSensor } from "./devices/technicmediumhubgyrosensor";
|
|
38
40
|
import { TechnicMediumHubTiltSensor } from "./devices/technicmediumhubtiltsensor";
|
|
39
41
|
import { TechnicXLargeLinearMotor } from "./devices/technicxlargelinearmotor";
|
|
42
|
+
import { Technic3x3ColorLightMatrix } from "./devices/technic3x3colorlightmatrix";
|
|
40
43
|
import { TiltSensor } from "./devices/tiltsensor";
|
|
41
44
|
import { TrainMotor } from "./devices/trainmotor";
|
|
42
45
|
import { VoltageSensor } from "./devices/voltagesensor";
|
|
@@ -56,6 +59,7 @@ window.PoweredUP = {
|
|
|
56
59
|
RemoteControl,
|
|
57
60
|
DuploTrainBase,
|
|
58
61
|
Consts,
|
|
62
|
+
Color,
|
|
59
63
|
ColorDistanceSensor,
|
|
60
64
|
Device,
|
|
61
65
|
DuploTrainBaseColorSensor,
|
|
@@ -79,10 +83,12 @@ window.PoweredUP = {
|
|
|
79
83
|
TechnicMediumHubAccelerometerSensor,
|
|
80
84
|
TechnicMediumHubGyroSensor,
|
|
81
85
|
TechnicMediumHubTiltSensor,
|
|
86
|
+
TechnicSmallAngularMotor,
|
|
82
87
|
TechnicMediumAngularMotor,
|
|
83
88
|
TechnicLargeAngularMotor,
|
|
84
89
|
TechnicLargeLinearMotor,
|
|
85
90
|
TechnicXLargeLinearMotor,
|
|
91
|
+
Technic3x3ColorLightMatrix,
|
|
86
92
|
TiltSensor,
|
|
87
93
|
TrainMotor,
|
|
88
94
|
VoltageSensor,
|
package/src/index-node.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as Consts from "./consts";
|
|
2
2
|
|
|
3
3
|
import { PoweredUP } from "./poweredup-node";
|
|
4
|
+
import { Color } from "./color";
|
|
4
5
|
|
|
5
6
|
import { BaseHub } from "./hubs/basehub";
|
|
6
7
|
import { DuploTrainBase } from "./hubs/duplotrainbase";
|
|
@@ -32,11 +33,13 @@ import { TechnicDistanceSensor } from "./devices/technicdistancesensor";
|
|
|
32
33
|
import { TechnicForceSensor } from "./devices/technicforcesensor";
|
|
33
34
|
import { TechnicLargeAngularMotor } from "./devices/techniclargeangularmotor";
|
|
34
35
|
import { TechnicLargeLinearMotor } from "./devices/techniclargelinearmotor";
|
|
36
|
+
import { TechnicSmallAngularMotor } from "./devices/technicsmallangularmotor";
|
|
35
37
|
import { TechnicMediumAngularMotor } from "./devices/technicmediumangularmotor";
|
|
36
38
|
import { TechnicMediumHubAccelerometerSensor } from "./devices/technicmediumhubaccelerometersensor";
|
|
37
39
|
import { TechnicMediumHubGyroSensor } from "./devices/technicmediumhubgyrosensor";
|
|
38
40
|
import { TechnicMediumHubTiltSensor } from "./devices/technicmediumhubtiltsensor";
|
|
39
41
|
import { TechnicXLargeLinearMotor } from "./devices/technicxlargelinearmotor";
|
|
42
|
+
import { Technic3x3ColorLightMatrix } from "./devices/technic3x3colorlightmatrix";
|
|
40
43
|
import { TiltSensor } from "./devices/tiltsensor";
|
|
41
44
|
import { TrainMotor } from "./devices/trainmotor";
|
|
42
45
|
import { VoltageSensor } from "./devices/voltagesensor";
|
|
@@ -56,6 +59,7 @@ export {
|
|
|
56
59
|
RemoteControl,
|
|
57
60
|
DuploTrainBase,
|
|
58
61
|
Consts,
|
|
62
|
+
Color,
|
|
59
63
|
ColorDistanceSensor,
|
|
60
64
|
Device,
|
|
61
65
|
DuploTrainBaseColorSensor,
|
|
@@ -79,10 +83,12 @@ export {
|
|
|
79
83
|
TechnicMediumHubAccelerometerSensor,
|
|
80
84
|
TechnicMediumHubGyroSensor,
|
|
81
85
|
TechnicMediumHubTiltSensor,
|
|
86
|
+
TechnicSmallAngularMotor,
|
|
82
87
|
TechnicMediumAngularMotor,
|
|
83
88
|
TechnicLargeAngularMotor,
|
|
84
89
|
TechnicLargeLinearMotor,
|
|
85
90
|
TechnicXLargeLinearMotor,
|
|
91
|
+
Technic3x3ColorLightMatrix,
|
|
86
92
|
TiltSensor,
|
|
87
93
|
TrainMotor,
|
|
88
94
|
VoltageSensor,
|
package/src/poweredup-browser.ts
CHANGED
|
@@ -15,6 +15,7 @@ import { EventEmitter } from "events";
|
|
|
15
15
|
|
|
16
16
|
import Debug = require("debug");
|
|
17
17
|
import { IBLEAbstraction } from "./interfaces";
|
|
18
|
+
import { TechnicSmallHub } from "./hubs/technicsmallhub";
|
|
18
19
|
const debug = Debug("poweredup");
|
|
19
20
|
|
|
20
21
|
|
|
@@ -151,7 +152,10 @@ export class PoweredUP extends EventEmitter {
|
|
|
151
152
|
case Consts.BLEManufacturerData.DUPLO_TRAIN_BASE_ID:
|
|
152
153
|
resolve(Consts.HubType.DUPLO_TRAIN_BASE);
|
|
153
154
|
break;
|
|
154
|
-
case Consts.BLEManufacturerData.
|
|
155
|
+
case Consts.BLEManufacturerData.TECHNIC_SMALL_HUB_ID:
|
|
156
|
+
resolve(Consts.HubType.TECHNIC_SMALL_HUB);
|
|
157
|
+
break;
|
|
158
|
+
case Consts.BLEManufacturerData.TECHNIC_MEDIUM_HUB_ID:
|
|
155
159
|
resolve(Consts.HubType.TECHNIC_MEDIUM_HUB);
|
|
156
160
|
break;
|
|
157
161
|
}
|
|
@@ -208,6 +212,9 @@ export class PoweredUP extends EventEmitter {
|
|
|
208
212
|
case Consts.HubType.DUPLO_TRAIN_BASE:
|
|
209
213
|
hub = new DuploTrainBase(device);
|
|
210
214
|
break;
|
|
215
|
+
case Consts.HubType.TECHNIC_SMALL_HUB:
|
|
216
|
+
hub = new TechnicSmallHub(device);
|
|
217
|
+
break;
|
|
211
218
|
case Consts.HubType.TECHNIC_MEDIUM_HUB:
|
|
212
219
|
hub = new TechnicMediumHub(device);
|
|
213
220
|
break;
|
package/src/poweredup-node.ts
CHANGED
|
@@ -18,13 +18,17 @@ import { EventEmitter } from "events";
|
|
|
18
18
|
import Debug = require("debug");
|
|
19
19
|
const debug = Debug("poweredup");
|
|
20
20
|
import noble = require("@abandonware/noble");
|
|
21
|
+
import { TechnicSmallHub } from "./hubs/technicsmallhub";
|
|
21
22
|
|
|
22
23
|
let ready = false;
|
|
23
24
|
let wantScan = false;
|
|
24
25
|
let discoveryEventAttached = false;
|
|
25
26
|
|
|
26
27
|
const startScanning = () => {
|
|
27
|
-
noble.startScanning(
|
|
28
|
+
noble.startScanning([
|
|
29
|
+
Consts.BLEService.LPF2_HUB,
|
|
30
|
+
Consts.BLEService.WEDO2_SMART_HUB
|
|
31
|
+
]);
|
|
28
32
|
};
|
|
29
33
|
|
|
30
34
|
noble.on("stateChange", (state: string) => {
|
|
@@ -168,6 +172,8 @@ export class PoweredUP extends EventEmitter {
|
|
|
168
172
|
hub = new RemoteControl(device);
|
|
169
173
|
} else if (DuploTrainBase.IsDuploTrainBase(peripheral)) {
|
|
170
174
|
hub = new DuploTrainBase(device);
|
|
175
|
+
} else if (TechnicSmallHub.IsTechnicSmallHub(peripheral)) {
|
|
176
|
+
hub = new TechnicSmallHub(device);
|
|
171
177
|
} else if (TechnicMediumHub.IsTechnicMediumHub(peripheral)) {
|
|
172
178
|
hub = new TechnicMediumHub(device);
|
|
173
179
|
} else if (Mario.IsMario(peripheral)) {
|
package/src/utils.ts
CHANGED
|
@@ -88,3 +88,10 @@ export const calculateRamp = (device: Device, fromPower: number, toPower: number
|
|
|
88
88
|
device.setEventTimer(interval);
|
|
89
89
|
return emitter;
|
|
90
90
|
};
|
|
91
|
+
|
|
92
|
+
export const parseColor = (color: number) => {
|
|
93
|
+
if (color === 1 || color === 5) {
|
|
94
|
+
color = color + 1;
|
|
95
|
+
}
|
|
96
|
+
return color;
|
|
97
|
+
}
|