Link Search Menu Expand Document

Setup of Development Environment

VSCode

  1. Download and install Visual Studio Code.
  2. Open the open-bike-sensor.code-workspace in the project root.
  3. Install the recommended extensions (this might take a while, because Platform.io gets installed) and restart VSCode when required.
  4. Linux only: Install platformio-udev.rules by following this guide.
  5. Compile the code (Sidebar: 👽 > Build; Bottom bar: )
  6. Connect your ESP and upload the code (Sidebar: 👽 > Upload; Bottom bar: ➡️)

Alternatively you can also download the dependencies yourself and install it with the Arduino IDE (see below).

Troubleshooting

  • Can’t upload to device You can specify the device port that VS Code should upload to. Duplicate the custom_config.ini.example file to custom_config.ini and set the upload_port there manually. If this option is not set, the upload port will be autodetected which can fail on some systems or might select the wrong device if other devices are plugged in.

  • Compiling the code fails Use the Clean command and delete the .pio directory. Compiling the code again should work now. If any errors persist, please create a new issue!

CLion

  1. Install PlatformIO Core (CLI).
  2. Download and open CLion.
  3. Install the PlatformIO for CLion plugin. Open Configure > Plugins in the welcome screen (alternatively Plugins in the preferences) and search for “PlatformIO” in the Marketplace tab.
  4. Restart CLion.
  5. Open the project folder withOpen or Import in the welcome screen (alternatively File > Open ... using the menu bar)
  6. A popup “Create CMakeLists.txt?” will appear. Select “yes”.
  7. Open the CLion preferences and navigate to Build, Execution, Deployment > CMake. Delete the Debug profile and add a new profile. This new profile should automatically have the name esp32dev. Apply these changes and close the preferences.
  8. Select the configuration PlatformIO Build & Upload | esp32dev in the top bar.
  9. Use the 🔨 Build button to compile the code.
  10. Connect your ESP and use the ▶ Run button to compile and upload the code. To upload without re-compiling the code, switch to the configuration PlatformIO Only Upload | esp32dev in the top bar.

Troubleshooting

  • Can’t upload to device You can specify the device port that CLion should upload to. Duplicate the custom_config.ini.example file to custom_config.ini and set the upload_port there manually. If this option is not set, the upload port will be autodetected which can fail on some systems or might select the wrong device if other devices are plugged in.

  • Compiling the code fails In the menu bar run/click Tools > PlatformIO > Re-Init and then try to compile the code again. If this didn’t fix it delete the directories .pio and cmake-build-*. Compiling the code again should work now. If any errors persist, please create a new issue!

Arduino IDE

  • Install board
  • Install dependencies
  • Open OpenBikeSensorFirmware.ino in Arduino IDE
  • Connect sensor
  • Compile and upload to ESP32

There are detailed description for Ubuntu and ArchLinux.

Command line

  • Install platformio command line tool for your operating system.
  • Clone the repository.
  • Copy custom_config.ini.example to custom_config.ini and modify it to contain your upload port (only required if autodetection fails, or you want to flash via OTA).
  • Connect the sensor via USB, or put it into server mode for OTA flashing.
  • Run platformio run -t upload. This will compile and upload your firmware.