Switch to reflected light when calling threshold (#489)

* fix typo

* fixing threshold functions

* switch to reflected mode when calling threshold
This commit is contained in:
Peli de Halleux
2018-04-11 09:58:34 -06:00
committed by GitHub
parent 6c253182e4
commit a4a9af28a4
3 changed files with 14 additions and 4 deletions

View File

@ -115,8 +115,8 @@ namespace sensors {
//% this.fieldEditor="ports"
threshold(condition: UltrasonicSensorEvent): number {
switch (condition) {
case UltrasonicSensorEvent.ObjectNear: this.promixityThreshold.threshold(ThresholdState.Low); break;
case UltrasonicSensorEvent.ObjectDetected: this.movementThreshold; break;
case UltrasonicSensorEvent.ObjectNear: return this.promixityThreshold.threshold(ThresholdState.Low);
case UltrasonicSensorEvent.ObjectDetected: return this.movementThreshold;
}
return 0;
}