-
-
Notifications
You must be signed in to change notification settings - Fork 430
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 configuring board for IDE to select by default when sketch is opened #2438
Comments
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as duplicate.
This comment was marked as duplicate.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as duplicate.
This comment was marked as duplicate.
This comment was marked as duplicate.
This comment was marked as duplicate.
This comment was marked as duplicate.
This comment was marked as duplicate.
This comment was marked as off-topic.
This comment was marked as off-topic.
If you need any one to give it a try creating this function, count me in! |
@timkoers A few thoughts:
Things I'm less sure about:
|
This comment was marked as outdated.
This comment was marked as outdated.
@timkoers |
Sure! |
This comment was marked as resolved.
This comment was marked as resolved.
Just a little update, I managed to get it working!
|
Love it! Is it looking for the exact text "Arduino IDE Board Tool details"? If so, may I suggest something simpler and less likely to be incorrectly entered? E.g. "Settings" or "Tools Menu" or even "Arduino Tools Menu Settings". I'm trying to come up with things that are unlikely to be misspelled or typoed. E.g. You can look up and see the word "Arduino" in the ide so that's a good choice. And it is the "Tools Menu" so that's easy to remember. Probably "Arduino Tools Menu" is best. It tells you exactly where it's going to have effect. |
This comment was marked as off-topic.
This comment was marked as off-topic.
@timkoers, have you submitted a pull request for that? Was it rejected? (If so, why?) |
@tschundler I submitted a pull request (arduino/Arduino#7349) that has the feature that we are talking about implemented. I don't think it was rejected, it was not accepted. |
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as outdated.
This comment was marked as outdated.
@per1234 Oh, I'm terribly sorry if my tone came over wrong. I seriously meant no offense to you or anyone else. I guess my frustration with prior interactions with non-contributors is boiling over here and I apologize for that. Since you actually have contributed to the project, I'll take the time to try to explain further: Perhaps the word "interaction" is confusing. Let me clarify: This must go two ways. If you put something in the comments of the source .ino file which /always/ causes a change to settings, that violates least user surprise and breaks the CLI. If you pop up a dialog and /ask/ what the user wants, surprise is mitigated. Popping up a dialog is generally not done in CLI's, at least as far as I've seen. Would you want the CLI to stop mid way and ask the user about which board to target? For the CLI, a separate (optional) settings file, or the port / board association makes perfect sense. Interaction doesn't happen in CLI's except via the command line. The GUI IDE can write a settings file or, more obviously, change the command line options when invoking the compiler. This is a GUI IDE feature only. I guess it could be valuable for the CLI to issue a warning if the comment indicates one board and you're command line settings are compiling for another? But more than that would be problematic. Now, you could argue that the port / board association or a separate settings file makes sense in the GUI, but it has a serious limitation: The user must know about it. As I've indicated above, most beginning users are not aware of the need to select a board. Even if they understand the need to select for the board they own, the .INO that they pasted in often needs a specific board and this is not noted in the sketch which is all they have. An easy way for authors to add that to the file, in the comments so it doesn't break the CLI, and have the GUI IDE point it out to you, is a help. Interactions are typically associated with the GUI. We are specifically asking for a change to the GUI IDE ONLY for /interaction/ with the user. Again: It's like syntax highlighting or autocomplete. It simply works WITH the user /interactively/ to help a new user select the correct board for the project. Interactive. GUI only. Like autocomplete, or syntax highlighting, or copy and paste, or typing in the .INO file. Very simple: The GUI IDE looks at the comments, finds a matching block, sees that the menus don't match and this is the first time this session, so it asks the user if they want the menus updated from the comment. The user can say "Yes" or "No" and that's the end of the interaction. If they said yes, the menus are updated to match the INO. |
@JamesNewton +100000! The only problem with my PR, is that it is outdated. But I am willing to fix that |
Where is sketch.json documented? Quickly search Google found example of it, but no docs. It sounds like maybe a solution for most(?) cases. |
But it doesn't always cause a change. Let's say you do this:
Now the default board for that sketch is the Nano. So if you do this:
it will compile for the Nano. However, if you do this:
then it will compile for the Uno. The only time you wouldn't use the
No need, since the command line settings, if present, override the default settings in sketch.json.
Not if the IDE has a GUI interface that allows them to set the associations. They don't need to know the mechanism behind how that information is stored. This similar to the Arduino IDE's File > Preferences interface. The preferences are stored to the preferences.txt file, but the user doesn't need to know that. They just set their preferences via the GUI. This is similar to how arduino-cli has a
|
IMO the most simple way would be to hardcode-config the targeted board type by configuration in Sketch (e.g. #pragma config board="Nano"
#pragma config board="NODE_MCU 1.0"
#pragma config board="Adafruit Feather ESP32" |
If I may add my 10 cents... As I software developer by day; and Arduino enthusiast by night; may I make a suggestion: The config/ meta data can them be sodred in either a JSON file or YAML file. My understanding is that the Arduino-CLI makes use of a YAML file. Visual Studio creates a .vs folder, where the meta data for the project is stored, similarly JetBrains IDE's creates a .idea folder. This mechanism is also used in text editors like VS Code (.vscode folder). It is a simple yet elegant way of recording the IDE metadata as well as user selected settings. |
Enable the use of some meta-comment in the code so that the appropriate board is automatically selected for that code.
Additional context
Additional requests
Related
protocol
+port
info per sketch profile arduino-cli#2554The text was updated successfully, but these errors were encountered: