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

allow extension use with unrecognized boards #29

Merged
merged 1 commit into from
Dec 30, 2023

Conversation

mdonoughe
Copy link
Contributor

I tried to use this extension with my MagTag but MagTag isn't a recognized board so when I tried to select the serial monitor I got an error from project.ts about board being undefined. I put the vid and pid into settings.json, and then after reloading the window the extension failed to initialize because of board being undefined. This code makes it so if an unknown vid and pid are selected the extension continues to function, but obviously the board.pyi file will not be found.

Board.lookup just makes up a board instead of returning undefined. This makes the various places that call Board.lookup and don't check that they get a board back happy, but because the boards don't know they aren't recognized it's possible places that were expecting only CircuitPython boards will see other serial ports as if they were CircuitPython boards.

About Map and BoardData: JSON.parse never returns Map objects. Typescript doesn't know what JSON.parse is going to return so it allows you to write code that assumes the returned value will contain Maps, and because of the (lack of) runtime type system in Typescript this doesn't cause any problems as long as you don't try to use the returned value as a Map.

@LazaroFilm
Copy link

LazaroFilm commented Nov 17, 2022

I'm still running in this issue.
#15
#103
#96

@joedevivo joedevivo merged commit 3d71061 into joedevivo:master Dec 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants