Skip to content

Development

Dennis Boldt edited this page May 24, 2020 · 9 revisions

Development

Create a new configuration

  • config.h
    • Add config variable to Config-Struct
  • config.ino
    • Add new variable to loadConfiguration
    • Add new variable to saveConfiguration
    • Add new variable to printConfiguration
  • configServer.h
    • Add new variable to HTML template
  • configServer.ino
    • Add new variable to the corresponding handler function, to visualize it
    • Add new variable to the corresponding handler function, to save it
  • Use the new config variable in the code

Text-grid

To avoid pixel-based adressing, a simple grid was introduced:

---------------------------------
| (0,0) | (1,0) | (2,0) | (3,0) |
---------------------------------
| (0,1) | (1,1) | (2,1) | (3,1) |
---------------------------------
| (0,2) | (1,2) | (2,2) | (3,2) |
---------------------------------
| (0,3) | (1,3) | (2,3) | (3,3) |
---------------------------------
| (0,4) | (1,4) | (2,4) | (3,4) |
---------------------------------
| (0,5) | (1,5) | (2,5) | (3,5) |
---------------------------------
  • A text is only updated, when it changes, thus
    • calling the function with the same text again and again does not update the display!
    • calling the function with a new text, the privious text is written in BLACK at the same position, thus the text is erased. Afterwards, the new text is written in white. Finally the diplay is updated.
  • There are two functions on the Display class:
    • showTextOnGrid(int16_t x, int16_t y, String text)
      • Puts a text on (x,y) in font size 10
    • showTextOnGrid(int16_t x, int16_t y, String text, const uint8_t* font)
      • A Specific font can be used, e.g. 20 pixel: display->showTextOnGrid(0, 0, "Hello World", Dialog_plain_20)

Install esptool

git clone git@github.com:espressif/esptool.git
cd esptool/

Detect maximum flash size with esptool (Ubuntu)

./esptool.py --port /dev/ttyUSB0 flash_id | grep "flash size"

Detected flash size: 4MB

The ESP32 has 4MB flash memory!

Flash binary with esptool (Ubuntu)

  • Install esptool:
  • Download the newest release.
  • Connect a microUSB cable directly to the ESP32 (the USB-C port at the case is only for charging the battery)
  • Detect the correct port:
    ls /dev/ttyUSB*
  • Run the flash command:
    ./esptool.py \
      --chip esp32 \
      --port /dev/ttyUSB0 \
      --baud 921600 \
      --before default_reset \
      --after hard_reset write_flash \
      0x10000 ~/Download/OpenBikeSensorFirmware.ino.esp32.bin

Hint:

At a 0x10000 (64KB) offset in the flash is the app labelled “factory”. The bootloader will run this app by default.

See: https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-guides/partition-tables.html

Clone this wiki locally