pxt-microbit 4.1.4 → 4.1.8

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.
Files changed (58) hide show
  1. package/built/common-sim.d.ts +51 -2
  2. package/built/common-sim.js +296 -6
  3. package/built/hexcache/{6526a3337377701ca7bf1d9940f76fdccac145405380ee3ecc2c96f6049e34ce.hex → 0a7e07c684763d50c302169904fdbb9fc387e1f105f5c8a62f369eab7e443b53.hex} +9 -9
  4. package/built/hexcache/{8fc8a1499d69a5d8cc851cf49d16112b3021ab801238204dacf84073acf90e7c.hex → 13247a2921d73de268c2d92a591f952d610020f3c1938dde251c0139d1823417.hex} +9 -9
  5. package/built/hexcache/3237486a484d0d476c16429f4d524f5d3e2b2fd99336859f0cbb588ceb17e16b.hex +14849 -0
  6. package/built/hexcache/72b9e94993590d9bbc5283b9e11d7f3a19235783f6a54231bf9cc657c64d7bc1.hex +14318 -0
  7. package/built/sim-strings.json +3 -3
  8. package/built/sim.js +10 -12
  9. package/built/target-strings.json +2 -1
  10. package/built/target.js +117 -46
  11. package/built/target.json +117 -46
  12. package/built/targetlight.json +5 -5
  13. package/built/web/blockly.css +1 -1
  14. package/built/web/rtlblockly.css +1 -1
  15. package/built/web/rtlsemantic.css +16 -16
  16. package/built/web/semantic.css +16 -16
  17. package/docs/blocks/comments.md +131 -0
  18. package/docs/blocks/loops.md +12 -0
  19. package/docs/device/usb/webusb.md +31 -9
  20. package/docs/device/usb/windows-chrome.md +14 -24
  21. package/docs/device/usb/windows-edge.md +11 -13
  22. package/docs/device/usb.md +10 -4
  23. package/docs/device.md +28 -12
  24. package/docs/docs.md +1 -1
  25. package/docs/extensions.md +126 -2
  26. package/docs/projects/SUMMARY.md +7 -1
  27. package/docs/projects/micro-chat.md +8 -8
  28. package/docs/projects/mood-radio.md +3 -1
  29. package/docs/projects/multi-dice.md +8 -6
  30. package/docs/projects/plot-acceleration.md +2 -2
  31. package/docs/projects/v2-blow-away.md +317 -0
  32. package/docs/projects/v2-clap-lights.md +195 -0
  33. package/docs/projects/v2-countdown.md +151 -0
  34. package/docs/projects/v2-morse-chat.md +297 -0
  35. package/docs/projects/v2-pet-hamster.md +165 -0
  36. package/docs/projects.md +8 -2
  37. package/docs/reference/basic/forever.md +17 -4
  38. package/docs/reference/basic/show-number.md +1 -1
  39. package/docs/reference/game/change.md +10 -6
  40. package/docs/reference/game/get.md +6 -6
  41. package/docs/reference/game/set.md +29 -12
  42. package/docs/reference/loops/every-interval.md +42 -0
  43. package/docs/reference/radio/on-received-buffer.md +1 -0
  44. package/docs/reference/radio/on-received-number.md +2 -0
  45. package/docs/reference/radio/on-received-string.md +1 -0
  46. package/docs/reference/radio/on-received-value.md +1 -0
  47. package/docs/reference/radio/received-packet.md +1 -0
  48. package/docs/reference/radio/send-buffer.md +1 -0
  49. package/docs/reference/radio/send-string.md +1 -0
  50. package/docs/reference/radio/set-group.md +8 -0
  51. package/docs/reference/radio/write-received-packet-to-serial.md +1 -0
  52. package/docs/reference/radio/write-value-to-serial.md +1 -0
  53. package/docs/tutorials-v2.md +39 -0
  54. package/package.json +5 -5
  55. package/sim/public/icons/jacdac.svg +1 -1
  56. package/targetconfig.json +49 -9
  57. package/built/hexcache/02e34856c566087a1e5f0212e31686199c414ee7c8a2b9c36be7167d71548860.hex +0 -13960
  58. package/built/hexcache/447fa4d5b24ea1ca19eab3745af559cd49d5831ea3e3d6750812b3af3de0f2c4.hex +0 -14499
@@ -9,9 +9,9 @@
9
9
  "acceleration.z": "acceleration.z",
10
10
  "heading": "heading",
11
11
  "lightLevel": "lightLevel",
