pxt-common-packages 10.1.10 → 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 (35) hide show
  1. package/libs/azureiot/built/debug/binary.js +461 -461
  2. package/libs/base/core.cpp +28 -8
  3. package/libs/base/eventcontext.ts +7 -3
  4. package/libs/base/gc.cpp +1 -0
  5. package/libs/base/pxtbase.h +8 -0
  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 +8055 -8025
  9. package/libs/controller---none/built/debug/binary.js +8034 -8004
  10. package/libs/core---nrf52/platform.cpp +6 -0
  11. package/libs/core---nrf52/platform.h +3 -0
  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 +7888 -7858
  16. package/libs/lcd/built/debug/binary.js +8 -8
  17. package/libs/light-spectrum-sensor/built/debug/binary.js +8 -8
  18. package/libs/lora/built/debug/binary.js +8 -8
  19. package/libs/matrix-keypad/built/debug/binary.js +8 -8
  20. package/libs/mqtt/built/debug/binary.js +176 -176
  21. package/libs/net/built/debug/binary.js +176 -176
  22. package/libs/net-game/built/debug/binary.js +9754 -9724
  23. package/libs/palette/built/debug/binary.js +7887 -7857
  24. package/libs/pixel/built/debug/binary.js +8 -8
  25. package/libs/power/built/debug/binary.js +8 -8
  26. package/libs/proximity/built/debug/binary.js +8 -8
  27. package/libs/radio/built/debug/binary.js +8 -8
  28. package/libs/radio-broadcast/built/debug/binary.js +8 -8
  29. package/libs/rotary-encoder/built/debug/binary.js +8 -8
  30. package/libs/screen/built/debug/binary.js +50 -50
  31. package/libs/screen---st7735/panic.cpp +5 -1
  32. package/libs/servo/built/debug/binary.js +8 -8
  33. package/libs/sprite-scaling/built/debug/binary.js +7887 -7857
  34. package/libs/storyboard/built/debug/binary.js +7887 -7857
  35. 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;
@@ -1504,7 +1504,19 @@ int getConfig(int key, int defl) {
1504
1504
  return defl;
1505
1505
  int *cfgData = vmImg->configData;
1506
1506
  #else
1507
- int *cfgData = bytecode ? *(int **)&bytecode[18] : NULL;
1507
+ int *cfgData = NULL;
1508
+ if (bytecode) {
1509
+ cfgData = *(int **)&bytecode[18];
1510
+ } else {
1511
+ // This happens when getConfig() is called before the TypeScript
1512
+ // program starts (exec_binary()). One example is overriding heap size with:
1513
+ // namespace userconfig { export const SYSTEM_HEAP_BYTES = 10000 }
1514
+ unsigned *pc = (unsigned *)functionsAndBytecode;
1515
+ if (*pc++ == 0x4210) {
1516
+ uint16_t *bcode = *((uint16_t **)pc++);
1517
+ cfgData = *(int **)&bcode[18];
1518
+ }
1519
+ }
1508
1520
  #endif
1509
1521
 
1510
1522
  if (cfgData) {
@@ -1763,15 +1775,21 @@ void anyPrint(TValue v) {
1763
1775
  static void dtorDoNothing() {}
1764
1776
 
1765
1777
  #define PRIM_VTABLE(name, objectTp, tp, szexpr) \
1766
- 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
+ } \
1767
1781
  DEF_VTABLE(name##_vt, tp, objectTp, (void *)&dtorDoNothing, (void *)&anyPrint, 0, \
1768
1782
  (void *)&name##_size)
1769
1783
 
1770
1784
  #define NOOP ((void)0)
1771
1785
 
1772
1786
  #define STRING_VT(name, fix, scan, gcsize, data, utfsize, length, dataAt) \
1773
- static uint32_t name##_gcsize(BoxedString *p) { return TOWORDS(sizeof(void *) + (gcsize)); } \
1774
- 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
+ } \
1775
1793
  static const char *name##_data(BoxedString *p) { \
1776
1794
  fix; \
1777
1795
  return data; \
@@ -1932,6 +1950,8 @@ void dumpPerfCounters() {
1932
1950
  for (uint32_t i = 0; i < info->numPerfCounters; ++i) {
1933
1951
  auto c = &perfCounters[i];
1934
1952
  DMESG("%d,%d,%s", c->numstops, c->value, info->perfCounterNames[i]);
1953
+ c->value = 0;
1954
+ c->numstops = 0;
1935
1955
  }
1936
1956
  }
1937
1957
 
@@ -1950,7 +1970,7 @@ void stopPerfCounter(PerfCounters n) {
1950
1970
  auto c = &perfCounters[(uint32_t)n];
1951
1971
  if (!c->start)
1952
1972
  oops(51);
1953
- c->value += PERF_NOW() - c->start;
1973
+ c->value += ((PERF_NOW() - c->start) & PERF_NOW_MASK) / PERF_NOW_SCALE;
1954
1974
  c->start = 0;
1955
1975
  c->numstops++;
1956
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
  }
package/libs/base/gc.cpp CHANGED
@@ -455,6 +455,7 @@ static GCBlock *allocateBlockCore() {
455
455
  auto lowMem = getConfig(CFG_LOW_MEM_SIMULATION_KB, 0);
456
456
  auto sysHeapSize = getConfig(CFG_SYSTEM_HEAP_BYTES, 4 * 1024);
457
457
  auto heapSize = GC_GET_HEAP_SIZE();
458
+ DMESG("heap: %d (minus %d sys bytes)", heapSize, sysHeapSize);
458
459
  sz = heapSize - sysHeapSize;
459
460
  if (lowMem) {
460
461
  auto memIncrement = 32 * 1024;
@@ -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
  })