gap #3736
JFBow
started this conversation in
Compatible displays and setup files
gap
#3736
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hello,
I'm having the following problem with TFT_eSPI: when I draw the same image on the screen in two parts of the program, there's a display offset of 80 pixels along one axis between the two drawings. This 80-pixel area seems inaccessible to the second drawing, whose upper part is off-screen.
This offset occurs for setRotation to 2 or 3, not for values 0 or 1.
The offset occurs when the drawing (a circle with a radius) is called directly in "loop," and then again from "loop," via an object intended for display.
Called twice in "loop," there's no offset.
What should I do?
Thank you for your feedback.
STM32 F411 and 240x240 screen with ST7789.

My code, simplified as much as possible:
.ino :
`#include <TFT_eSPI.h>
TFT_eSPI tft = TFT_eSPI();
#include <Biblio.h>
Biblio biblio = Biblio(tft);
byte orientation = 2;
void setup() {
/* Initialise l'écran LCD */
tft.begin();
tft.setRotation(orientation);
tft.fillScreen(TFT_BLACK);
tft.setFreeFont(&FreeMono9pt7b);
}
void loop() {
// tft.setRotation(i);
tft.fillRect(0, 0, 150, 20, TFT_BLACK);
tft.setCursor(0,15);
tft.setTextColor(TFT_WHITE);
tft.print(" Orientation = ");
tft.println(orientation);
tft.drawSmoothCircle(120, 120, 120, TFT_RED, TFT_BLACK);
tft.drawLine(120, 120, 0, 120, TFT_RED);
delay(1000);
biblio.AffCercle(); // offset circle
// tft.drawSmoothCircle(120, 120, 120, TFT_RED, TFT_BLACK); // no offset
// tft.drawLine(120, 120, 0, 120, TFT_GREEN);
delay(1000);
}`
Biblio.h :
`#ifndef Biblio_h
#define Biblio_h
#include "Arduino.h"
#include <TFT_eSPI.h>
class Biblio
{ public:
Biblio(TFT_eSPI tft);
void AffCercle();
private:
TFT_eSPI _tft;
};
#endif // Biblio`
Biblio.cpp :
`#include "Arduino.h"
#include "Biblio.h"
Biblio::Biblio(TFT_eSPI tft)
{ _tft = tft;
}
void Biblio::AffCercle()
{ _tft.drawSmoothCircle(120, 120, 120, TFT_RED, TFT_BLACK); // Affiche le cercle de la mire
_tft.drawLine(120, 120, 0, 120, TFT_GREEN); // affiche réticule
}
`
Beta Was this translation helpful? Give feedback.
All reactions