Removing icons (#114)

* removing icons

* added "pause for light"
This commit is contained in:
Peli de Halleux 2017-12-19 11:37:33 -08:00 committed by GitHub
parent 9e427898ae
commit 919a03951c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
14 changed files with 139 additions and 132 deletions

View File

@ -8,5 +8,8 @@
"sensors.ColorSensor.onColorDetected|param|handler": "the code to run when detected", "sensors.ColorSensor.onColorDetected|param|handler": "the code to run when detected",
"sensors.ColorSensor.onLightChanged": "Registers code to run when the ambient light changes.", "sensors.ColorSensor.onLightChanged": "Registers code to run when the ambient light changes.",
"sensors.ColorSensor.onLightChanged|param|condition": "the light condition", "sensors.ColorSensor.onLightChanged|param|condition": "the light condition",
"sensors.ColorSensor.onLightChanged|param|handler": "the code to run when detected" "sensors.ColorSensor.onLightChanged|param|handler": "the code to run when detected",
"sensors.ColorSensor.pauseForColor": "Waits for the given color to be detected",
"sensors.ColorSensor.pauseForColor|param|color": "the color to detect",
"sensors.ColorSensor.pauseForLight": "Waits for the given color to be detected"
} }

View File

@ -13,14 +13,16 @@
"LightCondition.Dark|block": "dark", "LightCondition.Dark|block": "dark",
"LightIntensityMode.Ambient|block": "ambient light", "LightIntensityMode.Ambient|block": "ambient light",
"LightIntensityMode.Reflected|block": "reflected light", "LightIntensityMode.Reflected|block": "reflected light",
"sensors.ColorSensor.color|block": "`icons.colorSensor` %sensor| color", "sensors.ColorSensor.color|block": "%sensor| color",
"sensors.ColorSensor.light|block": "`icons.colorSensor` %sensor|%mode", "sensors.ColorSensor.light|block": "%sensor|%mode",
"sensors.ColorSensor.onColorDetected|block": "on `icons.colorSensor` %sensor|detected color %color", "sensors.ColorSensor.onColorDetected|block": "on %sensor|detected color %color",
"sensors.ColorSensor.onLightChanged|block": "on `icons.colorSensor` %sensor|%mode|%condition", "sensors.ColorSensor.onLightChanged|block": "on %sensor|%mode|%condition",
"sensors.color1|block": "1", "sensors.ColorSensor.pauseForColor|block": "pause %sensor|for color %color",
"sensors.color2|block": "2", "sensors.ColorSensor.pauseForLight|block": "pause %sensor|for %mode|light %condition",
"sensors.color3|block": "3", "sensors.color1|block": "color 1",
"sensors.color4|block": "4", "sensors.color2|block": "color 2",
"sensors.color3|block": "color 3",
"sensors.color4|block": "color 4",
"sensors|block": "sensors", "sensors|block": "sensors",
"{id:category}Sensors": "Sensors", "{id:category}Sensors": "Sensors",
"{id:group}Color Sensor": "Color Sensor" "{id:group}Color Sensor": "Color Sensor"

View File

@ -74,7 +74,7 @@ namespace sensors {
/** /**
* Gets the current color mode * Gets the current color mode
*/ */
colorMode() { colorMode() {
return <ColorSensorMode>this.mode; return <ColorSensorMode>this.mode;
} }
@ -99,11 +99,9 @@ namespace sensors {
* @param handler the code to run when detected * @param handler the code to run when detected
*/ */
//% help=sensors/color-sensor/on-color-detected //% help=sensors/color-sensor/on-color-detected
//% block="on `icons.colorSensor` %sensor|detected color %color" //% block="on %sensor|detected color %color"
//% blockId=colorOnColorDetected //% blockId=colorOnColorDetected
//% parts="colorsensor" //% parts="colorsensor"
//% sensor.fieldEditor="imagedropdown"
//% sensor.fieldOptions.columns=4
//% blockNamespace=sensors //% blockNamespace=sensors
//% weight=100 blockGap=8 //% weight=100 blockGap=8
//% group="Color Sensor" //% group="Color Sensor"
@ -115,16 +113,33 @@ namespace sensors {
control.raiseEvent(this._id, v); control.raiseEvent(this._id, v);
} }
/**
* Waits for the given color to be detected
* @param color the color to detect
*/
//% help=sensors/color-sensor/pause-for-color
//% block="pause %sensor|for color %color"
//% blockId=colorPauseForColorDetected
//% parts="colorsensor"
//% blockNamespace=sensors
//% weight=99 blockGap=8
//% group="Color Sensor"
pauseForColor(color: ColorSensorColor) {
this.setMode(ColorSensorMode.Color);
if (this.color() != color) {
const v = this._colorEventValue(<number>color);
control.waitForEvent(this._id, v);
}
}
/** /**
* Get the current color from the color sensor. * Get the current color from the color sensor.
* @param sensor the color sensor to query the request * @param sensor the color sensor to query the request
*/ */
//% help=sensors/color-sensor/color //% help=sensors/color-sensor/color
//% block="`icons.colorSensor` %sensor| color" //% block="%sensor| color"
//% blockId=colorGetColor //% blockId=colorGetColor
//% parts="colorsensor" //% parts="colorsensor"
//% sensor.fieldEditor="imagedropdown"
//% sensor.fieldOptions.columns=4
//% blockNamespace=sensors //% blockNamespace=sensors
//% weight=99 //% weight=99
//% group="Color Sensor" //% group="Color Sensor"
@ -139,17 +154,32 @@ namespace sensors {
* @param handler the code to run when detected * @param handler the code to run when detected
*/ */
//% help=sensors/color-sensor/on-light-changed //% help=sensors/color-sensor/on-light-changed
//% block="on `icons.colorSensor` %sensor|%mode|%condition" //% block="on %sensor|%mode|%condition"
//% blockId=colorOnLightChanged //% blockId=colorOnLightChanged
//% parts="colorsensor" //% parts="colorsensor"
//% sensor.fieldEditor="imagedropdown"
//% sensor.fieldOptions.columns=4
//% blockNamespace=sensors //% blockNamespace=sensors
//% weight=89 blockGap=8 //% weight=89 blockGap=8
//% group="Color Sensor" //% group="Color Sensor"
onLightChanged(mode: LightIntensityMode, condition: LightCondition, handler: () => void) { onLightChanged(mode: LightIntensityMode, condition: LightCondition, handler: () => void) {
control.onEvent(this._id, <number>condition, handler);
this.setMode(<ColorSensorMode><number>mode) this.setMode(<ColorSensorMode><number>mode)
control.onEvent(this._id, <number>condition, handler);
}
/**
* Waits for the given color to be detected
* @param color the color to detect
*/
//% help=sensors/color-sensor/pause-for-light
//% block="pause %sensor|for %mode|light %condition"
//% blockId=colorPauseForLight
//% parts="colorsensor"
//% blockNamespace=sensors
//% weight=88 blockGap=8
//% group="Color Sensor"
pauseForLight(mode: LightIntensityMode, condition: LightCondition) {
this.setMode(<ColorSensorMode><number>mode)
if (this.thresholdDetector.state != <number>condition)
control.waitForEvent(this._id, <number>condition)
} }
/** /**
@ -157,13 +187,11 @@ namespace sensors {
* @param sensor the color sensor port * @param sensor the color sensor port
*/ */
//% help=sensors/color-sensor/light //% help=sensors/color-sensor/light
//% block="`icons.colorSensor` %sensor|%mode" //% block="%sensor|%mode"
//% blockId=colorLight //% blockId=colorLight
//% parts="colorsensor" //% parts="colorsensor"
//% sensor.fieldEditor="imagedropdown"
//% sensor.fieldOptions.columns=4
//% blockNamespace=sensors //% blockNamespace=sensors
//% weight=88 //% weight=87
//% group="Color Sensor" //% group="Color Sensor"
light(mode: LightIntensityMode) { light(mode: LightIntensityMode) {
this.setMode(<ColorSensorMode><number>mode) this.setMode(<ColorSensorMode><number>mode)
@ -181,15 +209,15 @@ namespace sensors {
} }
} }
//% whenUsed block="1" weight=95 fixedInstance jres=icons.port1 //% whenUsed block="color 1" weight=95 fixedInstance jres=icons.port1
export const color1: ColorSensor = new ColorSensor(1) export const color1: ColorSensor = new ColorSensor(1)
//% whenUsed block="2" weight=90 fixedInstance jres=icons.port2 //% whenUsed block="color 2" weight=90 fixedInstance jres=icons.port2
export const color2: ColorSensor = new ColorSensor(2) export const color2: ColorSensor = new ColorSensor(2)
//% whenUsed block="3" weight=90 fixedInstance jres=icons.port3 //% whenUsed block="color 3" weight=90 fixedInstance jres=icons.port3
export const color3: ColorSensor = new ColorSensor(3) export const color3: ColorSensor = new ColorSensor(3)
//% whenUsed block="4" weight=90 fixedInstance jres=icons.port4 //% whenUsed block="color 4" weight=90 fixedInstance jres=icons.port4
export const color4: ColorSensor = new ColorSensor(4) export const color4: ColorSensor = new ColorSensor(4)
} }

View File

