Begun adding support for Powered Up peripherals

This commit is contained in:
Nathan Kunicki 2018-06-18 21:48:18 +01:00
parent a6c2161968
commit 58a4ceb7b1
2 changed files with 7 additions and 5 deletions

View File

@ -6,7 +6,7 @@ const Consts = {
POWERED_UP_HUB: 3 POWERED_UP_HUB: 3
}, },
Devices: { Devices: {
WEDO2_MOTOR: 1, BASIC_MOTOR: 1,
BOOST_LED: 22, BOOST_LED: 22,
WEDO2_TILT: 34, WEDO2_TILT: 34,
WEDO2_DISTANCE: 35, WEDO2_DISTANCE: 35,
@ -35,7 +35,9 @@ const Consts = {
BLE: { BLE: {
Name: { Name: {
WEDO2_SMART_HUB_NAME: "LPF2 Smart Hub 2 I/O", WEDO2_SMART_HUB_NAME: "LPF2 Smart Hub 2 I/O",
BOOST_MOVE_HUB_NAME: "LEGO Move Hub" BOOST_MOVE_HUB_NAME: "LEGO Move Hub",
POWERED_UP_HUB_NAME: "HUB NO.4",
POWERED_UP_REMOTE_NAME: "Handset"
}, },
Services: { Services: {
WEDO2_SMART_HUB: "000015231212efde1523785feabcd123", WEDO2_SMART_HUB: "000015231212efde1523785feabcd123",

6
hub.js
View File

@ -114,10 +114,10 @@ class Hub extends EventEmitter {
this._activatePortDevice(port.value, port.type, 0x00, 0x00); this._activatePortDevice(port.value, port.type, 0x00, 0x00);
break; break;
} }
case Consts.Devices.WEDO2_MOTOR: case Consts.Devices.BASIC_MOTOR:
{ {
port.type = Consts.Devices.WEDO2_MOTOR; port.type = Consts.Devices.BASIC_MOTOR;
debug(`Port ${port.id} connected, detected WEDO2_MOTOR`); debug(`Port ${port.id} connected, detected BASIC_MOTOR`);
this._activatePortDevice(port.value, port.type, 0x02, 0x00); this._activatePortDevice(port.value, port.type, 0x02, 0x00);
break; break;
} }