pxt-microbit 7.0.24 → 7.0.26
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/built/block-tests.js +1 -1
- package/built/editor.js +171 -77
- package/built/fieldeditors.js +94 -4
- package/built/target-strings.json +1 -1
- package/built/target.js +1 -1
- package/built/target.json +1 -1
- package/built/targetlight.json +1 -1
- package/package.json +2 -2
- /package/built/hexcache/{fbc8089808f65a1799837e03ee481088a737e25550deb72aa4dfbf7f154bdeab.hex → 163bd47d0cc7aad8a01454a1e7f3e9778a22babd8d6e36bb16c0d87cca0de0d0.hex} +0 -0
- /package/built/hexcache/{9be45665f3abe402bef9a9bd8ed0ef1e4ecd9b578792c6f0d5d42d4f03d63ab4.hex → b528e82d743abdcdd52e703fd840f2539668ef555f7216a23aef78b21e1f9fb8.hex} +0 -0
- /package/built/hexcache/{ed1952fd1d4c3257079d866091afb2bc4c6e99c65c80a55766953c8b2e7e9250.hex → c0dcdf277e3f20a675bc00961c9c692a4fc37190647f89acaf558c616700c46e.hex} +0 -0
- /package/built/hexcache/{ab613458a27c70d929c05304c823bf0de9c378d461db7e1ddaebcd155e73752c.hex → c175437b3b5f75fbf60a5feac6f9148dbe1bf27d880929f1417fe0388cb04eba.hex} +0 -0
package/built/editor.js
CHANGED
|
@@ -3429,14 +3429,7 @@ class DAPWrapper {
|
|
|
3429
3429
|
const connectionId = this.connectionId;
|
|
3430
3430
|
this.allocDAP(); // clean dap apis
|
|
3431
3431
|
await this.io.reconnectAsync();
|
|
3432
|
-
|
|
3433
|
-
// to commands from previous sessions (if any) are flushed. Count of 5 is arbitrary.
|
|
3434
|
-
for (let i = 0; i < 5; i++) {
|
|
3435
|
-
try {
|
|
3436
|
-
await this.getDaplinkVersionAsync();
|
|
3437
|
-
}
|
|
3438
|
-
catch (e) { }
|
|
3439
|
-
}
|
|
3432
|
+
await this.clearCommandsAsync();
|
|
3440
3433
|
// halt before reading from dap
|
|
3441
3434
|
// to avoid interference from data logger
|
|
3442
3435
|
await this.cortexM.halt();
|
|
@@ -3465,6 +3458,16 @@ class DAPWrapper {
|
|
|
3465
3458
|
// start jacdac, serial async
|
|
3466
3459
|
this.startReadSerial(connectionId);
|
|
3467
3460
|
}
|
|
3461
|
+
async clearCommandsAsync() {
|
|
3462
|
+
// before calling into dapjs, push through a few commands to make sure the responses
|
|
3463
|
+
// to commands from previous sessions (if any) are flushed. Count of 5 is arbitrary.
|
|
3464
|
+
for (let i = 0; i < 5; i++) {
|
|
3465
|
+
try {
|
|
3466
|
+
await this.getDaplinkVersionAsync();
|
|
3467
|
+
}
|
|
3468
|
+
catch (e) { }
|
|
3469
|
+
}
|
|
3470
|
+
}
|
|
3468
3471
|
async getDaplinkVersionAsync() {
|
|
3469
3472
|
return await this.dapCmdNums(0x00, 0x04);
|
|
3470
3473
|
}
|
|
@@ -3505,6 +3508,7 @@ class DAPWrapper {
|
|
|
3505
3508
|
if (!this.io.isConnected()) {
|
|
3506
3509
|
await this.io.reconnectAsync();
|
|
3507
3510
|
}
|
|
3511
|
+
await this.clearCommandsAsync();
|
|
3508
3512
|
await this.stopReadersAsync();
|
|
3509
3513
|
await this.cortexM.init();
|
|
3510
3514
|
await this.cortexM.reset(true);
|
|
@@ -3958,50 +3962,98 @@ exports.mkDAPLinkPacketIOWrapper = mkDAPLinkPacketIOWrapper;
|
|
|
3958
3962
|
|
|
3959
3963
|
},{}],4:[function(require,module,exports){
|
|
3960
3964
|
"use strict";
|
|
3961
|
-
/**
|
|
3962
|
-
* <block type="device_show_leds">
|
|
3963
|
-
<field name="LED00">FALSE</field>
|
|
3964
|
-
<field name="LED10">FALSE</field>
|
|
3965
|
-
<field name="LED20">FALSE</field>
|
|
3966
|
-
<field name="LED30">FALSE</field>
|
|
3967
|
-
<field name="LED40">FALSE</field>
|
|
3968
|
-
<field name="LED01">FALSE</field>
|
|
3969
|
-
<field name="LED11">FALSE</field>
|
|
3970
|
-
<field name="LED21">FALSE</field>
|
|
3971
|
-
<field name="LED31">TRUE</field>
|
|
3972
|
-
<field name="LED41">FALSE</field>
|
|
3973
|
-
<field name="LED02">FALSE</field>
|
|
3974
|
-
<field name="LED12">FALSE</field>
|
|
3975
|
-
<field name="LED22">FALSE</field>
|
|
3976
|
-
<field name="LED32">FALSE</field>
|
|
3977
|
-
<field name="LED42">FALSE</field>
|
|
3978
|
-
<field name="LED03">FALSE</field>
|
|
3979
|
-
<field name="LED13">TRUE</field>
|
|
3980
|
-
<field name="LED23">FALSE</field>
|
|
3981
|
-
<field name="LED33">FALSE</field>
|
|
3982
|
-
<field name="LED43">FALSE</field>
|
|
3983
|
-
<field name="LED04">FALSE</field>
|
|
3984
|
-
<field name="LED14">FALSE</field>
|
|
3985
|
-
<field name="LED24">FALSE</field>
|
|
3986
|
-
<field name="LED34">FALSE</field>
|
|
3987
|
-
<field name="LED44">FALSE</field>
|
|
3988
|
-
</block>
|
|
3989
|
-
|
|
3990
|
-
to
|
|
3991
|
-
<block type="device_show_leds">
|
|
3992
|
-
<field name="LEDS">`
|
|
3993
|
-
# # # # #
|
|
3994
|
-
. . . . #
|
|
3995
|
-
. . . . .
|
|
3996
|
-
. . . . #
|
|
3997
|
-
. . . . #
|
|
3998
|
-
`
|
|
3999
|
-
</field>
|
|
4000
|
-
</block>
|
|
4001
|
-
*/
|
|
4002
3965
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4003
3966
|
exports.patchBlocks = void 0;
|
|
4004
3967
|
function patchBlocks(pkgTargetVersion, dom) {
|
|
3968
|
+
if (pxt.semver.majorCmp(pkgTargetVersion || "0.0.0", "7.0.13") <= 0) {
|
|
3969
|
+
// Variable pin param
|
|
3970
|
+
/*
|
|
3971
|
+
<block type="device_get_digital_pin">
|
|
3972
|
+
<field name="name">DigitalPin.P0</field>
|
|
3973
|
+
</block>
|
|
3974
|
+
|
|
3975
|
+
converts to
|
|
3976
|
+
|
|
3977
|
+
<block type="device_get_digital_pin">
|
|
3978
|
+
<value name="name">
|
|
3979
|
+
<shadow type="digital_pin">
|
|
3980
|
+
<field name="pin">DigitalPin.P0</field>
|
|
3981
|
+
</shadow>
|
|
3982
|
+
</value>
|
|
3983
|
+
</block>
|
|
3984
|
+
*/
|
|
3985
|
+
pxt.U.toArray(dom.querySelectorAll("block[type=device_get_digital_pin]"))
|
|
3986
|
+
.concat(pxt.U.toArray(dom.querySelectorAll("shadow[type=device_get_digital_pin]")))
|
|
3987
|
+
.concat(pxt.U.toArray(dom.querySelectorAll("block[type=device_set_digital_pin]")))
|
|
3988
|
+
.concat(pxt.U.toArray(dom.querySelectorAll("block[type=device_get_analog_pin]")))
|
|
3989
|
+
.concat(pxt.U.toArray(dom.querySelectorAll("shadow[type=device_get_analog_pin]")))
|
|
3990
|
+
.concat(pxt.U.toArray(dom.querySelectorAll("block[type=device_set_analog_pin]")))
|
|
3991
|
+
.concat(pxt.U.toArray(dom.querySelectorAll("block[type=device_set_analog_period]")))
|
|
3992
|
+
.concat(pxt.U.toArray(dom.querySelectorAll("block[type=pins_on_pulsed]")))
|
|
3993
|
+
.concat(pxt.U.toArray(dom.querySelectorAll("block[type=pins_pulse_in]")))
|
|
3994
|
+
.concat(pxt.U.toArray(dom.querySelectorAll("shadow[type=pins_pulse_in]")))
|
|
3995
|
+
.concat(pxt.U.toArray(dom.querySelectorAll("block[type=device_set_servo_pin]")))
|
|
3996
|
+
.concat(pxt.U.toArray(dom.querySelectorAll("block[type=device_set_servo_pulse]")))
|
|
3997
|
+
.concat(pxt.U.toArray(dom.querySelectorAll("block[type=device_analog_set_pitch_pin]")))
|
|
3998
|
+
.concat(pxt.U.toArray(dom.querySelectorAll("block[type=device_set_pull]")))
|
|
3999
|
+
.concat(pxt.U.toArray(dom.querySelectorAll("block[type=device_set_pin_events]")))
|
|
4000
|
+
.concat(pxt.U.toArray(dom.querySelectorAll("block[type=pin_neopixel_matrix_width]")))
|
|
4001
|
+
.concat(pxt.U.toArray(dom.querySelectorAll("block[type=spi_pins]")))
|
|
4002
|
+
.concat(pxt.U.toArray(dom.querySelectorAll("block[type=pin_set_audio_pin]")))
|
|
4003
|
+
.forEach(node => {
|
|
4004
|
+
const blockType = node.getAttribute("type");
|
|
4005
|
+
pxt.U.toArray(node.children)
|
|
4006
|
+
.filter(oldPinNode => {
|
|
4007
|
+
if (oldPinNode.tagName != "field")
|
|
4008
|
+
return false;
|
|
4009
|
+
switch (blockType) {
|
|
4010
|
+
case "device_get_digital_pin":
|
|
4011
|
+
case "device_set_digital_pin":
|
|
4012
|
+
case "device_get_analog_pin":
|
|
4013
|
+
case "device_set_analog_pin":
|
|
4014
|
+
case "pins_pulse_in":
|
|
4015
|
+
case "device_set_servo_pin":
|
|
4016
|
+
case "device_analog_set_pitch_pin":
|
|
4017
|
+
case "pin_set_audio_pin":
|
|
4018
|
+
return oldPinNode.getAttribute("name") === "name";
|
|
4019
|
+
case "device_set_analog_period":
|
|
4020
|
+
case "pins_on_pulsed":
|
|
4021
|
+
case "device_set_pull":
|
|
4022
|
+
case "device_set_pin_events":
|
|
4023
|
+
case "pin_neopixel_matrix_width":
|
|
4024
|
+
return oldPinNode.getAttribute("name") === "pin";
|
|
4025
|
+
case "device_set_servo_pulse":
|
|
4026
|
+
return oldPinNode.getAttribute("name") === "value";
|
|
4027
|
+
case "spi_pins":
|
|
4028
|
+
return ["mosi", "miso", "sck"].includes(oldPinNode.getAttribute("name"));
|
|
4029
|
+
}
|
|
4030
|
+
return false;
|
|
4031
|
+
})
|
|
4032
|
+
.forEach(oldPinNode => {
|
|
4033
|
+
const valueNode = node.ownerDocument.createElement("value");
|
|
4034
|
+
valueNode.setAttribute("name", oldPinNode.getAttribute("name"));
|
|
4035
|
+
const pinShadowNode = node.ownerDocument.createElement("shadow");
|
|
4036
|
+
let pinBlockType;
|
|
4037
|
+
switch (oldPinNode.textContent.split(".")[0]) {
|
|
4038
|
+
case "DigitalPin":
|
|
4039
|
+
pinBlockType = "digital_pin_shadow";
|
|
4040
|
+
break;
|
|
4041
|
+
case "AnalogPin":
|
|
4042
|
+
pinBlockType = "analog_pin_shadow";
|
|
4043
|
+
break;
|
|
4044
|
+
}
|
|
4045
|
+
if (!pinBlockType)
|
|
4046
|
+
return;
|
|
4047
|
+
pinShadowNode.setAttribute("type", pinBlockType);
|
|
4048
|
+
const fieldNode = node.ownerDocument.createElement("field");
|
|
4049
|
+
fieldNode.setAttribute("name", "pin");
|
|
4050
|
+
fieldNode.textContent = oldPinNode.textContent;
|
|
4051
|
+
pinShadowNode.appendChild(fieldNode);
|
|
4052
|
+
valueNode.appendChild(pinShadowNode);
|
|
4053
|
+
node.replaceChild(valueNode, oldPinNode);
|
|
4054
|
+
});
|
|
4055
|
+
});
|
|
4056
|
+
}
|
|
4005
4057
|
if (pxt.semver.majorCmp(pkgTargetVersion || "0.0.0", "5.0.12") <= 0) {
|
|
4006
4058
|
// Eighth note misspelling
|
|
4007
4059
|
/*
|
|
@@ -4037,12 +4089,54 @@ function patchBlocks(pkgTargetVersion, dom) {
|
|
|
4037
4089
|
if (pxt.semver.majorCmp(pkgTargetVersion || "0.0.0", "1.0.0") >= 0)
|
|
4038
4090
|
return;
|
|
4039
4091
|
// showleds
|
|
4040
|
-
|
|
4092
|
+
/**
|
|
4093
|
+
<block type="device_show_leds">
|
|
4094
|
+
<field name="LED00">FALSE</field>
|
|
4095
|
+
<field name="LED10">FALSE</field>
|
|
4096
|
+
<field name="LED20">FALSE</field>
|
|
4097
|
+
<field name="LED30">FALSE</field>
|
|
4098
|
+
<field name="LED40">FALSE</field>
|
|
4099
|
+
<field name="LED01">FALSE</field>
|
|
4100
|
+
<field name="LED11">FALSE</field>
|
|
4101
|
+
<field name="LED21">FALSE</field>
|
|
4102
|
+
<field name="LED31">TRUE</field>
|
|
4103
|
+
<field name="LED41">FALSE</field>
|
|
4104
|
+
<field name="LED02">FALSE</field>
|
|
4105
|
+
<field name="LED12">FALSE</field>
|
|
4106
|
+
<field name="LED22">FALSE</field>
|
|
4107
|
+
<field name="LED32">FALSE</field>
|
|
4108
|
+
<field name="LED42">FALSE</field>
|
|
4109
|
+
<field name="LED03">FALSE</field>
|
|
4110
|
+
<field name="LED13">TRUE</field>
|
|
4111
|
+
<field name="LED23">FALSE</field>
|
|
4112
|
+
<field name="LED33">FALSE</field>
|
|
4113
|
+
<field name="LED43">FALSE</field>
|
|
4114
|
+
<field name="LED04">FALSE</field>
|
|
4115
|
+
<field name="LED14">FALSE</field>
|
|
4116
|
+
<field name="LED24">FALSE</field>
|
|
4117
|
+
<field name="LED34">FALSE</field>
|
|
4118
|
+
<field name="LED44">FALSE</field>
|
|
4119
|
+
</block>
|
|
4120
|
+
|
|
4121
|
+
converts to
|
|
4122
|
+
|
|
4123
|
+
<block type="device_show_leds">
|
|
4124
|
+
<field name="LEDS">`
|
|
4125
|
+
. . . . .
|
|
4126
|
+
. . . # .
|
|
4127
|
+
. . . . .
|
|
4128
|
+
. # . . .
|
|
4129
|
+
. . . . .
|
|
4130
|
+
`
|
|
4131
|
+
</field>
|
|
4132
|
+
</block>
|
|
4133
|
+
*/
|
|
4134
|
+
pxt.U.toArray(dom.querySelectorAll("block[type=device_show_leds]"))
|
|
4041
4135
|
.concat(pxt.U.toArray(dom.querySelectorAll("block[type=device_build_image]")))
|
|
4042
4136
|
.concat(pxt.U.toArray(dom.querySelectorAll("shadow[type=device_build_image]")))
|
|
4043
4137
|
.concat(pxt.U.toArray(dom.querySelectorAll("block[type=device_build_big_image]")))
|
|
4044
|
-
.concat(pxt.U.toArray(dom.querySelectorAll("shadow[type=device_build_big_image]")))
|
|
4045
|
-
|
|
4138
|
+
.concat(pxt.U.toArray(dom.querySelectorAll("shadow[type=device_build_big_image]")))
|
|
4139
|
+
.forEach(node => {
|
|
4046
4140
|
// don't rewrite if already upgraded, eg. field LEDS already present
|
|
4047
4141
|
if (pxt.U.toArray(node.children).filter(child => child.tagName == "field" && "LEDS" == child.getAttribute("name"))[0])
|
|
4048
4142
|
return;
|
|
@@ -4067,33 +4161,33 @@ function patchBlocks(pkgTargetVersion, dom) {
|
|
|
4067
4161
|
});
|
|
4068
4162
|
// radio
|
|
4069
4163
|
/*
|
|
4070
|
-
<block type="radio_on_packet" x="174" y="120">
|
|
4071
|
-
<mutation callbackproperties="receivedNumber" renamemap="{}"></mutation>
|
|
4072
|
-
<field name="receivedNumber">receivedNumber</field>
|
|
4073
|
-
</block>
|
|
4074
|
-
<block type="radio_on_packet" disabled="true" x="127" y="263">
|
|
4075
|
-
<mutation callbackproperties="receivedString,receivedNumber" renamemap="{"receivedString":"name","receivedNumber":"value"}"></mutation>
|
|
4076
|
-
<field name="receivedString">name</field>
|
|
4077
|
-
<field name="receivedNumber">value</field>
|
|
4078
|
-
</block>
|
|
4079
|
-
<block type="radio_on_packet" disabled="true" x="162" y="420">
|
|
4080
|
-
<mutation callbackproperties="receivedString" renamemap="{}"></mutation>
|
|
4081
|
-
<field name="receivedString">receivedString</field>
|
|
4082
|
-
</block>
|
|
4164
|
+
<block type="radio_on_packet" x="174" y="120">
|
|
4165
|
+
<mutation callbackproperties="receivedNumber" renamemap="{}"></mutation>
|
|
4166
|
+
<field name="receivedNumber">receivedNumber</field>
|
|
4167
|
+
</block>
|
|
4168
|
+
<block type="radio_on_packet" disabled="true" x="127" y="263">
|
|
4169
|
+
<mutation callbackproperties="receivedString,receivedNumber" renamemap="{"receivedString":"name","receivedNumber":"value"}"></mutation>
|
|
4170
|
+
<field name="receivedString">name</field>
|
|
4171
|
+
<field name="receivedNumber">value</field>
|
|
4172
|
+
</block>
|
|
4173
|
+
<block type="radio_on_packet" disabled="true" x="162" y="420">
|
|
4174
|
+
<mutation callbackproperties="receivedString" renamemap="{}"></mutation>
|
|
4175
|
+
<field name="receivedString">receivedString</field>
|
|
4176
|
+
</block>
|
|
4083
4177
|
|
|
4084
|
-
converts to
|
|
4178
|
+
converts to
|
|
4085
4179
|
|
|
4086
|
-
<block type="radio_on_number" x="196" y="208">
|
|
4087
|
-
<field name="HANDLER_receivedNumber" id="DCy(W;1)*jLWQUpoy4Mm" variabletype="">receivedNumber</field>
|
|
4088
|
-
</block>
|
|
4089
|
-
<block type="radio_on_value" x="134" y="408">
|
|
4090
|
-
<field name="HANDLER_name" id="*d-Jm^MJXO]Djs(dTR*?" variabletype="">name</field>
|
|
4091
|
-
<field name="HANDLER_value" id="A6HQjH[k^X43o3h775+G" variabletype="">value</field>
|
|
4092
|
-
</block>
|
|
4093
|
-
<block type="radio_on_string" x="165" y="583">
|
|
4094
|
-
<field name="HANDLER_receivedString" id="V9KsE!h$(iO?%W:[32CV" variabletype="">receivedString</field>
|
|
4095
|
-
</block>
|
|
4096
|
-
*/
|
|
4180
|
+
<block type="radio_on_number" x="196" y="208">
|
|
4181
|
+
<field name="HANDLER_receivedNumber" id="DCy(W;1)*jLWQUpoy4Mm" variabletype="">receivedNumber</field>
|
|
4182
|
+
</block>
|
|
4183
|
+
<block type="radio_on_value" x="134" y="408">
|
|
4184
|
+
<field name="HANDLER_name" id="*d-Jm^MJXO]Djs(dTR*?" variabletype="">name</field>
|
|
4185
|
+
<field name="HANDLER_value" id="A6HQjH[k^X43o3h775+G" variabletype="">value</field>
|
|
4186
|
+
</block>
|
|
4187
|
+
<block type="radio_on_string" x="165" y="583">
|
|
4188
|
+
<field name="HANDLER_receivedString" id="V9KsE!h$(iO?%W:[32CV" variabletype="">receivedString</field>
|
|
4189
|
+
</block>
|
|
4190
|
+
*/
|
|
4097
4191
|
const varids = {};
|
|
4098
4192
|
function addField(node, renameMap, name) {
|
|
4099
4193
|
const f = node.ownerDocument.createElement("field");
|
package/built/fieldeditors.js
CHANGED
|
@@ -4,18 +4,25 @@
|
|
|
4
4
|
/// <reference path="../node_modules/pxt-core/built/pxtsim.d.ts"/>
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const field_gestures_1 = require("./field_gestures");
|
|
7
|
+
const field_pinPicker_1 = require("./field_pinPicker");
|
|
7
8
|
pxt.editor.initFieldExtensionsAsync = function (opts) {
|
|
8
9
|
pxt.debug('loading pxt-microbit field editors...');
|
|
9
10
|
const res = {
|
|
10
|
-
fieldEditors: [
|
|
11
|
+
fieldEditors: [
|
|
12
|
+
{
|
|
11
13
|
selector: "gestures",
|
|
12
14
|
editor: field_gestures_1.FieldGestures
|
|
13
|
-
}
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
selector: "pinpicker",
|
|
18
|
+
editor: field_pinPicker_1.FieldPinPicker
|
|
19
|
+
}
|
|
20
|
+
]
|
|
14
21
|
};
|
|
15
22
|
return Promise.resolve(res);
|
|
16
23
|
};
|
|
17
24
|
|
|
18
|
-
},{"./field_gestures":2}],2:[function(require,module,exports){
|
|
25
|
+
},{"./field_gestures":2,"./field_pinPicker":3}],2:[function(require,module,exports){
|
|
19
26
|
"use strict";
|
|
20
27
|
/// <reference path="../node_modules/pxt-core/localtypings/pxtblockly.d.ts"/>
|
|
21
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -95,4 +102,87 @@ class FieldGestures extends pxtblockly.FieldImages {
|
|
|
95
102
|
}
|
|
96
103
|
exports.FieldGestures = FieldGestures;
|
|
97
104
|
|
|
98
|
-
},{}]
|
|
105
|
+
},{}],3:[function(require,module,exports){
|
|
106
|
+
"use strict";
|
|
107
|
+
/// <reference path="../node_modules/pxt-core/localtypings/pxtblockly.d.ts"/>
|
|
108
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
109
|
+
exports.FieldPinPicker = void 0;
|
|
110
|
+
const pxtblockly = pxt.blocks.requirePxtBlockly();
|
|
111
|
+
const Blockly = pxt.blocks.requireBlockly();
|
|
112
|
+
const WARNING_ID = "pinpicker_warning";
|
|
113
|
+
class FieldPinPicker extends pxtblockly.FieldGridPicker {
|
|
114
|
+
constructor() {
|
|
115
|
+
super(...arguments);
|
|
116
|
+
this.changeListener = (e) => {
|
|
117
|
+
if (e.type === Blockly.Events.BLOCK_MOVE && e.blockId === this.sourceBlock_.id) {
|
|
118
|
+
this.updateWarning();
|
|
119
|
+
}
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
init() {
|
|
123
|
+
super.init();
|
|
124
|
+
const sourceBlock = this.sourceBlock_;
|
|
125
|
+
if (sourceBlock.isShadow() || sourceBlock.isInFlyout) {
|
|
126
|
+
return;
|
|
127
|
+
}
|
|
128
|
+
sourceBlock.workspace.addChangeListener(this.changeListener);
|
|
129
|
+
}
|
|
130
|
+
doValueUpdate_(newValue) {
|
|
131
|
+
super.doValueUpdate_(newValue);
|
|
132
|
+
this.updateWarning();
|
|
133
|
+
}
|
|
134
|
+
updateWarning() {
|
|
135
|
+
this.hideWarning();
|
|
136
|
+
const sourceBlock = this.sourceBlock_;
|
|
137
|
+
if (!sourceBlock || !this.value_ || sourceBlock.isShadow() || sourceBlock.isInFlyout) {
|
|
138
|
+
return;
|
|
139
|
+
}
|
|
140
|
+
const pin = this.value_.split(".")[1];
|
|
141
|
+
if (!isAnalogWriteOnlyPin(pin)) {
|
|
142
|
+
return;
|
|
143
|
+
}
|
|
144
|
+
const parent = sourceBlock.outputConnection.targetBlock();
|
|
145
|
+
if (!parent || parent.type !== "device_get_analog_pin") {
|
|
146
|
+
return;
|
|
147
|
+
}
|
|
148
|
+
this.showWarning(pin);
|
|
149
|
+
}
|
|
150
|
+
showWarning(pin) {
|
|
151
|
+
if (!this.sourceBlock_) {
|
|
152
|
+
return;
|
|
153
|
+
}
|
|
154
|
+
this.sourceBlock_.setWarningText(pxt.U.lf("{0} is a write only analog pin", pin), WARNING_ID);
|
|
155
|
+
}
|
|
156
|
+
hideWarning() {
|
|
157
|
+
if (!this.sourceBlock_) {
|
|
158
|
+
return;
|
|
159
|
+
}
|
|
160
|
+
this.sourceBlock_.setWarningText(null, WARNING_ID);
|
|
161
|
+
}
|
|
162
|
+
dispose() {
|
|
163
|
+
var _a, _b;
|
|
164
|
+
super.dispose();
|
|
165
|
+
(_b = (_a = this.sourceBlock_) === null || _a === void 0 ? void 0 : _a.workspace) === null || _b === void 0 ? void 0 : _b.removeChangeListener(this.changeListener);
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
exports.FieldPinPicker = FieldPinPicker;
|
|
169
|
+
function isAnalogWriteOnlyPin(pin) {
|
|
170
|
+
switch (pin) {
|
|
171
|
+
case "P5":
|
|
172
|
+
case "P6":
|
|
173
|
+
case "P7":
|
|
174
|
+
case "P8":
|
|
175
|
+
case "P9":
|
|
176
|
+
case "P11":
|
|
177
|
+
case "P12":
|
|
178
|
+
case "P13":
|
|
179
|
+
case "P14":
|
|
180
|
+
case "P15":
|
|
181
|
+
case "P16":
|
|
182
|
+
return true;
|
|
183
|
+
default:
|
|
184
|
+
return false;
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
},{}]},{},[1,2,3]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"A Blocks / JavaScript code editor for the micro:bit powered by Microsoft MakeCode.":"A Blocks / JavaScript code editor for the micro:bit powered by Microsoft MakeCode.","A micro-servo library":"A micro-servo library","Adds new blocks for message communication in the radio category":"Adds new blocks for message communication in the radio category","BETA - Camera, remote control and other Bluetooth services. App required.":"BETA - Camera, remote control and other Bluetooth services. App required.","Behind the MakeCode Hardware":"Behind the MakeCode Hardware","Blocks to JavaScript":"Blocks to JavaScript","Bluetooth services":"Bluetooth services","Buy":"Buy","Can't import microbit.co.uk scripts...":"Can't import microbit.co.uk scripts...","Coding Cards":"Coding Cards","Coding for Teachers":"Coding for Teachers","Color manipulation":"Color manipulation","Courses":"Courses","Data logging to flash memory. micro:bit (V2) only.":"Data logging to flash memory. micro:bit (V2) only.","Data logging to flash.":"Data logging to flash.","Deep Dive":"Deep Dive","Disable Bluetooth Event Service":"Disable Bluetooth Event Service","Download cancelled":"Download cancelled","Download failed, please try again":"Download failed, please try again","Download for V2 only":"Download for V2 only","Fashion":"Fashion","Fonts for displays (V2 only).":"Fonts for displays (V2 only).","Games":"Games","Go Back":"Go Back","Go to the old editor":"Go to the old editor","Great coding skills! Unfortunately, your program is too large to fit on a micro:bit V1😢. You can go back and try to make your program smaller, or you can download your program onto a micro:bit V2.":"Great coding skills! Unfortunately, your program is too large to fit on a micro:bit V1😢. You can go back and try to make your program smaller, or you can download your program onto a micro:bit V2.","Great coding skills! Unfortunately, your program is too large to fit on a micro:bit V2😢. You can go back and try to make your program smaller, or continue to use the simulator to run your code.":"Great coding skills! Unfortunately, your program is too large to fit on a micro:bit V2😢. You can go back and try to make your program smaller, or continue to use the simulator to run your code.","Hardware":"Hardware","Importing microbit.co.uk programs is not supported in this editor anymore. Please open this script in the https://makecode.microbit.org/v0 editor.":"Importing microbit.co.uk programs is not supported in this editor anymore. Please open this script in the https://makecode.microbit.org/v0 editor.","Jacdac":"Jacdac","JustWorks pairing (default): Pairing is automatic once the pairing is initiated.":"JustWorks pairing (default): Pairing is automatic once the pairing is initiated.","Live Coding":"Live Coding","MicroCode for the new micro:bit (V2)":"MicroCode for the new micro:bit (V2)","Microsoft MakeCode for micro:bit":"Microsoft MakeCode for micro:bit","Music":"Music","New? Start here!":"New? Start here!","No Pairing Required: Anyone can connect via Bluetooth.":"No Pairing Required: Anyone can connect via Bluetooth.","Oops, there was a problem downloading your code":"Oops, there was a problem downloading your code","Passkey pairing: Pairing requires 6 digit key to pair.":"Passkey pairing: Pairing requires 6 digit key to pair.","Radio Games":"Radio Games","Record sound clips. micro:bit (V2) only":"Record sound clips. micro:bit (V2) only","Reference":"Reference","Science":"Science","Science Experiments":"Science Experiments","Settings storage in internal flash":"Settings storage in internal flash","Support":"Support","The microbit core library":"The microbit core library","The microphone library":"The microphone library","The radio services":"The radio services","Tools":"Tools","Toys":"Toys","Turtle":"Turtle","Tutorials":"Tutorials","Tutorials for the new micro:bit (V2)":"Tutorials for the new micro:bit (V2)","makecode.microbit.org":"makecode.microbit.org","{id:extension-tag}Gaming":"Gaming","{id:extension-tag}Lights and Display":"Lights and Display","{id:extension-tag}Networking":"Networking","{id:extension-tag}Robotics":"Robotics","{id:extension-tag}Science":"Science","{id:extension-tag}Software":"Software","{id:type}Image":"Image","{id:type}LedSprite":"LedSprite","{id:var}image":"image","{id:var}sprite":"sprite"}
|
|
1
|
+
{"A Blocks / JavaScript code editor for the micro:bit powered by Microsoft MakeCode.":"A Blocks / JavaScript code editor for the micro:bit powered by Microsoft MakeCode.","A micro-servo library":"A micro-servo library","Adds new blocks for message communication in the radio category":"Adds new blocks for message communication in the radio category","BETA - Camera, remote control and other Bluetooth services. App required.":"BETA - Camera, remote control and other Bluetooth services. App required.","Behind the MakeCode Hardware":"Behind the MakeCode Hardware","Blocks to JavaScript":"Blocks to JavaScript","Bluetooth services":"Bluetooth services","Buy":"Buy","Can't import microbit.co.uk scripts...":"Can't import microbit.co.uk scripts...","Coding Cards":"Coding Cards","Coding for Teachers":"Coding for Teachers","Color manipulation":"Color manipulation","Courses":"Courses","Data logging to flash memory. micro:bit (V2) only.":"Data logging to flash memory. micro:bit (V2) only.","Data logging to flash.":"Data logging to flash.","Deep Dive":"Deep Dive","Disable Bluetooth Event Service":"Disable Bluetooth Event Service","Download cancelled":"Download cancelled","Download failed, please try again":"Download failed, please try again","Download for V2 only":"Download for V2 only","Fashion":"Fashion","Fonts for displays (V2 only).":"Fonts for displays (V2 only).","Games":"Games","Go Back":"Go Back","Go to the old editor":"Go to the old editor","Great coding skills! Unfortunately, your program is too large to fit on a micro:bit V1😢. You can go back and try to make your program smaller, or you can download your program onto a micro:bit V2.":"Great coding skills! Unfortunately, your program is too large to fit on a micro:bit V1😢. You can go back and try to make your program smaller, or you can download your program onto a micro:bit V2.","Great coding skills! Unfortunately, your program is too large to fit on a micro:bit V2😢. You can go back and try to make your program smaller, or continue to use the simulator to run your code.":"Great coding skills! Unfortunately, your program is too large to fit on a micro:bit V2😢. You can go back and try to make your program smaller, or continue to use the simulator to run your code.","Hardware":"Hardware","Importing microbit.co.uk programs is not supported in this editor anymore. Please open this script in the https://makecode.microbit.org/v0 editor.":"Importing microbit.co.uk programs is not supported in this editor anymore. Please open this script in the https://makecode.microbit.org/v0 editor.","Jacdac":"Jacdac","JustWorks pairing (default): Pairing is automatic once the pairing is initiated.":"JustWorks pairing (default): Pairing is automatic once the pairing is initiated.","Live Coding":"Live Coding","MicroCode for the new micro:bit (V2)":"MicroCode for the new micro:bit (V2)","Microsoft MakeCode for micro:bit":"Microsoft MakeCode for micro:bit","Music":"Music","New? Start here!":"New? Start here!","No Pairing Required: Anyone can connect via Bluetooth.":"No Pairing Required: Anyone can connect via Bluetooth.","Oops, there was a problem downloading your code":"Oops, there was a problem downloading your code","Passkey pairing: Pairing requires 6 digit key to pair.":"Passkey pairing: Pairing requires 6 digit key to pair.","Radio Games":"Radio Games","Record sound clips. micro:bit (V2) only":"Record sound clips. micro:bit (V2) only","Reference":"Reference","Science":"Science","Science Experiments":"Science Experiments","Settings storage in internal flash":"Settings storage in internal flash","Support":"Support","The microbit core library":"The microbit core library","The microphone library":"The microphone library","The radio services":"The radio services","Tools":"Tools","Toys":"Toys","Turtle":"Turtle","Tutorials":"Tutorials","Tutorials for the new micro:bit (V2)":"Tutorials for the new micro:bit (V2)","makecode.microbit.org":"makecode.microbit.org","{0} is a write only analog pin":"{0} is a write only analog pin","{id:extension-tag}Gaming":"Gaming","{id:extension-tag}Lights and Display":"Lights and Display","{id:extension-tag}Networking":"Networking","{id:extension-tag}Robotics":"Robotics","{id:extension-tag}Science":"Science","{id:extension-tag}Software":"Software","{id:type}Image":"Image","{id:type}LedSprite":"LedSprite","{id:var}image":"image","{id:var}sprite":"sprite"}
|