From bd06fb80f3b4298d5d23d05d36c15e92196abfc9 Mon Sep 17 00:00:00 2001 From: Peli de Halleux Date: Thu, 12 Apr 2018 14:25:44 -0700 Subject: [PATCH] Threshold to calibration (#495) * renaming threshold to calibration * rename threshold to calibration --- libs/color-sensor/color.ts | 14 ++++++++++---- libs/ev3/ns.ts | 2 +- libs/infrared-sensor/ir.ts | 4 ++-- libs/ultrasonic-sensor/ultrasonic.ts | 4 ++-- 4 files changed, 15 insertions(+), 9 deletions(-) diff --git a/libs/color-sensor/color.ts b/libs/color-sensor/color.ts index 33f61a2b..8baee344 100644 --- a/libs/color-sensor/color.ts +++ b/libs/color-sensor/color.ts @@ -232,11 +232,17 @@ namespace sensors { return this.getNumber(NumberFormat.UInt8LE, 0) } + /** + * Gets the ambient light + */ //% ambientLight() { return this.light(LightIntensityMode.Ambient); } + /** + * Gets the reflected light value + */ //% reflectedLight() { return this.light(LightIntensityMode.Reflected); @@ -245,10 +251,10 @@ namespace sensors { /** * Set a threshold value * @param condition the dark or bright light condition - * @param value the value threshold + * @param value the value threshold, eg: 10 */ //% blockId=colorSetThreshold block="set **color sensor** %this|%condition|to %value" - //% group="Threshold" blockGap=8 weight=90 + //% group="Calibration" blockGap=8 weight=90 //% value.min=0 value.max=100 //% this.fieldEditor="ports" //% help=sensors/color-sensor/set-threshold @@ -269,7 +275,7 @@ namespace sensors { * @param condition the light condition */ //% blockId=colorGetThreshold block="**color sensor** %this|%condition" - //% group="Threshold" blockGap=8 weight=89 + //% group="Calibration" weight=89 //% this.fieldEditor="ports" //% help=sensors/color-sensor/threshold threshold(condition: Light): number { @@ -285,7 +291,7 @@ namespace sensors { * Collects measurement of the light condition and adjusts the threshold to 10% / 90%. */ //% blockId=colorCalibrateLight block="calibrate **color sensor** %this|for %mode" - //% group="Threshold" weight=91 blockGap=8 + //% group="Calibration" weight=91 blockGap=8 //% this.fieldEditor="ports" //% help=sensors/color-sensor/calibrate-light calibrateLight(mode: LightIntensityMode, deviation: number = 8) { diff --git a/libs/ev3/ns.ts b/libs/ev3/ns.ts index dccf5665..1da62b78 100644 --- a/libs/ev3/ns.ts +++ b/libs/ev3/ns.ts @@ -8,7 +8,7 @@ namespace brick { //% color="#C8509B" weight=95 icon="\uf10f" //% labelLineWidth=100 -//% groups='["Touch Sensor", "Color Sensor", "Ultrasonic Sensor", "Gyro Sensor", "Infrared Sensor", "Remote Infrared Beacon", "Threshold"]' +//% groups='["Touch Sensor", "Color Sensor", "Ultrasonic Sensor", "Gyro Sensor", "Infrared Sensor", "Remote Infrared Beacon", "Calibration"]' namespace sensors { } diff --git a/libs/infrared-sensor/ir.ts b/libs/infrared-sensor/ir.ts index 1a11b2eb..11ffd744 100644 --- a/libs/infrared-sensor/ir.ts +++ b/libs/infrared-sensor/ir.ts @@ -261,7 +261,7 @@ namespace sensors { * @param value the value threshold */ //% blockId=irSetThreshold block="set **infrared** %this|%condition|to %value" - //% group="Threshold" blockGap=8 weight=49 + //% group="Calibration" blockGap=8 weight=49 //% value.min=0 value.max=100 //% this.fieldEditor="ports" setPromixityThreshold(condition: InfraredSensorEvent, value: number) { @@ -276,7 +276,7 @@ namespace sensors { * @param condition the proximity condition */ //% blockId=irGetThreshold block="**infrared** %this|%condition" - //% group="Threshold" blockGap=8 weight=49 + //% group="Calibration" weight=49 //% this.fieldEditor="ports" proximityThreshold(condition: InfraredSensorEvent): number { return this._proximityThreshold.threshold(condition); diff --git a/libs/ultrasonic-sensor/ultrasonic.ts b/libs/ultrasonic-sensor/ultrasonic.ts index f0a1c13b..7df02881 100644 --- a/libs/ultrasonic-sensor/ultrasonic.ts +++ b/libs/ultrasonic-sensor/ultrasonic.ts @@ -96,7 +96,7 @@ namespace sensors { * @param value the value threshold */ //% blockId=ultrasonicSetThreshold block="set **ultrasonic** %this|%condition|to %value" - //% group="Threshold" blockGap=8 weight=80 + //% group="Calibration" blockGap=8 weight=80 //% value.min=0 value.max=255 //% this.fieldEditor="ports" setThreshold(condition: UltrasonicSensorEvent, value: number) { @@ -111,7 +111,7 @@ namespace sensors { * @param condition the proximity condition */ //% blockId=ultrasonicGetThreshold block="**ultrasonic** %this|%condition" - //% group="Threshold" blockGap=8 weight=79 + //% group="Calibration" weight=79 //% this.fieldEditor="ports" threshold(condition: UltrasonicSensorEvent): number { switch (condition) {