Code loads per Webwizard but doesn't appear to really load

Basic / Standard Reef Angel hardware
Post Reply
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: Code loads per Webwizard but doesn't appear to really lo

Post by rimai »

Delayed start is not applicable to you. It is meant for metal halides.
Actinic offset is to create an offset from the standard lights.
Let's say you set lights from 9am to 9pm and offset to 60 minutes, your actinics would follow 8am and 10pm
Roberto.
jcjrogers
Posts: 66
Joined: Fri May 05, 2017 11:27 am

Re: Code loads per Webwizard but doesn't appear to really lo

Post by jcjrogers »

Ok...so would this work:

/// LED lights: Port 1 - Always On (LEDs are controlled by a phone app). Lights on 9:00am, Lights off 9:00pm.
/// T5's: Port 2 - Offset -180 minutes (-3 hours). Generates Lights on 12:00pm, Lights off 6:00pm.
/// Fixture Fans: Port 3 - Time Schedule. Fans on 9:00am, Fans off 9:00pm (matches LED schedule).
/// Refugium LED: Port 4 - Opposite Port 3 (Lights on 9:00pm, Lights off 9:00am.
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: Code loads per Webwizard but doesn't appear to really lo

Post by rimai »

Yeap. I think so
Roberto.
jcjrogers
Posts: 66
Joined: Fri May 05, 2017 11:27 am

Re: Code loads per Webwizard but doesn't appear to really lo

Post by jcjrogers »

Ok so a few more questions:
  • 1. Can you mix code used for internal memory with hard coded parameters? For example, could I have a line ReefAngel.StandardLights( Port2 ); in a sketch with a line ReefAngel.StandardLights( Port3,9,0,21,0 ); , thereby allowing me to hard code one port and have the other "Time Schedule" port where it can be altered via the Uapp?

    2. If you can't mix hard coded parameters and internal memory code in the same sketch with the same function, can you mix with different functions like ReefAngel.StandardLights( Port2 ); and ReefAngel.StandardHeater( T1_PROBE,Box1_Port1,760,800 ); ?

    3. Does the visual representation of ports (red/green, On/Off/Auto) come from the actual running program with actual running parameters, or does it come from whatever parameters are sitting in Internal Memory? In other words, if I save my parameters in the code, will Uapp, the portal, and my controller show what the relays are doing based on what my code's parameters are, or do they visually represent whatever parameters are sitting in internal memory? For example If I hard code parameters such that my heater turns on at 77 deg F and off at 77.5 deg F, but Internal memory has on at 75 deg F and off at 80 deg F, if my T1 temperature is 78 deg F, would the visual relay show off-red, matching my "real" parameters, or would it show on-green, matching the bogus parameters in internal memory?
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: Code loads per Webwizard but doesn't appear to really lo

Post by rimai »

Yes, you can mix.
The controller will follow whatever you instruct it to do, whether you save settings on internal memory, hard code them or both.
The on/off/auto is whatever the controller is following from your code.
Roberto.
jcjrogers
Posts: 66
Joined: Fri May 05, 2017 11:27 am

Re: Code loads per Webwizard but doesn't appear to really lo

Post by jcjrogers »

rimai wrote:Yes, you can mix.
The controller will follow whatever you instruct it to do, whether you save settings on internal memory, hard code them or both.
The on/off/auto is whatever the controller is following from your code.
Great! I've got a couple of options, and having access to what is really going on is more important than how I manage parameters.
jcjrogers
Posts: 66
Joined: Fri May 05, 2017 11:27 am

Re: Code loads per Webwizard but doesn't appear to really lo

Post by jcjrogers »

A few more questions:
  • 1. I know the Webwizard doesn't load parameters to the controller. Does the Webwizard code generated as Internal Memory load to the controller?

    2. If the Webwizard cannot load Internal Memory code to the controller, what code do I add in the Arduino Wizard to make the controller recognize the Cloud Wifi ( ReefAngel.CloudPortal(); ) isn't recognized?

    3. If the Webwizard Internal Memory code will load to the controller, for those parameters I want to edit online, do I need to replace the Webwizard generated code with Arduino generated code? For instance, do I need to change ReefAngel.StandardLights( Port2 ); with ReefAngel.ActinicLights( Port2 ); if I want to edit my offset online?
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: Code loads per Webwizard but doesn't appear to really lo

