Minor refactor fix (#102)
* Minor fix to a refactor of motor output this.brake to this._brake * No (_this) in global context * Minor fix
This commit is contained in:
parent
539cf3d73e
commit
944098b9f9
@ -200,7 +200,7 @@ namespace motors {
|
||||
*/
|
||||
private stop() {
|
||||
this.__init();
|
||||
stop(this._port);
|
||||
stop(this._port, this._brake);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -340,7 +340,7 @@ namespace motors {
|
||||
setSpeed(speed: number) {
|
||||
speed = Math.clamp(speed >> 0, -100, 100);
|
||||
if (!speed) {
|
||||
stop(this._ports);
|
||||
stop(this._ports, this._brake);
|
||||
return;
|
||||
}
|
||||
syncMotors(this._ports, {
|
||||
@ -377,7 +377,7 @@ namespace motors {
|
||||
moveSteering(steering: number, speed: number, value: number, unit: MoveUnit) {
|
||||
speed = Math.clamp(-100, 100, speed >> 0);
|
||||
if (!speed) {
|
||||
stop(this._ports);
|
||||
stop(this._ports, this._brake);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -513,9 +513,9 @@ namespace motors {
|
||||
writePWM(b);
|
||||
}
|
||||
|
||||
function stop(out: Output) {
|
||||
function stop(out: Output, brake: boolean) {
|
||||
const b = mkCmd(out, DAL.opOutputStop, 1)
|
||||
b.setNumber(NumberFormat.UInt8LE, 2, this.brake ? 1 : 0)
|
||||
b.setNumber(NumberFormat.UInt8LE, 2, brake ? 1 : 0)
|
||||
writePWM(b);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user