MiguelRodmen
Member
Hello,
I'm working with Teensy and Nextion TFT, and it works good when I'm getting variables values, I started to do this instead of using Nexloop method because when I started this code I was using Arduino Mega, and sometimes Nexloop wasn't getting the event trigger because Arduino was busy in any other action, but get variables values is a little slow process, so now, I'm using Teensy 4.0 and I was thinking to use multithreading to check for any event on my Serial at same time I'm doing the other actions, but the Nexloop is not getting anything, so I made another code to only run Nexloop, and it didn't work either.
In addition, I put some indicators to my debugging serial port, to know where my code was getting stuck doing the Nexloop, and it's not doing the while loop
void nexLoop(NexTouch *nex_listen_list[])
{
static uint8_t __buffer[10];
uint16_t i;
uint8_t c;
while (nexSerial.available() > 0)
{
delay(10);
c = nexSerial.read();
if (NEX_RET_EVENT_TOUCH_HEAD == c)
{
if (nexSerial.available() >= 6)
{
__buffer[0] = c;
for (i = 1; i < 7; i++)
{
__buffer = nexSerial.read();
}
__buffer = 0x00;
if (0xFF == __buffer[4] && 0xFF == __buffer[5] && 0xFF == __buffer[6])
{
NexTouch::iterate(nex_listen_list, __buffer[1], __buffer[2], (int32_t)__buffer[3]);
}
}
}
}
}
I'm working with ITEADLIB, Arduino 1.8.13 & Teensyduino 1.53.
Thanks in advance
I'm working with Teensy and Nextion TFT, and it works good when I'm getting variables values, I started to do this instead of using Nexloop method because when I started this code I was using Arduino Mega, and sometimes Nexloop wasn't getting the event trigger because Arduino was busy in any other action, but get variables values is a little slow process, so now, I'm using Teensy 4.0 and I was thinking to use multithreading to check for any event on my Serial at same time I'm doing the other actions, but the Nexloop is not getting anything, so I made another code to only run Nexloop, and it didn't work either.
In addition, I put some indicators to my debugging serial port, to know where my code was getting stuck doing the Nexloop, and it's not doing the while loop
void nexLoop(NexTouch *nex_listen_list[])
{
static uint8_t __buffer[10];
uint16_t i;
uint8_t c;
while (nexSerial.available() > 0)
{
delay(10);
c = nexSerial.read();
if (NEX_RET_EVENT_TOUCH_HEAD == c)
{
if (nexSerial.available() >= 6)
{
__buffer[0] = c;
for (i = 1; i < 7; i++)
{
__buffer = nexSerial.read();
}
__buffer = 0x00;
if (0xFF == __buffer[4] && 0xFF == __buffer[5] && 0xFF == __buffer[6])
{
NexTouch::iterate(nex_listen_list, __buffer[1], __buffer[2], (int32_t)__buffer[3]);
}
}
}
}
}
I'm working with ITEADLIB, Arduino 1.8.13 & Teensyduino 1.53.
Thanks in advance
Last edited: