Merge pull request #50 from Microsoft/icons

Icons in blocks
This commit is contained in:
Peli de Halleux 2017-11-16 22:48:35 -08:00 committed by GitHub
commit fb743dea74
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
21 changed files with 204 additions and 171 deletions

View File

@ -32,86 +32,85 @@
"TouchSensorEvent.Released|block": "released",
"UltrasonicSensorEvent.ObjectDetected|block": "object detected",
"UltrasonicSensorEvent.ObjectNear|block": "object near",
"brick.Button.isPressed|block": "%button|is pressed",
"brick.Button.onEvent|block": "on %button|%event",
"brick.Button.wasPressed|block": "%button|was pressed",
"brick._imagePicker|block": "%image",
"brick.buttonDown|block": "button down",
"brick.buttonEnter|block": "button enter",
"brick.buttonLeft|block": "button left",
"brick.buttonRight|block": "button right",
"brick.buttonUp|block": "button up",
"brick.Button.isPressed|block": "`icons.brickButtons` %button|is pressed",
"brick.Button.onEvent|block": "on `icons.brickButtons` %button|%event",
"brick.Button.wasPressed|block": "`icons.brickButtons` %button|was pressed",
"brick.buttonDown|block": "down",
"brick.buttonEnter|block": "enter",
"brick.buttonLeft|block": "left",
"brick.buttonRight|block": "right",
"brick.buttonUp|block": "up",
"brick.pattern|block": "%pattern",
"brick.print|block": "print %text| at x: %x| y: %y",
"brick.setPixel|block": "set pixel %on| at x: %x| y: %y",
"brick.setStatusLight|block": "set status light %pattern=led_pattern",
"brick.print|block": "`icons.brickDisplay` print %text| at x: %x| y: %y",
"brick.setPixel|block": "`icons.brickDisplay` set pixel %on| at x: %x| y: %y",
"brick.setStatusLight|block": "set `icons.brickButtons` to %pattern=led_pattern",
"brick.showImage|block": "show image %image=scren_image_picker",
"brick|block": "brick",
"control.raiseEvent|block": "raise event|from %src|with value %value",
"control|block": "control",
"motors.Motor.count|block": "%motor|count",
"motors.Motor.move|block": "move %motor|by %angle|degrees at %power|%",
"motors.Motor.power|block": "power %motor|to %power|%",
"motors.Motor.setBrake|block": "set %motor|brake %brake",
"motors.Motor.setReversed|block": "set %motor|reversed %reversed",
"motors.Motor.speed|block": "%motor|speed",
"motors.Motor.stop|block": "stop %motor",
"motors.Motor.tachoCount|block": "%motor|tacho count",
"motors.largeMotorA|block": "large motor A",
"motors.largeMotorB|block": "large motor B",
"motors.largeMotorC|block": "large motor C",
"motors.largeMotorD|block": "large motor D",
"motors.mediumMotorA|block": "medium motor A",
"motors.mediumMotorB|block": "medium motor B",
"motors.mediumMotorC|block": "medium motor C",
"motors.mediumMotorD|block": "medium motor D",
"motors.stopAllMotors|block": "stop all motors",
"motors.Motor.count|block": "`icons.motorLarge` %motor|count",
"motors.Motor.move|block": "move `icons.motorLarge` %motor|by %angle|degrees at %power|%",
"motors.Motor.power|block": "power `icons.motorLarge` %motor|to %power|%",
"motors.Motor.setBrake|block": "set `icons.motorLarge` %motor|brake %brake",
"motors.Motor.setReversed|block": "set `icons.motorLarge` %motor|reversed %reversed",
"motors.Motor.speed|block": "`icons.motorLarge` %motor|speed",
"motors.Motor.stop|block": "stop `icons.motorLarge` %motor",
"motors.Motor.tachoCount|block": "`icons.motorLarge` %motor|tacho count",
"motors.largeMotorA|block": "large A",
"motors.largeMotorB|block": "large B",
"motors.largeMotorC|block": "large C",
"motors.largeMotorD|block": "large D",
"motors.mediumMotorA|block": "medium A",
"motors.mediumMotorB|block": "medium B",
"motors.mediumMotorC|block": "medium C",
"motors.mediumMotorD|block": "medium D",
"motors.stopAllMotors|block": "stop all `icons.motorLarge`",
"motors|block": "motors",
"output|block": "output",
"screen|block": "screen",
"sensors.ColorSensor.ambientLight|block": "%color| ambient light",
"sensors.ColorSensor.color|block": "%color| color",
"sensors.ColorSensor.onColorDetected|block": "on %sensor|detected %color",
"sensors.ColorSensor.reflectedLight|block": "%color| reflected light",
"sensors.GyroSensor.angle|block": "%sensor|angle",
"sensors.GyroSensor.rate|block": "%sensor|rotation rate",
"sensors.InfraredSensor.on|block": "on %sensor|%event",
"sensors.InfraredSensor.proximity|block": "%infrared|proximity",
"sensors.InfraredSensor.remoteCommand|block": "%infrared|remote command",
"sensors.InfraredSensor.wait|block": "wait %sensor|for %event",
"sensors.RemoteInfraredBeaconButton.isPressed|block": "%button|is pressed",
"sensors.RemoteInfraredBeaconButton.onEvent|block": "on %button|%event",
"sensors.RemoteInfraredBeaconButton.wasPressed|block": "%button|was pressed",
"sensors.TouchSensor.isTouched|block": "%sensor|is touched",
"sensors.TouchSensor.onEvent|block": "on %sensor|%event",
"sensors.UltraSonicSensor.distance|block": "%sensor|distance",
"sensors.UltraSonicSensor.on|block": "on %sensor|%event",
"sensors.UltraSonicSensor.wait|block": "wait %sensor|for %event",
"sensors.color1|block": "color sensor 1",
"sensors.color2|block": "color sensor 2",
"sensors.color3|block": "color sensor 3",
"sensors.color4|block": "color sensor 4",
"sensors.gyro1|block": "gyro sensor 1",
"sensors.gyro2|block": "gyro sensor 2",
"sensors.gyro3|block": "gyro sensor 3",
"sensors.gyro4|block": "gyro sensor 4",
"sensors.infraredSensor1|block": "infrared sensor 1",
"sensors.infraredSensor2|block": "infrared sensor 2",
"sensors.infraredSensor3|block": "infrared sensor 3",
"sensors.infraredSensor4|block": "infrared sensor 4",
"sensors.remoteButtonBottomLeft|block": "remote button bottom-left",
"sensors.remoteButtonBottomRight|block": "remote button bottom-right",
"sensors.remoteButtonCenter|block": "remote button center",
"sensors.remoteButtonTopLeft|block": "remote button top-left",
"sensors.remoteButtonTopRight|block": "remote button top-right",
"sensors.touchSensor1|block": "touch sensor 1",
"sensors.touchSensor2|block": "touch sensor 2",
"sensors.touchSensor3|block": "touch sensor 3",
"sensors.touchSensor4|block": "touch sensor 4",
"sensors.ultrasonic1|block": "ultrasonic sensor 1",
"sensors.ultrasonic2|block": "ultrasonic sensor 2",
"sensors.ultrasonic3|block": "ultrasonic sensor 3",
"sensors.ultrasonic4|block": "ultrasonic sensor 4",
"sensors.ColorSensor.ambientLight|block": "`icons.colorSensor` %color| ambient light",
"sensors.ColorSensor.color|block": "`icons.colorSensor` %color| color",
"sensors.ColorSensor.onColorDetected|block": "on `icons.colorSensor` %sensor|detected %color",
"sensors.ColorSensor.reflectedLight|block": "`icons.colorSensor` %color| reflected light",
"sensors.GyroSensor.angle|block": "`icons.gyroSensor` %sensor|angle",
"sensors.GyroSensor.rate|block": "`icons.gyroSensor` %sensor|rotation rate",
"sensors.InfraredSensor.on|block": "on `icons.infraredSensor` %sensor|%event",
"sensors.InfraredSensor.proximity|block": "`icons.infraredSensor` %infrared|proximity",
"sensors.InfraredSensor.remoteCommand|block": "`icons.infraredSensor` %infrared|remote command",
"sensors.InfraredSensor.wait|block": "wait `icons.infraredSensor` %sensor|for %event",
"sensors.RemoteInfraredBeaconButton.isPressed|block": "`icons.infraredSensor` %button|is pressed",
"sensors.RemoteInfraredBeaconButton.onEvent|block": "on `icons.infraredSensor` %button|%event",
"sensors.RemoteInfraredBeaconButton.wasPressed|block": "`icons.infraredSensor` %button|was pressed",
"sensors.TouchSensor.isTouched|block": "`icons.touchSensor` %sensor|is touched",
"sensors.TouchSensor.onEvent|block": "on `icons.touchSensor` %sensor|%event",
"sensors.UltraSonicSensor.distance|block": "`icons.ultrasonicSensor` %sensor|distance",
"sensors.UltraSonicSensor.on|block": "on `icons.ultrasonicSensor` %sensor|%event",
"sensors.UltraSonicSensor.wait|block": "wait `icons.ultrasonicSensor` %sensor|for %event",
"sensors.color1|block": "1",
"sensors.color2|block": "2",
"sensors.color3|block": "3",
"sensors.color4|block": "4",
"sensors.gyro1|block": "1",
"sensors.gyro2|block": "2",
"sensors.gyro3|block": "3",
"sensors.gyro4|block": "4",
"sensors.infraredSensor1|block": "1",
"sensors.infraredSensor2|block": "2",
"sensors.infraredSensor3|block": "3",
"sensors.infraredSensor4|block": "4",
"sensors.remoteButtonBottomLeft|block": "bottom-left",
"sensors.remoteButtonBottomRight|block": "bottom-right",
"sensors.remoteButtonCenter|block": "center",
"sensors.remoteButtonTopLeft|block": "top-left",
"sensors.remoteButtonTopRight|block": "top-right",
"sensors.touchSensor1|block": "1",
"sensors.touchSensor2|block": "2",
"sensors.touchSensor3|block": "3",
"sensors.touchSensor4|block": "4",
"sensors.ultrasonic1|block": "1",
"sensors.ultrasonic2|block": "2",
"sensors.ultrasonic3|block": "3",
"sensors.ultrasonic4|block": "4",
"sensors|block": "sensors",
"serial|block": "serial",
"{id:category}Brick": "Brick",

