2025-11-13 8:20 AM
I would like to read some data from the EEPROM on initialization to use in the TouchGFX application.
I currently have an API that can request read/write operations from TouchGFX to the backend.
At the moment, I've implemented it in the Model.hpp
void bind(ModelListener* listener)
{
modelListener = listener;
if (!storageInitialized) {
initializeFromStorage();
storageInitialized = true;
}
}with
void Model::initializeFromStorage()
{
#ifndef SIMULATOR
StorageResponse_t wr = Storage_Request(STORAGE_CMD_READ,
EEPROM_ADDR_STRUCT_2,
&struct2,
sizeof(struct2));
wr = Storage_Request(STORAGE_CMD_READ,
EEPROM_ADDR_STRUCT_1,
&struct1,
sizeof(struct1));
#endif
}but I'm not sure if it's the correct location.
I just want to send the read EEPROM command on the first load of TouchGFX and never again
Solved! Go to Solution.
2025-11-18 2:01 AM
Hello @nico23 ,
Are you trying to read purely GUI-related data, such as variables to be stored in the model later? If so, using the bind method seems appropriate. However, if the data pertains to TouchGFX initialization—like determining which screen to start with—you may need to call initializeFromStorage() beforehand.
2025-11-18 2:01 AM
Hello @nico23 ,
Are you trying to read purely GUI-related data, such as variables to be stored in the model later? If so, using the bind method seems appropriate. However, if the data pertains to TouchGFX initialization—like determining which screen to start with—you may need to call initializeFromStorage() beforehand.
2025-11-18 2:08 AM
Yes, they are data purely stored in the model and used only for the GUI to display (or not) certain things when moving to the various views.
Out of curiosity, what's the location in case I want to run initializeFromStorage() beforehand?
Thanks
2025-11-18 2:58 AM
Ok actually the example I took (determining which screen to start with) might not be the the best because you could also handle this in the model easily. I think everything that is related to your TouchGFX application can be handled inside of it.