B4R Question the corect way to keep unchanging variable

yaniv hanya

Active Member
Licensed User
I create an app that will connect the device (ESP32) to web socket, and according to device ID should get commands from the web.
the deviceID is created once, in first connection, and then should be kept and used again and again. i create it and keep it in the eeprom.

i thought that it will be incorrect to read it again and again from the eeprom. but i couldn't find a way to keep and use it in run time.

if i declare it as Global variable, i can't change it from the code (eerror MSG-"you can't change Global variable from code")

if i declare it in each function that use it- it is endless calls to eeprom...

and if i declare it in the Process_Globals sub, i get an error MSG- "the initializing order is not stable, it is not safe to use it…".

Do you have any idea what is the right way to do it?

Thanks!
 
Top