Skip to main content
HAnh
Associate III
October 20, 2020
Question

How can initiate custom value for Screen in TouchGFX

  • October 20, 2020
  • 4 replies
  • 1116 views

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.

This topic has been closed for replies.

4 replies

MM..1
Super User
October 20, 2020

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
HAnhAuthor
Associate III
October 20, 2020

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
Super User
October 20, 2020

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
HAnhAuthor
Associate III
October 20, 2020

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