I have an application running on a Cobra 2 and I am finding that the touch screen is very poor response time. I often have to hit a button a number of times before it responds.
I have 5 threads in total running. 1 handles the display, 1 handles the GSM modem, 1 handles the HTTP request, 1 handles the sending of data over TCP/IP to a server and the last one handles the Xbee network.
The display is refreshed every second. Sleep is called at the end of the loop with a value 1,000ms
The GSM is checked for any SMS every 10 seconds. Sleep is 10,000ms
HTTP handler is simply waiting for a connection.
The server thread send the data every 2 seconds. Sleep is 2,000ms
The Xbee thread just does a few variable checks to see if we are to send any data. Most of the time is only sends about 1 per day. The sleep is 1,000ms
The Xbee received data is handled with a data received handler. I am using the MFToolkit for this. Data is transmitted by 3 sensors and each one sends every 2 seconds.
Now, if I disable the Xbee thread so that it does not start the data received handler, I get perfect response from the touch screen so I am therefore happy that the issue is not in the other threads. Same effect if I disable the sensors to stop sending and only have the thread started so there is no data being received.
I have looked through the MFtoolkit source and there are thread.sleep calls being made during the polling for data. The code does not use a datareceived handler. All data is polled.
There is no delay in my display code. I can see the clock being updated every second as expected.
I have even tried to set the Xbee thread to lowest priority and no change.
Has anyone else using the Cobra 2 run into issues with touch response?
On my ChipworkX based design, I use interrupt handling to read the touch and it has a similar system reading Xbee with 10 sensors and the response to touch is as fast as it can be.
How is the touch processed on the Cobra 2? I can see that it is via the ADC on the processor so wondering how often this is processed? I would assume that there is no interrupt with this and it is handled via polling?