12
- "logo touch (micro:bit V2 needed)": "logo touch (micro:bit V2 needed)",
13
- "micro:bit V2 needed": "micro:bit V2 needed",
14
- "microphone (microbit:v2 needed)": "microphone (microbit:v2 needed)",
12
+ "logo touch (micro:bit v2 needed)": "logo touch (micro:bit v2 needed)",
13
+ "micro:bit v2 needed": "micro:bit v2 needed",
14
+ "microphone (micro:bit v2 needed)": "microphone (micro:bit v2 needed)",
15
15
  "sound level": "sound level",
16
16
  "temperature": "temperature"
17
17
  }
package/built/sim.js CHANGED
@@ -3784,7 +3784,7 @@ path.sim-board {
3784
3784
  let pt = this.element.createSVGPoint();
3785
3785
  pxsim.svg.buttonEvents(this.head, (ev) => {
3786
3786
  let cur = pxsim.svg.cursorPoint(pt, this.element, ev);
3787
- state.compassState.heading = Math.floor(Math.atan2(cur.y - yc, cur.x - xc) * 180 / Math.PI + 90);
3787
+ state.compassState.heading = 360 - (Math.floor(Math.atan2(cur.y - yc, cur.x - xc) * 180 / Math.PI) + 90) - 360;
3788
3788
  if (state.compassState.heading < 0)
3789
3789
  state.compassState.heading += 360;
3790
3790
  this.updateHeading();
@@ -3793,7 +3793,7 @@ path.sim-board {
3793
3793
  }
3794
3794
  let txt = state.compassState.heading.toString() + "°";
3795
3795
  if (txt != this.headText.textContent) {
3796
- pxsim.svg.rotateElement(this.head, xc, yc, state.compassState.heading + 180);
3796
+ pxsim.svg.rotateElement(this.head, xc, yc, 360 - state.compassState.heading - 180);
3797
3797
  this.headText.textContent = txt;
3798
3798
  if (this.props.runtime)
3799
3799
  this.props.runtime.environmentGlobals[pxsim.localization.lf("heading")] = state.compassState.heading;
@@ -4151,7 +4151,7 @@ path.sim-board {
4151
4151
  this.props.theme = visuals.themes[0];
4152
4152
  }
4153
4153
  // display v2 indicator
4154
- const title = pxsim.localization.lf("micro:bit V2 needed");
4154
+ const title = pxsim.localization.lf("micro:bit v2 needed");
4155
4155
  this.v2Circle = pxsim.svg.child(this.g, "circle", { r: 21, title: title });
4156
4156
  pxsim.svg.fill(this.v2Circle, "white");
4157
4157
  this.v2Text = pxsim.svg.child(this.g, "text", { class: "sim-text", title: title });
@@ -4168,17 +4168,17 @@ path.sim-board {
4168
4168
  this.pins[this.pins.length - 1].setAttribute("d", "M 458 317.6 c -13 0 -23.6 10.6 -23.6 23.6 c 0 0 0 0.1 0 0.1 h 0 V 406 h 7 c 0 0 -1 -9 8 -8 l 17 0 c 0 0 9 -1 8 8 h 1.6 c 2 0 4 -1 5 -3 v -60.7 c 0 -0.4 0 -0.9 0 -1.3 C 481.6 328.1 471 317.6 458 317.6 z M 457.8 360.9 c -10.7 0 -19.3 -8.6 -19.3 -19.3 c 0 -10.7 8.6 -19.3 19.3 -19.3 c 10.7 0 19.3 8.7 19.3 19.3 C 477.1 352.2 468.4 360.9 457.8 360.9 z");
4169
4169
  // outline
4170
4170
  this.pkg.setAttribute("d", "M 498 31.9 C 498 14.3 483.7 0 466.1 0 H 31.9 C 14.3 0 0 14.3 0 31.9 v 342.2 C -1 399 21 405 23 406 c 0 0 -1 -9 8 -8 l 18 0 c 0 0 9 -1 8 8 h 7 h 50 h 7 c 0 0 -1 -9 8 -8 l 18 0 c 0 0 9 -1 8 8 h 7 h 63 h 7 c 0 0 -1 -9 8 -8 l 18 0 c 0 0 9 -1 8 8 h 7 h 64 h 7 c 0 0 -1 -9 8 -8 l 18 0 c 0 0 9 -1 8 8 h 7 h 51 h 5 c 0 0 -1 -9 8 -8 l 18 0 c 0 0 9 -1 8 8 h 0 c 9 0 23 -17 23 -31 V 31.9 z M 14.3 206.7 c -2.7 0 -4.8 -2.2 -4.8 -4.8 c 0 -2.7 2.2 -4.8 4.8 -4.8 c 2.7 0 4.8 2.2 4.8 4.8 C 19.2 204.6 17 206.7 14.3 206.7 z M 486.2 206.7 c -2.7 0 -4.8 -2.2 -4.8 -4.8 c 0 -2.72 0.2 -4.8 4.8 -4.8 c 2.7 0 4.8 2.2 4.8 4.8 C 491 204.6 488.8 206.7 486.2 206.7 z");
4171
- const headTitle = pxsim.localization.lf("logo touch (micro:bit V2 needed)");
4171
+ const headTitle = pxsim.localization.lf("logo touch (micro:bit v2 needed)");
4172
4172
  pxsim.accessibility.makeFocusable(this.headParts);
4173
4173
  pxsim.accessibility.setAria(this.headParts, "button", headTitle);
4174
4174
  // microphone led
4175
- const microphoneTitle = pxsim.localization.lf("microphone (microbit:v2 needed)");
4175
+ const microphoneTitle = pxsim.localization.lf("microphone (micro:bit v2 needed)");
4176
4176
  const microg = pxsim.svg.child(this.g, "g", { title: microphoneTitle });
4177
4177
  this.microphoneLed = pxsim.svg.path(microg, "sim-led sim-mic", "M 352.852 71 C 351.315 71 350.07 72.248 350.07 73.784 V 79.056 C 350.07 80.594 351.316 81.838 352.852 81.838 C 354.387 81.838 355.634 80.593 355.634 79.056 V 73.784 C 355.634 72.248 354.387 71 352.852 71 Z M 346.743 79.981 C 346.743 82.84 348.853 85.062 351.501 85.658 V 87.095 H 348.448 V 89.329 H 357.366 V 87.095 H 354.306 V 85.658 C 356.954 85.064 359.071 82.842 359.071 79.981 H 357.057 C 357.057 82.174 355.168 83.81 352.905 83.81 C 350.64 83.81 348.757 82.173 348.757 79.981 Z");
4178
4178
  pxsim.svg.fills([this.microphoneLed], this.props.theme.ledOff);
4179
4179
  // ring
4180
4180
  const microhole = pxsim.svg.child(this.g, "circle", { cx: 336, cy: 86, r: 3, stroke: "gold", strokeWidth: "1px" });
4181
- pxsim.svg.title(microhole, pxsim.localization.lf("microphone (microbit:v2 needed)"));
4181
+ pxsim.svg.title(microhole, pxsim.localization.lf("microphone (micro:bit v2 needed)"));
4182
4182
  this.updateMicrophone();
4183
4183
  this.updateTheme();
4184
4184
  }
@@ -4632,22 +4632,20 @@ var pxsim;
4632
4632
  }
4633
4633
  control.profilingEnabled = profilingEnabled;
4634
4634
  function __log(priority, str) {
4635
- let prefix = "";
4636
4635
  switch (priority) {
4637
4636
  case 0:
4638
- prefix = "d>";
4637
+ console.debug("d>" + str);
4639
4638
  break;
4640
4639
  case 1:
4641
- prefix = "l>";
4640
+ console.log("l>" + str);
4642
4641
  break;
4643
4642
  case 2:
4644
- prefix = "w>";
4643
+ console.warn("w>" + str);
4645
4644
  break;
4646
4645
  case 3:
4647
- prefix = "e>";
4646
+ console.error("e>" + str);
4648
4647
  break;
4649
4648
  }
4650
- console.log(prefix + str);
4651
4649
  pxsim.runtime.board.writeSerial(str);
4652
4650
  }
4653
4651
  control.__log = __log;
@@ -4,7 +4,7 @@
4
4
  "Adds new blocks for message communication in the radio category": "Adds new blocks for message communication in the radio category",
5
5
  "BETA - Camera, remote control and other Bluetooth services. App required.": "BETA - Camera, remote control and other Bluetooth services. App required.",
6
6
  "Behind the MakeCode Hardware": "Behind the MakeCode Hardware",
7
- "Blocks To JavaScript": "Blocks To JavaScript",
7
+ "Blocks to JavaScript": "Blocks to JavaScript",
8
8
  "Bluetooth services": "Bluetooth services",
9
9
  "Buy": "Buy",
10
10
  "Can't import microbit.co.uk scripts...": "Can't import microbit.co.uk scripts...",
@@ -42,6 +42,7 @@
42
42
  "Toys": "Toys",
43
43
  "Turtle": "Turtle",
44
44
  "Tutorials": "Tutorials",
45
+ "Tutorials for the new micro:bit (V2)": "Tutorials for the new micro:bit (V2)",
45
46
  "makecode.microbit.org": "makecode.microbit.org",
46
47
  "{id:type}Image": "Image",
47
48
  "{id:type}LedSprite": "LedSprite",