pxt-microbit 5.1.30 → 5.1.32

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/editor.js CHANGED
@@ -3355,9 +3355,12 @@ class DAPWrapper {
3355
3355
  this.cortexM = new DapJS.CortexM(this.dap);
3356
3356
  }
3357
3357
  get binName() {
3358
+ return `${this.devVariant}-${pxtc.BINARY_HEX}`;
3359
+ }
3360
+ get devVariant() {
3358
3361
  if (this.usesCODAL === undefined)
3359
3362
  console.warn('try to access codal information before it is computed');
3360
- return (this.usesCODAL ? "mbcodal-" : "mbdal-") + pxtc.BINARY_HEX;
3363
+ return this.usesCODAL ? "mbcodal" : "mbdal";
3361
3364
  }
3362
3365
  unsupportedParts() {
3363
3366
  if (this.usesCODAL === undefined)
@@ -3551,7 +3554,7 @@ class DAPWrapper {
3551
3554
  pxt.tickEvent('hid.flash.full.error.open', { res: res[1] });
3552
3555
  throw new Error(lf("Download failed, please try again"));
3553
3556
  }
3554
- const binFile = resp.outfiles[this.binName];
3557
+ const binFile = this.getBinFile(resp);
3555
3558
  log(`bin file ${this.binName} in ${Object.keys(resp.outfiles).join(', ')}, ${(binFile === null || binFile === void 0 ? void 0 : binFile.length) || -1}b`);
3556
3559
  const hexUint8 = pxt.U.stringToUint8Array(binFile);
3557
3560
  log(`hex ${(hexUint8 === null || hexUint8 === void 0 ? void 0 : hexUint8.byteLength) || -1}b, ~${(hexUint8.byteLength / chunkSize) | 0} chunks of ${chunkSize}b`);
@@ -3620,10 +3623,18 @@ class DAPWrapper {
3620
3623
  return uicr;
3621
3624
  });
3622
3625
  }
3626
+ getBinFile(resp) {
3627
+ var _a;
3628
+ const multiVariantBinFile = resp.outfiles[this.binName];
3629
+ if (multiVariantBinFile)
3630
+ return multiVariantBinFile;
3631
+ const dvBin = ((_a = resp.builtVariants) === null || _a === void 0 ? void 0 : _a.find(el => el === this.devVariant)) && resp.outfiles[pxtc.BINARY_HEX];
3632
+ if (dvBin)
3633
+ return resp.outfiles[pxtc.BINARY_HEX];
3634
+ throw new Error(`unable to find ${this.binName} in outfiles ${Object.keys(resp.outfiles).join(', ')}`);
3635
+ }
3623
3636
  computeFlashChecksum(resp) {
3624
- const binFile = resp.outfiles[this.binName];
3625
- if (!binFile)
3626
- throw new Error(`unable to find ${this.binName} in outfiles ${Object.keys(resp.outfiles).join(', ')}`);
3637
+ const binFile = this.getBinFile(resp);
3627
3638
  return this.getFlashChecksumsAsync()
3628
3639
  .then(checksums => {
3629
3640
  log(`checksums ${pxt.Util.toHex(checksums)}`);