pxt-common-packages 10.1.11 → 10.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.
Files changed (34) hide show
  1. package/libs/azureiot/built/debug/binary.js +461 -461
  2. package/libs/base/core.cpp +15 -7
  3. package/libs/base/eventcontext.ts +7 -3
  4. package/libs/base/pxtbase.h +8 -0
  5. package/libs/color/built/debug/binary.js +8 -8
  6. package/libs/color-sensor/built/debug/binary.js +8 -8
  7. package/libs/controller/built/debug/binary.js +8055 -8025
  8. package/libs/controller---none/built/debug/binary.js +8034 -8004
  9. package/libs/core---nrf52/platform.cpp +6 -0
  10. package/libs/core---nrf52/platform.h +3 -0
  11. package/libs/datalogger/built/debug/binary.js +63 -63
  12. package/libs/edge-connector/built/debug/binary.js +8 -8
  13. package/libs/esp32/built/debug/binary.js +462 -462
  14. package/libs/game/built/debug/binary.js +7888 -7858
  15. package/libs/lcd/built/debug/binary.js +8 -8
  16. package/libs/light-spectrum-sensor/built/debug/binary.js +8 -8
  17. package/libs/lora/built/debug/binary.js +8 -8
  18. package/libs/matrix-keypad/built/debug/binary.js +8 -8
  19. package/libs/mqtt/built/debug/binary.js +176 -176
  20. package/libs/net/built/debug/binary.js +176 -176
  21. package/libs/net-game/built/debug/binary.js +9754 -9724
  22. package/libs/palette/built/debug/binary.js +7887 -7857
  23. package/libs/pixel/built/debug/binary.js +8 -8
  24. package/libs/power/built/debug/binary.js +8 -8
  25. package/libs/proximity/built/debug/binary.js +8 -8
  26. package/libs/radio/built/debug/binary.js +8 -8
  27. package/libs/radio-broadcast/built/debug/binary.js +8 -8
  28. package/libs/rotary-encoder/built/debug/binary.js +8 -8
  29. package/libs/screen/built/debug/binary.js +50 -50
  30. package/libs/screen---st7735/panic.cpp +5 -1
  31. package/libs/servo/built/debug/binary.js +8 -8
  32. package/libs/sprite-scaling/built/debug/binary.js +7887 -7857
  33. package/libs/storyboard/built/debug/binary.js +7887 -7857
  34. package/package.json +1 -1
@@ -208,10 +208,10 @@ static void setupSkipList(String r, const char *data, int packed) {
208
208
  auto len = r->skip.size;
209
209
  if (data)
210
210
  memcpy(dst, data, len);
211
- #pragma GCC diagnostic push
212
- #pragma GCC diagnostic ignored "-Wstringop-overflow"
211
+ #pragma GCC diagnostic push
212
+ #pragma GCC diagnostic ignored "-Wstringop-overflow"
213
213
  dst[len] = 0;
214
- #pragma GCC diagnostic pop
214
+ #pragma GCC diagnostic pop
215
215
  const char *ptr = dst;
216
216
  auto skipEntries = PXT_NUM_SKIP_ENTRIES(r);
217
217
  auto lst = packed ? r->skip_pack.list : r->skip.list;
@@ -1775,15 +1775,21 @@ void anyPrint(TValue v) {
1775
1775
  static void dtorDoNothing() {}
1776
1776
 
1777
1777
  #define PRIM_VTABLE(name, objectTp, tp, szexpr) \
1778
- static uint32_t name##_size(tp *p) { return TOWORDS(sizeof(tp) + szexpr); } \
1778
+ static uint32_t name##_size(tp *p) { \
1779
+ return TOWORDS(sizeof(tp) + szexpr); \
1780
+ } \
1779
1781
  DEF_VTABLE(name##_vt, tp, objectTp, (void *)&dtorDoNothing, (void *)&anyPrint, 0, \
1780
1782
  (void *)&name##_size)
1781
1783
 
1782
1784
  #define NOOP ((void)0)
1783
1785
 
1784
1786
  #define STRING_VT(name, fix, scan, gcsize, data, utfsize, length, dataAt) \
1785
- static uint32_t name##_gcsize(BoxedString *p) { return TOWORDS(sizeof(void *) + (gcsize)); } \
1786
- static void name##_gcscan(BoxedString *p) { scan; } \
1787
+ static uint32_t name##_gcsize(BoxedString *p) { \
1788
+ return TOWORDS(sizeof(void *) + (gcsize)); \
1789
+ } \
1790
+ static void name##_gcscan(BoxedString *p) { \
1791
+ scan; \
1792
+ } \
1787
1793
  static const char *name##_data(BoxedString *p) { \
1788
1794
  fix; \
1789
1795
  return data; \
@@ -1944,6 +1950,8 @@ void dumpPerfCounters() {
1944
1950
  for (uint32_t i = 0; i < info->numPerfCounters; ++i) {
1945
1951
  auto c = &perfCounters[i];
1946
1952
  DMESG("%d,%d,%s", c->numstops, c->value, info->perfCounterNames[i]);
1953
+ c->value = 0;
1954
+ c->numstops = 0;
1947
1955
  }
1948
1956
  }
1949
1957
 
@@ -1962,7 +1970,7 @@ void stopPerfCounter(PerfCounters n) {
1962
1970
  auto c = &perfCounters[(uint32_t)n];
1963
1971
  if (!c->start)
1964
1972
  oops(51);
1965
- c->value += PERF_NOW() - c->start;
1973
+ c->value += ((PERF_NOW() - c->start) & PERF_NOW_MASK) / PERF_NOW_SCALE;
1966
1974
  c->start = 0;
1967
1975
  c->numstops++;
1968
1976
  }
@@ -49,6 +49,7 @@ namespace control {
49
49
  private frameWorker: number;
50
50
  private framesInSample: number;
51
51
  private timeInSample: number;
52
+ private lastPerfDump: number;
52
53
  public deltaTimeMillis: number;
53
54
  private prevTimeMillis: number;
54
55
  private idleCallbacks: (() => void)[];
@@ -81,16 +82,19 @@ namespace control {
81
82
  for (let f of this.frameCallbacks) {
82
83
  f.handler()
83
84
  }
84
- let runtime = control.millis() - loopStart
85
+ const now = control.millis()
86
+ let runtime = now - loopStart
85
87
  this.timeInSample += runtime
86
88
  this.framesInSample++
87
89
  if (this.timeInSample > 1000 || this.framesInSample > 30) {
90
+ const realTimeInSample = now - this.lastPerfDump
91
+ this.lastPerfDump = now
88
92
  const fps = this.framesInSample / (this.timeInSample / 1000);
89
93
  EventContext.lastStats = `fps:${Math.round(fps)}`;
90
94
  if (fps < 99)
91
95
  EventContext.lastStats += "." + (Math.round(fps * 10) % 10)
92
- if (control.ramSize() > 2000000 && control.profilingEnabled()) {
93
- control.dmesg(`${(fps * 100) | 0}/100 fps - ${this.framesInSample} frames`)
96
+ if (control.profilingEnabled()) {
97
+ control.dmesg(`${(fps * 100) | 0}/100 fps - ${this.framesInSample} frames (${this.timeInSample}ms/${realTimeInSample}ms)`)
94
98
  control.gc()
95
99
  control.dmesgPerfCounters()
96
100
  }
@@ -1020,6 +1020,14 @@ enum class PerfCounters {
1020
1020
  #error "missing platform timer support"
1021
1021
  #endif
1022
1022
 
1023
+ #ifndef PERF_NOW_MASK
1024
+ #define PERF_NOW_MASK 0xffffffff
1025
+ #endif
1026
+
1027
+ #ifndef PERF_NOW_SCALE
1028
+ #define PERF_NOW_SCALE 1
1029
+ #endif
1030
+
1023
1031
  struct PerfCounter {
1024
1032
  uint32_t value;
1025
1033
  uint32_t numstops;
@@ -56,7 +56,7 @@ const pxsim_pxtrt = pxsim.pxtrt;
56
56
  const pxsim_numops = pxsim.numops;
57
57
 
58
58
 
59
- function _main___P136215(s) {
59
+ function _main___P136319(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___136458 = (undefined);
70
- globals._pollEventQueue___136471 = (undefined);
69
+ globals._intervals___136562 = (undefined);
70
+ globals._pollEventQueue___136575 = (undefined);
71
71
  r0 = undefined;
72
72
  return leave(s, r0)
73
73
  default: oops()
74
74
  } } }
75
- _main___P136215.info = {"start":0,"length":0,"line":0,"column":0,"endLine":0,"endColumn":0,"fileName":"colorbuffer.ts","functionName":"<main>","argumentNames":[]}
76
- _main___P136215.continuations = [ ]
75
+ _main___P136319.info = {"start":0,"length":0,"line":0,"column":0,"endLine":0,"endColumn":0,"fileName":"colorbuffer.ts","functionName":"<main>","argumentNames":[]}
76
+ _main___P136319.continuations = [ ]
77
77
 
78
- function _main___P136215_mk(s) {
78
+ function _main___P136319_mk(s) {
79
79
  checkStack(s.depth);
80
80
  return {
81
- parent: s, fn: _main___P136215, depth: s.depth + 1,
81
+ parent: s, fn: _main___P136319, 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___P136215_mk(s) {
88
88
 
89
89
  const breakpoints = setupDebugger(1, [])
90
90
 
91
- return _main___P136215
91
+ return _main___P136319
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___P95247(s) {
59
+ function _main___P95325(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___95490 = (undefined);
70
- globals._pollEventQueue___95503 = (undefined);
69
+ globals._intervals___95568 = (undefined);
70
+ globals._pollEventQueue___95581 = (undefined);
71
71
  r0 = undefined;
72
72
  return leave(s, r0)
73
73
  default: oops()
74
74
  } } }
75
- _main___P95247.info = {"start":0,"length":0,"line":0,"column":0,"endLine":0,"endColumn":0,"fileName":"tcs34725.ts","functionName":"<main>","argumentNames":[]}
76
- _main___P95247.continuations = [ ]
75
+ _main___P95325.info = {"start":0,"length":0,"line":0,"column":0,"endLine":0,"endColumn":0,"fileName":"tcs34725.ts","functionName":"<main>","argumentNames":[]}
76
+ _main___P95325.continuations = [ ]
77
77
 
78
- function _main___P95247_mk(s) {
78
+ function _main___P95325_mk(s) {
79
79
  checkStack(s.depth);
80
80
  return {
81
- parent: s, fn: _main___P95247, depth: s.depth + 1,
81
+ parent: s, fn: _main___P95325, 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___P95247_mk(s) {
88
88
 
89
89
  const breakpoints = setupDebugger(1, [])
90
90
 
91
- return _main___P95247
91
+ return _main___P95325
92
92
  })