Page 3 of 3

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

PostPosted: Wed May 24, 2017 9:51 pm
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.

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

PostPosted: Thu May 25, 2017 12:12 am
by rimai
yeap

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

PostPosted: Thu May 25, 2017 5:02 pm
by jcjrogers
Thanks!

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

PostPosted: Tue May 30, 2017 3:54 pm
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?

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

PostPosted: Tue May 30, 2017 6:56 pm
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.

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

PostPosted: Tue May 30, 2017 9:11 pm
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.

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

PostPosted: Tue May 30, 2017 10:35 pm
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.

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

PostPosted: Wed May 31, 2017 11:23 am
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!!!