More reliable motor command for PUP hub
This commit is contained in:
parent
e89e729a8c
commit
4f3f121319
15
lpf2hub.ts
15
lpf2hub.ts
@ -133,25 +133,16 @@ export class LPF2Hub extends Hub {
|
|||||||
return resolve();
|
return resolve();
|
||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
let data = Buffer.from([0x08, 0x00, 0x81, portObj.value, 0x11, 0x51, 0x00, this._mapSpeed(speed)]);
|
const data = Buffer.from([0x0a, 0x00, 0x81, portObj.value, 0x11, 0x60, 0x00, this._mapSpeed(speed), 0x00, 0x00]);
|
||||||
if (this.type === Consts.Hubs.POWERED_UP_HUB && portObj.type === Consts.Devices.BOOST_INTERACTIVE_MOTOR) {
|
|
||||||
data = Buffer.from([0x07, 0x00, 0x81, portObj.value, 0x11, 0x02, this._mapSpeed(speed)]);
|
|
||||||
}
|
|
||||||
this._writeMessage(Consts.BLECharacteristics.BOOST_ALL, data);
|
this._writeMessage(Consts.BLECharacteristics.BOOST_ALL, data);
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
let data = Buffer.from([0x08, 0x00, 0x81, portObj.value, 0x11, 0x51, 0x00, 0x00]);
|
const data = Buffer.from([0x0a, 0x00, 0x81, portObj.value, 0x11, 0x60, 0x00, 0x00, 0x00, 0x00]);
|
||||||
if (this.type === Consts.Hubs.POWERED_UP_HUB && portObj.type === Consts.Devices.BOOST_INTERACTIVE_MOTOR) {
|
|
||||||
data = Buffer.from([0x07, 0x00, 0x81, portObj.value, 0x11, 0x02, 0x00]);
|
|
||||||
}
|
|
||||||
this._writeMessage(Consts.BLECharacteristics.BOOST_ALL, data);
|
this._writeMessage(Consts.BLECharacteristics.BOOST_ALL, data);
|
||||||
return resolve();
|
return resolve();
|
||||||
}, time);
|
}, time);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
let data = Buffer.from([0x08, 0x00, 0x81, portObj.value, 0x11, 0x51, 0x00, this._mapSpeed(speed)]);
|
const data = Buffer.from([0x0a, 0x00, 0x81, portObj.value, 0x11, 0x60, 0x00, this._mapSpeed(speed), 0x00, 0x00]);
|
||||||
if (this.type === Consts.Hubs.POWERED_UP_HUB && portObj.type === Consts.Devices.BOOST_INTERACTIVE_MOTOR) {
|
|
||||||
data = Buffer.from([0x07, 0x00, 0x81, portObj.value, 0x11, 0x02, this._mapSpeed(speed)]);
|
|
||||||
}
|
|
||||||
this._writeMessage(Consts.BLECharacteristics.BOOST_ALL, data);
|
this._writeMessage(Consts.BLECharacteristics.BOOST_ALL, data);
|
||||||
return resolve();
|
return resolve();
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user