Map and clean deprecated functions (#175)

* add image and deprecated arrow functions

* update locales

* map basic.showArrow

* map arrow blocks

* map & remove arrow images

* remove arrow blocks

* update locales

* remove & patch:
rgbw -> rgb
button/pin pressed -> button/pin event
loudness -> soundLevel

* update ts mappings for arrows

* add wip ts patch rules

* update .blocks files

* use Click instead of Down as default in Documentation and tests

* patch test.blocks

* fix lowercase name tag

* update test.blocks

* update blocks test files

* update blocks test files

* format block files

* pass blocks file tests

* fix ts mapping

* fix color.defl value

closes https://github.com/microsoft/pxt-calliope/issues/136

* fix ts mappings

- add optional spacing at the end of rgbw()
- map up to v4.0.19

* add suggested changes

* replace innerText by textContent

Co-authored-by: JW <gitkraken@juriwolf.de>
Co-authored-by: Juri <info@juriwolf.de>
This commit is contained in:
Juri Wolf
2022-04-26 19:28:42 +02:00
committed by GitHub
parent 3b9d90e551
commit a93febb5b7
102 changed files with 1458 additions and 740 deletions

View File

@ -23,7 +23,7 @@ confuse the @boardname@.
This example runs the calibration when the user presses **A+B** buttons.
```blocks
input.onButtonPressed(Button.AB, () => {
input.onButtonEvent(Button.AB, ButtonEvent.Click, () => {
input.calibrateCompass();
})
```

View File

@ -41,15 +41,15 @@ let degrees = 0
basic.forever(() => {
degrees = input.compassHeading()
if (degrees < 45) {
basic.showArrow(ArrowNames.North)
basic.showIcon(IconNames.ArrowNorth)
} else if (degrees < 135) {
basic.showArrow(ArrowNames.East)
basic.showIcon(IconNames.ArrowEast)
} else if (degrees < 225) {
basic.showArrow(ArrowNames.South)
basic.showIcon(IconNames.ArrowSouth)
} else if (degrees < 315) {
basic.showArrow(ArrowNames.West)
basic.showIcon(IconNames.ArrowWest)
} else {
basic.showArrow(ArrowNames.North)
basic.showIcon(IconNames.ArrowNorth)
}
})
```
@ -70,7 +70,7 @@ confuse the @boardname@.
Keep the calibration handy by running it when the user pressed **A+B**.
```block
input.onButtonPressed(Button.AB, () => {
input.onButtonEvent(Button.AB, ButtonEvent.Click, () => {
input.calibrateCompass();
})
```

View File

@ -29,7 +29,7 @@ program shows the light level
on the [LED screen](/device/screen).
```blocks
input.onButtonPressed(Button.B, () => {
input.onButtonEvent(Button.B, ButtonEvent.Click, () => {
let level = input.lightLevel()
basic.showNumber(level)
})

View File

@ -9,7 +9,7 @@ on the @boardname@.
* For `A` and `B` together: This handler works when `A` and `B` are both pushed down, then one of them is released within 1.5 seconds of pushing down the second button.
```sig
input.onButtonPressed(Button.A, () => {})
input.onButtonEvent(Button.A, ButtonEvent.Click, () => {})
```
Find out how buttons provide input to the @boardname@ in this video:
@ -24,7 +24,7 @@ Each time you press the button, the [LED screen](/device/screen) shows the `coun
```blocks
let count = 0
basic.showNumber(count)
input.onButtonPressed(Button.A, () => {
input.onButtonEvent(Button.A, ButtonEvent.Click, () => {
count++;
basic.showNumber(count);
})
@ -35,7 +35,7 @@ input.onButtonPressed(Button.A, () => {
This example shows a number from 1 to 6 when you press the `B` button.
```blocks
input.onButtonPressed(Button.B, () => {
input.onButtonEvent(Button.B, ButtonEvent.Click, () => {
let dice = randint(0, 5) + 1
basic.showNumber(dice)
})

View File

@ -14,7 +14,7 @@ through your body and back into the @boardname@. This is called
**completing a circuit**. It's like you're a big wire!
```sig
input.onPinPressed(TouchPin.P0, () => {
input.onPinTouchEvent(TouchPin.P0, ButtonEvent.Click, () => {
})
```
@ -43,7 +43,7 @@ Every time you press the pin, the program shows the number of times on the scree
```blocks
let count = 0
basic.showNumber(count)
input.onPinPressed(TouchPin.P0, () => {
input.onPinTouchEvent(TouchPin.P0, ButtonEvent.Click, () => {
count = count + 1
basic.showNumber(count)
})

View File

@ -13,7 +13,7 @@ through your body and back into the @boardname@. This is called
**completing a circuit**. It's like you're a big wire!
```sig
input.onPinReleased(TouchPin.P0, () => {
input.onPinTouchEvent(TouchPin.P0, ButtonEvent.Up, () => {
})
```
@ -36,7 +36,7 @@ Every time you release the pin, the program shows the number of times on the scr
```blocks
let count = 0
basic.showNumber(count, 100)
input.onPinReleased(TouchPin.P0, () => {
input.onPinTouchEvent(TouchPin.P0, ButtonEvent.Up, () => {
count = count + 1
basic.showNumber(count, 100)
})

View File

@ -18,7 +18,7 @@ program finds the number of milliseconds since the program started
and shows it on the [LED screen](/device/screen).
```blocks
input.onButtonPressed(Button.B, () => {
input.onButtonEvent(Button.B, ButtonEvent.Click, () => {
let now = input.runningTime()
basic.showNumber(now)
})