Merge branch 'master' into motorsync

This commit is contained in:
Peli de Halleux 2017-12-13 21:16:33 -08:00
commit 1b6d84a9b8
15 changed files with 152 additions and 150 deletions

View File

@ -106,9 +106,9 @@ namespace sensors {
//% weight=100 blockGap=8 //% weight=100 blockGap=8
//% group="Color Sensor" //% group="Color Sensor"
onColorDetected(color: ColorSensorColor, handler: () => void) { onColorDetected(color: ColorSensorColor, handler: () => void) {
this.setMode(ColorSensorMode.Color)
const v = this._colorEventValue(<number>color); const v = this._colorEventValue(<number>color);
control.onEvent(this._id, v, handler); control.onEvent(this._id, v, handler);
this.setMode(ColorSensorMode.Color)
if (this.color() == color) if (this.color() == color)
control.raiseEvent(this._id, v); control.raiseEvent(this._id, v);
} }

View File

@ -18,8 +18,8 @@
"brick.Button.isPressed": "Check if button is currently pressed or not.", "brick.Button.isPressed": "Check if button is currently pressed or not.",
"brick.Button.onEvent": "Do something when a button or sensor is clicked, up or down.", "brick.Button.onEvent": "Do something when a button or sensor is clicked, up or down.",
"brick.Button.onEvent|param|body": "code to run when the event is raised", "brick.Button.onEvent|param|body": "code to run when the event is raised",
"brick.Button.waitUntil": "Waits until the event is raised", "brick.Button.pauseUntil": "Waits until the event is raised",
"brick.Button.waitUntil|param|ev": "the event to wait for", "brick.Button.pauseUntil|param|ev": "the event to wait for",
"brick.Button.wasPressed": "See if the button was pressed again since the last time you checked.", "brick.Button.wasPressed": "See if the button was pressed again since the last time you checked.",
"brick._imagePicker": "An image", "brick._imagePicker": "An image",
"brick._imagePicker|param|image": "the image", "brick._imagePicker|param|image": "the image",

View File

@ -20,7 +20,7 @@
"Output.D|block": "D", "Output.D|block": "D",
"brick.Button.isPressed|block": "`icons.brickButtons` %button|is pressed", "brick.Button.isPressed|block": "`icons.brickButtons` %button|is pressed",
"brick.Button.onEvent|block": "on `icons.brickButtons` %button|%event", "brick.Button.onEvent|block": "on `icons.brickButtons` %button|%event",
"brick.Button.waitUntil|block": "wait until `icons.brickButtons` %button|%event", "brick.Button.pauseUntil|block": "pause until `icons.brickButtons` %button|%event",
"brick.Button.wasPressed|block": "`icons.brickButtons` %button|was pressed", "brick.Button.wasPressed|block": "`icons.brickButtons` %button|was pressed",
"brick._imagePicker|block": "%image", "brick._imagePicker|block": "%image",
"brick.buttonDown|block": "down", "brick.buttonDown|block": "down",

View File

@ -132,13 +132,13 @@ namespace brick {
* Waits until the event is raised * Waits until the event is raised
* @param ev the event to wait for * @param ev the event to wait for
*/ */
//% help=input/button/wait-until //% help=input/button/pause-until
//% blockId=buttonWaitUntil block="wait until `icons.brickButtons` %button|%event" //% blockId=buttonWaitUntil block="pause until `icons.brickButtons` %button|%event"
//% parts="brick" //% parts="brick"
//% blockNamespace=brick //% blockNamespace=brick
//% weight=98 blockGap=8 //% weight=98 blockGap=8
//% group="Buttons" //% group="Buttons"
waitUntil(ev: ButtonEvent) { pauseUntil(ev: ButtonEvent) {
control.waitForEvent(this._id, ev); control.waitForEvent(this._id, ev);
} }
} }

View File

