pxt-common-packages 12.3.29 → 12.3.31

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 (46) hide show
  1. package/built/common-sim.js +2 -1
  2. package/libs/accelerometer/built/debug/binary.js +8 -8
  3. package/libs/azureiot/built/debug/binary.js +461 -461
  4. package/libs/base/math.ts +28 -5
  5. package/libs/base/pxtbase.h +1 -1
  6. package/libs/color/built/debug/binary.js +8 -8
  7. package/libs/color-sensor/built/debug/binary.js +8 -8
  8. package/libs/controller/built/debug/binary.js +7388 -7377
  9. package/libs/controller---none/built/debug/binary.js +7368 -7357
  10. package/libs/core/built/debug/binary.js +2 -2
  11. package/libs/core---samd/built/debug/binary.js +8 -8
  12. package/libs/datalogger/built/debug/binary.js +63 -63
  13. package/libs/edge-connector/built/debug/binary.js +8 -8
  14. package/libs/esp32/built/debug/binary.js +462 -462
  15. package/libs/game/built/debug/binary.js +7307 -7296
  16. package/libs/game/sprite.ts +4 -0
  17. package/libs/gamepad/built/debug/binary.js +8 -8
  18. package/libs/keyboard/built/debug/binary.js +8 -8
  19. package/libs/lcd/built/debug/binary.js +8 -8
  20. package/libs/light/built/debug/binary.js +8 -8
  21. package/libs/light-spectrum-sensor/built/debug/binary.js +8 -8
  22. package/libs/lora/built/debug/binary.js +8 -8
  23. package/libs/matrix-keypad/built/debug/binary.js +8 -8
  24. package/libs/microphone/built/debug/binary.js +8 -8
  25. package/libs/mouse/built/debug/binary.js +8 -8
  26. package/libs/mqtt/built/debug/binary.js +176 -176
  27. package/libs/music/built/debug/binary.js +8 -8
  28. package/libs/net/built/debug/binary.js +176 -176
  29. package/libs/net-game/built/debug/binary.js +9024 -9013
  30. package/libs/palette/built/debug/binary.js +7306 -7295
  31. package/libs/pixel/built/debug/binary.js +8 -8
  32. package/libs/power/built/debug/binary.js +8 -8
  33. package/libs/proximity/built/debug/binary.js +8 -8
  34. package/libs/pulse/built/debug/binary.js +8 -8
  35. package/libs/radio/built/debug/binary.js +8 -8
  36. package/libs/radio-broadcast/built/debug/binary.js +8 -8
  37. package/libs/rotary-encoder/built/debug/binary.js +8 -8
  38. package/libs/screen/built/debug/binary.js +50 -50
  39. package/libs/screen/sim/image.ts +4 -3
  40. package/libs/servo/built/debug/binary.js +8 -8
  41. package/libs/settings/settings.cpp +1 -1
  42. package/libs/sprite-scaling/built/debug/binary.js +7306 -7295
  43. package/libs/storyboard/built/debug/binary.js +7304 -7293
  44. package/libs/tests/built/debug/binary.js +15 -15
  45. package/libs/thermometer/built/debug/binary.js +8 -8
  46. package/package.json +1 -1
package/libs/base/math.ts CHANGED
@@ -1,12 +1,27 @@
1
1
  namespace Math {
2
-
2
+ //% blockIdentity="Math._constant"
3
+ //% block="π"
4
+ export const PI = 3.141592653589793;
5
+ //% blockIdentity="Math._constant"
6
+ //% block="e"
3
7
  export const E = 2.718281828459045;
8
+ //% blockIdentity="Math._constant"
9
+ //% block="ln(2)"
4
10
  export const LN2 = 0.6931471805599453;
11
+ //% blockIdentity="Math._constant"
12
+ //% block="ln(10)"
5
13
  export const LN10 = 2.302585092994046;
14
+ //% blockIdentity="Math._constant"
15
+ //% block="log₂(e)"
6
16
  export const LOG2E = 1.4426950408889634;
17
+ //% blockIdentity="Math._constant"
18
+ //% block="log₁₀(e)"
7
19
  export const LOG10E = 0.4342944819032518;
8
- export const PI = 3.141592653589793;
20
+ //% blockIdentity="Math._constant"
21
+ //% block="√½"
9
22
  export const SQRT1_2 = 0.7071067811865476;
23
+ //% blockIdentity="Math._constant"
24
+ //% block="√2"
10
25
  export const SQRT2 = 1.4142135623730951;
11
26
 
12
27
  /**
@@ -22,7 +37,7 @@ namespace Math {
22
37
  //% inlineInputMode=inline
23
38
  export function map(value: number, fromLow: number, fromHigh: number, toLow: number, toHigh: number): number {
24
39
  return ((value - fromLow) * (toHigh - toLow)) / (fromHigh - fromLow) + toLow;
25
- }
40
+ }
26
41
 
27
42
  /**
28
43
  * Constrains a number to be within a range
@@ -59,7 +74,7 @@ namespace Math {
59
74
  let b = b_m16[s2];
60
75
  let m16 = b_m16[s2+1];
61
76
  let mx = (m16 * secoffset) >> 4;
62
-
77
+
63
78
  let y = mx + b;
64
79
  if( theta & 0x80 ) y = -y;
65
80
 
@@ -69,13 +84,21 @@ namespace Math {
69
84
  }
70
85
 
71
86
  /**
72
- * Returns the cosine of an input angle. This is an 8-bit approximation.
87
+ * Returns the cosine of an input angle. This is an 8-bit approximation.
73
88
  * @param theta input angle from 0-255
74
89
  */
75
90
  //% help=math/icos weight=10 advanced=true blockGap=8
76
91
  export function icos(theta: number) {
77
92
  return isin(theta + 16384);
78
93
  }
94
+
95
+ //% shim=TD_ID
96
+ //% block="$MEMBER"
97
+ //% constantShim
98
+ //% weight=0
99
+ export function _constant(MEMBER: number): number {
100
+ return MEMBER;
101
+ }
79
102
  }
