cancel
Showing results for 
Search instead for 
Did you mean: 

Displaying Data to TouchGFX UI using wildcards

Nikola-01
Associate II

Hi Guys

I am a noobie and I am just starting out with TouchGFX. I have designed a 7 screen gui which cycles between screens (1-7 in that order which cylces indefinitely) and I have a text area which I want to populate with real-time data. This is only on screen 4 and 6 and I have defined the wildcards in the designer as follows:

Nikola01_2-1714987046276.png
Nikola01_1-1714986998861.png

I have generated the code using TouchGFX 4.23.2 and then I open the IOC file in CubeMX where I add ADC initialization as well as two tasks and two semaphores. One to update screen4 and one to update screen6, I then generate the code in MX and then click on "Open Project" to import it into CubeIDE.

I do not know where to take it from here. Essentially I want to read an ADC voltage (polling) in the two tasks I have created, then from there update screen4 and screen6 wildcards when the screen is loaded.

Here is my main.c:

I have tried to follow this video: https://www.youtube.com/watch?v=EbWOv_0Lp-U&t=241s, however when I adapt it to 7 screens and 2 semaphores and tasks, I upload the code to my STM32F429i-DISC1 and I just observe a white screen, however when I upload the code without having made any modifications in STMCubeIDE as seen in the video, I see the desired gui implemented with the exception of the real time data being displayed on screen 4 and 6.

Any help would be appreciated thanks.

1 ACCEPTED SOLUTION

Accepted Solutions
Nikola-01
Associate II

This is The code which I found works in case anyone was wondering.

void Screen4View::UpdateVoltage(float value)
{
	Unicode::snprintfFloat(textAreaVoltageBuffer,sizeof(textAreaVoltageBuffer), "%.2f V", value);
    textAreaVoltage.invalidate();
}

View solution in original post

2 REPLIES 2
Nikola-01
Associate II

Ok, so I have worked on it longer and I have gotten to this point:
I call a function in my Screen6View.cpp which I want to update the wildcard value in the gui.
This is how my code looks:

#include <gui/screen6_screen/Screen6View.hpp>
#include "string.h"

Screen6View::Screen6View()
{

}

void Screen6View::setupScreen()
{
    Screen6ViewBase::setupScreen();
}

void Screen6View::tearDownScreen()
{
    Screen6ViewBase::tearDownScreen();
}

void Screen6View::UpdateCurrent(float value)
{
	Unicode::UnicodeChar buffer[6];
    Unicode::snprintfFloat(buffer,sizeof(buffer), "%.2f", 3.15345);
	textAreaCurrent.setWildcard(buffer);
	textAreaCurrent.invalidate();
}

When I debug my board, I can see that I am entering the UpdateCurrent function. I set the Initial value of the wildcard to be -1 and ass soon as I call my UpdateCurrent function the wildcard updates to the fallback character of the wildcard which I set to be '-' in touchGFX.

When I inspect the contents of buffer during runtime I see the following:
buffer[0] = 51
buffer[1] = 46
buffer[2] = 49

buffer[3] = 53

buffer[4] = 0

buffer[5] = 42405

 

I know buffer[0]-buffer[4] is supposed to represent 3.15 with null termination.

I just don't know why the embedded gui is updating the wildcard with the fallback character '-'.

Nikola-01
Associate II

This is The code which I found works in case anyone was wondering.

void Screen4View::UpdateVoltage(float value)
{
	Unicode::snprintfFloat(textAreaVoltageBuffer,sizeof(textAreaVoltageBuffer), "%.2f V", value);
    textAreaVoltage.invalidate();
}