@ -47,13 +47,13 @@
"console|block": "console", "console|block": "console",
"control.raiseEvent|block": "raise event|from %src|with value %value", "control.raiseEvent|block": "raise event|from %src|with value %value",
"control|block": "control", "control|block": "control",
"motors.Motor.angle|block": "`icons.motorLarge` %motor|angle", "motors.Motor.angle|block": "%motor|angle",
"motors.Motor.speed|block": "`icons.motorLarge` %motor|speed", "motors.Motor.speed|block": "%motor|speed",
"motors.MotorBase.move|block": "move `icons.motorLarge` %motor|for %value|%unit|at %speed|%", "motors.MotorBase.move|block": "move %motor|for %value|%unit|at %speed|%",
"motors.MotorBase.pauseUntilReady|block": "%motor|pause until ready", "motors.MotorBase.pauseUntilReady|block": "%motor|pause until ready",
"motors.MotorBase.setBrake|block": "set `icons.motorLarge` %motor|brake %brake", "motors.MotorBase.setBrake|block": "set %motor|brake %brake",
"motors.MotorBase.setReversed|block": "set `icons.motorLarge` %motor|reversed %reversed", "motors.MotorBase.setReversed|block": "set %motor|reversed %reversed",
"motors.MotorBase.setSpeed|block": "set speed of `icons.motorLarge` %motor|to %speed|%", "motors.MotorBase.setSpeed|block": "set speed of %motor|to %speed|%",
"motors.SynchedMotorPair.steer|block": "steer %chassis|%steering|%|at speed %speed|%|by %value|%unit", "motors.SynchedMotorPair.steer|block": "steer %chassis|%steering|%|at speed %speed|%|by %value|%unit",
"motors.SynchedMotorPair.tank|block": "tank %chassis|left %speedLeft|%|right %speedRight|%|by %value|%unit", "motors.SynchedMotorPair.tank|block": "tank %chassis|left %speedLeft|%|right %speedRight|%|by %value|%unit",
"motors.largeAB|block": "large A+B", "motors.largeAB|block": "large A+B",

View File

