This commit is contained in:
parent
6a7c4899b4
commit
198d637ef9
@ -27,8 +27,8 @@ poweredUP.on("discover", async (hub) => { // Wait to discover hubs
|
|||||||
if (
|
if (
|
||||||
// device instanceof PoweredUP.MoveHubMediumLinearMotor ||
|
// device instanceof PoweredUP.MoveHubMediumLinearMotor ||
|
||||||
device instanceof PoweredUP.MediumLinearMotor ||
|
device instanceof PoweredUP.MediumLinearMotor ||
|
||||||
device instanceof PoweredUP.ControlPlusLargeMotor ||
|
device instanceof PoweredUP.TechnicLargeLinearMotor ||
|
||||||
device instanceof PoweredUP.ControlPlusXLargeMotor
|
device instanceof PoweredUP.TechnicXLargeLinearMotor
|
||||||
) {
|
) {
|
||||||
const motor = device;
|
const motor = device;
|
||||||
|
|
||||||
|
@ -54,7 +54,7 @@ export enum DeviceType {
|
|||||||
UNKNOWN = 0,
|
UNKNOWN = 0,
|
||||||
SIMPLE_MEDIUM_LINEAR_MOTOR = 1,
|
SIMPLE_MEDIUM_LINEAR_MOTOR = 1,
|
||||||
TRAIN_MOTOR = 2,
|
TRAIN_MOTOR = 2,
|
||||||
LED_LIGHTS = 8,
|
LIGHT = 8,
|
||||||
VOLTAGE = 20,
|
VOLTAGE = 20,
|
||||||
CURRENT = 21,
|
CURRENT = 21,
|
||||||
PIEZO_TONE = 22,
|
PIEZO_TONE = 22,
|
||||||
@ -69,8 +69,8 @@ export enum DeviceType {
|
|||||||
DUPLO_TRAIN_BASE_SPEAKER = 42,
|
DUPLO_TRAIN_BASE_SPEAKER = 42,
|
||||||
DUPLO_TRAIN_BASE_COLOR = 43,
|
DUPLO_TRAIN_BASE_COLOR = 43,
|
||||||
DUPLO_TRAIN_BASE_SPEEDOMETER = 44,
|
DUPLO_TRAIN_BASE_SPEEDOMETER = 44,
|
||||||
CONTROL_PLUS_LARGE_MOTOR = 46,
|
TECHNIC_LARGE_LINEAR_MOTOR = 46,
|
||||||
CONTROL_PLUS_XLARGE_MOTOR = 47,
|
TECHNIC_XLARGE_LINEAR_MOTOR = 47,
|
||||||
CONTROL_PLUS_GEST = 54,
|
CONTROL_PLUS_GEST = 54,
|
||||||
POWERED_UP_REMOTE_BUTTON = 55,
|
POWERED_UP_REMOTE_BUTTON = 55,
|
||||||
RSSI = 56,
|
RSSI = 56,
|
||||||
|
@ -11,13 +11,13 @@ import { PUPRemote } from "./pupremote";
|
|||||||
import { WeDo2SmartHub } from "./wedo2smarthub";
|
import { WeDo2SmartHub } from "./wedo2smarthub";
|
||||||
|
|
||||||
import { ColorDistanceSensor } from "./colordistancesensor";
|
import { ColorDistanceSensor } from "./colordistancesensor";
|
||||||
import { ControlPlusLargeMotor } from "./controlpluslargemotor";
|
|
||||||
import { ControlPlusXLargeMotor } from "./controlplusxlargemotor";
|
|
||||||
import { Device } from "./device";
|
import { Device } from "./device";
|
||||||
import { Lights } from "./lights";
|
import { Light } from "./light";
|
||||||
import { MediumLinearMotor } from "./mediumlinearmotor";
|
import { MediumLinearMotor } from "./mediumlinearmotor";
|
||||||
import { MoveHubMediumLinearMotor } from "./MoveHubMediumLinearMotor";
|
import { MoveHubMediumLinearMotor } from "./movehubmediumlinearmotor";
|
||||||
import { SimpleMediumLinearMotor } from "./simplemediumlinearmotor";
|
import { SimpleMediumLinearMotor } from "./simplemediumlinearmotor";
|
||||||
|
import { TechnicLargeLinearMotor } from "./techniclargelinearmotor";
|
||||||
|
import { TechnicXLargeLinearMotor } from "./technicxlargelinearmotor";
|
||||||
import { TrainMotor } from "./trainmotor";
|
import { TrainMotor } from "./trainmotor";
|
||||||
|
|
||||||
import { isWebBluetooth } from "./utils";
|
import { isWebBluetooth } from "./utils";
|
||||||
@ -34,13 +34,13 @@ window.PoweredUP = {
|
|||||||
DuploTrainBase,
|
DuploTrainBase,
|
||||||
Consts,
|
Consts,
|
||||||
ColorDistanceSensor,
|
ColorDistanceSensor,
|
||||||
ControlPlusLargeMotor,
|
|
||||||
ControlPlusXLargeMotor,
|
|
||||||
Device,
|
Device,
|
||||||
Lights,
|
Light,
|
||||||
MediumLinearMotor,
|
MediumLinearMotor,
|
||||||
MoveHubMediumLinearMotor,
|
MoveHubMediumLinearMotor,
|
||||||
SimpleMediumLinearMotor,
|
SimpleMediumLinearMotor,
|
||||||
|
TechnicLargeLinearMotor,
|
||||||
|
TechnicXLargeLinearMotor,
|
||||||
TrainMotor,
|
TrainMotor,
|
||||||
isWebBluetooth
|
isWebBluetooth
|
||||||
};
|
};
|
||||||
|
@ -11,13 +11,13 @@ import { PUPRemote } from "./pupremote";
|
|||||||
import { WeDo2SmartHub } from "./wedo2smarthub";
|
import { WeDo2SmartHub } from "./wedo2smarthub";
|
||||||
|
|
||||||
import { ColorDistanceSensor } from "./colordistancesensor";
|
import { ColorDistanceSensor } from "./colordistancesensor";
|
||||||
import { ControlPlusLargeMotor } from "./controlpluslargemotor";
|
|
||||||
import { ControlPlusXLargeMotor } from "./controlplusxlargemotor";
|
|
||||||
import { Device } from "./device";
|
import { Device } from "./device";
|
||||||
import { Lights } from "./lights";
|
import { Light } from "./light";
|
||||||
import { MediumLinearMotor } from "./mediumlinearmotor";
|
import { MediumLinearMotor } from "./mediumlinearmotor";
|
||||||
import { MoveHubMediumLinearMotor } from "./MoveHubMediumLinearMotor";
|
import { MoveHubMediumLinearMotor } from "./movehubmediumlinearmotor";
|
||||||
import { SimpleMediumLinearMotor } from "./simplemediumlinearmotor";
|
import { SimpleMediumLinearMotor } from "./simplemediumlinearmotor";
|
||||||
|
import { TechnicLargeLinearMotor } from "./techniclargelinearmotor";
|
||||||
|
import { TechnicXLargeLinearMotor } from "./technicxlargelinearmotor";
|
||||||
import { TrainMotor } from "./trainmotor";
|
import { TrainMotor } from "./trainmotor";
|
||||||
|
|
||||||
import { isWebBluetooth } from "./utils";
|
import { isWebBluetooth } from "./utils";
|
||||||
@ -34,13 +34,13 @@ export {
|
|||||||
DuploTrainBase,
|
DuploTrainBase,
|
||||||
Consts,
|
Consts,
|
||||||
ColorDistanceSensor,
|
ColorDistanceSensor,
|
||||||
ControlPlusLargeMotor,
|
|
||||||
ControlPlusXLargeMotor,
|
|
||||||
Device,
|
Device,
|
||||||
Lights,
|
Light,
|
||||||
MediumLinearMotor,
|
MediumLinearMotor,
|
||||||
MoveHubMediumLinearMotor,
|
MoveHubMediumLinearMotor,
|
||||||
SimpleMediumLinearMotor,
|
SimpleMediumLinearMotor,
|
||||||
|
TechnicLargeLinearMotor,
|
||||||
|
TechnicXLargeLinearMotor,
|
||||||
TrainMotor,
|
TrainMotor,
|
||||||
isWebBluetooth
|
isWebBluetooth
|
||||||
};
|
};
|
||||||
|
@ -4,11 +4,11 @@ import { WeDo2SmartHub } from "./wedo2smarthub";
|
|||||||
|
|
||||||
import * as Consts from "./consts";
|
import * as Consts from "./consts";
|
||||||
|
|
||||||
export class Lights extends Device {
|
export class Light extends Device {
|
||||||
|
|
||||||
|
|
||||||
constructor (hub: Hub, portId: number) {
|
constructor (hub: Hub, portId: number) {
|
||||||
super(hub, portId, Consts.DeviceType.LED_LIGHTS);
|
super(hub, portId, Consts.DeviceType.LIGHT);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -2,12 +2,12 @@ import { Device } from "./device";
|
|||||||
import { Hub } from "./hub";
|
import { Hub } from "./hub";
|
||||||
|
|
||||||
import { ColorDistanceSensor } from "./colordistancesensor";
|
import { ColorDistanceSensor } from "./colordistancesensor";
|
||||||
import { ControlPlusLargeMotor } from "./controlpluslargemotor";
|
import { Light } from "./light";
|
||||||
import { ControlPlusXLargeMotor } from "./controlplusxlargemotor";
|
|
||||||
import { Lights } from "./lights";
|
|
||||||
import { MediumLinearMotor } from "./mediumlinearmotor";
|
import { MediumLinearMotor } from "./mediumlinearmotor";
|
||||||
import { MoveHubMediumLinearMotor } from "./MoveHubMediumLinearMotor";
|
import { MoveHubMediumLinearMotor } from "./movehubmediumlinearmotor";
|
||||||
import { SimpleMediumLinearMotor } from "./simplemediumlinearmotor";
|
import { SimpleMediumLinearMotor } from "./simplemediumlinearmotor";
|
||||||
|
import { TechnicLargeLinearMotor } from "./techniclargelinearmotor";
|
||||||
|
import { TechnicXLargeLinearMotor } from "./technicxlargelinearmotor";
|
||||||
import { TrainMotor } from "./trainmotor";
|
import { TrainMotor } from "./trainmotor";
|
||||||
|
|
||||||
import * as Consts from "./consts";
|
import * as Consts from "./consts";
|
||||||
@ -289,8 +289,8 @@ export class LPF2Hub extends Hub {
|
|||||||
let device;
|
let device;
|
||||||
|
|
||||||
switch (deviceType) {
|
switch (deviceType) {
|
||||||
case Consts.DeviceType.LED_LIGHTS:
|
case Consts.DeviceType.LIGHT:
|
||||||
device = new Lights(this, portId);
|
device = new Light(this, portId);
|
||||||
break;
|
break;
|
||||||
case Consts.DeviceType.TRAIN_MOTOR:
|
case Consts.DeviceType.TRAIN_MOTOR:
|
||||||
device = new TrainMotor(this, portId);
|
device = new TrainMotor(this, portId);
|
||||||
@ -304,11 +304,11 @@ export class LPF2Hub extends Hub {
|
|||||||
case Consts.DeviceType.MEDIUM_LINEAR_MOTOR:
|
case Consts.DeviceType.MEDIUM_LINEAR_MOTOR:
|
||||||
device = new MediumLinearMotor(this, portId);
|
device = new MediumLinearMotor(this, portId);
|
||||||
break;
|
break;
|
||||||
case Consts.DeviceType.CONTROL_PLUS_LARGE_MOTOR:
|
case Consts.DeviceType.TECHNIC_LARGE_LINEAR_MOTOR:
|
||||||
device = new ControlPlusLargeMotor(this, portId);
|
device = new TechnicLargeLinearMotor(this, portId);
|
||||||
break;
|
break;
|
||||||
case Consts.DeviceType.CONTROL_PLUS_XLARGE_MOTOR:
|
case Consts.DeviceType.TECHNIC_XLARGE_LINEAR_MOTOR:
|
||||||
device = new ControlPlusXLargeMotor(this, portId);
|
device = new TechnicXLargeLinearMotor(this, portId);
|
||||||
break;
|
break;
|
||||||
case Consts.DeviceType.COLOR_DISTANCE_SENSOR:
|
case Consts.DeviceType.COLOR_DISTANCE_SENSOR:
|
||||||
device = new ColorDistanceSensor(this, portId);
|
device = new ColorDistanceSensor(this, portId);
|
||||||
|
@ -3,10 +3,10 @@ import { Hub } from "./hub";
|
|||||||
import * as Consts from "./consts";
|
import * as Consts from "./consts";
|
||||||
import { TachoMotor } from "./tachomotor";
|
import { TachoMotor } from "./tachomotor";
|
||||||
|
|
||||||
export class ControlPlusLargeMotor extends TachoMotor {
|
export class TechnicLargeLinearMotor extends TachoMotor {
|
||||||
|
|
||||||
constructor (hub: Hub, portId: number) {
|
constructor (hub: Hub, portId: number) {
|
||||||
super(hub, portId, Consts.DeviceType.CONTROL_PLUS_LARGE_MOTOR);
|
super(hub, portId, Consts.DeviceType.TECHNIC_LARGE_LINEAR_MOTOR);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -3,10 +3,10 @@ import { Hub } from "./hub";
|
|||||||
import * as Consts from "./consts";
|
import * as Consts from "./consts";
|
||||||
import { TachoMotor } from "./tachomotor";
|
import { TachoMotor } from "./tachomotor";
|
||||||
|
|
||||||
export class ControlPlusXLargeMotor extends TachoMotor {
|
export class TechnicXLargeLinearMotor extends TachoMotor {
|
||||||
|
|
||||||
constructor (hub: Hub, portId: number) {
|
constructor (hub: Hub, portId: number) {
|
||||||
super(hub, portId, Consts.DeviceType.CONTROL_PLUS_XLARGE_MOTOR);
|
super(hub, portId, Consts.DeviceType.TECHNIC_XLARGE_LINEAR_MOTOR);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -6,12 +6,12 @@ import { Device } from "./device";
|
|||||||
import { Hub } from "./hub";
|
import { Hub } from "./hub";
|
||||||
|
|
||||||
import { ColorDistanceSensor } from "./colordistancesensor";
|
import { ColorDistanceSensor } from "./colordistancesensor";
|
||||||
import { ControlPlusLargeMotor } from "./controlpluslargemotor";
|
import { Light } from "./light";
|
||||||
import { ControlPlusXLargeMotor } from "./controlplusxlargemotor";
|
|
||||||
import { Lights } from "./lights";
|
|
||||||
import { MediumLinearMotor } from "./mediumlinearmotor";
|
import { MediumLinearMotor } from "./mediumlinearmotor";
|
||||||
import { MoveHubMediumLinearMotor } from "./MoveHubMediumLinearMotor";
|
import { MoveHubMediumLinearMotor } from "./movehubmediumlinearmotor";
|
||||||
import { SimpleMediumLinearMotor } from "./simplemediumlinearmotor";
|
import { SimpleMediumLinearMotor } from "./simplemediumlinearmotor";
|
||||||
|
import { TechnicLargeLinearMotor } from "./techniclargelinearmotor";
|
||||||
|
import { TechnicXLargeLinearMotor } from "./technicxlargelinearmotor";
|
||||||
import { TrainMotor } from "./trainmotor";
|
import { TrainMotor } from "./trainmotor";
|
||||||
|
|
||||||
import * as Consts from "./consts";
|
import * as Consts from "./consts";
|
||||||
@ -281,8 +281,8 @@ export class WeDo2SmartHub extends Hub {
|
|||||||
let device;
|
let device;
|
||||||
|
|
||||||
switch (deviceType) {
|
switch (deviceType) {
|
||||||
case Consts.DeviceType.LED_LIGHTS:
|
case Consts.DeviceType.LIGHT:
|
||||||
device = new Lights(this, portId);
|
device = new Light(this, portId);
|
||||||
break;
|
break;
|
||||||
// case Consts.DeviceType.BOOST_TACHO_MOTOR:
|
// case Consts.DeviceType.BOOST_TACHO_MOTOR:
|
||||||
// device = new BoostTachoMotor(this, portId);
|
// device = new BoostTachoMotor(this, portId);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user