pxt-microbit 4.1.8 → 4.1.12
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/common-sim.d.ts +13 -0
- package/built/common-sim.js +130 -0
- package/built/hexcache/{3237486a484d0d476c16429f4d524f5d3e2b2fd99336859f0cbb588ceb17e16b.hex → 2e531278289eae457e1cccb8ab9c35c37392d7bca298a9c914d515231f10de08.hex} +0 -0
- package/built/hexcache/{0a7e07c684763d50c302169904fdbb9fc387e1f105f5c8a62f369eab7e443b53.hex → 566b6b2b0341e146f91e1e6e084f04c21396c2a978ad779ff0577f2d6ef94ba1.hex} +10762 -10738
- package/built/hexcache/58e649966811340afef9864c236c865cc74b565a6a5bd11146194e7d1f8b0b29.hex +20247 -0
- package/built/hexcache/{72b9e94993590d9bbc5283b9e11d7f3a19235783f6a54231bf9cc657c64d7bc1.hex → f002349db15ad319d4165a4fb268171a6b286f6fc462a2650670c3b87645d3e0.hex} +0 -0
- package/built/target.js +94 -41
- package/built/target.json +94 -41
- package/built/targetlight.json +6 -6
- package/built/theme.json +1 -0
- package/built/web/blockly.css +1 -1
- package/built/web/react-common-skillmap.css +13 -0
- package/built/web/rtlblockly.css +1 -1
- package/built/web/rtlreact-common-skillmap.css +13 -0
- package/built/web/rtlsemantic.css +16 -4
- package/built/web/semantic.css +16 -4
- package/docs/extensions.md +25 -1
- package/docs/projects/micro-coin.md +12 -8
- package/docs/reference/radio/received-packet.md +9 -1
- package/docs/reference/radio/received-signal-strength.md +16 -9
- package/package.json +3 -3
- package/pxtarget.json +2 -1
- package/targetconfig.json +8 -2
- package/built/hexcache/13247a2921d73de268c2d92a591f952d610020f3c1938dde251c0139d1823417.hex +0 -20222
package/built/common-sim.d.ts
CHANGED
|
@@ -1007,6 +1007,8 @@ declare namespace pxsim.ImageMethods {
|
|
|
1007
1007
|
function _fillCircle(img: RefImage, cxy: number, r: number, c: number): void;
|
|
1008
1008
|
function _blitRow(img: RefImage, xy: number, from: RefImage, xh: number): void;
|
|
1009
1009
|
function blitRow(img: RefImage, x: number, y: number, from: RefImage, fromX: number, fromH: number): void;
|
|
1010
|
+
function _blit(img: RefImage, src: RefImage, args: RefCollection): boolean;
|
|
1011
|
+
function blit(dst: RefImage, src: RefImage, args: RefCollection): boolean;
|
|
1010
1012
|
}
|
|
1011
1013
|
declare namespace pxsim.image {
|
|
1012
1014
|
function byteHeight(h: number, bpp: number): number;
|
|
@@ -1117,6 +1119,14 @@ declare namespace pxsim.input {
|
|
|
1117
1119
|
function onSwitchMoved(direction: number, body: RefAction): void;
|
|
1118
1120
|
function switchRight(): boolean;
|
|
1119
1121
|
}
|
|
1122
|
+
declare namespace pxsim.tts {
|
|
1123
|
+
function _getLanguageCode(): string;
|
|
1124
|
+
function _speakAsync(text: string, pitch?: number, rate?: number, volume?: number, language?: string, onStart?: RefAction, onBoundary?: RefAction): Promise<void>;
|
|
1125
|
+
function _pause(): void;
|
|
1126
|
+
function _isPaused(): boolean;
|
|
1127
|
+
function _resume(): void;
|
|
1128
|
+
function _cancel(): void;
|
|
1129
|
+
}
|
|
1120
1130
|
declare namespace pxsim {
|
|
1121
1131
|
interface TemperatureBoard extends CommonBoard {
|
|
1122
1132
|
thermometerState: AnalogSensorState;
|
|
@@ -1218,10 +1228,13 @@ declare namespace pxsim._wifi {
|
|
|
1218
1228
|
export function socketClose(fd: int32): int32;
|
|
1219
1229
|
export function eventID(): int32;
|
|
1220
1230
|
export function scanStart(): void;
|
|
1231
|
+
export function startLoginServer(): void;
|
|
1221
1232
|
export function scanResults(): RefBuffer;
|
|
1222
1233
|
export function connect(ssid: string, pass: string): int32;
|
|
1223
1234
|
export function disconnect(): int32;
|
|
1224
1235
|
export function isConnected(): boolean;
|
|
1236
|
+
export function ipInfo(): RefBuffer;
|
|
1237
|
+
export function rssi(): number;
|
|
1225
1238
|
export function _raiseEvent(id: number): void;
|
|
1226
1239
|
export {};
|
|
1227
1240
|
}
|
package/built/common-sim.js
CHANGED
|
@@ -3904,6 +3904,55 @@ var pxsim;
|
|
|
3904
3904
|
}
|
|
3905
3905
|
}
|
|
3906
3906
|
ImageMethods.blitRow = blitRow;
|
|
3907
|
+
function _blit(img, src, args) {
|
|
3908
|
+
return blit(img, src, args);
|
|
3909
|
+
}
|
|
3910
|
+
ImageMethods._blit = _blit;
|
|
3911
|
+
function blit(dst, src, args) {
|
|
3912
|
+
const xDst = args.getAt(0);
|
|
3913
|
+
const yDst = args.getAt(1);
|
|
3914
|
+
const wDst = args.getAt(2);
|
|
3915
|
+
const hDst = args.getAt(3);
|
|
3916
|
+
const xSrc = args.getAt(4);
|
|
3917
|
+
const ySrc = args.getAt(5);
|
|
3918
|
+
const wSrc = args.getAt(6);
|
|
3919
|
+
const hSrc = args.getAt(7);
|
|
3920
|
+
const transparent = args.getAt(8);
|
|
3921
|
+
const check = args.getAt(9);
|
|
3922
|
+
const xSrcStep = ((wSrc << 16) / wDst) | 0;
|
|
3923
|
+
const ySrcStep = ((hSrc << 16) / hDst) | 0;
|
|
3924
|
+
const xDstClip = Math.abs(Math.min(0, xDst));
|
|
3925
|
+
const yDstClip = Math.abs(Math.min(0, yDst));
|
|
3926
|
+
const xDstStart = xDst + xDstClip;
|
|
3927
|
+
const yDstStart = yDst + yDstClip;
|
|
3928
|
+
const xDstEnd = Math.min(dst._width, xDst + wDst);
|
|
3929
|
+
const yDstEnd = Math.min(dst._height, yDst + hDst);
|
|
3930
|
+
const xSrcStart = Math.max(0, (xSrc << 16) + xDstClip * xSrcStep);
|
|
3931
|
+
const ySrcStart = Math.max(0, (ySrc << 16) + yDstClip * ySrcStep);
|
|
3932
|
+
const xSrcEnd = Math.min(src._width, xSrc + wSrc) << 16;
|
|
3933
|
+
const ySrcEnd = Math.min(src._height, ySrc + hSrc) << 16;
|
|
3934
|
+
if (!check)
|
|
3935
|
+
dst.makeWritable();
|
|
3936
|
+
for (let yDstCur = yDstStart, ySrcCur = ySrcStart; yDstCur < yDstEnd && ySrcCur < ySrcEnd; ++yDstCur, ySrcCur += ySrcStep) {
|
|
3937
|
+
const ySrcCurI = ySrcCur >> 16;
|
|
3938
|
+
for (let xDstCur = xDstStart, xSrcCur = xSrcStart; xDstCur < xDstEnd && xSrcCur < xSrcEnd; ++xDstCur, xSrcCur += xSrcStep) {
|
|
3939
|
+
const xSrcCurI = xSrcCur >> 16;
|
|
3940
|
+
const cSrc = getPixel(src, xSrcCurI, ySrcCurI);
|
|
3941
|
+
if (check && cSrc) {
|
|
3942
|
+
const cDst = getPixel(dst, xDstCur, yDstCur);
|
|
3943
|
+
if (cDst) {
|
|
3944
|
+
return true;
|
|
3945
|
+
}
|
|
3946
|
+
continue;
|
|
3947
|
+
}
|
|
3948
|
+
if (!transparent || cSrc) {
|
|
3949
|
+
setPixel(dst, xDstCur, yDstCur, cSrc);
|
|
3950
|
+
}
|
|
3951
|
+
}
|
|
3952
|
+
}
|
|
3953
|
+
return false;
|
|
3954
|
+
}
|
|
3955
|
+
ImageMethods.blit = blit;
|
|
3907
3956
|
})(ImageMethods = pxsim.ImageMethods || (pxsim.ImageMethods = {}));
|
|
3908
3957
|
})(pxsim || (pxsim = {}));
|
|
3909
3958
|
(function (pxsim) {
|
|
@@ -4530,6 +4579,80 @@ var pxsim;
|
|
|
4530
4579
|
})(input = pxsim.input || (pxsim.input = {}));
|
|
4531
4580
|
})(pxsim || (pxsim = {}));
|
|
4532
4581
|
var pxsim;
|
|
4582
|
+
(function (pxsim) {
|
|
4583
|
+
var tts;
|
|
4584
|
+
(function (tts) {
|
|
4585
|
+
function _getLanguageCode() {
|
|
4586
|
+
return window.navigator.language;
|
|
4587
|
+
}
|
|
4588
|
+
tts._getLanguageCode = _getLanguageCode;
|
|
4589
|
+
function _speakAsync(text, pitch, rate, volume, language, onStart, onBoundary) {
|
|
4590
|
+
return new Promise((resolve, reject) => {
|
|
4591
|
+
const utterance = new SpeechSynthesisUtterance(text);
|
|
4592
|
+
utterance.voice = getVoiceForLanguage(language || _getLanguageCode());
|
|
4593
|
+
if (pitch != undefined)
|
|
4594
|
+
utterance.pitch = pitch;
|
|
4595
|
+
if (rate != undefined)
|
|
4596
|
+
utterance.rate = rate;
|
|
4597
|
+
if (volume != undefined)
|
|
4598
|
+
utterance.volume = volume;
|
|
4599
|
+
utterance.onend = () => resolve();
|
|
4600
|
+
utterance.onerror = reject;
|
|
4601
|
+
if (onStart) {
|
|
4602
|
+
utterance.onstart = () => pxsim.runtime.runFiberAsync(onStart);
|
|
4603
|
+
}
|
|
4604
|
+
if (onBoundary) {
|
|
4605
|
+
utterance.onboundary = event => {
|
|
4606
|
+
const offset = event.charIndex;
|
|
4607
|
+
const nextWord = text.substring(offset).split(/\s/).shift();
|
|
4608
|
+
pxsim.runtime.runFiberAsync(onBoundary, offset, nextWord, text);
|
|
4609
|
+
};
|
|
4610
|
+
}
|
|
4611
|
+
speechSynthesis.speak(utterance);
|
|
4612
|
+
});
|
|
4613
|
+
}
|
|
4614
|
+
tts._speakAsync = _speakAsync;
|
|
4615
|
+
function _pause() {
|
|
4616
|
+
speechSynthesis.pause();
|
|
4617
|
+
}
|
|
4618
|
+
tts._pause = _pause;
|
|
4619
|
+
function _isPaused() {
|
|
4620
|
+
return speechSynthesis.paused;
|
|
4621
|
+
}
|
|
4622
|
+
tts._isPaused = _isPaused;
|
|
4623
|
+
function _resume() {
|
|
4624
|
+
speechSynthesis.resume();
|
|
4625
|
+
}
|
|
4626
|
+
tts._resume = _resume;
|
|
4627
|
+
function _cancel() {
|
|
4628
|
+
speechSynthesis.cancel();
|
|
4629
|
+
}
|
|
4630
|
+
tts._cancel = _cancel;
|
|
4631
|
+
function getVoiceForLanguage(language) {
|
|
4632
|
+
language = language.toLowerCase();
|
|
4633
|
+
const generalCode = language.substring(0, 2);
|
|
4634
|
+
let bestMatch;
|
|
4635
|
+
let bestNonlocalMatch;
|
|
4636
|
+
for (const voice of speechSynthesis.getVoices()) {
|
|
4637
|
+
const current = voice.lang.toLowerCase();
|
|
4638
|
+
if (current === language) {
|
|
4639
|
+
if (voice.localService)
|
|
4640
|
+
return voice;
|
|
4641
|
+
else
|
|
4642
|
+
bestNonlocalMatch = voice;
|
|
4643
|
+
}
|
|
4644
|
+
else if (current.substring(0, 2) === generalCode) {
|
|
4645
|
+
if (!bestMatch && voice.localService)
|
|
4646
|
+
bestMatch = voice;
|
|
4647
|
+
if (!bestNonlocalMatch && !voice.localService)
|
|
4648
|
+
bestNonlocalMatch = voice;
|
|
4649
|
+
}
|
|
4650
|
+
}
|
|
4651
|
+
return bestMatch || bestNonlocalMatch || (language !== "en-us" ? getVoiceForLanguage("en-US") : undefined);
|
|
4652
|
+
}
|
|
4653
|
+
})(tts = pxsim.tts || (pxsim.tts = {}));
|
|
4654
|
+
})(pxsim || (pxsim = {}));
|
|
4655
|
+
var pxsim;
|
|
4533
4656
|
(function (pxsim) {
|
|
4534
4657
|
function thermometerState() {
|
|
4535
4658
|
return pxsim.board().thermometerState;
|
|
@@ -4929,6 +5052,9 @@ var pxsim;
|
|
|
4929
5052
|
_raiseEvent(1 /* ScanDone */);
|
|
4930
5053
|
}
|
|
4931
5054
|
_wifi.scanStart = scanStart;
|
|
5055
|
+
function startLoginServer() {
|
|
5056
|
+
}
|
|
5057
|
+
_wifi.startLoginServer = startLoginServer;
|
|
4932
5058
|
function scanResults() {
|
|
4933
5059
|
const b = new Uint8Array(7);
|
|
4934
5060
|
b[0] = -20; // rssi
|
|
@@ -4948,6 +5074,10 @@ var pxsim;
|
|
|
4948
5074
|
_wifi.disconnect = disconnect;
|
|
4949
5075
|
function isConnected() { return true; }
|
|
4950
5076
|
_wifi.isConnected = isConnected;
|
|
5077
|
+
function ipInfo() { return new pxsim.RefBuffer(new Uint8Array(4 * 3)); }
|
|
5078
|
+
_wifi.ipInfo = ipInfo;
|
|
5079
|
+
function rssi() { return -24; }
|
|
5080
|
+
_wifi.rssi = rssi;
|
|
4951
5081
|
function _raiseEvent(id) {
|
|
4952
5082
|
pxsim.control.raiseEvent(_wifi.eventID(), id, undefined);
|
|
4953
5083
|
}
|