cancel
Showing results for 
Search instead for 
Did you mean: 

Graph Widget as an Oscilloscope?

PKriv.1
Associate III

Hello,

I wanted to try how would TouchGFX look like in one cool application - an Oscilloscope. I checked out the Graph widget and thought to myself, I could use it for that purpose. So, I set up everything like it was explained here, and I put the ADC in the interrupt mode. I saw that the only function to insert the data points into the graph is addDataPoint(). It did work, however, I was only able to insert one point at the time. The line slowly scrolls across the graph, and it takes some time to fill it from one end to the other. Not really the actual "oscilloscope" experience, I was going for. So I'd like to ask:

a) is there a way to speed up the data feed onto the graph?

b) is there a way to flush multiple data points at once, such it might be the array of ADC values?

Best regards,

PK

EDIT: I played with the simulator and found out that I can just add all the points in a for loop within the handleTickEvent() event, and the simulation sounds very promising. This might be what I'm looking for.

1 ACCEPTED SOLUTION

Accepted Solutions
Alexandre RENOUX
Principal

Hello @PKriv.1​ ,

As the name states a Dynamic Graph is meant to be dynamic, meaning that you add points dynamically in a loop fashion and the graph changes with time.

We are currently working on a "static graph" that will display a fixed range of x values with all the points added at once.

Unfortunately, I cannot give you any date for the release of this new widget. If you really need it and you have the skills, you can still create your own widget. TouchGFX is not meant to cover all the different widgets and UI behaviors that a user can come up with. If the user needs some very specific type of widget, it is expected that the user creates it himself.

Sorry for the inconvenience.

/Alexandre

View solution in original post

9 REPLIES 9
Alexandre RENOUX
Principal

Hello PKriv.1,

If I understand well, you found your answer yourself ?

If so, please close this topic by choosing Select as Best either for this message or add a new one and select this one as Best.

/Alexandre

PKriv.1
Associate III

Kinda. It displays the data in the burst manner, not point by point. I would still like to know a couple of things:

a) is there a better way to add the data into the dynamicGraph widget instead adding points one after the other in the loop manner, like this:

void Screen1View::handleTickEvent()
{
tickCounter++;
// Insert each second tick
if (tickCounter % 2 == 0) {
  // Insert data point
  for (int i = 0; i < 280; i++)
        mojGraf.addDataPoint((float)adc_data[i]/4096.0f *100); 
  }
}

Wouldnt it be better to pass the whole data array by the address, something like myGraph.addDataArray(float *data_array, int NUMBER_OF_DATA_POINTS)?

b) is there a way to turn off the rolling values of x-labels? I'd like to be able to set my own values, but the TouchGFX Designer doesnt enable me to set them. Instead, all I get is ever increasing labels on the x-axis.

BTW, i wrote a small blog post on partial framebuffer strategy and its implementation on a custom board with very popular ILI3941 screen. Be my guest to check it out: https://helentronica.com/2021/01/22/touchgfx-on-a-custom-made-low-cost-board-with-the-ili9341-controller-over-spi/

One by one seems to be the only way as of right now. I asked the same question regarding the x-values. Basically, you have to manually set a private data counter value, then play around with the x-axis offset and scale to get the values to show what you want them to show. The graph widget seems to have been primarily designed for enumerating sequential points, and getting it to work like a scatterplot requires some serious arm-twisting in my experience. Good luck.

Embedded UI/UX Consulting: cadenza.design

Hey, thanks for pointing me there, I see, got to implement my own x axis counter and deduce it from their value. Why is this not simply given in the API, I don't see any reason why not..ughh, I'm slowly getting tired of this TouchGFX....

Alexandre RENOUX
Principal

Hello @PKriv.1​ ,

As the name states a Dynamic Graph is meant to be dynamic, meaning that you add points dynamically in a loop fashion and the graph changes with time.

We are currently working on a "static graph" that will display a fixed range of x values with all the points added at once.

Unfortunately, I cannot give you any date for the release of this new widget. If you really need it and you have the skills, you can still create your own widget. TouchGFX is not meant to cover all the different widgets and UI behaviors that a user can come up with. If the user needs some very specific type of widget, it is expected that the user creates it himself.

Sorry for the inconvenience.

/Alexandre

PKriv.1
Associate III

Got it...do you have a link on how to develop custom widgets?

Got it...do you have a link on how to develop custom widgets?

Hello @PKriv.1​ ,

You will find some explanation on the documentation website : link

But since there are custom widgets, the article does not provide the answer for every widget but simply the overall idea based on a QR code widget example.

Also, since it's widgets, you can refer to any existing widget in TouchGFX to see the structure and how to create your own. The entire library is your reference ;)

/Alexandre

Ten months have passed, but this very useful feature has not been added yet. Although several new versions have already been released...