cancel
Showing results for 
Search instead for 
Did you mean: 

How can initiate custom value for Screen in TouchGFX

HAnh
Associate III

Hi everyone.

I have built TouchGFX with STM32F746, I will store some variable in external eeprom when screen power of, and when starting I will read these variable from eeprom to initiate for my screen,

But I don't know how to can i to do it, my screen always show value, which i initiate in willcard in TouchGFX

Thanks and best regards.

4 REPLIES 4
MM..1
Chief II

Simply in any Screen1View.cpp use in function

void Screen1View::setupScreen()

{

  Screen1ViewBase::setupScreen();

//example

   Unicode::snprintf(textAreaVerBuffer, TEXTAREAVER_SIZE, "1.%d", VERSION);

   textAreaVer.setWildcard(textAreaVerBuffer);

   textAreaVer.invalidate();

,,,

any other object change and invalidate

HAnh
Associate III

Thanks for your respond.

I have it, but start up screen seem start before I get value form model, where I store and read data

Unicode::snprintf(txtMainStartTimeOxyHourBuffer,TXTMAINSTARTTIMEOXYHOUR_SIZE,"%d",presenter->getOxyStartHour());

Unicode::snprintf(txtMainStartTimeOxyMinuteBuffer,TXTMAINSTARTTIMEOXYMINUTE_SIZE,"%02d",presenter->getOxyStartMinute());

before Screen turnoff I have been save data in the model, so when start i will read data from eeprom, and in model i will update it for screen.

Do we have another way?

Thanks and best regards

MM..1
Chief II

Model isnt good place for load presets. Better is main before oskernelstart or when you need model use make all object invisible in setupScreen.

Then after load change it to visible. But this cant be handled in model. You need refresh variable and manipulate objects on screen in void Screen1View::handleTickEvent()

HAnh
Associate III

That mean I can make extern variable from main, and extern it in Screen, which i need use this variable