- Install the Visual Studio Code (VS Code) text editor
- Install the PlatformIO VS Code extension
- The provided link has instructions on how install the extension in VS Code
- The PlatformIO project needs to be opened
- Click the PlatformIO logo/extension on the left tool bar
- Under the
QUICK ACCESS > PIO Homesection, selectionProjects & Configuration - At the top, select
Add Existingand select this directory
- To compile, select the PlatformIO logo/extension on the left again if it is not still selected
- Under
esp32dev > GeneralselectBuildand the firmware image will be built - There are additional options for uploading the firmware to the device and monitoring
- Under
Some users prefer not to use VSCode (those who prefer Emacs, Vim, subtext, etc.)
The official documentation
has great guide on how to install the CLI tooling. Here
is PlatformIO's guide on how to use the CLI command pio. The full guide for PlatformIO Core installation is available here.
As the documentation says, you do not have to follow all steps in the CLI guide if you have also installed the VS Code extension, PlatformIO IDE. It will be advised to follow the directions under the documentation for "Install Shell Commands" to be able to run the commands pio and piodebuggdb anywhere in the terminal. For the Makefile
mentioned below, it is required to install the shell commands for the make command to function correctly.
In this directory, there is a makefile. If you have make installed, run make or make build to compile the firmware without requiring a connected device. The available targets are:
build--- compiles the firmware image. This is the default target used bymake.upload--- compiles and uploads the firmware image to a connected device.run--- uploads the firmware image and begins running a monitor, which prints serial output and allows commands to be typed in, just as in the Arduino IDE.monitor--- runs the serial monitor without uploading a new firmware image.
These commands are implemented on the command line as:
make
make build
make upload
make run
make monitor
With PlatformIO, the creation of the LittleFS is a separate step from building the firmware image. However, it only has to be built if
there have been changes to the /data directory and it only has to be uploaded to the device if the the image has changed or the flash
pages containing the file system have been erased.
In the extension side panel, below the General section with the Build and Upload targets, there is another section, Platform. Under
the Platform section, there are the Build Filesystem Image and Upload Filesystem Image. Using the Upload Filesystem Image target will
build and upload the file system if the file system needs building.
The full command is pio run --target uploadfs but the Make target make uploadfs can be used.
Installing/flashing a new firmware image requires the device, Krake, to be set into a state for it to allow a new firmware image. That can be accomplished with the following steps:
- Connect Krake to power and to the computer
- Press and hold the BOOT button.
- While still holding BOOT, press and release the RESET button once.
- Release the BOOT button.
- The chip is now in boot mode. You can run your flasher and the port should respond.
WiFi credentials remain stored until explicitly cleared. Developers can clear saved WiFi credentials from the LCD Developer Mode menu or from the served settings page; the device then restarts into its normal WiFi setup flow.
Every topic/payload pair queued for MQTT publication is also queued independently for transmission from the Krake ESP32 VSPI controller. This keeps the local SPI output available even when WiFi or MQTT is offline. The controller uses a 1 MHz, MSB-first, SPI mode 0 link with SCLK=18, MISO=19, MOSI=23, and chip-select SS=15. Each transfer is one frame:
"KRK1" | retain byte | topic length byte | payload length byte | topic bytes | payload bytes
The built-in LED retains its heartbeat and adds connection indicators: two short winks after WiFi connects and three short winks after MQTT connects.