pxt-microbit 5.1.33 → 5.1.34
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/common-sim.d.ts +8 -2
- package/built/common-sim.js +21 -0
- package/built/sim.d.ts +9 -3
- package/built/sim.js +27 -5
- package/built/target.js +1 -1
- package/built/target.json +1 -1
- package/built/targetlight.json +1 -1
- package/built/theme.json +1 -1
- package/built/web/react-common-authcode.css +1 -1
- package/built/web/react-common-multiplayer.css +1 -1
- package/built/web/react-common-skillmap.css +1 -1
- package/built/web/rtlreact-common-authcode.css +1 -1
- package/built/web/rtlreact-common-multiplayer.css +1 -1
- package/built/web/rtlreact-common-skillmap.css +1 -1
- package/built/web/rtlsemantic.css +1 -1
- package/built/web/semantic.css +1 -1
- package/docs/tours/editor-tour.md +12 -0
- package/package.json +3 -3
- package/pxtarget.json +1 -0
package/built/sim.js
CHANGED
|
@@ -70,7 +70,7 @@ var pxsim;
|
|
|
70
70
|
ID_RADIO: 9 /* MICROBIT_ID_RADIO */,
|
|
71
71
|
RADIO_EVT_DATAGRAM: 1 /* MICROBIT_RADIO_EVT_DATAGRAM */
|
|
72
72
|
});
|
|
73
|
-
this.builtinParts["microphone"] = this.microphoneState = new pxsim.
|
|
73
|
+
this.builtinParts["microphone"] = this.microphoneState = new pxsim.MicrophoneState(3001 /* DEVICE_ID_MICROPHONE */, 0, 255, 86, 165);
|
|
74
74
|
this.builtinParts["recording"] = this.recordingState = new pxsim.RecordingState();
|
|
75
75
|
this.builtinParts["accelerometer"] = this.accelerometerState = new pxsim.AccelerometerState(pxsim.runtime);
|
|
76
76
|
this.builtinParts["serial"] = this.serialState = new pxsim.SerialState(pxsim.runtime, this);
|
|
@@ -1822,6 +1822,7 @@ var pxsim;
|
|
|
1822
1822
|
if (!b)
|
|
1823
1823
|
return 0;
|
|
1824
1824
|
b.setUsed();
|
|
1825
|
+
b.pingSoundLevel();
|
|
1825
1826
|
return b.getLevel();
|
|
1826
1827
|
}
|
|
1827
1828
|
input.soundLevel = soundLevel;
|
|
@@ -1830,6 +1831,7 @@ var pxsim;
|
|
|
1830
1831
|
if (!b)
|
|
1831
1832
|
return;
|
|
1832
1833
|
b.setUsed();
|
|
1834
|
+
b.onSoundRegistered = true;
|
|
1833
1835
|
pxsim.pxtcore.registerWithDal(b.id, sound, body);
|
|
1834
1836
|
}
|
|
1835
1837
|
input.onSound = onSound;
|
|
@@ -1837,7 +1839,6 @@ var pxsim;
|
|
|
1837
1839
|
const b = pxsim.microphoneState();
|
|
1838
1840
|
if (!b)
|
|
1839
1841
|
return;
|
|
1840
|
-
b.setUsed();
|
|
1841
1842
|
if (sound === 2 /* SoundThreshold.Loud */)
|
|
1842
1843
|
b.setHighThreshold(threshold);
|
|
1843
1844
|
else
|
|
@@ -2305,6 +2306,7 @@ var pxsim;
|
|
|
2305
2306
|
function stopRecorder(b) {
|
|
2306
2307
|
b.recordingState.recorder.stop();
|
|
2307
2308
|
b.recordingState.currentlyRecording = false;
|
|
2309
|
+
pxsim.runtime.queueDisplayUpdate();
|
|
2308
2310
|
if (b.recordingState.stream.active) {
|
|
2309
2311
|
b.recordingState.stream.getAudioTracks().forEach(track => {
|
|
2310
2312
|
track.stop();
|
|
@@ -2336,7 +2338,6 @@ var pxsim;
|
|
|
2336
2338
|
pxsim.runtime.queueDisplayUpdate();
|
|
2337
2339
|
b.recordingState.recordTimeoutID = setTimeout(() => {
|
|
2338
2340
|
stopRecorder(b);
|
|
2339
|
-
pxsim.runtime.queueDisplayUpdate();
|
|
2340
2341
|
}, 5000);
|
|
2341
2342
|
b.recordingState.recorder.ondataavailable = (e) => {
|
|
2342
2343
|
b.recordingState.chunks.push(e.data);
|
|
@@ -3201,11 +3202,11 @@ path.sim-board {
|
|
|
3201
3202
|
return;
|
|
3202
3203
|
let theme = this.props.theme;
|
|
3203
3204
|
if (this.microphoneLed) {
|
|
3204
|
-
if (b.recordingState.currentlyRecording) {
|
|
3205
|
+
if (b.recordingState.currentlyRecording || b.microphoneState.soundLevelRequested) {
|
|
3205
3206
|
pxsim.svg.fills([this.microphoneLed], theme.ledOn);
|
|
3206
3207
|
pxsim.svg.filter(this.microphoneLed, `url(#ledglow)`);
|
|
3207
3208
|
}
|
|
3208
|
-
else if (!b.microphoneState.
|
|
3209
|
+
else if (!(b.microphoneState.onSoundRegistered || b.microphoneState.soundLevelRequested)) {
|
|
3209
3210
|
pxsim.svg.fills([this.microphoneLed], theme.ledOff);
|
|
3210
3211
|
pxsim.svg.filter(this.microphoneLed, `url(#none)`);
|
|
3211
3212
|
}
|
|
@@ -4427,6 +4428,27 @@ var pxsim;
|
|
|
4427
4428
|
})(pxsim || (pxsim = {}));
|
|
4428
4429
|
var pxsim;
|
|
4429
4430
|
(function (pxsim) {
|
|
4431
|
+
class MicrophoneState extends pxsim.AnalogSensorState {
|
|
4432
|
+
constructor() {
|
|
4433
|
+
super(...arguments);
|
|
4434
|
+
this.onSoundRegistered = false;
|
|
4435
|
+
this.soundLevelRequested = false;
|
|
4436
|
+
this.pingSoundLevel = () => {
|
|
4437
|
+
if (this.onSoundRegistered) {
|
|
4438
|
+
return;
|
|
4439
|
+
}
|
|
4440
|
+
this.soundLevelRequested = true;
|
|
4441
|
+
pxsim.runtime.queueDisplayUpdate();
|
|
4442
|
+
clearTimeout(this.pingUsed);
|
|
4443
|
+
this.pingUsed = setTimeout(() => {
|
|
4444
|
+
this.soundLevelRequested = false;
|
|
4445
|
+
pxsim.runtime.queueDisplayUpdate();
|
|
4446
|
+
this.pingUsed = undefined;
|
|
4447
|
+
}, 100);
|
|
4448
|
+
};
|
|
4449
|
+
}
|
|
4450
|
+
}
|
|
4451
|
+
pxsim.MicrophoneState = MicrophoneState;
|
|
4430
4452
|
function microphoneState() {
|
|
4431
4453
|
return pxsim.board().microphoneState;
|
|
4432
4454
|
}
|