Don't reset threashold when resetting color mode (#932)
* don't reset threshold when changing modes * updated docs
This commit is contained in:
parent
d179f18ef3
commit
f745079728
@ -32,6 +32,10 @@
|
|||||||
"name": "Moving with Gyro",
|
"name": "Moving with Gyro",
|
||||||
"description": "Use the gyro for correct the robot trajectory.",
|
"description": "Use the gyro for correct the robot trajectory.",
|
||||||
"youTubeId": "ufiOPvW37xc"
|
"youTubeId": "ufiOPvW37xc"
|
||||||
|
}, {
|
||||||
|
"name": "Line following with 1 color sensor",
|
||||||
|
"description": "Simple line following using the color sensor.",
|
||||||
|
"youTubeId": "_LeduyKQVjg"
|
||||||
}]
|
}]
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -73,13 +73,7 @@ namespace sensors {
|
|||||||
}
|
}
|
||||||
|
|
||||||
setMode(m: ColorSensorMode) {
|
setMode(m: ColorSensorMode) {
|
||||||
if (m == ColorSensorMode.AmbientLightIntensity) {
|
// don't change threshold after initialization
|
||||||
this.thresholdDetector.setLowThreshold(5);
|
|
||||||
this.thresholdDetector.setHighThreshold(20);
|
|
||||||
} else {
|
|
||||||
this.thresholdDetector.setLowThreshold(20);
|
|
||||||
this.thresholdDetector.setHighThreshold(80);
|
|
||||||
}
|
|
||||||
this._setMode(m)
|
this._setMode(m)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -814,10 +814,10 @@ namespace sensors {
|
|||||||
|
|
||||||
export class ThresholdDetector {
|
export class ThresholdDetector {
|
||||||
public id: number;
|
public id: number;
|
||||||
public min: number;
|
private min: number;
|
||||||
public max: number;
|
private max: number;
|
||||||
public lowThreshold: number;
|
private lowThreshold: number;
|
||||||
public highThreshold: number;
|
private highThreshold: number;
|
||||||
public level: number;
|
public level: number;
|
||||||
public state: ThresholdState;
|
public state: ThresholdState;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user