Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Beta: iOS micro:bit app refuses to pair with hex from Beta #5913

Open
martinwork opened this issue Sep 5, 2024 · 10 comments
Open

Beta: iOS micro:bit app refuses to pair with hex from Beta #5913

martinwork opened this issue Sep 5, 2024 · 10 comments

Comments

@martinwork
Copy link
Contributor

Hex files from beta contain version information that the iOS micro:bit app interprets as too old to work. I expect this is a CODAL issue - mentioning here for visibility. I will investigate further.

@microbit-carlos
Copy link
Collaborator

Thanks for opening the ticket Martin! I didn't realised this was in CODAL, I'll look into this right away.

@abchatra something we need to discuss for the release.

@microbit-matt-hillsdon
Copy link
Contributor

Heads up: I don't normally look at the iOS code so this could be wrong!

You can access the beta editor by long pressing the back button inside MakeCode in iOS and enabling the toggle.

Best guess is that it’s reading this: NSString *strVersion = [ self jsonTextForKey: irmAT"eVER" inDict: dictHeader];

https://github.com/microbit-foundation/microbit-ios/blob/4c65a90f21699fa4c76a5e6e62e7e690f35a9041/Source/irmHexToBin.m#L1136C55-L1136C59

That seems to be the eVER field in the LZMA’d metadata which uses this value:

pxt.appTarget.versions ? pxt.appTarget.versions.target : "",

I'm not sure what type of version number that is (perhaps CODAL?).

If you test live hex on device -> flash using iOS app with beta your get an “Update” / “Send” / “Cancel” dialog. Send still works. Update appears to do nothing (back to MakeCode).

If you test beta hex on device -> flash using iOS app with beta you also get an error but no dialog just an option to view Details that shows “Failed - old software”.

@microbit-matt-hillsdon
Copy link
Contributor

Not convinced its that version any more - lots of versions are checked before showing the UI that reads that version again. Will leave to @martinwork and @carlosperate (who I think suspects CODAL version).

@martinwork
Copy link
Contributor Author

Thanks @microbit-matt-hillsdon @microbit-carlos It refuses to pair with a recently built C++ program too.

@microbit-carlos
Copy link
Collaborator

microbit-carlos commented Sep 5, 2024

@martinwork I can confirm that this is caused by the latest CODAL populating the CODAL_VERSION/DEVICE_DAL_VERSION macro with the tag version (in this case "0.2.67") instead of the old "unkonwn".

Tested this by using MakeCode beta with the iOS app and setting the CODAL_VERSION macro in the pxt.json file (although sometimes I needed to exit the editor and reopen the project to be able to get MakeCode to recompile using the cloud compiler). And this does work with beta:

{
    "yotta": {
        "config": {
            "CODAL_VERSION": "\"unknown\""
        }
    }
}

If I set CODAL_VERSION to "2.0.0" it does seem to work as well, although in some/most cases (unsure the frequency), it says that the MakeCode version is old. It does offer the option to "update", "send", or "cancel", and using "send" works.

If I set it to "1.0.0", and the micro:bit is running a hex from live (version "unknown"), then it also shows the "old MakeCode" error, but can click "send", and it flashes.

But once the board has a hex with CODAL_VERSION set to "1.0.0" (via WebUSB flashing or BLE flashing), then I cannot flash anymore a project with CODAL_VERSION set to "1.0.0" or "2.0.0" (or a hex built-in the app) . I get a "Failed - old software" "Old firmware" error.

Is it possible the app is checking the "firmware version" to determine if it's compatible with the micro:bit board connected?

@martinwork
Copy link
Contributor Author

Yes the checks in the app are for V1. V2 always passed by default because it's version was "unknown", but now fails because the V2 DAL version is earlier than any V1 DAL version. The thresholds are... reject versions <1.4.16 and ask about sending a version < 2.1.0 unless the target is a V1.3. The app needs to be updated to cope with the change, which might take a few days.

@microbit-carlos
Copy link
Collaborator

microbit-carlos commented Sep 5, 2024

Thanks Martin!
I'll update CODAL to revert back CODAL_VERSION to "unknown" as it will affect all iOS app users.

We should consider this a blocking issue, so I'll reopen this until I have sent a PR with the tag, and be able to test the latest beta with the iOS app.

@abchatra once a new CODAL tag is released and merged into MakeCode, will somebody from the MakeCode team be able to test flashing with the the iOS app + MakeCode beta before releasing to live?
(the back button in the MakeCode editor webview can be long-pressed to show a menu where beta can be selected).

Any previous testing with the app should have triggered this issue, so it'd be good if you could also check if you can replicate the problem as it currently stands, to be able to confidently test that it's been fixed.

microbit-carlos added a commit to lancaster-university/codal-microbit-v2 that referenced this issue Sep 5, 2024
This is to workaround an issue in the iOS app as described in:
microsoft/pxt-microbit#5913
microbit-carlos added a commit to lancaster-university/codal-microbit-v2 that referenced this issue Sep 5, 2024
This is to workaround an issue in the iOS app as described in:
microsoft/pxt-microbit#5913
@microbit-carlos
Copy link
Collaborator

@abchatra I've created the PR:

@martinwork
Copy link
Contributor Author

@microbit-carlos The app seems OK with MakeCode 7.0.38.

@microbit-carlos
Copy link
Collaborator

Thanks Martin!
I've also tested the Android app with a combination of old hex files, Makecode v6.0.28 and v7.0.38 and all works.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants