Skip to content

Latest commit

 

History

History
76 lines (59 loc) · 4.85 KB

README.md

File metadata and controls

76 lines (59 loc) · 4.85 KB

Building

PlatformIO IDE (Visual Studio Code Extension)

  1. Install the Visual Studio Code (VS Code) text editor
  2. Install the PlatformIO VS Code extension
    • The provided link has instructions on how install the extension in VS Code
  3. The PlatformIO project needs to be opened
    • Click the PlatformIO logo/extension on the left tool bar
    • Under the QUICK ACCESS > PIO Home section, selection Projects & Configuration
    • At the top, select Add Existing and select this directory
  4. To compile, select the PlatformIO logo/extension on the left again if it is not still selected
    • Under esp32dev > General select Build and the firmware image will be built
    • There are additional options for uploading the firmware to the device and monitoring

PlatformIO from Command Line

Some users prefer not to use VSCode (those who prefer Emacs, Vim, subtext, etc.)

PlatformIO Core (CLI) Installation

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.

Build

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:

  1. build --- compiles the firmware image. This is the default target used by make.
  2. upload --- compiles and uploads the firmware image to a connected device.
  3. 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.
  4. 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

Building LittleFS Filesystem

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.

PlatformIO IDE (VS Code Extension)

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.

PlatformIO Core (CLI)

The full command is pio run --target uploadfs but the Make target make uploadfs can be used.

Krake Installation

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:

  1. Connect Krake to power and to the computer
  2. Press and hold the BOOT button.
  3. While still holding BOOT, press and release the RESET button once.
  4. Release the BOOT button.
  5. The chip is now in boot mode. You can run your flasher and the port should respond.

Runtime Connectivity and SPI Broker Mirror

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.