Merge branch 'master' of https://github.com/microsoft/pxt-ev3
This commit is contained in:
commit
886464b470
@ -15,7 +15,7 @@ namespace pxsim {
|
||||
private speedCmdValues: number[];
|
||||
private speedCmdTacho: number;
|
||||
private speedCmdTime: number;
|
||||
private _synchedMotor: MotorNode; // non-null if master motor
|
||||
private _synchedMotor: MotorNode; // non-null if synchronized
|
||||
|
||||
constructor(port: number, large: boolean) {
|
||||
super(port);
|
||||
@ -50,6 +50,7 @@ namespace pxsim {
|
||||
|
||||
clearSpeedCmd() {
|
||||
delete this.speedCmd;
|
||||
delete this.speedCmdValues;
|
||||
delete this._synchedMotor;
|
||||
}
|
||||
|
||||
@ -135,10 +136,10 @@ namespace pxsim {
|
||||
}
|
||||
case DAL.opOutputStepSync:
|
||||
case DAL.opOutputTimeSync: {
|
||||
if (!this._synchedMotor) // handled in other motor code
|
||||
const otherMotor = this._synchedMotor;
|
||||
if (otherMotor.port < this.port) // handled in other motor code
|
||||
break;
|
||||
|
||||
const otherMotor = this._synchedMotor;
|
||||
const speed = this.speedCmdValues[0];
|
||||
const turnRatio = this.speedCmdValues[1];
|
||||
const stepsOrTime = this.speedCmdValues[2];
|
||||
|
@ -70,7 +70,7 @@ namespace pxsim {
|
||||
for (const motor of motors) {
|
||||
const otherMotor = motors.filter(m => m.port != motor.port)[0];
|
||||
motor.setSyncCmd(
|
||||
motor.port < otherMotor.port ? otherMotor : undefined,
|
||||
otherMotor,
|
||||
cmd, [speed, turnRatio, stepsOrTime, brake]);
|
||||
}
|
||||
return 2;
|
||||
|
Loading…
Reference in New Issue
Block a user