From e94ac6f6f1ab75db8d6be97dda8545e4459881ca Mon Sep 17 00:00:00 2001 From: Peli de Halleux Date: Tue, 6 Feb 2018 22:18:39 -0800 Subject: [PATCH] renaming brick.setLight to brick.setStatusLight (#307) * renaming brick.setLight to brick.setStatusLight * updated docs --- docs/SUMMARY.md | 2 +- docs/coding/reversing-the-robot-1.md | 2 +- docs/coding/reversing-the-robot-2.md | 2 +- docs/coding/reversing-the-robot-3.md | 2 +- docs/examples/core-set/gyroboy-labview.md | 4 +-- docs/examples/core-set/puppy-labview.md | 4 +-- docs/examples/core-set/robotarm-labview.md | 4 +-- docs/examples/crane-labview.md | 4 +-- docs/examples/gyro-boy-labview.md | 4 +-- docs/reference/brick.md | 2 +- docs/reference/brick/battery-level.md | 6 ++-- docs/reference/brick/button/is-pressed.md | 4 +-- docs/reference/brick/button/on-event.md | 2 +- docs/reference/brick/button/was-pressed.md | 4 +-- .../{set-light.md => set-status-light.md} | 10 +++---- .../sensors/color-sensor/ambient-light.md | 4 +-- .../reference/sensors/color-sensor/color.md | 4 +-- .../sensors/color-sensor/reflected-light.md | 4 +-- libs/core/buttons.ts | 10 +++---- libs/core/test.ts | 4 +-- libs/mood/mood.ts | 30 +++++++++---------- .../sensors/touch-sensor/is-pressed.md | 4 +-- .../sensors/touch-sensor/was-pressed.md | 4 +-- 23 files changed, 60 insertions(+), 60 deletions(-) rename docs/reference/brick/{set-light.md => set-status-light.md} (76%) diff --git a/docs/SUMMARY.md b/docs/SUMMARY.md index 72bda684..aeefb6b3 100644 --- a/docs/SUMMARY.md +++ b/docs/SUMMARY.md @@ -52,7 +52,7 @@ * [is pressed](/reference/brick/button/is-pressed) * [was pressed](/reference/brick/button/was-pressed) * [pause until](/reference/brick/button/pause-until) - * [set light](/reference/brick/set-light) + * [set light](/reference/brick/set-status-light) * [battery level](/reference/brick/battery-level) * [Motors](/reference/motors) * [set speed](/reference/motors/motor/set-speed) diff --git a/docs/coding/reversing-the-robot-1.md b/docs/coding/reversing-the-robot-1.md index 30c36c86..ab6924d2 100644 --- a/docs/coding/reversing-the-robot-1.md +++ b/docs/coding/reversing-the-robot-1.md @@ -6,7 +6,7 @@ brick.buttonEnter.onEvent(ButtonEvent.Bumped, function () { sensors.touch1.pauseUntil(ButtonEvent.Pressed) motors.largeBC.setSpeed(0) loops.pause(1000) - brick.setLight(BrickLight.OrangeFlash) + brick.setStatusLight(StatusLight.OrangeFlash) motors.largeBC.setSpeed(-50) loops.pause(2000) motors.largeBC.setSpeed(0) diff --git a/docs/coding/reversing-the-robot-2.md b/docs/coding/reversing-the-robot-2.md index ca1c844c..0452f3b1 100644 --- a/docs/coding/reversing-the-robot-2.md +++ b/docs/coding/reversing-the-robot-2.md @@ -7,7 +7,7 @@ brick.buttonEnter.onEvent(ButtonEvent.Bumped, function () { sensors.touch2.pauseUntil(ButtonEvent.Pressed) motors.largeBC.setSpeed(0) loops.pause(1000) - brick.setLight(BrickLight.OrangeFlash) + brick.setStatusLight(StatusLight.OrangeFlash) motors.largeBC.setSpeed(-50) loops.pause(2000) motors.largeBC.setSpeed(0) diff --git a/docs/coding/reversing-the-robot-3.md b/docs/coding/reversing-the-robot-3.md index b40eb432..1d09de79 100644 --- a/docs/coding/reversing-the-robot-3.md +++ b/docs/coding/reversing-the-robot-3.md @@ -10,7 +10,7 @@ brick.buttonEnter.onEvent(ButtonEvent.Bumped, function () { brick.showImage(images.eyesTiredMiddle) motors.largeBC.setSpeed(0) loops.pause(1000) - brick.setLight(BrickLight.OrangeFlash) + brick.setStatusLight(StatusLight.OrangeFlash) brick.showImage(images.eyesDizzy) motors.largeBC.setSpeed(-50) loops.pause(2000) diff --git a/docs/examples/core-set/gyroboy-labview.md b/docs/examples/core-set/gyroboy-labview.md index b1296634..f69e12a8 100644 --- a/docs/examples/core-set/gyroboy-labview.md +++ b/docs/examples/core-set/gyroboy-labview.md @@ -146,11 +146,11 @@ loops.forever(function () { } motors.stopAllMotors() st = 0; - brick.setLight(BrickLight.RedPulse); + brick.setStatusLight(StatusLight.RedPulse); brick.showImage(images.eyesKnockedOut) music.playSoundEffect(sounds.movementsSpeedDown) sensors.touch3.pauseUntil(ButtonEvent.Pressed) - brick.setLight(BrickLight.Off); + brick.setStatusLight(StatusLight.Off); }) // BHV diff --git a/docs/examples/core-set/puppy-labview.md b/docs/examples/core-set/puppy-labview.md index 140097ba..0e95532f 100644 --- a/docs/examples/core-set/puppy-labview.md +++ b/docs/examples/core-set/puppy-labview.md @@ -29,7 +29,7 @@ function DN() { function MNRH() { motors.mediumC.setBrake(true) brick.showImage(images.legoEv3icon) - brick.setLight(BrickLight.OrangePulse) + brick.setStatusLight(StatusLight.OrangePulse) while (!brick.buttonEnter.wasPressed()) { if (brick.buttonUp.wasPressed()) { motors.mediumC.setSpeed(-100); @@ -41,7 +41,7 @@ function MNRH() { } motors.mediumC.stop(); motors.mediumC.clearCounts(); - brick.setLight(BrickLight.Green); + brick.setStatusLight(StatusLight.Green); } function IS(t: number) { diff --git a/docs/examples/core-set/robotarm-labview.md b/docs/examples/core-set/robotarm-labview.md index 412a426c..d5e9f278 100644 --- a/docs/examples/core-set/robotarm-labview.md +++ b/docs/examples/core-set/robotarm-labview.md @@ -20,9 +20,9 @@ INI() let down = false; loops.forever(function () { brick.showImage(images.informationQuestionMark) - brick.setLight(BrickLight.OrangePulse); + brick.setStatusLight(StatusLight.OrangePulse); pauseUntil(() => (down = brick.buttonDown.wasPressed()) || brick.buttonUp.wasPressed()) - brick.setLight(BrickLight.Off) + brick.setStatusLight(StatusLight.Off) music.playSoundEffect(sounds.mechanicalAirRelease) brick.showImage(images.informationAccept) if (down) { diff --git a/docs/examples/crane-labview.md b/docs/examples/crane-labview.md index c1e6c22b..5aca874b 100644 --- a/docs/examples/crane-labview.md +++ b/docs/examples/crane-labview.md @@ -20,9 +20,9 @@ INI() let down = false; loops.forever(function () { brick.showImage(images.informationQuestionMark) - brick.setLight(BrickLight.OrangePulse); + brick.setStatusLight(StatusLight.OrangePulse); pauseUntil(() => (down = brick.buttonDown.wasPressed()) || brick.buttonUp.wasPressed()) - brick.setLight(BrickLight.Off) + brick.setStatusLight(StatusLight.Off) music.playSoundEffect(sounds.mechanicalAirRelease) brick.showImage(images.informationAccept) if (down) { diff --git a/docs/examples/gyro-boy-labview.md b/docs/examples/gyro-boy-labview.md index ef6b084a..89ee19fe 100644 --- a/docs/examples/gyro-boy-labview.md +++ b/docs/examples/gyro-boy-labview.md @@ -146,11 +146,11 @@ loops.forever(function () { } motors.stopAllMotors() st = 0; - brick.setLight(BrickLight.RedPulse); + brick.setStatusLight(StatusLight.RedPulse); brick.showImage(images.eyesKnockedOut) music.playSoundEffect(sounds.movementsSpeedDown) sensors.touch3.pauseUntil(ButtonEvent.Pressed) - brick.setLight(BrickLight.Off); + brick.setStatusLight(StatusLight.Off); }) // BHV diff --git a/docs/reference/brick.md b/docs/reference/brick.md index 9a1ae91c..269acaf9 100644 --- a/docs/reference/brick.md +++ b/docs/reference/brick.md @@ -20,7 +20,7 @@ brick.buttonEnter.onEvent(ButtonEvent.Bumped, function () { brick.buttonEnter.pauseUntil(ButtonEvent.Bumped); brick.buttonEnter.isPressed() brick.buttonEnter.wasPressed() -brick.setLight(BrickLight.Red); +brick.setStatusLight(StatusLight.Red); ``` ## Other diff --git a/docs/reference/brick/battery-level.md b/docs/reference/brick/battery-level.md index 0968f3a4..e2a4f2a7 100644 --- a/docs/reference/brick/battery-level.md +++ b/docs/reference/brick/battery-level.md @@ -22,11 +22,11 @@ loops.forever(function() { battery = brick.batteryLevel(); if (battery > 15) { - brick.setLight(BrickLight.Green); + brick.setStatusLight(StatusLight.Green); } else if (battery > 5) { - brick.setLight(BrickLight.Orange); + brick.setStatusLight(StatusLight.Orange); } else { - brick.setLight(BrickLight.RedPulse) + brick.setStatusLight(StatusLight.RedPulse) } loops.pause(30000) }) diff --git a/docs/reference/brick/button/is-pressed.md b/docs/reference/brick/button/is-pressed.md index b7b77073..ae0ac82e 100644 --- a/docs/reference/brick/button/is-pressed.md +++ b/docs/reference/brick/button/is-pressed.md @@ -34,11 +34,11 @@ Set the brick light to green when the `down` is pressed. When the button is not let isRed = false; loops.forever(function() { if (brick.buttonLeft.isPressed()) { - brick.setLight(BrickLight.Green); + brick.setStatusLight(StatusLight.Green); isRed = false; } else { if (!isRed) { - brick.setLight(BrickLight.Red); + brick.setStatusLight(StatusLight.Red); isRed = true; } } diff --git a/docs/reference/brick/button/on-event.md b/docs/reference/brick/button/on-event.md index 138c25b2..b3966365 100644 --- a/docs/reference/brick/button/on-event.md +++ b/docs/reference/brick/button/on-event.md @@ -16,7 +16,7 @@ Your @boardname@ has touch sensors that work like buttons. Instead of saying `en ```block sensors.touch1.onEvent(ButtonEvent.Pressed, function () { - brick.setLight(BrickLight.Orange); + brick.setStatusLight(StatusLight.Orange); }); ``` diff --git a/docs/reference/brick/button/was-pressed.md b/docs/reference/brick/button/was-pressed.md index 7a2d33c9..59208217 100644 --- a/docs/reference/brick/button/was-pressed.md +++ b/docs/reference/brick/button/was-pressed.md @@ -35,9 +35,9 @@ Set the brick light to green if the `right` button was pressed before the `left` ```blocks brick.buttonLeft.onEvent(ButtonEvent.Bumped, function() { if (brick.buttonRight.wasPressed()) { - brick.setLight(BrickLight.Green) + brick.setStatusLight(StatusLight.Green) } else { - brick.setLight(BrickLight.Off) + brick.setStatusLight(StatusLight.Off) } }) ``` diff --git a/docs/reference/brick/set-light.md b/docs/reference/brick/set-status-light.md similarity index 76% rename from docs/reference/brick/set-light.md rename to docs/reference/brick/set-status-light.md index 56c29bb5..c69a64f8 100644 --- a/docs/reference/brick/set-light.md +++ b/docs/reference/brick/set-status-light.md @@ -3,7 +3,7 @@ Set the light on the brick to a solid or flashing color. ```sig -brick.setLight(BrickLight.Red); +brick.setStatusLight(StatusLight.Red); ``` ## Parameters @@ -25,13 +25,13 @@ Repeatedly show a different color pattern for the brick light. ```blocks loops.forever(function () { - brick.setLight(BrickLight.Orange) + brick.setStatusLight(StatusLight.Orange) loops.pause(1000) - brick.setLight(BrickLight.GreenFlash) + brick.setStatusLight(StatusLight.GreenFlash) loops.pause(2000) - brick.setLight(BrickLight.RedPulse) + brick.setStatusLight(StatusLight.RedPulse) loops.pause(2000) - brick.setLight(BrickLight.Off) + brick.setStatusLight(StatusLight.Off) loops.pause(500) }) ``` diff --git a/libs/color-sensor/docs/reference/sensors/color-sensor/ambient-light.md b/libs/color-sensor/docs/reference/sensors/color-sensor/ambient-light.md index f9984bbb..767d875b 100644 --- a/libs/color-sensor/docs/reference/sensors/color-sensor/ambient-light.md +++ b/libs/color-sensor/docs/reference/sensors/color-sensor/ambient-light.md @@ -3,9 +3,9 @@ ```blocks loops.forever(function () { if (sensors.color1.ambientLight() > 20) { - brick.setLight(BrickLight.Green) + brick.setStatusLight(StatusLight.Green) } else { - brick.setLight(BrickLight.Orange) + brick.setStatusLight(StatusLight.Orange) } }) ``` \ No newline at end of file diff --git a/libs/color-sensor/docs/reference/sensors/color-sensor/color.md b/libs/color-sensor/docs/reference/sensors/color-sensor/color.md index 221c04f9..dc793988 100644 --- a/libs/color-sensor/docs/reference/sensors/color-sensor/color.md +++ b/libs/color-sensor/docs/reference/sensors/color-sensor/color.md @@ -3,9 +3,9 @@ ```blocks loops.forever(function () { if (sensors.color1.color() == ColorSensorColor.Green) { - brick.setLight(BrickLight.Green) + brick.setStatusLight(StatusLight.Green) } else { - brick.setLight(BrickLight.Orange) + brick.setStatusLight(StatusLight.Orange) } }) ``` \ No newline at end of file diff --git a/libs/color-sensor/docs/reference/sensors/color-sensor/reflected-light.md b/libs/color-sensor/docs/reference/sensors/color-sensor/reflected-light.md index 7afeb8cf..79f12643 100644 --- a/libs/color-sensor/docs/reference/sensors/color-sensor/reflected-light.md +++ b/libs/color-sensor/docs/reference/sensors/color-sensor/reflected-light.md @@ -3,9 +3,9 @@ ```blocks loops.forever(function () { if (sensors.color1.reflectedLight() > 20) { - brick.setLight(BrickLight.Green) + brick.setStatusLight(StatusLight.Green) } else { - brick.setLight(BrickLight.Orange) + brick.setStatusLight(StatusLight.Orange) } }) ``` \ No newline at end of file diff --git a/libs/core/buttons.ts b/libs/core/buttons.ts index 13470436..6d35baf7 100644 --- a/libs/core/buttons.ts +++ b/libs/core/buttons.ts @@ -2,7 +2,7 @@ /** * Patterns for lights under the buttons. */ -const enum BrickLight { +const enum StatusLight { //% block=off enumval=0 Off = 0, //% block=green enumval=1 @@ -244,16 +244,16 @@ namespace control { namespace brick { // the brick starts with the red color - let currPattern: BrickLight = BrickLight.Red; + let currPattern: StatusLight = StatusLight.Red; /** * Set lights. * @param pattern the lights pattern to use. eg: BrickLight.Orange */ - //% blockId=setLights block="set light to %pattern" + //% blockId=setLights block="set status light to %pattern" //% weight=100 group="Buttons" - //% help=brick/set-light - export function setLight(pattern: BrickLight): void { + //% help=brick/set-status-light + export function setStatusLight(pattern: StatusLight): void { if (currPattern === pattern) return currPattern = pattern; diff --git a/libs/core/test.ts b/libs/core/test.ts index d050a8d5..f35c193c 100644 --- a/libs/core/test.ts +++ b/libs/core/test.ts @@ -2,7 +2,7 @@ screen.clear() brick.print("PXT!", 10, 30, Draw.Quad) brick.drawRect(40, 40, 20, 10, Draw.Fill) -brick.setLight(BrickLight.Orange) +brick.setStatusLight(StatusLight.Orange) brick.heart.doubled().draw(100, 50, Draw.Double | Draw.Transparent) @@ -12,7 +12,7 @@ brick.buttonEnter.onEvent(ButtonEvent.Bumped, () => { brick.buttonLeft.onEvent(ButtonEvent.Bumped, () => { brick.drawRect(10, 70, 20, 10, Draw.Fill) - brick.setLight(BrickLight.Red) + brick.setStatusLight(StatusLight.Red) brick.setFont(brick.microbitFont()) }) diff --git a/libs/mood/mood.ts b/libs/mood/mood.ts index 14294e82..17c22102 100644 --- a/libs/mood/mood.ts +++ b/libs/mood/mood.ts @@ -18,9 +18,9 @@ namespace brick { export class Mood { private image: Image; private sound: Sound; - private light: BrickLight; + private light: StatusLight; - constructor(image: Image, sound: Sound, light: BrickLight) { + constructor(image: Image, sound: Sound, light: StatusLight) { this.image = image; this.sound = sound; this.light = light; @@ -30,7 +30,7 @@ namespace brick { * Shows the mood on the EV3 */ show() { - brick.setLight(this.light); + brick.setStatusLight(this.light); brick.showImage(this.image); music.playSoundEffectUntilDone(this.sound); loops.pause(20); @@ -56,71 +56,71 @@ namespace moods { * A sleeping mood */ //% fixedInstance jres=images.eyesSleeping - export const sleeping = new brick.Mood(images.eyesSleeping, sounds.expressionsSnoring, BrickLight.OrangePulse); + export const sleeping = new brick.Mood(images.eyesSleeping, sounds.expressionsSnoring, StatusLight.OrangePulse); /** * A awake mood */ //% fixedInstance jres=images.eyesAwake - export const awake = new brick.Mood(images.eyesAwake, sounds.informationActivate, BrickLight.Orange); + export const awake = new brick.Mood(images.eyesAwake, sounds.informationActivate, StatusLight.Orange); /** * A tired mood */ //% fixedInstance jres=images.eyesTiredMiddle - export const tired = new brick.Mood(images.eyesTiredMiddle, sounds.expressionsSneezing, BrickLight.OrangeFlash); + export const tired = new brick.Mood(images.eyesTiredMiddle, sounds.expressionsSneezing, StatusLight.OrangeFlash); /** * An angry mood */ //% fixedInstance jres=images.eyesAngry - export const angry = new brick.Mood(images.eyesAngry, sounds.animalsDogGrowl, BrickLight.RedPulse); + export const angry = new brick.Mood(images.eyesAngry, sounds.animalsDogGrowl, StatusLight.RedPulse); /** * A sad mood */ //% fixedInstance jres=images.eyesTear - export const sad = new brick.Mood(images.eyesTear, sounds.animalsDogWhine, BrickLight.Red); + export const sad = new brick.Mood(images.eyesTear, sounds.animalsDogWhine, StatusLight.Red); /** * A dizzy mood */ //% fixedInstance jres=images.eyesDizzy - export const dizzy = new brick.Mood(images.eyesDizzy, sounds.expressionsUhOh, BrickLight.OrangeFlash); + export const dizzy = new brick.Mood(images.eyesDizzy, sounds.expressionsUhOh, StatusLight.OrangeFlash); /** * A knocked out mood */ //% fixedInstance jres=images.eyesKnockedOut - export const knockedOut = new brick.Mood(images.eyesKnockedOut, sounds.informationError, BrickLight.RedFlash); + export const knockedOut = new brick.Mood(images.eyesKnockedOut, sounds.informationError, StatusLight.RedFlash); /** * Looking around left */ //% fixedInstance jres=images.eyesMiddleLeft - export const middleLeft = new brick.Mood(images.eyesMiddleLeft, sounds.informationAnalyze, BrickLight.Off); + export const middleLeft = new brick.Mood(images.eyesMiddleLeft, sounds.informationAnalyze, StatusLight.Off); /** * Looking around right */ //% fixedInstance jres=images.eyesMiddleRight - export const middleRight = new brick.Mood(images.eyesMiddleRight, sounds.informationAnalyze, BrickLight.Off); + export const middleRight = new brick.Mood(images.eyesMiddleRight, sounds.informationAnalyze, StatusLight.Off); /** * In love mood */ //% fixedInstance jres=images.eyesLove - export const love = new brick.Mood(images.eyesLove, sounds.expressionsMagicWand, BrickLight.GreenPulse); + export const love = new brick.Mood(images.eyesLove, sounds.expressionsMagicWand, StatusLight.GreenPulse); /** * In laughing mood */ //% fixedInstance jres=images.eyesWinking - export const winking = new brick.Mood(images.eyesWinking, sounds.expressionsLaughing1, BrickLight.GreenFlash); + export const winking = new brick.Mood(images.eyesWinking, sounds.expressionsLaughing1, StatusLight.GreenFlash); /** * In a neutral mood */ //% fixedInstance jres=images.eyesNeutral - export const neutral = new brick.Mood(images.eyesNeutral, undefined, BrickLight.Green); + export const neutral = new brick.Mood(images.eyesNeutral, undefined, StatusLight.Green); } \ No newline at end of file diff --git a/libs/touch-sensor/docs/reference/sensors/touch-sensor/is-pressed.md b/libs/touch-sensor/docs/reference/sensors/touch-sensor/is-pressed.md index 2c222120..e75a02a2 100644 --- a/libs/touch-sensor/docs/reference/sensors/touch-sensor/is-pressed.md +++ b/libs/touch-sensor/docs/reference/sensors/touch-sensor/is-pressed.md @@ -3,9 +3,9 @@ ```blocks loops.forever(function () { if (sensors.touch1.isPressed()) { - brick.setLight(BrickLight.Green) + brick.setStatusLight(StatusLight.Green) } else { - brick.setLight(BrickLight.Orange) + brick.setStatusLight(StatusLight.Orange) } }) ``` \ No newline at end of file diff --git a/libs/touch-sensor/docs/reference/sensors/touch-sensor/was-pressed.md b/libs/touch-sensor/docs/reference/sensors/touch-sensor/was-pressed.md index 2efe7b90..37a0f921 100644 --- a/libs/touch-sensor/docs/reference/sensors/touch-sensor/was-pressed.md +++ b/libs/touch-sensor/docs/reference/sensors/touch-sensor/was-pressed.md @@ -3,9 +3,9 @@ ```blocks loops.forever(function () { if (sensors.touch1.wasPressed()) { - brick.setLight(BrickLight.Green) + brick.setStatusLight(StatusLight.Green) } else { - brick.setLight(BrickLight.Orange) + brick.setStatusLight(StatusLight.Orange) } }) ``` \ No newline at end of file