microsoft / pxt-microbit

A Blocks / JavaScript code editor for the micro:bit built on Microsoft MakeCode
https://makecode.microbit.org
Other
727 stars 640 forks source link

Hex files with extensions don't load into offline editor #5047

Open jaustin opened 1 year ago

jaustin commented 1 year ago

Describe the bug

When loading hex files that contain (some) extensions, the offline version of MakeCode fails to load the hex file if you are offline. It works when you're online, but my goal in testing this was finding a route for distributing extensions for offline use.

Weird things to note/that make testing harder:

This is important feedback from accessory makers at BETT who want to be able to use the offline version of MakeCode with their extensions/accessories at competitions where internet access is limited.

To Reproduce Steps to reproduce the behavior:

  1. Download the offline editor: makecode.microbit.org/offline
  2. In the ONLINE editor in the browser: create a program with an extension in it. I used Elecfreaks Ringbit Car in the video but It also fails with ble-pxt-hid.
  3. Save this program as a hex file
  4. Turn off internet access
  5. Open the offline app (testing is easier if this is the first time)
  6. Drop the 'extension' hex into the app
  7. It fails to load
  8. Drop a normal/default hex into the app: it succeeds

Expected behavior The script should load as normal

Screenshots

https://user-images.githubusercontent.com/147113/232015206-e9ffccfc-6cca-4e62-987a-de56e1e14133.mp4

Desktop (please complete the following information):

jaustin commented 1 year ago

CC @elecfreaks

abchatra commented 1 year ago

@jaustin Can you share the extension hex file? Is it self-contained? Like not referring to other extension in GitHub?

jaustin commented 1 year ago

I think one of the examples is not self contained, but the other looks like it is... For the pxt-hid one, it looks like only bundled deps (and still fails):

    "dependencies": {
        "core": "*",
        "bluetooth": "*"
    },

For the Ringbit one, less soo

    "dependencies": {
        "core": "*",
        "neopixel": "github:elecfreaks/pxt-neopixel"
    },

(There is a neopixel extension in the source viewer once I do load it... Was there once some code to patch/switch the neopixel drivers after an update?)

Here are the two example hexes that failed to load offline first time. microbit-offline-extensions.hex.zip

microbit-microbit-remote-offlinetest.zip