Go Down

Topic: Board Settings in *.ino file (Read 5799 times) previous topic - next topic

OldSteve

I often change boards in the IDE between UNO and ATtiny85, but when loading an existing file, the board and related settings always reflect what I had loaded previously, rather than the actual board settings for that file.

It would be wonderful if the board settings for a project could be saved in the *.ino file, and loaded automatically when the file is opened.

As things are currently, I'll write a sketch for the ATtiny85, save it then write one for the UNO and save it. When I re-open the ATtiny85 *.ino file, it defaults back to the UNO and I'm constantly forgetting to set the board and oscillator settings back to the ATtiny85 to suit the current project.
I plan on buying a Mega or two shortly, which will make it even more of a problem, (minor as it is).

Would this be a hard thing to incorporate into the *.ino file?
Please do not PM me for help. I am not a personal consultant.
And others will benefit as well if you post your question publicly on the forums.

OldSteve

Well, it's pretty clear by the degree of support that I'm the only one who thinks this would be a good feature to incorporate into the IDE, so it's probably best to just forget that I posted this suggestion.

I did it again this morning, and tried to 'upload using programmer' to an ATtiny85, wondered why it wouldn't upload, then realised that when I selected ATtiny, the board setting had defaulted back to the ATtiny45 because I'd uploaded to a UNO just beforehand.

I'll learn to live with it. :)
Please do not PM me for help. I am not a personal consultant.
And others will benefit as well if you post your question publicly on the forums.

davew

#2
Oct 31, 2015, 06:05 am Last Edit: Oct 31, 2015, 06:07 am by davew
I have similar problems. My workaround at the moment is to add a comment at the start of the .ino.

I use ESP8266, Uno, Etherten, Maple and others, so have started putting things like:

/*
 * #! Board is generic ESP
 * DW, 20151031
 */

(the '#!' is based on Linux shell scripts using '#! /bin/bash')

I posted to this Suggestions topic and have had no response either.


Dave

OldSteve

I have similar problems. My workaround at the moment is to add a comment at the start of the .ino.
I use ESP8266, Uno, Etherten, Maple and others, so have started putting things like:
/*
 * #! Board is generic ESP
 * DW, 20151031
 */
(the '#!' is based on Linux shell scripts using '#! /bin/bash')
I posted to this Suggestions topic and have had no response either.
Dave
Yeah, I saw your thread Dave. Like with this thread, it's a good way to test the water. Since no one except you responded to this thread, it's confirmation to me that the board information shouldn't be added to the *.ino file, if no one else wants it. I'm happy enough to live with the problem.

Already, with the ATtiny85, I'm getting used to carefully checking that ATtiny85 is selected, along with the 8MHz internal oscillator that I like to use, so it's not tripping me up as much. At the moment, I'm writing two 'sketches' that communicate serially with each other - one for the UNO and one for the ATtiny85, so am swapping between the two very regularly. It would be good if the correct board/chip and settings were automatically loaded when each respective sketch was opened.


Please do not PM me for help. I am not a personal consultant.
And others will benefit as well if you post your question publicly on the forums.

dmjlambert

I remember this topic from before:
https://github.com/arduino/Arduino/issues/3228
And here is another approach, a little different:
https://github.com/arduino/Arduino/issues/1482
I suspect coding something like that would be difficult.   If it is easy, somebody could take this one step further by actually coding the changes and submitting a pull request in github and that may get incorporated faster than a suggestion.   

OldSteve

I remember this topic from before:
https://github.com/arduino/Arduino/issues/3228
And here is another approach, a little different:
https://github.com/arduino/Arduino/issues/1482
Right. Thanks for those links. So I'm not so alone after all. :D


Quote
I suspect coding something like that would be difficult.   If it is easy, somebody could take this one step further by actually coding the changes and submitting a pull request in github and that may get incorporated faster than a suggestion.
It definitely wouldn't be easy. I guess it would mean having an 'invisible' section of the *.ino file format, that couldn't be seen by the user, to hold the board/chip info. It would certainly mean a major change to the file format, but it would still be nice. :)

And I'm not capable of doing it, since it would also mean changes to the IDE to support it.

If we have more than one sketch open, we have them in different instances of the IDE window, so that shouldn't be a drama. Each instance could save it's menu settings to the currently open *.ino file.
Please do not PM me for help. I am not a personal consultant.
And others will benefit as well if you post your question publicly on the forums.

Delta_G

Yet another reason I've for the most part abandoned the Arduino IDE and write code in Eclipse with the Arduino plugin where the board selection is part of the project settings. 

