Simulator support for motor commands (#137)

* support for "step" functions

* locale files

* enum issue

* fixing decoding of array

* implement clear count

* log unknown commands
This commit is contained in:
Peli de Halleux
2017-12-27 17:05:15 -08:00
committed by GitHub
parent 751df2fe8c
commit f01370e4fd
3 changed files with 113 additions and 70 deletions

View File

@ -118,10 +118,8 @@ namespace pxsim {
getMotor(port: number, large?: boolean): MotorNode[] {
if (port == 0xFF) return this.getMotors(); // Return all motors
const motorPort = this.motorMap[port];
if (this.outputNodes[motorPort] == undefined) {
this.outputNodes[motorPort] = large ?
new LargeMotorNode(motorPort) : new MediumMotorNode(motorPort);
}
if (!this.outputNodes[motorPort])
this.outputNodes[motorPort] = new MotorNode(motorPort, large);
return [this.outputNodes[motorPort]];
}
@ -130,7 +128,7 @@ namespace pxsim {
}
getSensor(port: number, type: number): SensorNode {
if (this.inputNodes[port] == undefined) {
if (!this.inputNodes[port]) {
switch (type) {
case DAL.DEVICE_TYPE_GYRO: this.inputNodes[port] = new GyroSensorNode(port); break;
case DAL.DEVICE_TYPE_COLOR: this.inputNodes[port] = new ColorSensorNode(port); break;