Problème police de caractère écran TFT

Bonjour,
Je souhaite ajouter une police de caractère sur mon écran TFT.
Elle fonctionne bien mais dès que l'écran se rafraichit, elle disparait .
Avez vous une solution .

#include <Wire.h>
#include <Adafruit_Sensor.h>
#include <Adafruit_BME280.h>
#define SEALEVELPRESSURE_HPA (1013.25)
Adafruit_BME280 bme; // I2C
unsigned long delayTime;

#include <SPI.h>
#include "Adafruit_GFX.h"
#include <Fonts/FreeSerif9pt7b.h>
#include "Adafruit_HX8357.h"

#ifdef ESP32
   #define STMPE_CS 32
   #define TFT_CS   15
   #define TFT_DC   33
   #define SD_CS    14
#endif


#define TFT_RST -1

// Use hardware SPI and the above for CS/DC
Adafruit_HX8357 tft = Adafruit_HX8357(TFT_CS, TFT_DC, TFT_RST);


void setup() {
  Serial.begin(57600);
  
    while(!Serial);    // time to get serial running
    Serial.println(F("BME280 test"));
    unsigned status;
    status = bme.begin();  
     if (!status) {
        Serial.println("Could not find a valid BME280 sensor, check wiring, address, sensor ID!");
        Serial.print("SensorID was: 0x"); Serial.println(bme.sensorID(),16);
        Serial.print("        ID of 0x60 represents a BME 280.\n");
        while (1) delay(10);
    }    
    Serial.println("-- Default Test --");
    delayTime = 1000;
    Serial.println();

  
  Serial.println("HX8357D Test!"); 
  tft.begin();

  // read diagnostics (optional but can help debug problems)
  uint8_t x = tft.readcommand8(HX8357_RDPOWMODE);
  Serial.print("Display Power Mode: 0x"); Serial.println(x, HEX);
  x = tft.readcommand8(HX8357_RDMADCTL);
  Serial.print("MADCTL Mode: 0x"); Serial.println(x, HEX);
  x = tft.readcommand8(HX8357_RDCOLMOD);
  Serial.print("Pixel Format: 0x"); Serial.println(x, HEX);
  x = tft.readcommand8(HX8357_RDDIM);
  Serial.print("Image Format: 0x"); Serial.println(x, HEX);
  x = tft.readcommand8(HX8357_RDDSDR);
  Serial.print("Self Diagnostic: 0x"); Serial.println(x, HEX); 
  
  Serial.println(F("Benchmark                Time (microseconds)"));

  Serial.println(F("Done!"));
}


void loop(void) {

   Serial.print("Temperature = ");
   Serial.print(bme.readTemperature());
   Serial.println(" °C");

  tft.setRotation(1);
  tft.fillScreen(HX8357_WHITE);
  
  tft.setCursor(0,25);
  tft.setTextColor(HX8357_BLUE);
  tft.setFont(&FreeSerif9pt7b);
  tft.println("Temperature :");
  tft.setCursor(0, 50);
  tft.setTextColor(HX8357_BLUE);
  tft.setTextSize(3);
  tft.println(bme.readTemperature());
  
  tft.setCursor(300, 175);
  tft.setTextColor(HX8357_GREEN);
  tft.setFont(&FreeSerif9pt7b);
  tft.println("Humidite :");
  tft.setCursor(300, 200);
  tft.setTextColor(HX8357_GREEN);
  tft.setTextSize(3);
  tft.println(bme.readHumidity());

  delay(5000);
  


}

Que veux-tu dire par "elle disparaît" ?

En fait , la police fonctionne, mais dès que l'écran s'actualise la police disparait et celle de base revient

Ce serait intéressant de vérifier l'utilisation mémoire de ton application. Tu spécifies avant chaque écriture la police utilisée. Il n'y a aucune raison, il me semble, pour avoir un tel comportement.

J'ai mis mon programme en entier au dessus

Quel carte Arduino utilises tu ? Un ESP32 ?

oui

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.