Post by rimai »

Why do you need to load internal memory code?
You really don't need one. One is already loaded before the controller is shipped. If you really want to load it, you can use the initial internal memory.ino that comes with the arduino IDE and copy/paste on the webwizard.
Roberto.
jcjrogers
Posts: 66
Joined: Fri May 05, 2017 11:27 am

Re: Code loads per Webwizard but doesn't appear to really lo

Post by jcjrogers »

rimai wrote:Why do you need to load internal memory code?
You really don't need one. One is already loaded before the controller is shipped. If you really want to load it, you can use the initial internal memory.ino that comes with the arduino IDE and copy/paste on the webwizard.
Sorry, I'm not using the correct terminology. Since I'm not a C programmer, I have to break the logic down and then figure out the code using the wizards. This is my understanding:
  • 1. The code with the code lines that start with "Internal" load the parameters into the controller and are those that show on the Uapp under "Internal Memory".

    2. Void.loop code lines such as ReefAngel.StandardLights( Port2 ); are loaded into the controller to leave parameters undefined, allowing the user to alter them via the Uapp by changing parameters under the "Internal Memory" section.

    3. Void.loop code lines such as ReefAngel.StandardLights( Port2,12,0,18,0 ); loaded into the controller, hard code the parameters, thereby overriding any parameters that were a) Loaded into the controller with code lines that start with "Internal", and b) Parameters listed in Uapp, even if they have been overwritten from the original.
I'm really guessing at which Uapp parameter matches which line of code as I've seen no cross-walk. For example, the first option in Uapp is "Time Schedule - Turn Lights on at ..../Turn Lights off at ...". Something has to take that parameter and tie it to code that references a port. I don't know what that code is... StandardLights, MHOnHour... something has to link the options in Uapp to the port I want to manipulate, but I can't quite figure out what that is.
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: Code loads per Webwizard but doesn't appear to really lo

Post by rimai »

Yeah. StandardLights will use those settings.
So just change them on uapp. Then, there is no need for internal memory file to be loaded.
Roberto.
jcjrogers
Posts: 66
Joined: Fri May 05, 2017 11:27 am

Re: Code loads per Webwizard but doesn't appear to really lo

Post by jcjrogers »

rimai wrote:Yeah. StandardLights will use those settings.
So just change them on uapp. Then, there is no need for internal memory file to be loaded.
Ok, since I have the Internal File already loaded, I don't need to mess with that. Since the Webwizard doesn't offer any sort of offset as an option, I copied the code generated in Arduino when creating an Offset in the Arduino Wizard. Will this work?
  • ReefAngel.ActinicLights( Port2 ); /// T5's: Port 2 - Manipulate parameters via "Time Schedule - Actinic Offset" in Uapp. The offset values will add/subtract from Port 3 values below.

    ReefAngel.StandardLights( Port3 ); /// Fixture Fans: Port 3 - Manipulate parameters via "Time Schedule - Turn Daylights On/Off" in Uapp. (matches Port 1 LEDs schedule controlled by Bluefish controller).

    ReefAngel.Relay.Set( Port4, !ReefAngel.Relay.Status( Port3 ) ); /// Refugium LED: Port 4 - Opposite Port 3.
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: Code loads per Webwizard but doesn't appear to really lo

Post by rimai »

yeap
Roberto.
jcjrogers
Posts: 66
Joined: Fri May 05, 2017 11:27 am

Re: Code loads per Webwizard but doesn't appear to really lo

Post by jcjrogers »

Thanks!
jcjrogers
Posts: 66
Joined: Fri May 05, 2017 11:27 am

Re: Code loads per Webwizard but doesn't appear to really lo

Post by jcjrogers »

