Ok !! this seems to work : i have done a mapping and found coefficient to convert pixel to touch screen coordonate. But now i have a strange problem i can't understand. In the loop i setted up the HOME touch screen button. This Button will be use to change dispaly to the main menu (from parameters menu). When i click it the SErial communicate "we made it" meaning we passed the condition to close the parameter menu. Then it should do a clear screen and set the back all in black to clear the old menu but nothing happened. I set up a Serial.print after clear screen and myGLCD.fillRect and surprise.... Serial tell me Dafuq each 2000ms as he is supposed to do, but nothing change on the screen. Here is the loop and void code. :
void temps_parametres(){
startup();
int a=1;
myGLCD.print("Leve Soleil : ",20,30);
myGLCD.print(":", 155,30);
myGLCD.print("Couche Soleil : ",20,80);
myGLCD.print(":", 155,80);
myGLCD.print("Leve Lune : ",20,130);
myGLCD.print(":",155,130);
myGLCD.print("Couche Lune : ", 20,180);
myGLCD.print(":", 155,180);
myGLCD.printNumI(lsh,140,30, 2, '0');
myGLCD.printNumI(lsm,170,30, 2, '0');
myGLCD.printNumI(csh,140,80, 2, '0');
myGLCD.printNumI(csm,170,80, 2, '0');
myGLCD.printNumI(llh,140,130, 2, '0');
myGLCD.printNumI(llm,170,130, 2, '0');
myGLCD.printNumI(clh,140,180, 2, '0');
myGLCD.printNumI(clm,170,180, 2, '0');
do
{
tp = myTouch.getPoint();
if (tp.x<=240 && tp.x>=200 && tp.y<=50 && tp.y>=10)
{
if(lsm==59){
if(lsh==23)
{lsh=0;
lsm=0;
}
else{lsh=lsh+1;}
}
else{lsm=lsm+1;}
myGLCD.printNumI(lsh,140,30, 2, '0');
myGLCD.printNumI(lsm,170,30, 2, '0');
}
if (tp.x<=240 && tp.x>=200 && tp.y<=100 && tp.y>=60)
{
if(csm==59){
if(csh==23)
{csh=0;
csm=0;
}
else{csh=csh+1;}
}
else{csm=csm+1;}
myGLCD.printNumI(csh,140,80, 2, '0');
myGLCD.printNumI(csm,170,80, 2, '0');
}
if (tp.x<=240 && tp.x>=200 && tp.y<=150 && tp.y>=110)
{
if(llm==59){
if(llh==23)
{llh=0;
llm=0;
}
else{llh=llh+1;}
}
else{llm=llm+1;}
myGLCD.printNumI(llh,140,130, 2, '0');
myGLCD.printNumI(llm,170,130, 2, '0');
}
if (tp.x<=160 && tp.x>=0 && tp.y<=200 && tp.y>=160)
{
if(clm==59){
if(clh==23)
{clh=0;
clm=0;
}
else{clh=clh+1;}
}
else{clm=clm+1;}
myGLCD.printNumI(clh,140,180, 2, '0');
myGLCD.printNumI(clm,170,180, 2, '0');
}
if (tp.x<=300 && tp.x>=260 && tp.y<=50 && tp.y>=10)
{
if(lsm==0){
if(lsh==0)
{lsh=23;
lsm=59;
}
else{lsh=lsh-1;lsm=59;}
}
else{lsm=lsm-1;}
myGLCD.printNumI(lsh,140,30, 2, '0');
myGLCD.printNumI(lsm,170,30, 2, '0');
}
if (tp.x<=300 && tp.x>=260 && tp.y<=100 && tp.y>=60)
{
if(csm==0){
if(csh==0)
{csh=23;
csm=59;
}
else{csh=csh-1;csm=59;}
}
else{csm=csm-1;}
myGLCD.printNumI(csh,140,80, 2, '0');
myGLCD.printNumI(csm,170,80, 2, '0');
}
if (tp.x<=300 && tp.x>=260 && tp.y<=150 && tp.y>=110)
{
if(llm==0){
if(llh==0)
{llh=23;
llm=59;
}
else{llh=llh-1;llm=59;}
}
else{llm=llm-1;}
myGLCD.printNumI(llh,140,130, 2, '0');
myGLCD.printNumI(llm,170,130, 2, '0');
}
if (tp.x<=300 && tp.x>=260 && tp.y<=200 && tp.y>=160)
{
if(clm==0){
if(clh==0)
{clh=23;
clm=59;
}
else{clh=clh-1;clm=59;}
}
else{clm=clm-1;}
}
myGLCD.printNumI(clh,140,180, 2, '0');
myGLCD.printNumI(clm,170,180, 2, '0');
if (tp.x<=619 && tp.x>=284.25 && tp.y<=900 && tp.y>=750)
{
Serial.print("We Made It !! \n");
a=0;
}
}while (a==1);
myGLCD.clrScr();
}
void loop() {
if(tp.x<=160 && tp.x>=0 && tp.y<=20 && tp.y>=0 && state==false)
{
state=true;
};
if (state == true)
{
temps_parametres();
state=false;
};
myGLCD.setColor(255,255,255);
myGLCD.fillRect(0,dispx,0,dispy);
Serial.print("Dafuq \n");
delay(2000);
}
EDIT : mapping to convert display position to touch screen position is a bit harder than i thought. I have luck that it worked for home button but when i tryed to do the same for all the 8 others ones, it didn't workes and i understood that i can't find a constant coefficient to link the 2 parameters. IF someone is inspired let me know.
2nd Edit : Finally done the mapping by testing each corne of each button and writing coordonates. Unfortunately i have the same problem as before : The screen can't be modify. I mean it detects when i say "+" to a parameter Serial.print send the good new number of the parameter but as if i put right after myGLCD.print(the new number at the same place as the old) nothing happen.....
3rd Edit : For now i have to add myGLCD.Init before cleaning screen or making any change.... This is hard..... i need help lol