@ -1,260 +1,260 @@
namespace images { namespace images {
//% fixedInstance jres //% fixedInstance jres blockIdentity=brick._imagePicker
export const expressionsBigSmile = screen.unpackPNG(hex``); export const expressionsBigSmile = screen.unpackPNG(hex``);
//% fixedInstance jres //% fixedInstance jres blockIdentity=brick._imagePicker
export const expressionsHeartLarge = screen.unpackPNG(hex``); export const expressionsHeartLarge = screen.unpackPNG(hex``);
//% fixedInstance jres //% fixedInstance jres blockIdentity=brick._imagePicker
export const expressionsHeartSmall = screen.unpackPNG(hex``); export const expressionsHeartSmall = screen.unpackPNG(hex``);
//% fixedInstance jres //% fixedInstance jres blockIdentity=brick._imagePicker
export const expressionsMouth1open = screen.unpackPNG(hex``); export const expressionsMouth1open = screen.unpackPNG(hex``);
//% fixedInstance jres //% fixedInstance jres blockIdentity=brick._imagePicker
export const expressionsMouth1shut = screen.unpackPNG(hex``); export const expressionsMouth1shut = screen.unpackPNG(hex``);
//% fixedInstance jres //% fixedInstance jres blockIdentity=brick._imagePicker
export const expressionsMouth2open = screen.unpackPNG(hex``); export const expressionsMouth2open = screen.unpackPNG(hex``);
//% fixedInstance jres //% fixedInstance jres blockIdentity=brick._imagePicker
export const expressionsMouth2shut = screen.unpackPNG(hex``); export const expressionsMouth2shut = screen.unpackPNG(hex``);
//% fixedInstance jres //% fixedInstance jres blockIdentity=brick._imagePicker
export const expressionsSad = screen.unpackPNG(hex``); export const expressionsSad = screen.unpackPNG(hex``);
//% fixedInstance jres //% fixedInstance jres blockIdentity=brick._imagePicker
export const expressionsSick = screen.unpackPNG(hex``); export const expressionsSick = screen.unpackPNG(hex``);
//% fixedInstance jres //% fixedInstance jres blockIdentity=brick._imagePicker
export const expressionsSmile = screen.unpackPNG(hex``); export const expressionsSmile = screen.unpackPNG(hex``);
//% fixedInstance jres //% fixedInstance jres blockIdentity=brick._imagePicker
export const expressionsSwearing = screen.unpackPNG(hex``); export const expressionsSwearing = screen.unpackPNG(hex``);
//% fixedInstance jres //% fixedInstance jres blockIdentity=brick._imagePicker
export const expressionsTalking = screen.unpackPNG(hex``); export const expressionsTalking = screen.unpackPNG(hex``);
//% fixedInstance jres //% fixedInstance jres blockIdentity=brick._imagePicker
export const expressionsWink = screen.unpackPNG(hex``); export const expressionsWink = screen.unpackPNG(hex``);
//% fixedInstance jres //% fixedInstance jres blockIdentity=brick._imagePicker
export const expressionsZzz = screen.unpackPNG(hex``); export const expressionsZzz = screen.unpackPNG(hex``);
//% fixedInstance jres //% fixedInstance jres blockIdentity=brick._imagePicker
export const eyesAngry = screen.unpackPNG(hex``); export const eyesAngry = screen.unpackPNG(hex``);
//% fixedInstance jres //% fixedInstance jres blockIdentity=brick._imagePicker
export const eyesAwake = screen.unpackPNG(hex``); export const eyesAwake = screen.unpackPNG(hex``);
//% fixedInstance jres //% fixedInstance jres blockIdentity=brick._imagePicker
export const eyesBlackEye = screen.unpackPNG(hex``); export const eyesBlackEye = screen.unpackPNG(hex``);
//% fixedInstance jres //% fixedInstance jres blockIdentity=brick._imagePicker
export const eyesBottomLeft = screen.unpackPNG(hex``); export const eyesBottomLeft = screen.unpackPNG(hex``);
//% fixedInstance jres //% fixedInstance jres blockIdentity=brick._imagePicker
export const eyesBottomRight = screen.unpackPNG(hex``); export const eyesBottomRight = screen.unpackPNG(hex``);
//% fixedInstance jres //% fixedInstance jres blockIdentity=brick._imagePicker
export const eyesCrazy1 = screen.unpackPNG(hex``); export const eyesCrazy1 = screen.unpackPNG(hex``);
//% fixedInstance jres //% fixedInstance jres blockIdentity=brick._imagePicker
export const eyesCrazy2 = screen.unpackPNG(hex``); export const eyesCrazy2 = screen.unpackPNG(hex``);
//% fixedInstance jres //% fixedInstance jres blockIdentity=brick._imagePicker
export const eyesDisappointed = screen.unpackPNG(hex``); export const eyesDisappointed = screen.unpackPNG(hex``);
//% fixedInstance jres //% fixedInstance jres blockIdentity=brick._imagePicker
export const eyesDizzy = screen.unpackPNG(hex``); export const eyesDizzy = screen.unpackPNG(hex``);
//% fixedInstance jres //% fixedInstance jres blockIdentity=brick._imagePicker
export const eyesDown = screen.unpackPNG(hex``); export const eyesDown = screen.unpackPNG(hex``);
//% fixedInstance jres //% fixedInstance jres blockIdentity=brick._imagePicker
export const eyesEvil = screen.unpackPNG(hex``); export const eyesEvil = screen.unpackPNG(hex``);
//% fixedInstance jres //% fixedInstance jres blockIdentity=brick._imagePicker
export const eyesHurt = screen.unpackPNG(hex``); export const eyesHurt = screen.unpackPNG(hex``);
//% fixedInstance jres //% fixedInstance jres blockIdentity=brick._imagePicker
export const eyesKnockedOut = screen.unpackPNG(hex``); export const eyesKnockedOut = screen.unpackPNG(hex``);
//% fixedInstance jres //% fixedInstance jres blockIdentity=brick._imagePicker
export const eyesLove = screen.unpackPNG(hex``); export const eyesLove = screen.unpackPNG(hex``);
//% fixedInstance jres //% fixedInstance jres blockIdentity=brick._imagePicker
export const eyesMiddleLeft = screen.unpackPNG(hex``); export const eyesMiddleLeft = screen.unpackPNG(hex``);
//% fixedInstance jres //% fixedInstance jres blockIdentity=brick._imagePicker
export const eyesMiddleRight = screen.unpackPNG(hex``); export const eyesMiddleRight = screen.unpackPNG(hex``);
//% fixedInstance jres //% fixedInstance jres blockIdentity=brick._imagePicker
export const eyesNeutral = screen.unpackPNG(hex``); export const eyesNeutral = screen.unpackPNG(hex``);
//% fixedInstance jres //% fixedInstance jres blockIdentity=brick._imagePicker
export const eyesNuclear = screen.unpackPNG(hex``); export const eyesNuclear = screen.unpackPNG(hex``);
//% fixedInstance jres //% fixedInstance jres blockIdentity=brick._imagePicker
export const eyesPinchLeft = screen.unpackPNG(hex``); export const eyesPinchLeft = screen.unpackPNG(hex``);
//% fixedInstance jres //% fixedInstance jres blockIdentity=brick._imagePicker
export const eyesPinchMiddle = screen.unpackPNG(hex``); export const eyesPinchMiddle = screen.unpackPNG(hex``);
//% fixedInstance jres //% fixedInstance jres blockIdentity=brick._imagePicker
export const eyesPinchRight = screen.unpackPNG(hex``); export const eyesPinchRight = screen.unpackPNG(hex``);
//% fixedInstance jres //% fixedInstance jres blockIdentity=brick._imagePicker
export const eyesSleeping = screen.unpackPNG(hex``); export const eyesSleeping = screen.unpackPNG(hex``);
//% fixedInstance jres //% fixedInstance jres blockIdentity=brick._imagePicker
export const eyesTear = screen.unpackPNG(hex``); export const eyesTear = screen.unpackPNG(hex``);
//% fixedInstance jres //% fixedInstance jres blockIdentity=brick._imagePicker
export const eyesTiredLeft = screen.unpackPNG(hex``); export const eyesTiredLeft = screen.unpackPNG(hex``);
//% fixedInstance jres //% fixedInstance jres blockIdentity=brick._imagePicker
export const eyesTiredMiddle = screen.unpackPNG(hex``); export const eyesTiredMiddle = screen.unpackPNG(hex``);
//% fixedInstance jres //% fixedInstance jres blockIdentity=brick._imagePicker
export const eyesTiredRight = screen.unpackPNG(hex``); export const eyesTiredRight = screen.unpackPNG(hex``);
//% fixedInstance jres //% fixedInstance jres blockIdentity=brick._imagePicker
export const eyesToxic = screen.unpackPNG(hex``); export const eyesToxic = screen.unpackPNG(hex``);
//% fixedInstance jres //% fixedInstance jres blockIdentity=brick._imagePicker
export const eyesUp = screen.unpackPNG(hex``); export const eyesUp = screen.unpackPNG(hex``);
//% fixedInstance jres //% fixedInstance jres blockIdentity=brick._imagePicker
export const eyesWinking = screen.unpackPNG(hex``); export const eyesWinking = screen.unpackPNG(hex``);
//% fixedInstance jres //% fixedInstance jres blockIdentity=brick._imagePicker
export const informationAccept = screen.unpackPNG(hex``); export const informationAccept = screen.unpackPNG(hex``);
//% fixedInstance jres //% fixedInstance jres blockIdentity=brick._imagePicker
export const informationBackward = screen.unpackPNG(hex``); export const informationBackward = screen.unpackPNG(hex``);
//% fixedInstance jres //% fixedInstance jres blockIdentity=brick._imagePicker
export const informationDecline = screen.unpackPNG(hex``); export const informationDecline = screen.unpackPNG(hex``);
//% fixedInstance jres //% fixedInstance jres blockIdentity=brick._imagePicker
export const informationForward = screen.unpackPNG(hex``); export const informationForward = screen.unpackPNG(hex``);
//% fixedInstance jres //% fixedInstance jres blockIdentity=brick._imagePicker
export const informationLeft = screen.unpackPNG(hex``); export const informationLeft = screen.unpackPNG(hex``);
//% fixedInstance jres //% fixedInstance jres blockIdentity=brick._imagePicker
export const informationNoGo = screen.unpackPNG(hex``); export const informationNoGo = screen.unpackPNG(hex``);
//% fixedInstance jres //% fixedInstance jres blockIdentity=brick._imagePicker
export const informationQuestionMark = screen.unpackPNG(hex``); export const informationQuestionMark = screen.unpackPNG(hex``);
//% fixedInstance jres //% fixedInstance jres blockIdentity=brick._imagePicker
export const informationRight = screen.unpackPNG(hex``); export const informationRight = screen.unpackPNG(hex``);
//% fixedInstance jres //% fixedInstance jres blockIdentity=brick._imagePicker
export const informationStop1 = screen.unpackPNG(hex``); export const informationStop1 = screen.unpackPNG(hex``);
//% fixedInstance jres //% fixedInstance jres blockIdentity=brick._imagePicker
export const informationStop2 = screen.unpackPNG(hex``); export const informationStop2 = screen.unpackPNG(hex``);
//% fixedInstance jres //% fixedInstance jres blockIdentity=brick._imagePicker
export const informationThumbsDown = screen.unpackPNG(hex``); export const informationThumbsDown = screen.unpackPNG(hex``);
//% fixedInstance jres //% fixedInstance jres blockIdentity=brick._imagePicker
export const informationThumbsUp = screen.unpackPNG(hex``); export const informationThumbsUp = screen.unpackPNG(hex``);
//% fixedInstance jres //% fixedInstance jres blockIdentity=brick._imagePicker
export const informationWarning = screen.unpackPNG(hex``); export const informationWarning = screen.unpackPNG(hex``);
//% fixedInstance jres //% fixedInstance jres blockIdentity=brick._imagePicker
export const legoColorSensor = screen.unpackPNG(hex``); export const legoColorSensor = screen.unpackPNG(hex``);
//% fixedInstance jres //% fixedInstance jres blockIdentity=brick._imagePicker
export const legoEv3icon = screen.unpackPNG(hex``); export const legoEv3icon = screen.unpackPNG(hex``);
//% fixedInstance jres //% fixedInstance jres blockIdentity=brick._imagePicker
export const legoEv3 = screen.unpackPNG(hex``); export const legoEv3 = screen.unpackPNG(hex``);
//% fixedInstance jres //% fixedInstance jres blockIdentity=brick._imagePicker
export const legoGyroSensor = screen.unpackPNG(hex``); export const legoGyroSensor = screen.unpackPNG(hex``);
//% fixedInstance jres //% fixedInstance jres blockIdentity=brick._imagePicker
export const legoIrBeacon = screen.unpackPNG(hex``); export const legoIrBeacon = screen.unpackPNG(hex``);
//% fixedInstance jres //% fixedInstance jres blockIdentity=brick._imagePicker
export const legoIrSensor = screen.unpackPNG(hex``); export const legoIrSensor = screen.unpackPNG(hex``);
//% fixedInstance jres //% fixedInstance jres blockIdentity=brick._imagePicker
export const legoLego = screen.unpackPNG(hex``); export const legoLego = screen.unpackPNG(hex``);
//% fixedInstance jres //% fixedInstance jres blockIdentity=brick._imagePicker
export const legoLargeMotor = screen.unpackPNG(hex``); export const legoLargeMotor = screen.unpackPNG(hex``);
//% fixedInstance jres //% fixedInstance jres blockIdentity=brick._imagePicker
export const legoMindstorms = screen.unpackPNG(hex``); export const legoMindstorms = screen.unpackPNG(hex``);
//% fixedInstance jres //% fixedInstance jres blockIdentity=brick._imagePicker
export const legoMediumMotor = screen.unpackPNG(hex``); export const legoMediumMotor = screen.unpackPNG(hex``);
//% fixedInstance jres //% fixedInstance jres blockIdentity=brick._imagePicker
export const legoSoundSensor = screen.unpackPNG(hex``); export const legoSoundSensor = screen.unpackPNG(hex``);
//% fixedInstance jres //% fixedInstance jres blockIdentity=brick._imagePicker
export const legoTempSensor = screen.unpackPNG(hex``); export const legoTempSensor = screen.unpackPNG(hex``);
//% fixedInstance jres //% fixedInstance jres blockIdentity=brick._imagePicker
export const legoTouchSensor = screen.unpackPNG(hex``); export const legoTouchSensor = screen.unpackPNG(hex``);
//% fixedInstance jres //% fixedInstance jres blockIdentity=brick._imagePicker
export const legoUsSensor = screen.unpackPNG(hex``); export const legoUsSensor = screen.unpackPNG(hex``);
//% fixedInstance jres //% fixedInstance jres blockIdentity=brick._imagePicker
export const objectsBomb = screen.unpackPNG(hex``); export const objectsBomb = screen.unpackPNG(hex``);
//% fixedInstance jres //% fixedInstance jres blockIdentity=brick._imagePicker
export const objectsBoom = screen.unpackPNG(hex``); export const objectsBoom = screen.unpackPNG(hex``);
//% fixedInstance jres //% fixedInstance jres blockIdentity=brick._imagePicker
export const objectsFire = screen.unpackPNG(hex``); export const objectsFire = screen.unpackPNG(hex``);
//% fixedInstance jres //% fixedInstance jres blockIdentity=brick._imagePicker
export const objectsFlowers = screen.unpackPNG(hex``); export const objectsFlowers = screen.unpackPNG(hex``);
//% fixedInstance jres //% fixedInstance jres blockIdentity=brick._imagePicker
export const objectsForest = screen.unpackPNG(hex``); export const objectsForest = screen.unpackPNG(hex``);
//% fixedInstance jres //% fixedInstance jres blockIdentity=brick._imagePicker
export const objectsLightOff = screen.unpackPNG(hex``); export const objectsLightOff = screen.unpackPNG(hex``);
//% fixedInstance jres //% fixedInstance jres blockIdentity=brick._imagePicker
export const objectsLightOn = screen.unpackPNG(hex``); export const objectsLightOn = screen.unpackPNG(hex``);
//% fixedInstance jres //% fixedInstance jres blockIdentity=brick._imagePicker
export const objectsLightning = screen.unpackPNG(hex``); export const objectsLightning = screen.unpackPNG(hex``);
//% fixedInstance jres //% fixedInstance jres blockIdentity=brick._imagePicker
export const objectsNight = screen.unpackPNG(hex``); export const objectsNight = screen.unpackPNG(hex``);
//% fixedInstance jres //% fixedInstance jres blockIdentity=brick._imagePicker
export const objectsPirate = screen.unpackPNG(hex``); export const objectsPirate = screen.unpackPNG(hex``);
//% fixedInstance jres //% fixedInstance jres blockIdentity=brick._imagePicker
export const objectsSnow = screen.unpackPNG(hex``); export const objectsSnow = screen.unpackPNG(hex``);
//% fixedInstance jres //% fixedInstance jres blockIdentity=brick._imagePicker
export const objectsTarget = screen.unpackPNG(hex``); export const objectsTarget = screen.unpackPNG(hex``);
//% fixedInstance jres //% fixedInstance jres blockIdentity=brick._imagePicker
export const progressBar0 = screen.unpackPNG(hex``); export const progressBar0 = screen.unpackPNG(hex``);
//% fixedInstance jres //% fixedInstance jres blockIdentity=brick._imagePicker
export const progressBar1 = screen.unpackPNG(hex``); export const progressBar1 = screen.unpackPNG(hex``);
//% fixedInstance jres //% fixedInstance jres blockIdentity=brick._imagePicker
export const progressBar2 = screen.unpackPNG(hex``); export const progressBar2 = screen.unpackPNG(hex``);
//% fixedInstance jres //% fixedInstance jres blockIdentity=brick._imagePicker
export const progressBar3 = screen.unpackPNG(hex``); export const progressBar3 = screen.unpackPNG(hex``);
//% fixedInstance jres //% fixedInstance jres blockIdentity=brick._imagePicker
export const progressBar4 = screen.unpackPNG(hex``); export const progressBar4 = screen.unpackPNG(hex``);
//% fixedInstance jres //% fixedInstance jres blockIdentity=brick._imagePicker
export const progressDial0 = screen.unpackPNG(hex``); export const progressDial0 = screen.unpackPNG(hex``);
//% fixedInstance jres //% fixedInstance jres blockIdentity=brick._imagePicker
export const progressDial1 = screen.unpackPNG(hex``); export const progressDial1 = screen.unpackPNG(hex``);
//% fixedInstance jres //% fixedInstance jres blockIdentity=brick._imagePicker
export const progressDial2 = screen.unpackPNG(hex``); export const progressDial2 = screen.unpackPNG(hex``);
//% fixedInstance jres //% fixedInstance jres blockIdentity=brick._imagePicker
export const progressDial3 = screen.unpackPNG(hex``); export const progressDial3 = screen.unpackPNG(hex``);
//% fixedInstance jres //% fixedInstance jres blockIdentity=brick._imagePicker
export const progressDial4 = screen.unpackPNG(hex``); export const progressDial4 = screen.unpackPNG(hex``);
//% fixedInstance jres //% fixedInstance jres blockIdentity=brick._imagePicker
export const progressDots0 = screen.unpackPNG(hex``); export const progressDots0 = screen.unpackPNG(hex``);
//% fixedInstance jres //% fixedInstance jres blockIdentity=brick._imagePicker
export const progressDots1 = screen.unpackPNG(hex``); export const progressDots1 = screen.unpackPNG(hex``);
//% fixedInstance jres //% fixedInstance jres blockIdentity=brick._imagePicker
export const progressDots2 = screen.unpackPNG(hex``); export const progressDots2 = screen.unpackPNG(hex``);
//% fixedInstance jres //% fixedInstance jres blockIdentity=brick._imagePicker
export const progressDots3 = screen.unpackPNG(hex``); export const progressDots3 = screen.unpackPNG(hex``);
//% fixedInstance jres //% fixedInstance jres blockIdentity=brick._imagePicker
export const progressHourglass0 = screen.unpackPNG(hex``); export const progressHourglass0 = screen.unpackPNG(hex``);
//% fixedInstance jres //% fixedInstance jres blockIdentity=brick._imagePicker
export const progressHourglass1 = screen.unpackPNG(hex``); export const progressHourglass1 = screen.unpackPNG(hex``);
//% fixedInstance jres //% fixedInstance jres blockIdentity=brick._imagePicker
export const progressHourglass2 = screen.unpackPNG(hex``); export const progressHourglass2 = screen.unpackPNG(hex``);
//% fixedInstance jres //% fixedInstance jres blockIdentity=brick._imagePicker
export const progressTimer0 = screen.unpackPNG(hex``); export const progressTimer0 = screen.unpackPNG(hex``);
//% fixedInstance jres //% fixedInstance jres blockIdentity=brick._imagePicker
export const progressTimer1 = screen.unpackPNG(hex``); export const progressTimer1 = screen.unpackPNG(hex``);
//% fixedInstance jres //% fixedInstance jres blockIdentity=brick._imagePicker
export const progressTimer2 = screen.unpackPNG(hex``); export const progressTimer2 = screen.unpackPNG(hex``);
//% fixedInstance jres //% fixedInstance jres blockIdentity=brick._imagePicker
export const progressTimer3 = screen.unpackPNG(hex``); export const progressTimer3 = screen.unpackPNG(hex``);
//% fixedInstance jres //% fixedInstance jres blockIdentity=brick._imagePicker
export const progressTimer4 = screen.unpackPNG(hex``); export const progressTimer4 = screen.unpackPNG(hex``);
//% fixedInstance jres //% fixedInstance jres blockIdentity=brick._imagePicker
export const progressWaterLevel0 = screen.unpackPNG(hex``); export const progressWaterLevel0 = screen.unpackPNG(hex``);
//% fixedInstance jres //% fixedInstance jres blockIdentity=brick._imagePicker
export const progressWaterLevel1 = screen.unpackPNG(hex``); export const progressWaterLevel1 = screen.unpackPNG(hex``);
//% fixedInstance jres //% fixedInstance jres blockIdentity=brick._imagePicker
export const progressWaterLevel2 = screen.unpackPNG(hex``); export const progressWaterLevel2 = screen.unpackPNG(hex``);
//% fixedInstance jres //% fixedInstance jres blockIdentity=brick._imagePicker
export const progressWaterLevel3 = screen.unpackPNG(hex``); export const progressWaterLevel3 = screen.unpackPNG(hex``);
//% fixedInstance jres //% fixedInstance jres blockIdentity=brick._imagePicker
export const systemAccept1 = screen.unpackPNG(hex``); export const systemAccept1 = screen.unpackPNG(hex``);
//% fixedInstance jres //% fixedInstance jres blockIdentity=brick._imagePicker
export const systemAccept2 = screen.unpackPNG(hex``); export const systemAccept2 = screen.unpackPNG(hex``);
//% fixedInstance jres //% fixedInstance jres blockIdentity=brick._imagePicker
export const systemAlert = screen.unpackPNG(hex``); export const systemAlert = screen.unpackPNG(hex``);
//% fixedInstance jres //% fixedInstance jres blockIdentity=brick._imagePicker
export const systemBox = screen.unpackPNG(hex``); export const systemBox = screen.unpackPNG(hex``);
//% fixedInstance jres //% fixedInstance jres blockIdentity=brick._imagePicker
export const systemBusy0 = screen.unpackPNG(hex``); export const systemBusy0 = screen.unpackPNG(hex``);
//% fixedInstance jres //% fixedInstance jres blockIdentity=brick._imagePicker
export const systemBusy1 = screen.unpackPNG(hex``); export const systemBusy1 = screen.unpackPNG(hex``);
//% fixedInstance jres //% fixedInstance jres blockIdentity=brick._imagePicker
export const systemDecline1 = screen.unpackPNG(hex``); export const systemDecline1 = screen.unpackPNG(hex``);
//% fixedInstance jres //% fixedInstance jres blockIdentity=brick._imagePicker
export const systemDecline2 = screen.unpackPNG(hex``); export const systemDecline2 = screen.unpackPNG(hex``);
//% fixedInstance jres //% fixedInstance jres blockIdentity=brick._imagePicker
export const systemDotEmpty = screen.unpackPNG(hex``); export const systemDotEmpty = screen.unpackPNG(hex``);
//% fixedInstance jres //% fixedInstance jres blockIdentity=brick._imagePicker
export const systemDotFull = screen.unpackPNG(hex``); export const systemDotFull = screen.unpackPNG(hex``);
//% fixedInstance jres //% fixedInstance jres blockIdentity=brick._imagePicker
export const systemEv3small = screen.unpackPNG(hex``); export const systemEv3small = screen.unpackPNG(hex``);
//% fixedInstance jres //% fixedInstance jres blockIdentity=brick._imagePicker
export const systemPlay = screen.unpackPNG(hex``); export const systemPlay = screen.unpackPNG(hex``);
//% fixedInstance jres //% fixedInstance jres blockIdentity=brick._imagePicker
export const systemSlider0 = screen.unpackPNG(hex``); export const systemSlider0 = screen.unpackPNG(hex``);
//% fixedInstance jres //% fixedInstance jres blockIdentity=brick._imagePicker
export const systemSlider1 = screen.unpackPNG(hex``); export const systemSlider1 = screen.unpackPNG(hex``);
//% fixedInstance jres //% fixedInstance jres blockIdentity=brick._imagePicker
export const systemSlider2 = screen.unpackPNG(hex``); export const systemSlider2 = screen.unpackPNG(hex``);
//% fixedInstance jres //% fixedInstance jres blockIdentity=brick._imagePicker
export const systemSlider3 = screen.unpackPNG(hex``); export const systemSlider3 = screen.unpackPNG(hex``);
//% fixedInstance jres //% fixedInstance jres blockIdentity=brick._imagePicker
export const systemSlider4 = screen.unpackPNG(hex``); export const systemSlider4 = screen.unpackPNG(hex``);
//% fixedInstance jres //% fixedInstance jres blockIdentity=brick._imagePicker
export const systemSlider5 = screen.unpackPNG(hex``); export const systemSlider5 = screen.unpackPNG(hex``);
//% fixedInstance jres //% fixedInstance jres blockIdentity=brick._imagePicker
export const systemSlider6 = screen.unpackPNG(hex``); export const systemSlider6 = screen.unpackPNG(hex``);
//% fixedInstance jres //% fixedInstance jres blockIdentity=brick._imagePicker
export const systemSlider7 = screen.unpackPNG(hex``); export const systemSlider7 = screen.unpackPNG(hex``);
//% fixedInstance jres //% fixedInstance jres blockIdentity=brick._imagePicker
export const systemSlider8 = screen.unpackPNG(hex``); export const systemSlider8 = screen.unpackPNG(hex``);
} }