jcjrogers wrote: /// LED lights: Port 1 - Always On (LEDs are controlled by a phone app). Lights on 9:00am, Lights off 9:00pm.
/// T5's: Port 2 - Offset -180 minutes (-3 hours). Generates Lights on 12:00pm, Lights off 6:00pm.
/// Fixture Fans: Port 3 - Time Schedule. Fans on 9:00am, Fans off 9:00pm (matches LED schedule).
/// Refugium LED: Port 4 - Opposite Port 3 (Lights on 9:00pm, Lights off 9:00am.
Ok, I got it coded and updating the Uapp does update the internal memory parameters. However, the values for the "Actinic Offset" in the Uapp are locked to 0-255 minutes, and it doesn't allow a negative number. I can make it work logically, but that requires me to:1) Run my fixture fans as the offset, and 2) Run my Refugium LED as "Opposite" from the "Offset" port. That is a lot more clumsy than the way I described above. My fixture fans need to run any time my Main LEDs or T5s are running. Matching my Main LED on/off time (set with a Bluefish controller) isn't that tough but setting my fixture fans on/off based on a number of minutes greater than the start/end time of my T5s leaves a lot of room for error. Furthermore, any error would also manifest in my refugium LED. Is there a way to allow a negative number in the Actinic Offset field in the Uapp?
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: Code loads per Webwizard but doesn't appear to really lo

Post by rimai »

The logic of the code will not work if you use negative number, I think.
I don't see nothing wrong of using T5 as standardlights and fans as offset.
Roberto.
jcjrogers
Posts: 66
Joined: Fri May 05, 2017 11:27 am

Re: Code loads per Webwizard but doesn't appear to really lo

Post by jcjrogers »

rimai wrote: I don't see nothing wrong of using T5 as standardlights and fans as offset.
I think it will work, it just complicates things. For instance, if I run my main LEDs 9a-9p (time set in Bluefish controller), I have to set my T5s in the center so I can offset my fans to match my LEDs. For instance, I could run my T5s 12:30p-5:30p and create a 210 minute offset, which would run my fans 9:00a-9:00p. If I ever want to change an on/off time for a light, I have to think it through, and a mistake could easily be made. Since my refugium LED runs "Opposite" my fans, I have to think that through as well.

It isn't a huge deal as I can make it work, it just isn't as clean as setting the on/off fan times to match the main LEDs and then creating a negative offset to run the T5s.
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: Code loads per Webwizard but doesn't appear to really lo

Post by rimai »

By looking at the source code, it seems it won't work with negative offset because we declared the offset as byte, which does not allow for a negative number.
https://github.com/reefangel/Libraries/ ... .cpp#L1429
But it is very easy to create your own function.
If you add this to the very end of your code:

Code: Select all

void MyOwnStandardLights(byte Relay, int MinuteOffset)
{
	int onTime=NumMins(InternalMemory.StdLightsOnHour_read(),InternalMemory.StdLightsOnMinute_read())-MinuteOffset;
	int offTime=NumMins(InternalMemory.StdLightsOffHour_read(),InternalMemory.StdLightsOffMinute_read())+MinuteOffset;
	ReefAngel.StandardLights(Relay,
			onTime/60,
			onTime%60,
			offTime/60,
			offTime%60
	);
}
You can call your own function like this:

Code: Select all

MyOwnStandardLights(Port1,-InternalMemory.ActinicOffset_read());
Which will pick up the offset from memory and use it in with negative offset.
Roberto.
jcjrogers
Posts: 66
Joined: Fri May 05, 2017 11:27 am

Re: Code loads per Webwizard but doesn't appear to really lo

Post by jcjrogers »

rimai wrote:By looking at the source code, it seems it won't work with negative offset because we declared the offset as byte, which does not allow for a negative number.
https://github.com/reefangel/Libraries/ ... .cpp#L1429
But it is very easy to create your own function.
If you add this to the very end of your code:

Code: Select all

void MyOwnStandardLights(byte Relay, int MinuteOffset)
{
	int onTime=NumMins(InternalMemory.StdLightsOnHour_read(),InternalMemory.StdLightsOnMinute_read())-MinuteOffset;
	int offTime=NumMins(InternalMemory.StdLightsOffHour_read(),InternalMemory.StdLightsOffMinute_read())+MinuteOffset;
	ReefAngel.StandardLights(Relay,
			onTime/60,
			onTime%60,
			offTime/60,
			offTime%60
	);
}
You can call your own function like this:

Code: Select all

MyOwnStandardLights(Port1,-InternalMemory.ActinicOffset_read());
Which will pick up the offset from memory and use it in with negative offset.
Three words... You 'da MAN!

Thanks!!!
Post Reply