Page 1 of 1

How to use StringInit Component to push a value in ROM ?

Posted: Fri May 09, 2025 12:46 pm
by Nico595
Hello,

I need to push user value in a ROM array to save mqtt username and password in the C code. I tried with StringInit Component but when I push a new value in "Str0", this variable is not saved when I restart the Pc App.

This function is it possible without design a txt file ?

1 - I set the box with the Str0 string.
2 - I enter a new string and save in Str0.
3 - I read the string from Str0.

It's ok, I have my new string in step 3 but the new string is lost if I restart the Pc App. I start with the string of step 1, registered in the Str0 parameter.



Capture d’écran 2025-05-09 134918.png
Capture d’écran 2025-05-09 134918.png (156.55 KiB) Viewed 1439 times


Thank you for your advices.

Re: How to use StringInit Component to push a value in ROM ?

Posted: Fri May 09, 2025 2:56 pm
by medelec35
Hello.
If you want to use properties to store and load values, then you can use the Property Manager (Component Libraries > Storage > Utility).
It will crate a file for you, so all the hard work is removed.
Alternatively, if you attach your project, I can see if there is a better way of achieving desired results.

Re: How to use StringInit Component to push a value in ROM ?

Posted: Fri May 09, 2025 4:30 pm
by Nico595
Hello Martin,

It's probably a perfect tool to save the variables in a .cfg file but have you an example or a method ? What is the good syntax to use the RegisterProperty Function ?

The config.cfg file is not wrote with a Save.

Capture d’écran 2025-05-09 181335.png
Capture d’écran 2025-05-09 181335.png (40.56 KiB) Viewed 1374 times



Thank you :)

Re: How to use StringInit Component to push a value in ROM ?

Posted: Fri May 09, 2025 6:51 pm
by medelec35
If you attach your project, I will see what I can do with it.

Re: How to use StringInit Component to push a value in ROM ?

Posted: Fri May 09, 2025 7:36 pm
by Nico595
I finally used the CSV Read Write Component to save and read variables in a config.cfg.
As this data content is password and username, I will encrypt the data before the save.

Thank you for your help.