TFT_eSPI Only Display Small Font

I’m using a STM32F405 Adafruit Feather Board and I ran the Free_Font_Demo.ini program from the TFT_eSPI examples. The code appears to run correctly but all the text is the same small font but it should be changing to different fonts.

My platform.ini has this:

[env:adafruit_feather_f405]
platform = ststm32
board = adafruit_feather_f405
framework = arduino
upload_protocol = dfu
lib_deps =
  Wire
  SPI
  TFT_eSPI
  Adafruit BME280 Library
  Adafruit DS3502

build_flags = 
  ;###############################################################
  ; TFT_eSPI library setting here (no need to edit library files):
  ;###############################################################
  -D USER_SETUP_LOADED=1                        ; Set this settings as valid
  -D ILI9341_DRIVER=1                           ; Select ILI9341 driver
  -D TFT_WIDTH=240                              ; Set TFT size
  -D TFT_HEIGHT=320
  -D TFT_MISO=24                                ; Define SPI pins
  -D TFT_MOSI=25
  -D TFT_SCLK=23
  -D TFT_CS=10
  -D TFT_DC=9                                  ; Data/Comand pin
  -D TFT_RST=-1                                 ; Reset pin
  -D LOAD_GLCD=1                                ; Load Fonts
  -D SPI_FREQUENCY=36000000                     ; Set SPI frequency
;   -D USER_SETUP_LOADED=1
;   -include $PROJECT_LIBDEPS_DIR/$PIOENV/TFT_eSPI_ID1559/User_Setups/Setup1_ILI9341.h
;   -D TFT_DC = 9
;   -D TFT_CS = 10

and the beginning of the code starts with this:

#include <Arduino.h>
#include <TFT_eSPI.h>
//#include <Fonts/FreeSerifBold18pt7b.h> // Font for TFT
#include "Free_Fonts.h"

// Use hardware SPI
TFT_eSPI tft = TFT_eSPI();

When I run the Run_User_Setup.ino example code it outputs this:

    TFT_eSPI ver = 2.2.8
    Transactions = Yes
    Font GLCD   loaded
    Font 2      loaded
    Font 4      loaded
    Font 6      loaded
    Font 7      loaded
    Font 8      loaded
    Smooth font enabled

So I believe I have everything configured correctly but it’s not displaying the different fonts

This loads only the GLCD font. You’re still ignoring

…which somehow contradicts the results from the Run_User_Setup.ino

But anyways try adding those -D all in your platformio.ini and retry.

1 Like

Thanks Max, you were right, adding those defines into platformio.ini as -D LOAD_FONT2=1 etc did the trick. Now I can walk away from the Arduino IDE and get back to working in VS Code.

1 Like