jfs49 j'ai modifié mon programme en rajoutant :
int picsize_x = myGLCD.getDisplayXSize();
int picsize_y = myGLCD.getDisplayYSize();
Serial.println("Ecran " + String(picsize_x) +"X"+ String(picsize_y));
que cela soit en mode PORTRAIT OU LANDSCAPE même indications 320x240
pour le reste je ne vois rien de différent
peux-tu regarder mon programme et voir si c'est ok.
merci
// GLCD + tactile + Carte SD
#include <memorysaver.h>
#include <UTFT.h> // Display controleur SSD1289 320x240
#include <URTouch.h> // Display Tactile
#include <URTouchCD.h>
UTFT myGLCD(ILI9341_16, 38, 39, 40, 41); // GLCD Controleur SSD1289 16 bits
URTouch myTouch( 6, 5, 4, 3, 2);
#define TOUCH_ORIENTATION LANDSCAPE
//#define TOUCH_ORIENTATION PORTRAIT
extern uint8_t SmallFont[]; // 8x12 pix
extern uint8_t BigFont[]; // 16x16 pix
extern uint8_t SevenSegNumFont[]; // 32x50 pix
extern uint8_t Retro8x16[];
extern uint8_t UbuntuBold[];
extern uint8_t GroteskBold16x32[];
extern uint8_t GroteskBold24x48[];
int x, y; // pour coordonnées zone Touche
// coordonnées pour pavé page0 TCH PLUS
const int x1P=120; // largeur du pavé
const int y1P=190; // hauteur du pavé
const int x2P=165; // largeur du pavé
const int y2P=235; // hauteur du pavé
// Couleurs prédéfinies en 16 bits
#define BLANC 0xFFFF
#define NOIR 0x0000
#define GRIS 0x8410
#define BLEU 0x001F
#define ROUGE 0xF800
#define JAUNE 0xFFE0
#define VERT 0x0400
#define AQUA 0x07FF
#define SILVER 0xC618
#define LIME 0x07E0
void setup() {
Serial.begin(9600);
randomSeed(analogRead(0));
// Setup the LCD
myGLCD.InitLCD();
myGLCD.setFont(SmallFont);
// Setup the TOUCH
myTouch.InitTouch();
myTouch.setPrecision(PREC_MEDIUM);
myGLCD.clrScr();
int picsize_x = myGLCD.getDisplayXSize();
int picsize_y = myGLCD.getDisplayYSize();
Serial.println("Ecran " + String(picsize_x) +"X"+ String(picsize_y));
drawButtons_Plus();
} // fin du SETUP
void loop() {
myGLCD.setFont(BigFont);
if (myTouch.dataAvailable())
{ myTouch.read();
Serial.println("z");
x=myTouch.getX();
y=myTouch.getY();
// touche PLUS
/* if ((x>=x1P) && (x<=x2P) && (y>=y1P) && (y<=y2P))
{
//Fonction_PLUS_P0();
waitForItP(x1P,y1P,x2P,y2P);
}
*/
Serial.print("x : ");
Serial.println(x);
Serial.print("y : ");
Serial.println(y);
}
}
void drawButtons_Plus() {
myGLCD.setColor(ROUGE); // couleur du pavé
myGLCD.fillRoundRect (x1P, y1P, x2P, y2P);
myGLCD.setColor(BLANC); // couleur pour contour du pavé Blanc
myGLCD.drawRoundRect (x1P, y1P, x2P, y2P);
myGLCD.setFont(GroteskBold16x32);
myGLCD.setBackColor(255,0,0); // couleur de fond du texte (255,0,0)
myGLCD.setColor(BLANC); // couleur du texte
myGLCD.print("+",(x1P+14),(y1P+6));
myGLCD.setBackColor(NOIR); // remettre couleur de fond noir
}
void waitForItP(int x1P,int y1P,int x2P,int y2P)
{
myGLCD.setColor(ROUGE);
myGLCD.drawRoundRect (x1P, y1P, x2P, y2P);
int PLUS_repet = 0;
while (myTouch.dataAvailable()) {
myGLCD.print("S",100,10);
}
myTouch.read();
myGLCD.setColor(BLANC);
myGLCD.drawRoundRect (x1P, y1P, x2P, y2P);
}