2023-10-25 08:37 PM
For an STM32H747i-DISCO board (800x480 lcd), I have used TouchGFX Designer v4.22.1 to create a very simple project with a box and static graph. The white box was maximized to the full screen. The static graph was untouched.
I imported this project into CubeIDE v1.13.2.
I want to be able to draw 799 horizontal line segments on the lcd. I am getting close but cannot get the resulting line to reach across the entire screen. It gets about 15% across and then stops.
The starting point of this short line can be moved to the right by adding a constant to 'segmentCounter' in graph1.addDataPoint( segmentCounter , 240 );, but the length of the line doesn't change.
Any hints to what I am doing wrong would be appreciated. The attached code should draw 799 one-pixel line line segments. Attached are Screen1View.cpp and .hpp, plus a picture of the display.
Solved! Go to Solution.
2023-10-26 12:47 AM - edited 2023-10-26 12:48 AM
Okey. I guess you must set the number of data points to 799 instead of 100 (default) in the tgfx designer graph1 properties.
Im not sure can this number of points be changed by code, the array size seems to statically allocated in view base class hpp.
Br JTP
2023-10-25 10:17 PM
Hello Bob
What if you dont add data to graph in every tick ? Now there comes lots of data. Maybe test first by adding 799 points just once.
I guess SegmentCounter is initialized automatically to zero, even youre not initializing it. Some big value on first time could cause problems, so maybe worth testing to initialize it also.
Br JTP
2023-10-25 10:53 PM
@JTP1 , I added segmentCounter=0 before the loop starts. I also made it so the data is added to the graph only once, and I verified this by moving the led toggle to inside the loop (it now only turns on and never turns off).
Neither of these changes had any effect. The line is still short, but it was worth trying your suggestion. It's a strange problem.
2023-10-26 12:47 AM - edited 2023-10-26 12:48 AM
Okey. I guess you must set the number of data points to 799 instead of 100 (default) in the tgfx designer graph1 properties.
Im not sure can this number of points be changed by code, the array size seems to statically allocated in view base class hpp.
Br JTP
2023-10-26 02:43 AM
@JTP1 , that's the answer. I didn't occur to me that there was simply a limit in the number of data points that could be added.
My project is for an audio spectrum analyzer that has an array of 1024 frequency bins. There are only 800 horizontal pixels in the lcd, so that's the maximum number of bins that could be displayed at any given sweep.
I changed to code to only display 100 bins, and that works perfectly. I'll try and change the limit to 799.
Thanks for your help on this.
2023-10-26 12:21 PM - edited 2023-10-26 07:20 PM
EDIT -- It turns out that TouchGFX Designer allow for the "Number of Data Points" to be arbitrarily changed at design time. There's no need for the 8 graphs described below. I just completely missed this when I was adding the original graph.
- - - - - - - - - - - - - - - - - - - - - - - - - - - -
@JTP1 , I've got it all working now. I simply added 7 more static graphs to the design. Now, each graph handles 100 of the 800 fft points. It was very easy to do.
Thanks again for your help. I was going crazy - trying ignorantly to stretch those poor 100 points into 800. :)
2023-10-27 03:37 AM
Yes thats true that you can put any number to 'number of datapoints' (in some limitations naturally) :thumbs_up:
Good to hear you get it working :D
Br JTP