Setup of Development Environment
VSCode
- Download and install Visual Studio Code.
- Open the
open-bike-sensor.code-workspace
in the project root. - Install the recommended extensions (this might take a while, because Platform.io gets installed) and restart VSCode when required.
- Linux only: Install
platformio-udev.rules
by following this guide. - Compile the code (Sidebar:
👽 > Build
; Bottom bar:✅
) - 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 tocustom_config.ini
and set theupload_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
- Install PlatformIO Core (CLI).
- Download and open CLion.
- Install the PlatformIO for CLion plugin. Open
Configure > Plugins
in the welcome screen (alternativelyPlugins
in the preferences) and search for “PlatformIO” in theMarketplace
tab. - Restart CLion.
- Open the project folder with
Open or Import
in the welcome screen (alternativelyFile > Open ...
using the menu bar) - A popup “Create CMakeLists.txt?” will appear. Select “yes”.
- Open the CLion preferences and navigate to
Build, Execution, Deployment > CMake
. Delete theDebug
profile and add a new profile. This new profile should automatically have the nameesp32dev
. Apply these changes and close the preferences. - Select the configuration
PlatformIO Build & Upload | esp32dev
in the top bar. - Use the
🔨 Build
button to compile the code. - Connect your ESP and use the
▶ Run
button to compile and upload the code. To upload without re-compiling the code, switch to the configurationPlatformIO 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 tocustom_config.ini
and set theupload_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
andcmake-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
tocustom_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.