To be honest I’m not sure how to word this question, but here is my problem:
We have a git repo where we work on an Arduino project. Because I usually work with multiple Arduino boards attached, I specify upload_port to be /dev/ttyACM0 in platformio.ini. However, my friends uses Windows, and in Windows there is no /dev/tty*, but COM* ports, and if I do git commit, their setup stops working. I cannot just add platformio.ini to .gitignore because then I cannot update other configs such as libraries, so is there a way that I can set this config in a way that it won’t get pushed to the repo?
Hmmm, why not create two build environments in platformio.ini
, one for Windows and one for Linux, differing in upload_port
setting?
You can even put common settings into common [env]
section, see Redirecting...
1 Like
There’s two ‘easy’ options I can see…
-
Use the global/common env as azarubkin mentioned. In other words, do all the stuff that doesn’t change in [env]
, and then have two named envs e.g. [env:WindowsDev]
and [env:LinuxDev]
(creative names, I know!) which then only specify the upload_port
.
-
If you have a more complete platformio, you might want to look at the extends
option - i.e. because you have multiple platforms, build flags, etc.
I suppose it might also be possible to craft an extra_script that looks for some environment variable or secondary configuration file hosted locally to force change the upload_port on the fly?