Pages: [1]   Go Down
Author Topic: Problems with nuelectronics touchscreen  (Read 842 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Karma: 0
Posts: 16
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Not really sure if the problem is with the touchscreen, the library, or my programming.

The issue is this: I'm trying to add a GUI resembling a clock face to an already substantial program. Up to a point, it works great displays the screen, and even most controls work on the screen. Then I added the final touch of detecting where the user presses on the clock face (which hour), and the arduino seems to go crazy on startup, without even going anywhere near some of the new code (like there is a memory corruption and most variables are overwritten with gibberish (although identical between restarts).

The two relevant pieces of code are attached (code files). There is also a header file "defs.h" which contains some typedefs, some defines, and two const float arrays with sine and cosine lookup tables.

The "suspect" lines of code are marked above with "**********" comment. Commenting either one of them out makes the program run fine (although without either part of the GUI, or part of the user input detection).

If both of these lines are uncommented, all variables are gibberish on the very startup, without any user input, even though only the line drawing the circles out of these two suspect lines seems to have been executed. Strangely enough, commenting out the "return" line seems to fix the issue (losing some of the intended functionality) even though that line is not executed until the user has touched the screen.

I'm really at my wits end as to what can cause this. One of the suspect lines is a return, and commenting it out should only change the value that is returned, nothing else (the integer value is then displayed on the screen, so no code path depends on it). The other suspect line just draws 12 circles on the screen, with no apparent memory issues.

Please HELP 

* thermostat.pde (6.21 KB - downloaded 10 times.)
* screen.cpp (4.21 KB - downloaded 24 times.)
* defs.h (11.37 KB - downloaded 13 times.)

Pages: [1]   Go Up
Jump to: