pxt-microbit 4.1.49 → 4.1.50

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/sim.d.ts CHANGED
@@ -571,6 +571,7 @@ declare namespace pxsim {
571
571
  readSerial(): string;
572
572
  serialOutBuffer: string;
573
573
  writeSerial(s: string): void;
574
+ writeCsv(s: string, type: "headers" | "row"): void;
574
575
  }
575
576
  }
576
577
  declare namespace pxsim.serial {
package/built/sim.js CHANGED
@@ -1220,7 +1220,7 @@ var pxsim;
1220
1220
  }
1221
1221
  b.ensureHardwareVersion(2);
1222
1222
  }
1223
- function commitRow(data) {
1223
+ function commitRow(data, type) {
1224
1224
  if (!pxsim.runtime)
1225
1225
  return;
1226
1226
  data += "\n";
@@ -1233,6 +1233,9 @@ var pxsim;
1233
1233
  if (mirrorToSerial) {
1234
1234
  pxsim.board().serialState.writeSerial(data);
1235
1235
  }
1236
+ if (type !== "plaintext") {
1237
+ pxsim.board().serialState.writeCsv(data, type);
1238
+ }
1236
1239
  }
1237
1240
  function beginRow() {
1238
1241
  init();
@@ -1302,11 +1305,11 @@ var pxsim;
1302
1305
  currentRow.length = headers.length;
1303
1306
  const line = currentRow.join(SEPARATOR);
1304
1307
  if (headers.length !== committedCols) {
1305
- commitRow(headers.join(SEPARATOR));
1308
+ commitRow(headers.join(SEPARATOR), "headers");
1306
1309
  committedCols = headers.length;
1307
1310
  }
1308
1311
  currentRow = undefined;
1309
- commitRow(line);
1312
+ commitRow(line, "row");
1310
1313
  return 0 /* DEVICE_OK */;
1311
1314
  }
1312
1315
  flashlog.endRow = endRow;
@@ -1314,7 +1317,7 @@ var pxsim;
1314
1317
  init();
1315
1318
  if (!s)
1316
1319
  return;
1317
- commitRow(s);
1320
+ commitRow(s, "plaintext");
1318
1321
  }
1319
1322
  flashlog.logString = logString;
1320
1323
  function clear(fullErase) {
@@ -2305,6 +2308,15 @@ var pxsim;
2305
2308
  this.serialOutBuffer = '';
2306
2309
  }
2307
2310
  }
2311
+ writeCsv(s, type) {
2312
+ pxsim.Runtime.postMessage({
2313
+ type: 'serial',
2314
+ data: s,
2315
+ id: pxsim.runtime.id,
2316
+ csvType: type,
2317
+ sim: true
2318
+ });
2319
+ }
2308
2320
  }
2309
2321
  pxsim.SerialState = SerialState;
2310
2322
  })(pxsim || (pxsim = {}));