supremesports
Hi Thiago,

I know you indicated somewhere that the retain function has been disabled due to compatibility issues. You also explained how to reactivate it for tests. I did the test and it permanently froze my OpenPLC runtime. I've been forced to uninstall and reinstall everything. 

I was wondering if there's something that I did wrong, or if there's any plan in getting this function to work.

I'm running on Windows for now, but I'll eventually migrate on my Raspberry Pi B+. Is it known to work properly on RPi?

Thanks ðŸ™‚
Quote 0 0
pbosscha
Hi Supremesports,

By chance we have done some retain tests this week on Ubuntu and it seemed to work just fine.
Admittedly we only tested the first 3 holding registers, but it seems to make space for the first 1000 registers.

This would then indicate a high probability that things should work just fine on RPi. 
Quote 0 0
supremesports
Ok, any details? Any source code to make it work? Thanks
Quote 0 0
thiagoralves
I believe that if you just uncomment the function calls for permanent storage on the main.cpp file will be enough to enable the functionlity. However, this thing was coded in the early stages of OpenPLC v2, which means it was a long time ago... I don’t know how well it would work (or if it will work at all) with OpenPLC v3. I might go back to it and do it the right way, with a switch to enable/disable it from the web interface and all the bells and whistles related to it. But, as you know, doing it right requires time. Since I don’t have a lot of time available right now I’m prioritizing what is more important first. Feel free to work on it if you have the time and skills. If you manage to make it work right, I can pull your changes to the oficial code on GitHub.
Quote 1 0
supremesports
Hi, I confirm it DOES NOT work with v3 as it froze everything up and I've been force to uninstall and reinstall OpenPLC Runtime completely.

I'll verify what I can do, bu I'm not well versed in those background applications. Also, my free times are very rare these days...
Quote 0 0
pbosscha
What we did:

Took the retain code out of V2: "persistent_storage.cpp", and un-commented the startup retain code in main.cpp and compiled the whole lot without any further changes. Then one needs a "persistent.file" which is EXACTLY 2K big.
Quote 0 0
plcopen
pbosscha wrote:
What we did:

Took the retain code out of V2: "persistent_storage.cpp", and un-commented the startup retain code in main.cpp and compiled the whole lot without any further changes. Then one needs a "persistent.file" which is EXACTLY 2K big.


How can we do this "Then one needs a "persistent.file" which is EXACTLY 2K big" 
Can you explain more detail .
Thank you so much
Quote 0 0
thiagoralves
AFAIK OpenPLC should create the persistent.file matching the buffers size at startup if one is not found
Quote 0 0
plcopen
AFAIK OpenPLC should create the persistent.file matching the buffers size at startup if one is not found

Can you give me an example file please.
Thank you so much Thiagoralves
Quote 0 0
thiagoralves
You don’t have to worry about this file. It will be created automatically. However, I just took a look at the persistent code from v2 and it needs some refactoring to work on v3. Just putting the file in there won’t be enough. Since it seems that a lot of people are interested in this feature, I will put some effort to bring it back to v3 this week.
Quote 0 0
plcopen
You don’t have to worry about this file. It will be created automatically. However, I just took a look at the persistent code from v2 and it needs some refactoring to work on v3. Just putting the file in there won’t be enough. Since it seems that a lot of people are interested in this feature, I will put some effort to bring it back to v3 this week.


Thank you so much Thiagoralves
Quote 0 0
forzalaquila
You don’t have to worry about this file. It will be created automatically. However, I just took a look at the persistent code from v2 and it needs some refactoring to work on v3. Just putting the file in there won’t be enough. Since it seems that a lot of people are interested in this feature, I will put some effort to bring it back to v3 this week.


thanks so much
Quote 0 0