Even the com port is part of the project settings, so when I have two codes on two UNOs I can load to one, unplug it, and load to the other without having to remember to go change the com port. 
|| | ||| | || | ||  ~Woodstock

Please do not PM with technical questions or comments.  Keep Arduino stuff out on the boards where it belongs.

OldSteve

Even the com port is part of the project settings, so when I have two codes on two UNOs I can load to one, unplug it, and load to the other without having to remember to go change the com port. 
I'd forgotten to mention the port selection aspect of this. It's the other thing I keep forgetting to do, and am reminded when I try to upload.
These are only minor annoyances when juggling multiple projects, but it would be nice if the board, port and any other settings were loaded with each project, or configurable default settings for new projects like with the MPLAB IDE for PIC chips.
Please do not PM me for help. I am not a personal consultant.
And others will benefit as well if you post your question publicly on the forums.

westfw

Quote
it would be nice if the board, port and any other settings were loaded with each project
For the record: I disagree, and think that it is an important feature of Arduino that the same sketch can easily be run on different boards with different CPUs/etc.  I *often* want a sketch to run on the board I currently have plugged in, and NOT the last board I compiled it for.

One of my major annoyances with "Atmel Studio" is that a "project" is so tightly bound to a particular cpu and board. (eg Optiboot compiles easily for nearly a dozen different CPUs via its makefile with little end-user knowledge required.  But it would take a dozen different AS projects to set up the same ease-of-use for AS users.)

OldSteve

For the record: I disagree, and think that it is an important feature of Arduino that the same sketch can easily be run on different boards with different CPUs/etc.  I *often* want a sketch to run on the board I currently have plugged in, and NOT the last board I compiled it for.
Yes, but in that case the settings could be changed. The point is that usually, a sketch will be compiled for the same board each time.
Please do not PM me for help. I am not a personal consultant.
And others will benefit as well if you post your question publicly on the forums.

vcor

Would love this feature too.  Seems like a checkbox option on the Boards Manager dialog "Force selected board within project" could easily be added to lock a board to a project. I deal with a number of custom boards and it always a headache to see lots of errors and then realize the board is set wrong. Some projects will never work on any standard board.

pgScorpio

You can solve this problem by using a batchfile to open .ino files using the IDE commandline options you can store the preferences.txt in the sketch folder, so ALL settings are per-sketch.
If you don't like bugs avoid software....

OldSteve

You can solve this problem by using a batchfile to open .ino files using the IDE commandline options you can store the preferences.txt in the sketch folder, so ALL settings are per-sketch.
Not everyone is familiar with creating batch files and writing the IDE command line options.
Nor should it be necessary to mess around that much to open *.ino files. Much better if it was incorporated into the IDE to begin with, don't you think?

Perhaps we should do away with the IDE altogether and just use a text editor to edit and command line options/batch files for everything else, including uploading with avrdude?

The idea of Arduino is to make things easier for beginners, not harder.
Please do not PM me for help. I am not a personal consultant.
And others will benefit as well if you post your question publicly on the forums.

Coding Badly


Syntax?

The problem with something simple...
// BOARD = Arduino Uno
...is that the developer may inadvertently create an action when they really meant to just document.

Would "extending" the Doxygen syntax be a good idea?  Does anyone use Doxygen to document their projects?

If the ino includes any settings, should those settings track the actual IDE settings?  If I change the board is the sketch automatically updated?

Should the syntax include a tracking option?


OldSteve

Syntax?

The problem with something simple...
// BOARD = Arduino Uno
...is that the developer may inadvertently create an action when they really meant to just document.
True. I was sort of thinking of hidden directives in the *.ino file, or perhaps even board settings on a per sketch basis stored in or related to the recent sketches list. (I hadn't thought it out too in-depth.)

My Arduino simulator uses comments though, for simulator directives, and it works pretty well.


Quote
Would "extending" the Doxygen syntax be a good idea?  Does anyone use Doxygen to document their projects?
I don't think that many people use Doxygen, especially not newcomers to Arduino.


Quote
If the ino includes any settings, should those settings track the actual IDE settings?  If I change the board is the sketch automatically updated?
Yes, definitely. Although it was the title of this thread, it wouldn't necessarily need to be stored in the *.ino file, it just struck me that would be the most convenient.


Quote
Should the syntax include a tracking option?
Maybe, although that's not absolutely necessary, and might over-complicate things.

As you can tell, I didn't put a real lot of thought into this, but just felt it would be a nice feature, regardless of exactly how it was implemented. :)
Please do not PM me for help. I am not a personal consultant.
And others will benefit as well if you post your question publicly on the forums.

Go Up