Hi There
I am Using a Esp32-C3 in combination with a Nextion Inelligent 7".
I get a really slow response when i touch something on my Nextion(something around 1second)
I think it has something to do with the serial input from the Nextion onto my Esp.
void checkNextionTouch(bool &kSicht,bool &kUnSicht,bool &kProg,bool &kSyn,bool &TSich,bool &TUns,bool &Wieder) //Auslesen der Touch events vom Nextion Display
{
if (Serial0.available()>0)
{
String str = Serial0.readString();
if (str == "kSicht")
{
kSicht = true;
} else
{
kSicht = false;
}
if (str == "kUnSicht")
{
kUnSicht = true;
} else
{
kUnSicht = false;
}
if (str == "kProg")
{
kProg = true;
} else
{
kProg = false;
}
if (str == "kSyn")
{
kSyn = true;
} else
{
kSyn = false;
}
if (str == "TSich")
{
TSich = true;
} else
{
TSich = false;
}
if (str == "TUns")
{
TUns = true;
} else
{
TUns = false;
}
if (str == "Wieder")
{
Wieder = true;
} else
{
Wieder = false;
}
str = "";
while (Serial0.available()>0) //empty Serial input Buffer
{
Serial0.read();
}
delay(10);
}
}
bool kSicht;
bool kUnSicht;
bool kProg;
bool kSyn;
bool TSich;
bool TUns;
bool Wieder;
void setup()
{
Serial0.begin(115200);
Serial.begin(9600);
}
void loop()
{
checkNextionTouch(kSicht, kUnSicht,kProg,kSyn,TSich,TUns,Wieder);
if (kSicht) {
// Handle the kSicht event
Serial.println("kSicht was touched");
}
if (kUnSicht) {
// Handle the kUnSicht event
Serial.println("kUnSicht was touched");
}
}
If i run this code and touch one of the fields on the Nextion i get a continous output on my Serial Monitor (in this cas kSicht and kUnSicht)
anyone got an idea how to fix this?
thanks in advance