80
103
 
81
104
  namespace Number {
@@ -1169,7 +1169,7 @@ bool removeElement(RefCollection *c, TValue x);
1169
1169
  #if MICROBIT_TOP_OF_FLASH
1170
1170
  #define FLASH_TOP MICROBIT_TOP_OF_FLASH
1171
1171
  #else
1172
- #define FLASH_TOP 0x00000000
1172
+ #define FLASH_TOP 0x00073000
1173
1173
  #endif
1174
1174
  #else
1175
1175
  #define FLASH_TOP 0x00000000
@@ -56,7 +56,7 @@ const pxsim_pxtrt = pxsim.pxtrt;
56
56
  const pxsim_numops = pxsim.numops;
57
57
 
58
58
 
59
- function _main___P141198(s) {
59
+ function _main___P141246(s) {
60
60
  let r0 = s.r0, step = s.pc;
61
61
  s.pc = -1;
62
62
 
@@ -66,19 +66,19 @@ if (yieldSteps-- < 0 && maybeYield(s, step, r0) || runtime !== pxsim.runtime) re
66
66
  switch (step) {
67
67
  case 0:
68
68
 
69
- globals._intervals___141441 = (undefined);
70
- globals._pollEventQueue___141454 = (undefined);
69
+ globals._intervals___141490 = (undefined);
70
+ globals._pollEventQueue___141503 = (undefined);
71
71
  r0 = undefined;
72
72
  return leave(s, r0)
73
73
  default: oops()
74
74
  } } }
75
- _main___P141198.info = {"start":0,"length":0,"line":0,"column":0,"endLine":0,"endColumn":0,"fileName":"colorbuffer.ts","functionName":"<main>","argumentNames":[]}
76
- _main___P141198.continuations = [ ]
75
+ _main___P141246.info = {"start":0,"length":0,"line":0,"column":0,"endLine":0,"endColumn":0,"fileName":"colorbuffer.ts","functionName":"<main>","argumentNames":[]}
76
+ _main___P141246.continuations = [ ]
77
77
 
78
- function _main___P141198_mk(s) {
78
+ function _main___P141246_mk(s) {
79
79
  checkStack(s.depth);
80
80
  return {
81
- parent: s, fn: _main___P141198, depth: s.depth + 1,
81
+ parent: s, fn: _main___P141246, depth: s.depth + 1,
82
82
  pc: 0, retval: undefined, r0: undefined, overwrittenPC: false, lambdaArgs: null,
83
83
  } }
84
84
 
@@ -88,5 +88,5 @@ function _main___P141198_mk(s) {
88
88
 
89
89
  const breakpoints = setupDebugger(1, [])
90
90
 
91
- return _main___P141198
91
+ return _main___P141246
92
92
  })
@@ -56,7 +56,7 @@ const pxsim_pxtrt = pxsim.pxtrt;
56
56
  const pxsim_numops = pxsim.numops;
57
57
 
58
58
 
59
- function _main___P98756(s) {
59
+ function _main___P98792(s) {
60
60
  let r0 = s.r0, step = s.pc;
61
61
  s.pc = -1;
62
62
 
@@ -66,19 +66,19 @@ if (yieldSteps-- < 0 && maybeYield(s, step, r0) || runtime !== pxsim.runtime) re
66
66
  switch (step) {
67
67
  case 0:
68
68
 
69
- globals._intervals___98999 = (undefined);
70
- globals._pollEventQueue___99012 = (undefined);
69
+ globals._intervals___99036 = (undefined);
70
+ globals._pollEventQueue___99049 = (undefined);
71
71
  r0 = undefined;
72
72
  return leave(s, r0)
73
73
  default: oops()
74
74
  } } }
75
- _main___P98756.info = {"start":0,"length":0,"line":0,"column":0,"endLine":0,"endColumn":0,"fileName":"tcs34725.ts","functionName":"<main>","argumentNames":[]}
76
- _main___P98756.continuations = [ ]
75
+ _main___P98792.info = {"start":0,"length":0,"line":0,"column":0,"endLine":0,"endColumn":0,"fileName":"tcs34725.ts","functionName":"<main>","argumentNames":[]}
76
+ _main___P98792.continuations = [ ]
77
77
 
78
- function _main___P98756_mk(s) {
78
+ function _main___P98792_mk(s) {
79
79
  checkStack(s.depth);
80
80
  return {
81
- parent: s, fn: _main___P98756, depth: s.depth + 1,
81
+ parent: s, fn: _main___P98792, depth: s.depth + 1,
82
82
  pc: 0, retval: undefined, r0: undefined, overwrittenPC: false, lambdaArgs: null,
83
83
  } }
84
84
 
@@ -88,5 +88,5 @@ function _main___P98756_mk(s) {
88
88
 
89
89
  const breakpoints = setupDebugger(1, [])
90
90
 
91
- return _main___P98756
91
+ return _main___P98792
92
92
  })