View File

@ -84,7 +84,7 @@ namespace brick {
* @param button the button to query the request
*/
//% help=input/button/is-pressed
//% block="%button|is pressed"
//% block="`icons.brickButtons` %button|is pressed"
//% blockId=buttonIsPressed
//% parts="brick"
//% blockNamespace=brick
@ -99,7 +99,7 @@ namespace brick {
* @param button the button to query the request
*/
//% help=input/button/was-pressed
//% block="%button|was pressed"
//% block="`icons.brickButtons` %button|was pressed"
//% blockId=buttonWasPressed
//% parts="brick"
//% blockNamespace=brick
@ -118,7 +118,7 @@ namespace brick {
* @param body code to run when the event is raised
*/
//% help=input/button/on-event
//% blockId=buttonEvent block="on %button|%event"
//% blockId=buttonEvent block="on `icons.brickButtons` %button|%event"
//% parts="brick"
//% blockNamespace=brick
//% weight=99 blockGap=8
@ -180,31 +180,31 @@ namespace brick {
/**
* Enter button on the EV3 Brick.
*/
//% whenUsed block="button enter" weight=95 fixedInstance
//% whenUsed block="enter" weight=95 fixedInstance
export const buttonEnter: Button = new DevButton(DAL.BUTTON_ID_ENTER)
/**
* Left button on the EV3 Brick.
*/
//% whenUsed block="button left" weight=95 fixedInstance
//% whenUsed block="left" weight=95 fixedInstance
export const buttonLeft: Button = new DevButton(DAL.BUTTON_ID_LEFT)
/**
* Right button on the EV3 Brick.
*/
//% whenUsed block="button right" weight=94 fixedInstance
//% whenUsed block="right" weight=94 fixedInstance
export const buttonRight: Button = new DevButton(DAL.BUTTON_ID_RIGHT)
/**
* Up button on the EV3 Brick.
*/
//% whenUsed block="button up" weight=95 fixedInstance
//% whenUsed block="up" weight=95 fixedInstance
export const buttonUp: Button = new DevButton(DAL.BUTTON_ID_UP)
/**
* Down button on the EV3 Brick.
*/
//% whenUsed block="button down" weight=95 fixedInstance
//% whenUsed block="down" weight=95 fixedInstance
export const buttonDown: Button = new DevButton(DAL.BUTTON_ID_DOWN)
}
@ -233,7 +233,7 @@ namespace brick {
* Set lights.
* @param pattern the lights pattern to use.
*/
//% blockId=setLights block="set status light %pattern=led_pattern"
//% blockId=setLights block="set `icons.brickButtons` to %pattern=led_pattern"
//% weight=100 group="Light"
export function setStatusLight(pattern: number): void {
if (currPattern === pattern)

View File

@ -59,7 +59,7 @@ namespace sensors {
* @param handler the code to run when detected
*/
//% help=input/color/on-color-detected
//% block="on %sensor|detected %color"
//% block="on `icons.colorSensor` %sensor|detected %color"
//% blockId=colorOnColorDetected
//% parts="colorsensor"
//% blockNamespace=sensors
@ -77,7 +77,7 @@ namespace sensors {
* @param color the color sensor to query the request
*/
//% help=input/color/ambient-light
//% block="%color| ambient light"
//% block="`icons.colorSensor` %color| ambient light"
//% blockId=colorGetAmbient
//% parts="colorsensor"
//% blockNamespace=sensors
@ -93,7 +93,7 @@ namespace sensors {
* @param color the color sensor to query the request
*/
//% help=input/color/refelected-light
//% block="%color| reflected light"
//% block="`icons.colorSensor` %color| reflected light"
//% blockId=colorGetReflected
//% parts="colorsensor"
//% blockNamespace=sensors
@ -109,7 +109,7 @@ namespace sensors {
* @param color the color sensor to query the request
*/
//% help=input/color/color
//% block="%color| color"
//% block="`icons.colorSensor` %color| color"
//% blockId=colorGetColor
//% parts="colorsensor"
//% blockNamespace=sensors
@ -121,15 +121,15 @@ namespace sensors {
}
}
//% whenUsed block="color sensor 3" weight=95 fixedInstance
export const color3: ColorSensor = new ColorSensor(3)
//% whenUsed block="color sensor 1" weight=95 fixedInstance
//% whenUsed block="1" weight=95 fixedInstance
export const color1: ColorSensor = new ColorSensor(1)
//% whenUsed block="color sensor 2" weight=95 fixedInstance
//% whenUsed block="3" weight=90 fixedInstance
export const color3: ColorSensor = new ColorSensor(3)
//% whenUsed block="2" weight=90 fixedInstance
export const color2: ColorSensor = new ColorSensor(2)
//% whenUsed block="color sensor 4" weight=95 fixedInstance
//% whenUsed block="4" weight=90 fixedInstance
export const color4: ColorSensor = new ColorSensor(4)
}

View File

@ -24,7 +24,7 @@ namespace sensors {
* @param sensor the gyroscope to query the request
*/
//% help=input/gyro/angle
//% block="%sensor|angle"
//% block="`icons.gyroSensor` %sensor|angle"
//% blockId=gyroGetAngle
//% parts="gyroscope"
//% blockNamespace=sensors
@ -40,7 +40,7 @@ namespace sensors {
* @param sensor the gyroscope to query the request
*/
//% help=input/gyro/rate
//% block="%sensor|rotation rate"
//% block="`icons.gyroSensor` %sensor|rotation rate"
//% blockId=gyroGetRate
//% parts="gyroscope"
//% blockNamespace=sensors
@ -52,15 +52,15 @@ namespace sensors {
}
}
//% fixedInstance whenUsed block="gyro sensor 2"
export const gyro2: GyroSensor = new GyroSensor(2)
//% fixedInstance whenUsed block="gyro sensor 1"
//% fixedInstance whenUsed block="1"
export const gyro1: GyroSensor = new GyroSensor(1)
//% fixedInstance whenUsed block="gyro sensor 3"
//% fixedInstance whenUsed block="2" weight=95
export const gyro2: GyroSensor = new GyroSensor(2)
//% fixedInstance whenUsed block="3"
export const gyro3: GyroSensor = new GyroSensor(3)
//% fixedInstance whenUsed block="gyro sensor 4"
//% fixedInstance whenUsed block="4"
export const gyro4: GyroSensor = new GyroSensor(4)
}

33
libs/core/icons.jres Normal file

File diff suppressed because one or more lines are too long

View File

@ -93,7 +93,7 @@ namespace sensors {
* @param button the remote button to query the request
*/
//% help=input/remote-infrared-beacon/is-pressed
//% block="%button|is pressed"
//% block="`icons.infraredSensor` %button|is pressed"
//% blockId=remoteButtonIsPressed
//% parts="remote"
//% blockNamespace=sensors
@ -108,7 +108,7 @@ namespace sensors {
* @param button the remote button to query the request
*/
//% help=input/remote-infrared-beacon/was-pressed
//% block="%button|was pressed"
//% block="`icons.infraredSensor` %button|was pressed"
//% blockId=remotebuttonWasPressed
//% parts="remote"
//% blockNamespace=sensors
@ -125,7 +125,7 @@ namespace sensors {
* @param body code to run when the event is raised
*/
//% help=input/remote-infrared-beacon/on-event
//% blockId=remotebuttonEvent block="on %button|%event"
//% blockId=remotebuttonEvent block="on `icons.infraredSensor` %button|%event"
//% parts="remote"
//% blockNamespace=sensors
//% weight=99 blockGap=8
@ -193,7 +193,7 @@ namespace sensors {
* @param handler the code to run when detected
*/
//% help=input/infrared/on
//% block="on %sensor|%event"
//% block="on `icons.infraredSensor` %sensor|%event"
//% blockId=infraredOn
//% parts="infraredsensor"
//% blockNamespace=sensors
@ -209,12 +209,12 @@ namespace sensors {
* Waits for the event to occur
*/
//% help=input/ultrasonic/wait
//% block="wait %sensor|for %event"
//% block="wait `icons.infraredSensor` %sensor|for %event"
//% blockId=infraredwait
//% parts="infraredsensor"
//% blockNamespace=sensors
//% weight=99 blockGap=8
//% group="Ultrasonic Sensor"
//% group="Infrared Sensor"
wait(event: InfraredSensorEvent) {
// TODO
}
@ -224,7 +224,7 @@ namespace sensors {
* @param ir the infrared sensor
*/
//% help=input/infrared/proximity
//% block="%infrared|proximity"
//% block="`icons.infraredSensor` %infrared|proximity"
//% blockId=infraredGetProximity
//% parts="infrared"
//% blockNamespace=sensors
@ -240,7 +240,7 @@ namespace sensors {
* @param ir the infrared sensor
*/
//% help=input/infrared/remote-command
//% block="%infrared|remote command"
//% block="`icons.infraredSensor` %infrared|remote command"
//% blockId=infraredGetRemoteCommand
//% parts="infrared"
//% blockNamespace=sensors
@ -258,46 +258,46 @@ namespace sensors {
}
}
//% fixedInstance whenUsed block="infrared sensor 1"
//% fixedInstance whenUsed block="1"
export const infraredSensor1: InfraredSensor = new InfraredSensor(1)
//% fixedInstance whenUsed block="infrared sensor 2"
//% fixedInstance whenUsed block="2"
export const infraredSensor2: InfraredSensor = new InfraredSensor(2)
//% fixedInstance whenUsed block="infrared sensor 3"
//% fixedInstance whenUsed block="3"
export const infraredSensor3: InfraredSensor = new InfraredSensor(3)
//% fixedInstance whenUsed block="infrared sensor 4"
//% fixedInstance whenUsed block="4"
export const infraredSensor4: InfraredSensor = new InfraredSensor(4)
/**
* Remote beacon (center) button.
*/
//% whenUsed block="remote button center" weight=95 fixedInstance
//% whenUsed block="center" weight=95 fixedInstance
export const remoteButtonCenter = irButton(IrRemoteButton.CenterBeacon)
/**
* Remote top-left button.
*/
//% whenUsed block="remote button top-left" weight=95 fixedInstance
//% whenUsed block="top-left" weight=95 fixedInstance
export const remoteButtonTopLeft = irButton(IrRemoteButton.TopLeft)
/**
* Remote top-right button.
*/
//% whenUsed block="remote button top-right" weight=95 fixedInstance
//% whenUsed block="top-right" weight=95 fixedInstance
export const remoteButtonTopRight = irButton(IrRemoteButton.TopRight)
/**
* Remote bottom-left button.
*/
//% whenUsed block="remote button bottom-left" weight=95 fixedInstance
//% whenUsed block="bottom-left" weight=95 fixedInstance
export const remoteButtonBottomLeft = irButton(IrRemoteButton.BottomLeft)
/**
* Remote bottom-right button.
*/
//% whenUsed block="remote button bottom-right" weight=95 fixedInstance
//% whenUsed block="bottom-right" weight=95 fixedInstance
export const remoteButtonBottomRight = irButton(IrRemoteButton.BottomRight)
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.1 KiB

View File

@ -66,7 +66,7 @@ namespace motors {
/**
* Stops all motors
*/
//% blockId=motorStopAll block="stop all motors"
//% blockId=motorStopAll block="stop all `icons.motorLarge`"
//% weight=10 group="Motors" blockGap=8
export function stopAllMotors() {
const b = mkCmd(Output.ALL, DAL.opOutputStop, 0)
@ -91,7 +91,7 @@ namespace motors {
* @param motor the output connection that the motor is connected to
* @param power the power from ``100`` full forward to ``-100`` full backward, eg: 50
*/
//% blockId=motorSetPower block="power %motor|to %power|%"
//% blockId=motorSetPower block="power `icons.motorLarge` %motor|to %power|%"
//% weight=99 group="Motors" blockGap=8
//% power.min=-100 power.max=100
power(power: number) {
@ -114,7 +114,7 @@ namespace motors {
* @param angle the degrees to rotate, eg: 360
* @param power the power from ``100`` full forward to ``-100`` full backward, eg: 50
*/
//% blockId=motorMove block="move %motor|by %angle|degrees at %power|%"
//% blockId=motorMove block="move `icons.motorLarge` %motor|by %angle|degrees at %power|%"
//% weight=98 group="Motors" blockGap=8
//% power.min=-100 power.max=100
move(angle: number, power: number) {
@ -134,7 +134,7 @@ namespace motors {
/**
* Stops the motor
*/
//% blockId=motorStop block="stop %motor"
//% blockId=motorStop block="stop `icons.motorLarge` %motor"
//% weight=97 group="Motors"
stop() {
const b = mkCmd(this.port, DAL.opOutputStop, 1)
@ -146,7 +146,7 @@ namespace motors {
* Sets the automatic brake on or off when the motor is off
* @param brake a value indicating if the motor should break when off
*/
//% blockId=outputMotorSetBrakeMode block="set %motor|brake %brake"
//% blockId=outputMotorSetBrakeMode block="set `icons.motorLarge` %motor|brake %brake"
//% brake.fieldEditor=toggleonoff
//% weight=60 group="Motors" blockGap=8
setBrake(brake: boolean) {
@ -156,7 +156,7 @@ namespace motors {
/**
* Reverses the motor polarity
*/
//% blockId=motorSetReversed block="set %motor|reversed %reversed"
//% blockId=motorSetReversed block="set `icons.motorLarge` %motor|reversed %reversed"
//% reversed.fieldEditor=toggleonoff
//% weight=59 group="Motors"
setReversed(reversed: boolean) {
@ -169,7 +169,7 @@ namespace motors {
* Gets motor actual speed.
* @param motor the port which connects to the motor
*/
//% blockId=motorSpeed block="%motor|speed"
//% blockId=motorSpeed block="`icons.motorLarge` %motor|speed"
//% weight=72 group="Motors" blockGap=8
speed(): number {
return getMotorData(this.port).actualSpeed;
@ -179,7 +179,7 @@ namespace motors {
* Gets motor step count.
* @param motor the port which connects to the motor
*/
//% blockId=motorCount block="%motor|count"
//% blockId=motorCount block="`icons.motorLarge` %motor|count"
//% weight=71 group="Motors" blockGap=8
count(): number {
return getMotorData(this.port).count;
@ -189,7 +189,7 @@ namespace motors {
* Gets motor tacho count.
* @param motor the port which connects to the motor
*/
//% blockId=motorTachoCount block="%motor|tacho count"
//% blockId=motorTachoCount block="`icons.motorLarge` %motor|tacho count"
//% weight=70 group="Motors"
tachoCount(): number {
return getMotorData(this.port).tachoCount;
@ -216,28 +216,28 @@ namespace motors {
}
}
//% whenUsed fixedInstance block="large motor A"
//% whenUsed fixedInstance block="large A"
export const largeMotorA = new Motor(Output.A, true);
//% whenUsed fixedInstance block="large motor B"
//% whenUsed fixedInstance block="large B"
export const largeMotorB = new Motor(Output.B, true);
//% whenUsed fixedInstance block="large motor C"
//% whenUsed fixedInstance block="large C"
export const largeMotorC = new Motor(Output.C, true);
//% whenUsed fixedInstance block="large motor D"
//% whenUsed fixedInstance block="large D"
export const largeMotorD = new Motor(Output.D, true);
//% whenUsed fixedInstance block="medium motor A"
//% whenUsed fixedInstance block="medium A"
export const mediumMotorA = new Motor(Output.A, false);
//% whenUsed fixedInstance block="medium motor B"
//% whenUsed fixedInstance block="medium B"
export const mediumMotorB = new Motor(Output.B, false);
//% whenUsed fixedInstance block="medium motor C"
//% whenUsed fixedInstance block="medium C"
export const mediumMotorC = new Motor(Output.C, false);
//% whenUsed fixedInstance block="medium motor D"
//% whenUsed fixedInstance block="medium D"
export const mediumMotorD = new Motor(Output.D, false);
function reset(out: Output) {

View File

@ -28,6 +28,7 @@
"dal.d.ts",
"images.ts",
"images.jres",
"icons.jres",
"ns.ts"
],
"testFiles": [

View File

@ -84,7 +84,7 @@ namespace brick {
* @param x the starting position's x coordinate, eg: 0
* @param y the starting position's x coordinate, eg: 0
*/
//% blockId=screen_setpixel block="set pixel %on| at x: %x| y: %y"
//% blockId=screen_setpixel block="`icons.brickDisplay` set pixel %on| at x: %x| y: %y"
//% weight=98 group="Screen"
//% x.min=0 x.max=178 y.min=0 y.max=128 on.fieldEditor=toggleonoff
export function setPixel(on: boolean, x: number, y: number) {
@ -100,7 +100,7 @@ namespace brick {
* @param x the starting position's x coordinate, eg: 0
* @param y the starting position's x coordinate, eg: 0
*/
//% blockId=screen_print block="print %text| at x: %x| y: %y"
//% blockId=screen_print block="`icons.brickDisplay` print %text| at x: %x| y: %y"
//% weight=99 group="Screen" inlineInputMode="inline" blockGap=8
//% x.min=0 x.max=178 y.min=0 y.max=128
export function print(text: string, x: number, y: number, mode = Draw.Normal) {

View File

@ -35,12 +35,28 @@ namespace sensors {
return DAL.DEVICE_TYPE_TOUCH
}
/**
* Do something when a touch sensor is touched...
* @param sensor the touch sensor that needs to be clicked or used
* @param event the kind of button gesture that needs to be detected
* @param body code to run when the event is raised
*/
//% help=input/touch/on-event
//% blockId=touchEvent block="on `icons.touchSensor` %sensor|%event"
//% parts="touch"
//% blockNamespace=sensors
//% weight=99 blockGap=8
//% group="Touch Sensor"
onEvent(ev: TouchSensorEvent, body: () => void) {
this.button.onEvent(<ButtonEvent><number>ev, body)
}
/**
* Check if touch sensor is touched.
* @param sensor the port to query the request
*/
//% help=input/touch/is-touched
//% block="%sensor|is touched"
//% block="`icons.touchSensor` %sensor|is touched"
//% blockId=touchIsTouched
//% parts="touch"
//% blockNamespace=sensors
@ -49,30 +65,14 @@ namespace sensors {
isTouched() {
return this.button.isPressed();
}
/**
* Do something when a touch sensor is touched...
* @param sensor the touch sensor that needs to be clicked or used
* @param event the kind of button gesture that needs to be detected
* @param body code to run when the event is raised
*/
//% help=input/touch/on-event
//% blockId=touchEvent block="on %sensor|%event"
//% parts="touch"
//% blockNamespace=sensors
//% weight=99 blockGap=8
//% group="Touch Sensor"
onEvent(ev: TouchSensorEvent, body: () => void) {
this.button.onEvent(<ButtonEvent><number>ev, body)
}
}
//% whenUsed block="touch sensor 1" weight=95 fixedInstance
//% whenUsed block="1" weight=95 fixedInstance
export const touchSensor1: TouchSensor = new TouchSensor(1)
//% whenUsed block="touch sensor 2" weight=95 fixedInstance
//% whenUsed block="2" weight=95 fixedInstance
export const touchSensor2: TouchSensor = new TouchSensor(2)
//% whenUsed block="touch sensor 3" weight=95 fixedInstance
//% whenUsed block="3" weight=95 fixedInstance
export const touchSensor3: TouchSensor = new TouchSensor(3)
//% whenUsed block="touch sensor 4" weight=95 fixedInstance
//% whenUsed block="4" weight=95 fixedInstance
export const touchSensor4: TouchSensor = new TouchSensor(4)
}

View File

@ -41,9 +41,9 @@ namespace sensors {
* @param handler the code to run when detected
*/
//% help=input/ultrasonic/on
//% block="on %sensor|%event"
//% blockId=ultrasonicOn
//% parts="infraredsensor"
//% block="on `icons.ultrasonicSensor` %sensor|%event"
//% parts="ultrasonicsensor"
//% blockNamespace=sensors
//% weight=100 blockGap=8
//% group="Ultrasonic Sensor"
@ -58,9 +58,9 @@ namespace sensors {
* Waits for the event to occur
*/
//% help=input/ultrasonic/wait
//% block="wait %sensor|for %event"
//% block="wait `icons.ultrasonicSensor` %sensor|for %event"
//% blockId=ultrasonicWait
//% parts="infraredsensor"
//% parts="ultrasonicsensor"
//% blockNamespace=sensors
//% weight=99 blockGap=8
//% group="Ultrasonic Sensor"
@ -73,9 +73,9 @@ namespace sensors {
* @param sensor the ultrasonic sensor port
*/
//% help=input/ultrasonic/distance
//% block="%sensor|distance"
//% block="`icons.ultrasonicSensor` %sensor|distance"
//% blockId=sonarGetDistance
//% parts="ultrasonic"
//% parts="ultrasonicsensor"
//% blockNamespace=sensors
//% weight=65 blockGap=8
//% group="Ultrasonic Sensor"
@ -86,15 +86,15 @@ namespace sensors {
}
}
//% fixedInstance whenUsed block="ultrasonic sensor 4"
export const ultrasonic4: UltraSonicSensor = new UltraSonicSensor(4)
//% fixedInstance whenUsed block="ultrasonic sensor 1"
//% fixedInstance whenUsed block="1"
export const ultrasonic1: UltraSonicSensor = new UltraSonicSensor(1)
//% fixedInstance whenUsed block="ultrasonic sensor 2"
//% fixedInstance whenUsed block="4"
export const ultrasonic4: UltraSonicSensor = new UltraSonicSensor(4)
//% fixedInstance whenUsed block="2"
export const ultrasonic2: UltraSonicSensor = new UltraSonicSensor(2)
//% fixedInstance whenUsed block="ultrasonic sensor 3"
//% fixedInstance whenUsed block="3"
export const ultrasonic3: UltraSonicSensor = new UltraSonicSensor(3)
}

View File

@ -1,6 +1,6 @@
{
"name": "pxt-ev3",
"version": "0.0.29",
"version": "0.0.30",
"description": "LEGO Mindstorms EV3 for Microsoft MakeCode",
"private": true,
"keywords": [
@ -39,8 +39,8 @@
"semantic-ui-less": "^2.2.4"
},
"dependencies": {
"pxt-common-packages": "0.12.17",
"pxt-core": "2.3.19"
"pxt-common-packages": "0.14.2",
"pxt-core": "2.3.27"
},
"scripts": {
"test": "node node_modules/pxt-core/built/pxt.js travis"