@ -196,7 +196,7 @@ namespace sensors.internal {
private lowThreshold: number; private lowThreshold: number;
private highThreshold: number; private highThreshold: number;
private level: number; private level: number;
private state: ThresholdState; public state: ThresholdState;
constructor(id: number, min = 0, max = 100, lowThreshold = 20, highThreshold = 80) { constructor(id: number, min = 0, max = 100, lowThreshold = 20, highThreshold = 80) {
this.id = id; this.id = id;

View File

@ -159,7 +159,7 @@ namespace motors {
* Sets the automatic brake on or off when the motor is off * Sets the automatic brake on or off when the motor is off
* @param brake a value indicating if the motor should break when off * @param brake a value indicating if the motor should break when off
*/ */
//% blockId=outputMotorSetBrakeMode block="set `icons.motorLarge` %motor|brake %brake" //% blockId=outputMotorSetBrakeMode block="set %motor|brake %brake"
//% brake.fieldEditor=toggleonoff //% brake.fieldEditor=toggleonoff
//% weight=60 blockGap=8 //% weight=60 blockGap=8
//% group="Motion" //% group="Motion"
@ -171,7 +171,7 @@ namespace motors {
/** /**
* Reverses the motor polarity * Reverses the motor polarity
*/ */
//% blockId=motorSetReversed block="set `icons.motorLarge` %motor|reversed %reversed" //% blockId=motorSetReversed block="set %motor|reversed %reversed"
//% reversed.fieldEditor=toggleonoff //% reversed.fieldEditor=toggleonoff
//% weight=59 //% weight=59
//% group="Motion" //% group="Motion"
@ -204,7 +204,7 @@ namespace motors {
* Sets the speed of the motor. * Sets the speed of the motor.
* @param speed the speed from ``100`` full forward to ``-100`` full backward, eg: 50 * @param speed the speed from ``100`` full forward to ``-100`` full backward, eg: 50
*/ */
//% blockId=motorSetSpeed block="set speed of `icons.motorLarge` %motor|to %speed|%" //% blockId=motorSetSpeed block="set speed of %motor|to %speed|%"
//% on.fieldEditor=toggleonoff //% on.fieldEditor=toggleonoff
//% weight=99 blockGap=8 //% weight=99 blockGap=8
//% speed.min=-100 speed.max=100 //% speed.min=-100 speed.max=100
@ -224,7 +224,7 @@ namespace motors {
* @param unit the meaning of the value * @param unit the meaning of the value
* @param speed the speed from ``100`` full forward to ``-100`` full backward, eg: 50 * @param speed the speed from ``100`` full forward to ``-100`` full backward, eg: 50
*/ */
//% blockId=motorMove block="move `icons.motorLarge` %motor|for %value|%unit|at %speed|%" //% blockId=motorMove block="move %motor|for %value|%unit|at %speed|%"
//% weight=98 blockGap=8 //% weight=98 blockGap=8
//% speed.min=-100 speed.max=100 //% speed.min=-100 speed.max=100
//% group="Motion" //% group="Motion"
@ -322,7 +322,7 @@ namespace motors {
* Gets motor actual speed. * Gets motor actual speed.
* @param motor the port which connects to the motor * @param motor the port which connects to the motor
*/ */
//% blockId=motorSpeed block="`icons.motorLarge` %motor|speed" //% blockId=motorSpeed block="%motor|speed"
//% weight=72 blockGap=8 //% weight=72 blockGap=8
//% group="Sensors" //% group="Sensors"
speed(): number { speed(): number {
@ -334,7 +334,7 @@ namespace motors {
* Gets motor ration angle. * Gets motor ration angle.
* @param motor the port which connects to the motor * @param motor the port which connects to the motor
*/ */
//% blockId=motorTachoCount block="`icons.motorLarge` %motor|angle" //% blockId=motorTachoCount block="%motor|angle"
//% weight=70 //% weight=70
//% group="Sensors" //% group="Sensors"
angle(): number { angle(): number {

View File

@ -1,10 +1,10 @@
{ {
"sensors.GyroSensor.angle|block": "`icons.gyroSensor` %sensor|angle", "sensors.GyroSensor.angle|block": "%sensor|angle",
"sensors.GyroSensor.rate|block": "`icons.gyroSensor` %sensor|rotation rate", "sensors.GyroSensor.rate|block": "%sensor|rotation rate",
"sensors.gyro1|block": "1", "sensors.gyro1|block": "gyro 1",
"sensors.gyro2|block": "2", "sensors.gyro2|block": "gyro 2",
"sensors.gyro3|block": "3", "sensors.gyro3|block": "gyro 3",
"sensors.gyro4|block": "4", "sensors.gyro4|block": "gyro 4",
"{id:category}Sensors": "Sensors", "{id:category}Sensors": "Sensors",
"{id:group}Gyro Sensor": "Gyro Sensor" "{id:group}Gyro Sensor": "Gyro Sensor"
} }

View File

@ -24,11 +24,9 @@ namespace sensors {
* @param sensor the gyroscope to query the request * @param sensor the gyroscope to query the request
*/ */
//% help=input/gyro/angle //% help=input/gyro/angle
//% block="`icons.gyroSensor` %sensor|angle" //% block="%sensor|angle"
//% blockId=gyroGetAngle //% blockId=gyroGetAngle
//% parts="gyroscope" //% parts="gyroscope"
//% sensor.fieldEditor="imagedropdown"
//% sensor.fieldOptions.columns=4
//% blockNamespace=sensors //% blockNamespace=sensors
//% weight=65 blockGap=8 //% weight=65 blockGap=8
//% group="Gyro Sensor" //% group="Gyro Sensor"
@ -42,11 +40,9 @@ namespace sensors {
* @param sensor the gyroscope to query the request * @param sensor the gyroscope to query the request
*/ */
//% help=input/gyro/rate //% help=input/gyro/rate
//% block="`icons.gyroSensor` %sensor|rotation rate" //% block="%sensor|rotation rate"
//% blockId=gyroGetRate //% blockId=gyroGetRate
//% parts="gyroscope" //% parts="gyroscope"
//% sensor.fieldEditor="imagedropdown"
//% sensor.fieldOptions.columns=4
//% blockNamespace=sensors //% blockNamespace=sensors
//% weight=65 blockGap=8 //% weight=65 blockGap=8
//% group="Gyro Sensor" //% group="Gyro Sensor"
@ -56,15 +52,15 @@ namespace sensors {
} }
} }
//% fixedInstance whenUsed block="1" jres=icons.port1 //% fixedInstance whenUsed block="gyro 1" jres=icons.port1
export const gyro1: GyroSensor = new GyroSensor(1) export const gyro1: GyroSensor = new GyroSensor(1)
//% fixedInstance whenUsed block="2" weight=95 jres=icons.port2 //% fixedInstance whenUsed block="gyro 2" weight=95 jres=icons.port2
export const gyro2: GyroSensor = new GyroSensor(2) export const gyro2: GyroSensor = new GyroSensor(2)
//% fixedInstance whenUsed block="3" jres=icons.port3 //% fixedInstance whenUsed block="gyro 3" jres=icons.port3
export const gyro3: GyroSensor = new GyroSensor(3) export const gyro3: GyroSensor = new GyroSensor(3)
//% fixedInstance whenUsed block="4" jres=icons.port4 //% fixedInstance whenUsed block="gyro 4" jres=icons.port4
export const gyro4: GyroSensor = new GyroSensor(4) export const gyro4: GyroSensor = new GyroSensor(4)
} }

View File

@ -1,17 +1,17 @@
{ {
"InfraredSensorEvent.ObjectDetected|block": "object detected", "InfraredSensorEvent.ObjectDetected|block": "object detected",
"InfraredSensorEvent.ObjectNear|block": "object near", "InfraredSensorEvent.ObjectNear|block": "object near",
"sensors.InfraredSensor.onEvent|block": "on `icons.infraredSensor` %sensor|%event", "sensors.InfraredSensor.onEvent|block": "on %sensor|%event",
"sensors.InfraredSensor.pauseUntil|block": "pause until `icons.infraredSensor` %sensor| %event", "sensors.InfraredSensor.pauseUntil|block": "pause until %sensor| %event",
"sensors.InfraredSensor.proximity|block": "`icons.infraredSensor` %sensor|proximity", "sensors.InfraredSensor.proximity|block": "%sensor|proximity",
"sensors.InfraredSensor.remoteCommand|block": "`icons.infraredSensor` %sensor|remote command", "sensors.InfraredSensor.remoteCommand|block": "%sensor|remote command",
"sensors.RemoteInfraredBeaconButton.isPressed|block": "`icons.infraredSensor` %button|is pressed", "sensors.RemoteInfraredBeaconButton.isPressed|block": "%button|is pressed",
"sensors.RemoteInfraredBeaconButton.onEvent|block": "on `icons.infraredSensor` %button|%event", "sensors.RemoteInfraredBeaconButton.onEvent|block": "on %button|%event",
"sensors.RemoteInfraredBeaconButton.wasPressed|block": "`icons.infraredSensor` %button|was pressed", "sensors.RemoteInfraredBeaconButton.wasPressed|block": "%button|was pressed",
"sensors.infraredSensor1|block": "1", "sensors.infraredSensor1|block": "infrared 1",
"sensors.infraredSensor2|block": "2", "sensors.infraredSensor2|block": "infrared 2",
"sensors.infraredSensor3|block": "3", "sensors.infraredSensor3|block": "infrared 3",
"sensors.infraredSensor4|block": "4", "sensors.infraredSensor4|block": "infrared 4",
"sensors.remoteButtonBottomLeft|block": "bottom-left", "sensors.remoteButtonBottomLeft|block": "bottom-left",
"sensors.remoteButtonBottomRight|block": "bottom-right", "sensors.remoteButtonBottomRight|block": "bottom-right",
"sensors.remoteButtonCenter|block": "center", "sensors.remoteButtonCenter|block": "center",

View File

@ -93,7 +93,7 @@ namespace sensors {
* @param button the remote button to query the request * @param button the remote button to query the request
*/ */
//% help=input/remote-infrared-beacon/is-pressed //% help=input/remote-infrared-beacon/is-pressed
//% block="`icons.infraredSensor` %button|is pressed" //% block="%button|is pressed"
//% blockId=remoteButtonIsPressed //% blockId=remoteButtonIsPressed
//% parts="remote" //% parts="remote"
//% blockNamespace=sensors //% blockNamespace=sensors
@ -108,7 +108,7 @@ namespace sensors {
* @param button the remote button to query the request * @param button the remote button to query the request
*/ */
//% help=input/remote-infrared-beacon/was-pressed //% help=input/remote-infrared-beacon/was-pressed
//% block="`icons.infraredSensor` %button|was pressed" //% block="%button|was pressed"
//% blockId=remotebuttonWasPressed //% blockId=remotebuttonWasPressed
//% parts="remote" //% parts="remote"
//% blockNamespace=sensors //% blockNamespace=sensors
@ -125,7 +125,7 @@ namespace sensors {
* @param body code to run when the event is raised * @param body code to run when the event is raised
*/ */
//% help=input/remote-infrared-beacon/on-event //% help=input/remote-infrared-beacon/on-event
//% blockId=remotebuttonEvent block="on `icons.infraredSensor` %button|%event" //% blockId=remotebuttonEvent block="on %button|%event"
//% parts="remote" //% parts="remote"
//% blockNamespace=sensors //% blockNamespace=sensors
//% weight=99 blockGap=8 //% weight=99 blockGap=8
@ -189,11 +189,9 @@ namespace sensors {
* @param handler the code to run when detected * @param handler the code to run when detected
*/ */
//% help=input/infrared/on //% help=input/infrared/on
//% block="on `icons.infraredSensor` %sensor|%event" //% block="on %sensor|%event"
//% blockId=infraredOn //% blockId=infraredOn
//% parts="infraredsensor" //% parts="infraredsensor"
//% sensor.fieldEditor="imagedropdown"
//% sensor.fieldOptions.columns=4
//% blockNamespace=sensors //% blockNamespace=sensors
//% weight=100 blockGap=8 //% weight=100 blockGap=8
//% group="Infrared Sensor" //% group="Infrared Sensor"
@ -205,11 +203,9 @@ namespace sensors {
* Waits for the event to occur * Waits for the event to occur
*/ */
//% help=input/ultrasonic/wait //% help=input/ultrasonic/wait
//% block="pause until `icons.infraredSensor` %sensor| %event" //% block="pause until %sensor| %event"
//% blockId=infraredwait //% blockId=infraredwait
//% parts="infraredsensor" //% parts="infraredsensor"
//% sensor.fieldEditor="imagedropdown"
//% sensor.fieldOptions.columns=4
//% blockNamespace=sensors //% blockNamespace=sensors
//% weight=99 blockGap=8 //% weight=99 blockGap=8
//% group="Infrared Sensor" //% group="Infrared Sensor"
@ -222,11 +218,9 @@ namespace sensors {
* @param sensor the infrared sensor * @param sensor the infrared sensor
*/ */
//% help=input/infrared/proximity //% help=input/infrared/proximity
//% block="`icons.infraredSensor` %sensor|proximity" //% block="%sensor|proximity"
//% blockId=infraredGetProximity //% blockId=infraredGetProximity
//% parts="infrared" //% parts="infrared"
//% sensor.fieldEditor="imagedropdown"
//% sensor.fieldOptions.columns=4
//% blockNamespace=sensors //% blockNamespace=sensors
//% weight=65 blockGap=8 //% weight=65 blockGap=8
//% group="Infrared Sensor" //% group="Infrared Sensor"
@ -240,11 +234,9 @@ namespace sensors {
* @param sensor the infrared sensor * @param sensor the infrared sensor
*/ */
//% help=input/infrared/remote-command //% help=input/infrared/remote-command
//% block="`icons.infraredSensor` %sensor|remote command" //% block="%sensor|remote command"
//% blockId=infraredGetRemoteCommand //% blockId=infraredGetRemoteCommand
//% parts="infrared" //% parts="infrared"
//% sensor.fieldEditor="imagedropdown"
//% sensor.fieldOptions.columns=4
//% blockNamespace=sensors //% blockNamespace=sensors
//% weight=65 blockGap=8 //% weight=65 blockGap=8
//% group="Infrared Sensor" //% group="Infrared Sensor"
@ -260,16 +252,16 @@ namespace sensors {
} }
} }
//% fixedInstance whenUsed block="1" jres=icons.port1 //% fixedInstance whenUsed block="infrared 1" jres=icons.port1
export const infraredSensor1: InfraredSensor = new InfraredSensor(1) export const infraredSensor1: InfraredSensor = new InfraredSensor(1)
//% fixedInstance whenUsed block="2" jres=icons.port2 //% fixedInstance whenUsed block="infrared 2" jres=icons.port2
export const infraredSensor2: InfraredSensor = new InfraredSensor(2) export const infraredSensor2: InfraredSensor = new InfraredSensor(2)
//% fixedInstance whenUsed block="3" jres=icons.port3 //% fixedInstance whenUsed block="infrared 3" jres=icons.port3
export const infraredSensor3: InfraredSensor = new InfraredSensor(3) export const infraredSensor3: InfraredSensor = new InfraredSensor(3)
//% fixedInstance whenUsed block="4" jres=icons.port4 //% fixedInstance whenUsed block="infrared 4" jres=icons.port4
export const infraredSensor4: InfraredSensor = new InfraredSensor(4) export const infraredSensor4: InfraredSensor = new InfraredSensor(4)

View File

@ -2,14 +2,14 @@
"TouchSensorEvent.Bumped|block": "bumped", "TouchSensorEvent.Bumped|block": "bumped",
"TouchSensorEvent.Pressed|block": "pressed", "TouchSensorEvent.Pressed|block": "pressed",
"TouchSensorEvent.Released|block": "released", "TouchSensorEvent.Released|block": "released",
"sensors.TouchSensor.isPressed|block": "`icons.touchSensor` %sensor|is pressed", "sensors.TouchSensor.isPressed|block": "%sensor|is pressed",
"sensors.TouchSensor.onEvent|block": "on `icons.touchSensor` %sensor|%event", "sensors.TouchSensor.onEvent|block": "on %sensor|%event",
"sensors.TouchSensor.pauseUntil|block": "pause until `icons.touchSensor` %sensor|%event", "sensors.TouchSensor.pauseUntil|block": "pause until %sensor|%event",
"sensors.TouchSensor.wasPressed|block": "`icons.touchSensor` %sensor|was pressed", "sensors.TouchSensor.wasPressed|block": "%sensor|was pressed",
"sensors.touchSensor1|block": "1", "sensors.touchSensor1|block": "touch 1",
"sensors.touchSensor2|block": "2", "sensors.touchSensor2|block": "touch 2",
"sensors.touchSensor3|block": "3", "sensors.touchSensor3|block": "touch 3",
"sensors.touchSensor4|block": "4", "sensors.touchSensor4|block": "touch 4",
"{id:category}Sensors": "Sensors", "{id:category}Sensors": "Sensors",
"{id:group}Touch Sensor": "Touch Sensor" "{id:group}Touch Sensor": "Touch Sensor"
} }

View File

@ -42,10 +42,8 @@ namespace sensors {
* @param body code to run when the event is raised * @param body code to run when the event is raised
*/ */
//% help=input/touch-sensor/on-event //% help=input/touch-sensor/on-event
//% blockId=touchEvent block="on `icons.touchSensor` %sensor|%event" //% blockId=touchEvent block="on %sensor|%event"
//% parts="touch" //% parts="touch"
//% sensor.fieldEditor="imagedropdown"
//% sensor.fieldOptions.columns=4
//% blockNamespace=sensors //% blockNamespace=sensors
//% weight=99 blockGap=8 //% weight=99 blockGap=8
//% group="Touch Sensor" //% group="Touch Sensor"
@ -59,10 +57,8 @@ namespace sensors {
* @param event the kind of button gesture that needs to be detected * @param event the kind of button gesture that needs to be detected
*/ */
//% help=input/touch-sensor/pause-until //% help=input/touch-sensor/pause-until
//% blockId=touchWaitUntil block="pause until `icons.touchSensor` %sensor|%event" //% blockId=touchWaitUntil block="pause until %sensor|%event"
//% parts="touch" //% parts="touch"
//% sensor.fieldEditor="imagedropdown"
//% sensor.fieldOptions.columns=4
//% blockNamespace=sensors //% blockNamespace=sensors
//% weight=98 blockGap=8 //% weight=98 blockGap=8
//% group="Touch Sensor" //% group="Touch Sensor"
@ -75,11 +71,9 @@ namespace sensors {
* @param sensor the port to query the request * @param sensor the port to query the request
*/ */
//% help=input/touch-sensor/is-pressed //% help=input/touch-sensor/is-pressed
//% block="`icons.touchSensor` %sensor|is pressed" //% block="%sensor|is pressed"
//% blockId=touchIsPressed //% blockId=touchIsPressed
//% parts="touch" //% parts="touch"
//% sensor.fieldEditor="imagedropdown"
//% sensor.fieldOptions.columns=4
//% blockNamespace=sensors //% blockNamespace=sensors
//% weight=81 blockGap=8 //% weight=81 blockGap=8
//% group="Touch Sensor" //% group="Touch Sensor"
@ -92,11 +86,9 @@ namespace sensors {
* @param sensor the port to query the request * @param sensor the port to query the request
*/ */
//% help=input/touch-sensor/was-pressed //% help=input/touch-sensor/was-pressed
//% block="`icons.touchSensor` %sensor|was pressed" //% block="%sensor|was pressed"
//% blockId=touchWasPressed //% blockId=touchWasPressed
//% parts="touch" //% parts="touch"
//% sensor.fieldEditor="imagedropdown"
//% sensor.fieldOptions.columns=4
//% blockNamespace=sensors //% blockNamespace=sensors
//% weight=81 blockGap=8 //% weight=81 blockGap=8
//% group="Touch Sensor" //% group="Touch Sensor"
@ -105,12 +97,12 @@ namespace sensors {
} }
} }
//% whenUsed block="1" weight=95 fixedInstance jres=icons.port1 //% whenUsed block="touch 1" weight=95 fixedInstance jres=icons.port1
export const touchSensor1: TouchSensor = new TouchSensor(1) export const touchSensor1: TouchSensor = new TouchSensor(1)
//% whenUsed block="2" weight=95 fixedInstance jres=icons.port2 //% whenUsed block="touch 2" weight=95 fixedInstance jres=icons.port2
export const touchSensor2: TouchSensor = new TouchSensor(2) export const touchSensor2: TouchSensor = new TouchSensor(2)
//% whenUsed block="3" weight=95 fixedInstance jres=icons.port3 //% whenUsed block="touch 3" weight=95 fixedInstance jres=icons.port3
export const touchSensor3: TouchSensor = new TouchSensor(3) export const touchSensor3: TouchSensor = new TouchSensor(3)
//% whenUsed block="4" weight=95 fixedInstance jres=icons.port4 //% whenUsed block="touch 4" weight=95 fixedInstance jres=icons.port4
export const touchSensor4: TouchSensor = new TouchSensor(4) export const touchSensor4: TouchSensor = new TouchSensor(4)
} }

View File

@ -2,13 +2,13 @@
"UltrasonicSensorEvent.ObjectDetected|block": "object detected", "UltrasonicSensorEvent.ObjectDetected|block": "object detected",
"UltrasonicSensorEvent.ObjectFar|block": "object far", "UltrasonicSensorEvent.ObjectFar|block": "object far",
"UltrasonicSensorEvent.ObjectNear|block": "object near", "UltrasonicSensorEvent.ObjectNear|block": "object near",
"sensors.UltraSonicSensor.distance|block": "`icons.ultrasonicSensor` %sensor|distance", "sensors.UltraSonicSensor.distance|block": "%sensor|distance",
"sensors.UltraSonicSensor.onEvent|block": "on `icons.ultrasonicSensor` %sensor|%event", "sensors.UltraSonicSensor.onEvent|block": "on %sensor|%event",
"sensors.UltraSonicSensor.pauseUntil|block": "pause until `icons.ultrasonicSensor` %sensor| %event", "sensors.UltraSonicSensor.pauseUntil|block": "pause until %sensor| %event",
"sensors.ultrasonic1|block": "1", "sensors.ultrasonic1|block": "ultrasonic 1",
"sensors.ultrasonic2|block": "2", "sensors.ultrasonic2|block": "ultrasonic 2",
"sensors.ultrasonic3|block": "3", "sensors.ultrasonic3|block": "ultrasonic 3",
"sensors.ultrasonic4|block": "4", "sensors.ultrasonic4|block": "ultrasonic 4",
"{id:category}Sensors": "Sensors", "{id:category}Sensors": "Sensors",
"{id:group}Ultrasonic Sensor": "Ultrasonic Sensor" "{id:group}Ultrasonic Sensor": "Ultrasonic Sensor"
} }

View File

@ -43,10 +43,8 @@ namespace sensors {
*/ */
//% help=input/ultrasonic/on //% help=input/ultrasonic/on
//% blockId=ultrasonicOn //% blockId=ultrasonicOn
//% block="on `icons.ultrasonicSensor` %sensor|%event" //% block="on %sensor|%event"
//% parts="ultrasonicsensor" //% parts="ultrasonicsensor"
//% sensor.fieldEditor="imagedropdown"
//% sensor.fieldOptions.columns=4
//% blockNamespace=sensors //% blockNamespace=sensors
//% weight=100 blockGap=8 //% weight=100 blockGap=8
//% group="Ultrasonic Sensor" //% group="Ultrasonic Sensor"
@ -58,11 +56,9 @@ namespace sensors {
* Waits for the event to occur * Waits for the event to occur
*/ */
//% help=input/ultrasonic/wait //% help=input/ultrasonic/wait
//% block="pause until `icons.ultrasonicSensor` %sensor| %event" //% block="pause until %sensor| %event"
//% blockId=ultrasonicWait //% blockId=ultrasonicWait
//% parts="ultrasonicsensor" //% parts="ultrasonicsensor"
//% sensor.fieldEditor="imagedropdown"
//% sensor.fieldOptions.columns=4
//% blockNamespace=sensors //% blockNamespace=sensors
//% weight=99 blockGap=8 //% weight=99 blockGap=8
//% group="Ultrasonic Sensor" //% group="Ultrasonic Sensor"
@ -75,11 +71,9 @@ namespace sensors {
* @param sensor the ultrasonic sensor port * @param sensor the ultrasonic sensor port
*/ */
//% help=input/ultrasonic/distance //% help=input/ultrasonic/distance
//% block="`icons.ultrasonicSensor` %sensor|distance" //% block="%sensor|distance"
//% blockId=sonarGetDistance //% blockId=sonarGetDistance
//% parts="ultrasonicsensor" //% parts="ultrasonicsensor"
//% sensor.fieldEditor="imagedropdown"
//% sensor.fieldOptions.columns=4
//% blockNamespace=sensors //% blockNamespace=sensors
//% weight=65 blockGap=8 //% weight=65 blockGap=8
//% group="Ultrasonic Sensor" //% group="Ultrasonic Sensor"
@ -90,15 +84,15 @@ namespace sensors {
} }
} }
//% fixedInstance whenUsed block="1" jres=icons.port1 //% fixedInstance whenUsed block="ultrasonic 1" jres=icons.port1
export const ultrasonic1: UltraSonicSensor = new UltraSonicSensor(1) export const ultrasonic1: UltraSonicSensor = new UltraSonicSensor(1)
//% fixedInstance whenUsed block="2" jres=icons.port2 //% fixedInstance whenUsed block="ultrasonic 2" jres=icons.port2
export const ultrasonic2: UltraSonicSensor = new UltraSonicSensor(2) export const ultrasonic2: UltraSonicSensor = new UltraSonicSensor(2)
//% fixedInstance whenUsed block="3" jres=icons.port3 //% fixedInstance whenUsed block="ultrasonic 3" jres=icons.port3
export const ultrasonic3: UltraSonicSensor = new UltraSonicSensor(3) export const ultrasonic3: UltraSonicSensor = new UltraSonicSensor(3)
//% fixedInstance whenUsed block="4" jres=icons.port4 //% fixedInstance whenUsed block="ultrasonic 4" jres=icons.port4
export const ultrasonic4: UltraSonicSensor = new UltraSonicSensor(4) export const ultrasonic4: UltraSonicSensor = new UltraSonicSensor(4)
} }