Skip to content

Toolchain Setup

Note: The following section is intended for advanced users who intend to dabble with the source code directly.

Toolchain Setup (Advanced)

ExpressLRS is written in C++ using the Arduino framework.

  • Rather than using the Arduino IDE (which let's face it, πŸ—Ώ is pretty clunky), we use platformio
  • To ease the use of pio we recommend to use the according extension for Visual Studio Code

PlatformIO

  1. πŸ”½ Download a copy of vscode for your computer
  2. πŸ“‚ Open vscode, and click on the "Extensions" icon in the toolbar on the right (see Managing Extensions πŸ“˜)
  3. πŸ”Ž In the search box, enter platformio, and install the extension (see the pio install documentation πŸ“š)

Git Setup

We recommend using VSCode's built-in Git client, as it requires the least 3rd party software πŸ€–.

  1. πŸ”½ Download a copy of git (this is also needed for PlatformIO)
  2. Install git, click yes to the default options (there are a LOT πŸ’―)
  3. IMPORTANT! Make sure you select this option during install, it adds git to PATH which is necessary for VScode cloning (the next step).

Cloning the Repo

  • In VSCode open the command pallete (using Cmd+Shift+P on MacOS or Ctrl+Shift+P on Windows)
  • Enter Git: Clone

  • Click that! πŸ‘ˆ
  • Then, enter ExpressLRS Repo URL -> https://github.com/AlessandroAU/ExpressLRS.git πŸ’»
  • Choose a folder for ExpressLRS. πŸ“‚

Selecting the Latest Release

Before we can do any building, you need to select a release build of ELRS. For example, release 0.1.0-RC1. In Visual Studio Code select that tag. The location of the selector is shown below. πŸ–±οΈ

Click the selector, and then type in the name of the tag, in this case 0.1.0-RC1.

PlatformIO Building

Once you had the time of your life setting up your toolchain 🧰 you are ready to Flash ⚑ ExpressLRS to supported hardware.

Building Targets using PlatformIO

  1. πŸ“‚ When you first launch Visual Studio Code, you should see the PlatformIO Home Page in a tab. Click the Open Project button. Navigate to the ExpressLRS repo directory. Navigate into the src folder (i.e. ./ExpressLRS/src/). Finally, press the Open button.
  2. ✏️ Edit the file ./src/user_defines.txt to define user specific variabls. 😈 Please make sure you did edit the file according to your needs!
  3. πŸ“Š In the toolbar on the left, click the PlatformIO icon, which will show the list of tasks. Now, select Project Tasks, expand your desired target and select Build/Upload (depending on the method). You should see the result in the terminal.
  4. πŸ™ƒ If something went wrong - please check the Terminal, too. It will contain at least a hint on what the issue is. Please ask the community for further helpπŸ§‘β€πŸ”§!

Updating your Local Repo

You've cloned the repository and are now wondering how to get new updates down the line? Then this document is meant for you! Here's a primer on how to keep your local copy of the repository up-to-date.

Method 1: The Clean Way - Fetch & Reset

Probably the easiest and least troublesome method, however, it'll overwrite any changes you've made to your local copy. ⚠

  1. Open the terminal

    You can either straight up open bash/cmd and navigate to your project folder or open an integrated terminal in VSCode:

    • Open the command pallete (using Cmd+Shift+P on MacOS or Ctrl+Shift+P on Windows)
    • Enter: Create New Integrated Terminal

      Terminal

  2. In the terminal, type: git fetch -pu && git reset --hard origin/master

    This will get you the latest version and destroy any local changes you've made.

Method 2: The lazy way - Commit, Pull & Merge

The advantage this method has over the first method is that all your changes to the user_defines.txt (or any other file, for that matter) will get merged together with any new updates. There's a possibility that, if changes are too big, you could end up with a merge conflict. If that doesn't appeal to you, stick to the first method.

  1. Commit your changes to your local repository

    • In VSCode open the command pallete (using Cmd+Shift+P on MacOS or Ctrl+Shift+P on Windows)
    • Enter: Git: Commit

      VSCode will tell you that there are unstaged changes and ask if you want to add them to the commit. Confirm this! This will just commit your changes to the user_defines.txt to your local repository. No worries, you're not overwriting anything on github! :octocat:

  2. Open the terminal, how-to is detailed in method 1

  3. In the terminal, type: git pull -f

    This will pull a new revision of the remote repository to your own local repository and automatically merge it with your own changes.