Go Down

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


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.
No, you're not and no, it's not...  I'm having the same question since I also have the very same issue. Trust me, we're not the only ones.

To me, it would be normal and logically if the board could be saved with the .ino file of a project since having different boards laying on your table is really not an exception.

I have different Arduino's, ESP8266 and ATTiny85 boards with which I'm working and each and every time I'm hitting the same stone (must be stupidity, I guess): forgot to change the board and bang... building is OK but uploading is, of course, not...

Hope this will change in the future.




Instead of using comments, I think using #pragma might be a better idea. The #pragma's would be picked up by the arduino-build tool and removed from the generated C++ sources. It is also technically backwards compatible since GCC will just ignore the unrecognized #pragmas.

Ideas I have:

Code: [Select]
#pragma arduino board "Arduino/Genuino Uno" // This selects the board in the sketch.
#pragma arduino board "Generic ESP8266" // You do meed to match the board title or identifier exactly though.
#pragma arduino upload programmer // Force uploading with programmer
#pragma arduino upload default // Default upload method.
#pragma arduino define SOME_VARIABLE // Passes -DSOME_VARIABLE to all calls of GCC
#pragma arduino import TFT // Pulls in a library without including its header file. There might be C++ header file collisions in some corner cases, and this alternative syntax can avoid that.
#pragma arduino config board.upload.arguments "-F" // This can even inject board.txt contents.


anyone have any luck with this ?


The #pragma idea is an excellent idea technix.

I try to use Atom PlatformIO when possible but I still use Arduino a lot. In PlatformIO all the settings are in an ini file, it's wonderful when you are working on multi-device setups. I would love to see this in the Arduino IDE as well!


I grepped the interweb for this topic and landed here.

Yes please. #pragma or something to set the board type!

I wonder where the "current settings" are stored; a tacky workaround could be to always launch Arduino.app from a command line script that read the .ino and munged the app prefs file.


Bumping this one - my filename normally includes the Boardtype. That would be a great improvement!


Will ide save the board settings?


FYI, the Arduino Web Editor does already have this feature. The board and port association is saved in a metadata file named sketch.json.

Go Up