pxt-microbit 5.1.21 → 5.1.23
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/sim.d.ts +7 -0
- package/built/sim.js +23 -2
- 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/rtlsemantic.css +1 -1
- package/built/web/semantic.css +1 -1
- package/docs/reference/led/plot-bar-graph.md +5 -5
- package/package.json +2 -2
- package/pxtarget.json +3 -6
package/built/sim.d.ts
CHANGED
|
@@ -18,6 +18,7 @@ declare namespace pxsim {
|
|
|
18
18
|
buttonPairState: ButtonPairState;
|
|
19
19
|
radioState: RadioState;
|
|
20
20
|
microphoneState: AnalogSensorState;
|
|
21
|
+
recordingState: RecordingState;
|
|
21
22
|
lightState: pxt.Map<CommonNeoPixelState>;
|
|
22
23
|
fileSystem: FileSystemState;
|
|
23
24
|
logoTouch: Button;
|
|
@@ -560,6 +561,11 @@ declare namespace pxsim.music.MusicalProgressions {
|
|
|
560
561
|
*/
|
|
561
562
|
function calculateFrequencyFromProgression(root: number, progression: Progression, offset: number): number;
|
|
562
563
|
}
|
|
564
|
+
declare namespace pxsim {
|
|
565
|
+
class RecordingState {
|
|
566
|
+
currentlyRecording: boolean;
|
|
567
|
+
}
|
|
568
|
+
}
|
|
563
569
|
declare namespace pxsim.record {
|
|
564
570
|
function record(): Promise<void>;
|
|
565
571
|
function play(): void;
|
|
@@ -736,6 +742,7 @@ declare namespace pxsim.visuals {
|
|
|
736
742
|
private updateLEDMatrix;
|
|
737
743
|
private updateGestures;
|
|
738
744
|
private updateMicrophone;
|
|
745
|
+
private updateRecordingActive;
|
|
739
746
|
private updateButtonAB;
|
|
740
747
|
private updatePin;
|
|
741
748
|
private updateTemperature;
|
package/built/sim.js
CHANGED
|
@@ -71,6 +71,7 @@ var pxsim;
|
|
|
71
71
|
RADIO_EVT_DATAGRAM: 1 /* MICROBIT_RADIO_EVT_DATAGRAM */
|
|
72
72
|
});
|
|
73
73
|
this.builtinParts["microphone"] = this.microphoneState = new pxsim.AnalogSensorState(3001 /* DEVICE_ID_MICROPHONE */, 0, 255, 86, 165);
|
|
74
|
+
this.builtinParts["recording"] = this.recordingState = new pxsim.RecordingState();
|
|
74
75
|
this.builtinParts["accelerometer"] = this.accelerometerState = new pxsim.AccelerometerState(pxsim.runtime);
|
|
75
76
|
this.builtinParts["serial"] = this.serialState = new pxsim.SerialState(pxsim.runtime, this);
|
|
76
77
|
this.builtinParts["thermometer"] = this.thermometerState = new pxsim.ThermometerState();
|
|
@@ -2273,12 +2274,24 @@ var pxsim;
|
|
|
2273
2274
|
})(music = pxsim.music || (pxsim.music = {}));
|
|
2274
2275
|
})(pxsim || (pxsim = {}));
|
|
2275
2276
|
var pxsim;
|
|
2277
|
+
(function (pxsim) {
|
|
2278
|
+
class RecordingState {
|
|
2279
|
+
constructor() {
|
|
2280
|
+
this.currentlyRecording = false;
|
|
2281
|
+
}
|
|
2282
|
+
}
|
|
2283
|
+
pxsim.RecordingState = RecordingState;
|
|
2284
|
+
})(pxsim || (pxsim = {}));
|
|
2276
2285
|
(function (pxsim) {
|
|
2277
2286
|
var record;
|
|
2278
2287
|
(function (record_1) {
|
|
2279
2288
|
async function record() {
|
|
2280
2289
|
//request permission is asynchronous
|
|
2281
|
-
pxsim.board();
|
|
2290
|
+
let b = pxsim.board();
|
|
2291
|
+
if (!b.recordingState.currentlyRecording) {
|
|
2292
|
+
b.recordingState.currentlyRecording = true;
|
|
2293
|
+
pxsim.runtime.queueDisplayUpdate();
|
|
2294
|
+
}
|
|
2282
2295
|
}
|
|
2283
2296
|
record_1.record = record;
|
|
2284
2297
|
function play() {
|
|
@@ -2943,7 +2956,7 @@ path.sim-board {
|
|
|
2943
2956
|
pxsim.svg.fill(this.display, theme.display);
|
|
2944
2957
|
pxsim.svg.fills(this.leds, theme.ledOn);
|
|
2945
2958
|
pxsim.svg.fills(this.ledsOuter, theme.ledOff);
|
|
2946
|
-
if (this.microphoneLed && this.board.microphoneState.sensorUsed) {
|
|
2959
|
+
if (this.microphoneLed && (this.board.microphoneState.sensorUsed || this.board.recordingState.currentlyRecording)) {
|
|
2947
2960
|
pxsim.svg.fills([this.microphoneLed], theme.ledOn);
|
|
2948
2961
|
pxsim.svg.filter(this.microphoneLed, `url(#ledglow)`);
|
|
2949
2962
|
}
|
|
@@ -2972,6 +2985,7 @@ path.sim-board {
|
|
|
2972
2985
|
return;
|
|
2973
2986
|
this.updateHardwareVersion();
|
|
2974
2987
|
this.updateMicrophone();
|
|
2988
|
+
this.updateRecordingActive();
|
|
2975
2989
|
this.updateButtonPairs();
|
|
2976
2990
|
this.updateLEDMatrix();
|
|
2977
2991
|
this.updatePins();
|
|
@@ -3057,6 +3071,13 @@ path.sim-board {
|
|
|
3057
3071
|
return;
|
|
3058
3072
|
this.updateSoundLevel();
|
|
3059
3073
|
}
|
|
3074
|
+
updateRecordingActive() {
|
|
3075
|
+
const b = pxsim.board();
|
|
3076
|
+
if (!b
|
|
3077
|
+
|| !b.recordingState.currentlyRecording)
|
|
3078
|
+
return;
|
|
3079
|
+
this.updateTheme();
|
|
3080
|
+
}
|
|
3060
3081
|
updateButtonAB() {
|
|
3061
3082
|
let state = this.board;
|
|
3062
3083
|
if (state.buttonPairState.usesButtonAB && !this.buttonABText) {
|