V4 updates (#210)

* update pxt.json files

* Fix button event enums

fixes https://github.com/microsoft/pxt-calliope/issues/206

* Fix Safari CSS Rule for iOS app

fixes https://github.com/microsoft/pxt-calliope/issues/205

* aprove preffered repos

should fix https://github.com/microsoft/pxt-calliope/issues/167
This commit is contained in:
Juri Wolf
2023-01-11 18:51:27 +01:00
committed by GitHub
parent 1aaedf1fa0
commit 77ed2ccfb1
62 changed files with 223 additions and 162 deletions

View File

@ -1,9 +1,9 @@
{
"name": "{0} block",
"description": "",
"dependencies": {
"core": "file:../core"
},
"description": "",
"files": [
"main.blocks",
"main.ts",

View File

@ -1,6 +1,9 @@
{
"name": "bluetooth",
"description": "Bluetooth services",
"dependencies": {
"core": "file:../core"
},
"files": [
"README.md",
"enums.d.ts",
@ -10,13 +13,10 @@
"BLEHF2Service.h",
"BLEHF2Service.cpp"
],
"public": true,
"weight": 10,
"searchOnly": true,
"icon": "./static/packages/bluetooth/icon.png",
"public": true,
"dependencies": {
"core": "file:../core"
},
"yotta": {
"config": {
"microbit-dal": {

View File

@ -1,10 +1,10 @@
{
"name": "{0} block",
"description": "",
"dependencies": {
"core": "file:../core",
"bluetooth": "file:../bluetooth"
},
"description": "",
"files": [
"main.blocks",
"main.ts",

12
libs/core/enums.d.ts vendored
View File

@ -39,21 +39,11 @@ declare namespace basic {
}
declare const enum ButtonEvent {
//% blockIdentity="input.buttonEventValueId"
//% block="pressed down"
declare const enum ButtonEvents {
Down = 1, // MICROBIT_BUTTON_EVT_DOWN
//% blockIdentity="input.buttonEventValueId"
//% block="released up"
Up = 2, // MICROBIT_BUTTON_EVT_UP
//% blockIdentity="input.buttonEventValueId"
//% block="clicked"
Click = 3, // MICROBIT_BUTTON_EVT_CLICK
//% blockIdentity="input.buttonEventValueId"
//% block="long clicked"
LongClick = 4, // MICROBIT_BUTTON_EVT_LONG_CLICK
//% blockIdentity="input.buttonEventValueId"
//% block="hold"
Hold = 5, // MICROBIT_BUTTON_EVT_HOLD
}

View File

@ -323,9 +323,9 @@ namespace game {
}
function unplugEvents(): void {
input.onButtonEvent(Button.A, ButtonEvent.Click, () => { });
input.onButtonEvent(Button.B, ButtonEvent.Click, () => { });
input.onButtonEvent(Button.AB, ButtonEvent.Click, () => {
input.onButtonEvent(Button.A, input.buttonEventValue(ButtonEvent.Click), () => { });
input.onButtonEvent(Button.B, input.buttonEventValue(ButtonEvent.Click), () => { });
input.onButtonEvent(Button.AB, input.buttonEventValue(ButtonEvent.Click), () => {
control.reset();
});
}

View File

@ -7,21 +7,11 @@ enum class Button {
AB = MICROBIT_ID_BUTTON_AB,
};
enum class ButtonEvent {
//% blockIdentity="input.buttonEventValueId"
//% block="pressed down"
enum class ButtonEvents {
Down = MICROBIT_BUTTON_EVT_DOWN,
//% blockIdentity="input.buttonEventValueId"
//% block="released up"
Up = MICROBIT_BUTTON_EVT_UP,
//% blockIdentity="input.buttonEventValueId"
//% block="clicked"
Click = MICROBIT_BUTTON_EVT_CLICK,
//% blockIdentity="input.buttonEventValueId"
//% block="long clicked"
LongClick = MICROBIT_BUTTON_EVT_LONG_CLICK,
//% blockIdentity="input.buttonEventValueId"
//% block="hold"
Hold = MICROBIT_BUTTON_EVT_HOLD,
};

View File

@ -1,3 +1,23 @@
enum ButtonEvent {
//% blockIdentity="input.buttonEventValueId"
//% block="pressed down"
Down = ButtonEvents.Down,
//% blockIdentity="input.buttonEventValueId"
//% block="released up"
Up = ButtonEvents.Up,
//% blockIdentity="input.buttonEventValueId"
//% block="clicked"
Click = ButtonEvents.Click,
//% blockIdentity="input.buttonEventValueId"
//% block="long clicked"
LongClick = ButtonEvents.LongClick,
//% blockIdentity="input.buttonEventValueId"
//% block="hold"
Hold = ButtonEvents.Hold,
};
/**
* Events and data from sensors
*/
@ -10,7 +30,7 @@ namespace input {
*/
//% help=input/button-event
//% weight=19 blockId="control_button_event_value" block="%id"
//% shim=TD_ID advanced=true
//% advanced=true
//% group="Events"
export function buttonEventValue(id: ButtonEvent): number {
return id;

View File

@ -1,7 +1,7 @@
{
"name": "core",
"description": "The microbit core library",
"additionalFilePath": "../../node_modules/pxt-common-packages/libs/base",
"dependencies": {},
"files": [
"README.md",
"platform.h",
@ -76,7 +76,7 @@
],
"testFiles": [],
"public": true,
"dependencies": {},
"additionalFilePath": "../../node_modules/pxt-common-packages/libs/base",
"dalDTS": {
"compileServiceVariant": "mbcodal",
"includeDirs": [
@ -172,5 +172,6 @@
}
}
]
}
}
},
"partial": true
}

View File

@ -1,6 +1,10 @@
{
"name": "devices",
"description": "BETA - Camera, remote control and other Bluetooth services. App required.",
"dependencies": {
"core": "file:../core",
"bluetooth": "file:../bluetooth"
},
"files": [
"README.md",
"enums.d.ts",
@ -8,12 +12,8 @@
"devices.cpp",
"devices.ts"
],
"public": true,
"icon": "./static/packages/devices/icon.png",
"hidden": true,
"public": true,
"dependencies": {
"core": "file:../core",
"bluetooth": "file:../bluetooth"
},
"installedVersion": "ljipgq"
}
}

View File

@ -1,5 +1,9 @@
{
"additionalFilePath": "../../node_modules/pxt-common-packages/libs/microphone",
"name": "microphone",
"description": "The microphone library",
"dependencies": {
"core": "file:../core"
},
"files": [
"README.md",
"microphone.cpp",
@ -7,8 +11,10 @@
"enums.d.ts",
"shims.d.ts"
],
"hidden": true,
"dependencies": {
"core": "file:../core"
}
"testFiles": [
"test.ts"
],
"public": true,
"additionalFilePath": "../../node_modules/pxt-common-packages/libs/microphone",
"hidden": true
}

View File

@ -22,10 +22,10 @@ enum RadioMessage {
heart,
skull
}
input.onButtonEvent(Button.A, ButtonEvent.Click, function () {
input.onButtonEvent(Button.A, input.buttonEventValue(ButtonEvent.Click), function () {
radio.sendMessage(RadioMessage.heart)
})
input.onButtonEvent(Button.B, ButtonEvent.Click, function () {
input.onButtonEvent(Button.B, input.buttonEventValue(ButtonEvent.Click), function () {
radio.sendMessage(RadioMessage.skull)
})
radio.onReceivedMessage(RadioMessage.heart, function () {

View File

@ -20,10 +20,10 @@ enum RadioMessage {
heart,
skull
}
input.onButtonEvent(Button.A, ButtonEvent.Click, function () {
input.onButtonEvent(Button.A, input.buttonEventValue(ButtonEvent.Click), function () {
radio.sendMessage(RadioMessage.heart)
})
input.onButtonEvent(Button.B, ButtonEvent.Click, function () {
input.onButtonEvent(Button.B, input.buttonEventValue(ButtonEvent.Click), function () {
radio.sendMessage(RadioMessage.skull)
})
radio.onReceivedMessage(RadioMessage.heart, function () {

View File

@ -1,4 +1,13 @@
{
"name": "radio-broadcast",
"description": "Adds new blocks for message communication in the radio category",
"dependencies": {
"core": "file:../core",
"radio": "file:../radio"
},
"files": [
"radio-broadcast.ts"
],
"additionalFilePath": "../../node_modules/pxt-common-packages/libs/radio-broadcast",
"icon": "./static/packages/radio-broadcast/icon.png"
}

View File

@ -1,4 +1,18 @@
{
"name": "radio",
"description": "The radio services",
"dependencies": {
"core": "file:../core"
},
"files": [
"README.md",
"shims.d.ts",
"enums.d.ts",
"radio.cpp",
"radio.ts",
"targetoverrides.ts"
],
"public": true,
"additionalFilePath": "../../node_modules/pxt-common-packages/libs/radio",
"icon": "./static/packages/radio/icon.png",
"yotta": {
@ -10,4 +24,4 @@
}
}
}
}
}

View File

@ -1,14 +1,16 @@
{
"additionalFilePath": "../../node_modules/pxt-common-packages/libs/servo",
"name": "servo",
"description": "A micro-servo library",
"dependencies": {
"core": "file:../core"
},
"files": [
"README.md",
"servo.ts",
"ns.ts",
"targetoverrides.ts"
],
"icon": "./static/packages/servo/icon.png",
"public": true,
"dependencies": {
"core": "file:../core"
}
}
"additionalFilePath": "../../node_modules/pxt-common-packages/libs/servo",
"icon": "./static/packages/servo/icon.png"
}

View File

@ -1,10 +1,10 @@
{
"name": "{0} bit",
"description": "",
"dependencies": {
"core": "file:../core",
"radio": "file:../radio"
},
"description": "",
"files": [
"main.ts",
"README.md"