PlatformIO build instructions using GUI

If anyone has an inkling to build the firmware with PlatformIO, I have made some basic instructions here that does’t use command line.

I had a raft of issues getting it to build the first time so I would be interested if others could provide some feedback on the process before I submit to the main repo.

5 Likes

looks good to me! cool beans.

1 Like

That’s the right way, thanks Dafe man!

Sometimes PIO doesn’t detect the device on the USB port and then on a retry it just does it okay.

1 Like

Some observations from a first time Windows 10 user of Visual Studio and Platformio.

  1. You should install Python and reboot before trying to install the Platformio extension.
  2. I also needed to install Git and close Visual Studio and reopen it to be successful.
  3. To get a clean build I have had to delete the auto-generated file ./.vscode/c_cpp_properties.json, close and re-open Visual Studio and WAIT until the file is auto-generated before compiling again.

Now I just need to wait for the hardware to arrive…

I also need to find where the version number is stored in the code so that I can confirm that I am using the latest code. I believe that the current version is stored in ./bin/version.sh

My biggest advice is to be patient and wait on platformio to finish what it is doing. I find that it takes 30 seconds for things to finish loading while it does not always tell you that it is still working on something.

2 Likes

How is the country/frequencies set from a GUI compile?

I got my t-beam 1.1 yesterday and flashed both today using platform.io following the short write-up. I could add a few things like “wait for a few minutes for the build” which seems like a long time considering I’m using a beefy Mac. I guess I’m used to interpreted languages these days - instant gratification!

I have to say the platform.io integration to Visual Studio is really slick and being able to upload and monitor the logs (even though I don’t know anything about arduino) is very nice!

Instructions worked like a charm. Thanks!

1 Like

Great notes, I now remember those headaches I had! Clearing the .JSON file you found could be handy for some. Are you able to update the Github or would you mind if I did?

./bin/version.sh is the only version reference I was able to find as well.

Feel free to incorporate any of my comments to the github page as you see fit.

1 Like

I believe you should be able to place a #define HW_VERSION_US within the file configuration.h

or HW_VERSION_EU433, HW_VERSION_EU865, HW_VERSION_CN, HW_VERSION_JP

@geeksville does this suffice?

@sgreszcz did you also have to install Git and Python/have them installed already?

Hmm, I have them installed due to work development activities with both Python and Git. The only thing I installed was platform.io then VScode (as I normally use Jetbrains’ Pycharm).

In this case it wasn’t a completely clean install.

1 Like

@geeksville it seems that we should be able to select in the platformio.ini file the:

  • Hardware type
  • Country
  • Frequency
  • Display type
  • Meshtastic function (client, repeater, etc)

If that is possible point me to the correct format and I will attempt to make the platformio.ini file a little more descriptive and update the file on github.

@lux sure thing, they currently come from environment variables, but if you want to change them in the file you can change them on these lines:

A pull-request to improve the internal documentation in this file would be great,

Frequency currently comes from country and I’m not sure it really needs to be different, but if you want something nonstandard you can change MeshRadio.h

I’ll take a stab at it and ask for comment before making the pull-request

2 Likes

Any progress on documenting how to set the region in platformIO? I wasn’t able to figure this out… :slight_smile:

You set them with environment variables. For instance (on linux or OS-X, I’m not sure of the windows syntax):

export COUNTRY=CN (or EU865 or whatever)

Then in that same shell run platform io and do a build. That’s why platformio.ini looks like this on line 36:

-DHW_VERSION_${sysenv.COUNTRY}

It is using a special “sysenv” function to ask for the COUNTRY environment variable and then passing that into the C compiler as -DHW_VERSION_CN (or whatever)

Does that help?

Aha. That helped. Windows system environment parameters can be changed as described below (in case anyone else has problems):

Is it not possible to chuck a #define HW_VERSION_XXX into configuration.h?

That would also be fine.