View File

@ -36,6 +36,7 @@ namespace motors {
pwmMM = control.mmap("/dev/lms_pwm", 0, 0) pwmMM = control.mmap("/dev/lms_pwm", 0, 0)
if (!pwmMM) control.fail("no PWM file") if (!pwmMM) control.fail("no PWM file")
motorMM = control.mmap("/dev/lms_motor", MotorDataOff.Size * DAL.NUM_OUTPUTS, 0) motorMM = control.mmap("/dev/lms_motor", MotorDataOff.Size * DAL.NUM_OUTPUTS, 0)
if (!motorMM) control.fail("no motor file")
resetMotors() resetMotors()
@ -285,6 +286,7 @@ namespace motors {
// only a single output at a time // only a single output at a time
function getMotorData(out: Output): MotorData { function getMotorData(out: Output): MotorData {
init()
let buf = motorMM.slice(outOffset(out), MotorDataOff.Size) let buf = motorMM.slice(outOffset(out), MotorDataOff.Size)
return { return {
actualSpeed: buf.getNumber(NumberFormat.Int8LE, MotorDataOff.Speed), actualSpeed: buf.getNumber(NumberFormat.Int8LE, MotorDataOff.Speed),

View File

@ -1,9 +1,9 @@
{ {
"sensors.InfraredSensor.onEvent": "Registers code to run when an object is getting near.", "sensors.InfraredSensor.onEvent": "Registers code to run when an object is getting near.",
"sensors.InfraredSensor.onEvent|param|handler": "the code to run when detected", "sensors.InfraredSensor.onEvent|param|handler": "the code to run when detected",
"sensors.InfraredSensor.pauseUntil": "Waits for the event to occur",
"sensors.InfraredSensor.proximity": "Get the promixity measured by the infrared sensor, from ``0`` (close) to ``100`` (far)", "sensors.InfraredSensor.proximity": "Get the promixity measured by the infrared sensor, from ``0`` (close) to ``100`` (far)",
"sensors.InfraredSensor.remoteCommand": "Get the remote commandreceived the infrared sensor.", "sensors.InfraredSensor.remoteCommand": "Get the remote commandreceived the infrared sensor.",
"sensors.InfraredSensor.waitUntil": "Waits for the event to occur",
"sensors.RemoteInfraredBeaconButton.isPressed": "Check if a remote button is currently pressed or not.", "sensors.RemoteInfraredBeaconButton.isPressed": "Check if a remote button is currently pressed or not.",
"sensors.RemoteInfraredBeaconButton.onEvent": "Do something when a button or sensor is clicked, up or down", "sensors.RemoteInfraredBeaconButton.onEvent": "Do something when a button or sensor is clicked, up or down",
"sensors.RemoteInfraredBeaconButton.onEvent|param|body": "code to run when the event is raised", "sensors.RemoteInfraredBeaconButton.onEvent|param|body": "code to run when the event is raised",

View File

@ -2,9 +2,9 @@
"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 `icons.infraredSensor` %sensor|%event",
"sensors.InfraredSensor.pauseUntil|block": "pause until `icons.infraredSensor` %sensor| %event",
"sensors.InfraredSensor.proximity|block": "`icons.infraredSensor` %sensor|proximity", "sensors.InfraredSensor.proximity|block": "`icons.infraredSensor` %sensor|proximity",
"sensors.InfraredSensor.remoteCommand|block": "`icons.infraredSensor` %sensor|remote command", "sensors.InfraredSensor.remoteCommand|block": "`icons.infraredSensor` %sensor|remote command",
"sensors.InfraredSensor.waitUntil|block": "wait until `icons.infraredSensor` %sensor| %event",
"sensors.RemoteInfraredBeaconButton.isPressed|block": "`icons.infraredSensor` %button|is pressed", "sensors.RemoteInfraredBeaconButton.isPressed|block": "`icons.infraredSensor` %button|is pressed",
"sensors.RemoteInfraredBeaconButton.onEvent|block": "on `icons.infraredSensor` %button|%event", "sensors.RemoteInfraredBeaconButton.onEvent|block": "on `icons.infraredSensor` %button|%event",
"sensors.RemoteInfraredBeaconButton.wasPressed|block": "`icons.infraredSensor` %button|was pressed", "sensors.RemoteInfraredBeaconButton.wasPressed|block": "`icons.infraredSensor` %button|was pressed",

View File

@ -205,7 +205,7 @@ namespace sensors {
* Waits for the event to occur * Waits for the event to occur
*/ */
//% help=input/ultrasonic/wait //% help=input/ultrasonic/wait
//% block="wait until `icons.infraredSensor` %sensor| %event" //% block="pause until `icons.infraredSensor` %sensor| %event"
//% blockId=infraredwait //% blockId=infraredwait
//% parts="infraredsensor" //% parts="infraredsensor"
//% sensor.fieldEditor="imagedropdown" //% sensor.fieldEditor="imagedropdown"
@ -213,7 +213,7 @@ namespace sensors {
//% blockNamespace=sensors //% blockNamespace=sensors
//% weight=99 blockGap=8 //% weight=99 blockGap=8
//% group="Infrared Sensor" //% group="Infrared Sensor"
waitUntil(event: InfraredSensorEvent) { pauseUntil(event: InfraredSensorEvent) {
control.waitForEvent(this._id, event); control.waitForEvent(this._id, event);
} }

View File

@ -3,6 +3,6 @@
"sensors.TouchSensor.isPressed": "Check if touch sensor is touched.", "sensors.TouchSensor.isPressed": "Check if touch sensor is touched.",
"sensors.TouchSensor.onEvent": "Do something when a touch sensor is touched...", "sensors.TouchSensor.onEvent": "Do something when a touch sensor is touched...",
"sensors.TouchSensor.onEvent|param|body": "code to run when the event is raised", "sensors.TouchSensor.onEvent|param|body": "code to run when the event is raised",
"sensors.TouchSensor.waitUntil": "Wait until the touch sensor is touched", "sensors.TouchSensor.pauseUntil": "Wait until the touch sensor is touched",
"sensors.TouchSensor.wasPressed": "Check if touch sensor is touched since it was last checked." "sensors.TouchSensor.wasPressed": "Check if touch sensor is touched since it was last checked."
} }

View File

@ -4,7 +4,7 @@
"TouchSensorEvent.Released|block": "released", "TouchSensorEvent.Released|block": "released",
"sensors.TouchSensor.isPressed|block": "`icons.touchSensor` %sensor|is pressed", "sensors.TouchSensor.isPressed|block": "`icons.touchSensor` %sensor|is pressed",
"sensors.TouchSensor.onEvent|block": "on `icons.touchSensor` %sensor|%event", "sensors.TouchSensor.onEvent|block": "on `icons.touchSensor` %sensor|%event",
"sensors.TouchSensor.waitUntil|block": "wait until `icons.touchSensor` %sensor|%event", "sensors.TouchSensor.pauseUntil|block": "pause until `icons.touchSensor` %sensor|%event",
"sensors.TouchSensor.wasPressed|block": "`icons.touchSensor` %sensor|was pressed", "sensors.TouchSensor.wasPressed|block": "`icons.touchSensor` %sensor|was pressed",
"sensors.touchSensor1|block": "1", "sensors.touchSensor1|block": "1",
"sensors.touchSensor2|block": "2", "sensors.touchSensor2|block": "2",

View File

@ -58,16 +58,16 @@ namespace sensors {
* @param sensor the touch sensor that needs to be clicked or used * @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 event the kind of button gesture that needs to be detected
*/ */
//% help=input/touch-sensor/wait-until //% help=input/touch-sensor/pause-until
//% blockId=touchWaitUntil block="wait until `icons.touchSensor` %sensor|%event" //% blockId=touchWaitUntil block="pause until `icons.touchSensor` %sensor|%event"
//% parts="touch" //% parts="touch"
//% sensor.fieldEditor="imagedropdown" //% sensor.fieldEditor="imagedropdown"
//% sensor.fieldOptions.columns=4 //% sensor.fieldOptions.columns=4
//% blockNamespace=sensors //% blockNamespace=sensors
//% weight=98 blockGap=8 //% weight=98 blockGap=8
//% group="Touch Sensor" //% group="Touch Sensor"
waitUntil(ev: TouchSensorEvent) { pauseUntil(ev: TouchSensorEvent) {
this.button.waitUntil(<ButtonEvent><number>ev); this.button.pauseUntil(<ButtonEvent><number>ev);
} }
/** /**

View File

@ -2,5 +2,5 @@
"sensors.UltraSonicSensor.distance": "Gets the distance from the sonar in centimeters", "sensors.UltraSonicSensor.distance": "Gets the distance from the sonar in centimeters",
"sensors.UltraSonicSensor.onEvent": "Registers code to run when the given color is close", "sensors.UltraSonicSensor.onEvent": "Registers code to run when the given color is close",
"sensors.UltraSonicSensor.onEvent|param|handler": "the code to run when detected", "sensors.UltraSonicSensor.onEvent|param|handler": "the code to run when detected",
"sensors.UltraSonicSensor.waitUntil": "Waits for the event to occur" "sensors.UltraSonicSensor.pauseUntil": "Waits for the event to occur"
} }

View File

@ -4,7 +4,7 @@
"UltrasonicSensorEvent.ObjectNear|block": "object near", "UltrasonicSensorEvent.ObjectNear|block": "object near",
"sensors.UltraSonicSensor.distance|block": "`icons.ultrasonicSensor` %sensor|distance", "sensors.UltraSonicSensor.distance|block": "`icons.ultrasonicSensor` %sensor|distance",
"sensors.UltraSonicSensor.onEvent|block": "on `icons.ultrasonicSensor` %sensor|%event", "sensors.UltraSonicSensor.onEvent|block": "on `icons.ultrasonicSensor` %sensor|%event",
"sensors.UltraSonicSensor.waitUntil|block": "wait until `icons.ultrasonicSensor` %sensor| %event", "sensors.UltraSonicSensor.pauseUntil|block": "pause until `icons.ultrasonicSensor` %sensor| %event",
"sensors.ultrasonic1|block": "1", "sensors.ultrasonic1|block": "1",
"sensors.ultrasonic2|block": "2", "sensors.ultrasonic2|block": "2",
"sensors.ultrasonic3|block": "3", "sensors.ultrasonic3|block": "3",

View File

@ -58,7 +58,7 @@ namespace sensors {
* Waits for the event to occur * Waits for the event to occur
*/ */
//% help=input/ultrasonic/wait //% help=input/ultrasonic/wait
//% block="wait until `icons.ultrasonicSensor` %sensor| %event" //% block="pause until `icons.ultrasonicSensor` %sensor| %event"
//% blockId=ultrasonicWait //% blockId=ultrasonicWait
//% parts="ultrasonicsensor" //% parts="ultrasonicsensor"
//% sensor.fieldEditor="imagedropdown" //% sensor.fieldEditor="imagedropdown"
@ -66,7 +66,7 @@ namespace sensors {
//% blockNamespace=sensors //% blockNamespace=sensors
//% weight=99 blockGap=8 //% weight=99 blockGap=8
//% group="Ultrasonic Sensor" //% group="Ultrasonic Sensor"
waitUntil(event: UltrasonicSensorEvent) { pauseUntil(event: UltrasonicSensorEvent) {
control.waitForEvent(this._id, event); control.waitForEvent(this._id, event);
} }