Page 1 of 1

How Internal Memory Works

Posted: Fri Jan 02, 2015 10:19 pm
by Reefology
Can someone please explain how the internal memory works? Or share a link to more info.

I see where to modify it but not sure how to use or when to apply it.

Thanks

Re: How Internal Memory Works

Posted: Sat Jan 03, 2015 6:40 am
by cosmith71
There are two ways to set parameters. One is in the code. For example:

Code: Select all

    ReefAngel.StandardLights( Port1,9,0,19,0 );
Sets up a standard light timer on relay #1 that runs from 0900 to 1900 (9,0,19,0). These values are hard coded and cannot be changed without uploading new code. If I wanted my lights to shut off at 8:30 PM, I'd have to change the code to this and re-upload:

Code: Select all

    ReefAngel.StandardLights( Port1,9,0,20,30 );
The other way to do this is with settings in memory. The equivalent code would be:

Code: Select all

    ReefAngel.DayLights( Port1 );
This says use the DayLights memory locations to set a timer on relay 1. This is only useful if you're on WiFi and can change the settings remotely with the Portal, U-App, or Android app.

The big difference is that you can change memory locations on the fly (using the Portal or an app) without having to upload new code every time you want to change a setting.

When you first generate in-the-memory code with the Wizard, it will generate a file to set the memory settings, then it will generate the code that actually runs the controller. You can use the memory settings code, or you can skip it and enter everything into the portal or apps manually.

--Colin

Re: How Internal Memory Works

Posted: Sat Jan 03, 2015 6:58 am
by lnevo
If you browse through the internal memory section within the portal you'll see all the values that you can set. For instance you'll see the Heater section has the values for on/off. To make use of those values you'll need to change your code from hard coded to using internal memory. Here is an example of the change:

Before:
ReefAngel.StandardHeater(Port1,790,800);

After:
ReefAngel.StandardHeater(Port1);

Re: How Internal Memory Works

Posted: Sat Jan 03, 2015 12:28 pm
by pandimus
ReefAngel.StandardHeater(Port1)

ReefAngel.StandardHeater(Port2)

So if you have this.. Two heaters.. Where is the temp value stored? And how do you change them individually?

Re: How Internal Memory Works

Posted: Sat Jan 03, 2015 3:00 pm
by lnevo
You cannot change them individually. They will both use the values set in InternalMemory when used that way. You can use the internal thermostat on each one to fine tune it, or control it manually in the code.

Re: How Internal Memory Works

Posted: Sat Jan 03, 2015 6:13 pm
by Sacohen
Excellent explanation Colin and Lee. I've always been a bit cloudy on that too.

Re: How Internal Memory Works

Posted: Mon Jan 05, 2015 4:08 am
by Reefology
cosmith71 wrote:You can use the memory settings code, or you can skip it and enter everything into the portal or apps manually.

--Colin
How do you enter everything into the portal or apps manually?

Re: How Internal Memory Works

Posted: Mon Jan 05, 2015 4:18 am
by cosmith71
On the Portal, click on internal memory. On the U-App, it's under settings.

--Colin

Re: How Internal Memory Works

Posted: Tue Apr 14, 2015 10:35 pm
by skehole
So it's as simple as removing the data from the end of the label and port identification?

Re: How Internal Memory Works

Posted: Wed Apr 15, 2015 11:39 am
by AlanM
You can see every memory location if you look for the section with mem_ at the beginning of each line in this file

https://github.com/reefangel/Libraries/ ... /Globals.h

If you look at

https://github.com/reefangel/Libraries/ ... alEEPROM.h

You can look for function declarations that end with _read() to see how to get values in your code in the loop if there isn't already a function that uses those values.

Re: How Internal Memory Works

Posted: Wed Dec 23, 2015 12:21 pm
by KCReefer
I'm assuming that it is okay to use both internal memory and code?

Example:

I want to use internal memory for my daylights, actinic, moonlight, heaters, and dosers, but I want a special 2 hour daily timer for a solenoid valve, which would require the parameters to be set in code. (Since there is no way to have a specialized time schedule that is not daylight, actinic, or moonlight in the internal memory.)

I am going to try it tonight, but I figured I'd ask anyway

Re: How Internal Memory Works

Posted: Wed Dec 23, 2015 12:51 pm
by lnevo
You can totally mix. You could also use variable locations 100-199 for custom variables. You just have to set through the http API or through the android app

Re: How Internal Memory Works

Posted: Wed Dec 23, 2015 2:24 pm
by KCReefer
Could you explain a little more about using the variable locations? perhaps give a simple example of the variable, how it can relate to the port, and how it would be accessed through the API?

I'm a software engineer II if that helps you decide how to explain this to me. I'm used to Java and front end development, although I do have some building automation background. I'm not too familiar with arduino at all

Re: How Internal Memory Works

Posted: Wed Dec 23, 2015 3:06 pm
by lnevo
Look at my INO I have declarations up top of all the custom memory locations I use.

You basically do an InternalMemory.read() and InternalMemory.write() to grab and set those variables. It's pretty basic. As a software engineer, I think you'll get it pretty quick.

You may want to peek at the library docs http://www.easte.net/ra/html