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

Basic / Standard Reef Angel hardware
Post Reply
jcjrogers
Posts: 66
Joined: Fri May 05, 2017 11:27 am

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

Post by jcjrogers »

I decided to move this to its own thread. I've run some code via the Webwizard, saving to internal memory. When I upload, the program compiles and tells me that it loaded. I'm using the USB-TTL cable, plugged into the first 6 pins, (starting from the right), with the black wire plugged into the first pin (on the right). The red Status light on the controller shimmers while loading and then the small screen on the controller goes back to the initial screen with T1, T2, T3, pH, etc. once completed. However, my temperature parameters, lights on/off times, etc. don't match the parameters from the code I've loaded. It also doesn't recognize that I have multiple lights and multiple heaters. When I go to the Uapp and Portal, I get the same things that are showing on the controller's screen (again, not what I loaded). If I click a relay on the Portal, I get the message, Only available with valid wifi address. Please make sure your controller is sending data to the Portal web server. If I click on a relay in the Uapp, it times out.

This is what the Portal shows regarding my connection:

Reef Angel wifi address: 75.66.121.57:2000
My reefangelid: jcjrogers
Connection Status: Unreachable Address

Last Update: 5/18/2017, 10:41:38 PM
Displaying data from: Webbanner database


I really am connected because the temperature and pH readings are following what the controller's screen shows, though the pH is bogus because there is no probe plugged-in.
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 web wizard unfortunately will not create a internal memory file to load into your controller.
If you use the wizard on the Arduino IDE, you will get that file.
It basically updates the memory settings and does nothing else.
Then you will need to upload your code. It's a 2 upload process.
So, if you are exclusively using the web wizard, you will need to manually upload this code or simply go to uapp and change the settings.
The portal is not capable of using the cloud server. It needs port forwarding setup on your router to allow access to your controller.
The web based uapp on the other hand, allows you to do that.
http://forum.reefangel.com/uapp/
The uapp for iOS needs an update to connect to the cloud server. It was released before we put the server online.
I'm waiting for more feedback to make sure everything is working before I push the update to the apple store.
So, if you don't want to setup port forwarding, just use the web based one linked above.
Roberto.
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 »

Oh, i forgot to mentioned where the internal memory code is.
If you open Arduino, it will be on the example folder.
If you didn't install it, here it is:

Code: Select all

#include <ReefAngel_Features.h>
#include <Globals.h>
#include <RA_Wifi.h>
#include <Wire.h>
#include <OneWire.h>
#include <Time.h>
#include <DS1307RTC.h>
#include <InternalEEPROM.h>
#include <RA_NokiaLCD.h>
#include <RA_ATO.h>
#include <RA_Joystick.h>
#include <LED.h>
#include <RA_TempSensor.h>
#include <Relay.h>
#include <RA_PWM.h>
#include <Timer.h>
#include <Memory.h>
#include <InternalEEPROM.h>
#include <RA_Colors.h>
#include <RA_CustomColors.h>
#include <AI.h>
#include <RF.h>
#include <IO.h>
#include <ORP.h>
#include <Salinity.h>
#include <PH.h>
#include <WaterLevel.h>
#include <ReefAngel.h>

void setup()
{
    InternalMemory.MHOnHour_write(15);
    InternalMemory.MHOnMinute_write(30);
    InternalMemory.MHOffHour_write(21);
    InternalMemory.MHOffMinute_write(0);
    InternalMemory.MHDelay_write(7);
    InternalMemory.StdLightsOnHour_write(14);
    InternalMemory.StdLightsOnMinute_write(0);
    InternalMemory.StdLightsOffHour_write(21);
    InternalMemory.StdLightsOffMinute_write(30);
    InternalMemory.DP1OnHour_write(20);
    InternalMemory.DP1OnMinute_write(0);
    InternalMemory.DP2OnHour_write(22);
    InternalMemory.DP2OnMinute_write(30);
    InternalMemory.DP1Timer_write(4);
    InternalMemory.DP2Timer_write(4);
    InternalMemory.DP1RepeatInterval_write(60);
    InternalMemory.DP2RepeatInterval_write(60);
    InternalMemory.ATOHourInterval_write(0);
    InternalMemory.FeedingTimer_write(900);
    InternalMemory.LCDTimer_write(600);
    InternalMemory.LEDPWMActinic_write(20);
    InternalMemory.LEDPWMDaylight_write(20);
    InternalMemory.WM1Timer_write(10);
    InternalMemory.WM2Timer_write(15);
    InternalMemory.HeaterTempOn_write(766);
    InternalMemory.HeaterTempOff_write(770);
    InternalMemory.ChillerTempOn_write(774);
    InternalMemory.ChillerTempOff_write(770);
    InternalMemory.OverheatTemp_write(1500);
    InternalMemory.PHMax_write(830);
    InternalMemory.PHMin_write(540);
    InternalMemory.SalMax_write(2550);
    InternalMemory.ORPMax_write(285);
    InternalMemory.ORPMin_write(1400);    
    InternalMemory.RFMode_write(Constant);
    InternalMemory.RFSpeed_write(50);
    InternalMemory.RFDuration_write(8);
    InternalMemory.RFDuration_write(8);
    InternalMemory.PWMSlopeStartD_write(15);
    InternalMemory.PWMSlopeEndD_write(100);
    InternalMemory.PWMSlopeDurationD_write(60);
    InternalMemory.PWMSlopeStartA_write(15);
    InternalMemory.PWMSlopeEndA_write(100);
    InternalMemory.PWMSlopeDurationA_write(60);
    InternalMemory.PWMSlopeStart0_write(15);
    InternalMemory.PWMSlopeEnd0_write(100);
    InternalMemory.PWMSlopeDuration0_write(60);
    InternalMemory.PWMSlopeStart1_write(15);
    InternalMemory.PWMSlopeEnd1_write(100);
    InternalMemory.PWMSlopeDuration1_write(60);
    InternalMemory.PWMSlopeStart2_write(15);
    InternalMemory.PWMSlopeEnd2_write(100);
    InternalMemory.PWMSlopeDuration2_write(60);
    InternalMemory.PWMSlopeStart3_write(15);
    InternalMemory.PWMSlopeEnd3_write(100);
    InternalMemory.PWMSlopeDuration3_write(60);
    InternalMemory.PWMSlopeStart4_write(15);
    InternalMemory.PWMSlopeEnd4_write(100);
    InternalMemory.PWMSlopeDuration4_write(60);
    InternalMemory.PWMSlopeStart5_write(15);
    InternalMemory.PWMSlopeEnd5_write(100);
    InternalMemory.PWMSlopeDuration5_write(60);
    InternalMemory.ATOExtendedTimeout_write(120);
    InternalMemory.ORPMin_write(2050);
    InternalMemory.ORPMax_write(450);
    InternalMemory.ActinicOffset_write(30);
    InternalMemory.CO2ControlOn_write(770);
    InternalMemory.CO2ControlOff_write(760);
    InternalMemory.PHControlOn_write(800);
    InternalMemory.PHControlOff_write(810);
    InternalMemory.AISlopeStartW_write(0);
    InternalMemory.AISlopeEndW_write(100);
    InternalMemory.AISlopeDurationW_write(60);
    InternalMemory.AISlopeStartB_write(0);
    InternalMemory.AISlopeEndB_write(100);
    InternalMemory.AISlopeDurationB_write(60);
    InternalMemory.AISlopeStartRB_write(0);
    InternalMemory.AISlopeEndRB_write(100);
    InternalMemory.AISlopeDurationRB_write(60);
    InternalMemory.RadionSlopeStartW_write(0);
    InternalMemory.RadionSlopeEndW_write(100);
    InternalMemory.RadionSlopeDurationW_write(60);
    InternalMemory.RadionSlopeStartRB_write(0);
    InternalMemory.RadionSlopeEndRB_write(100);
    InternalMemory.RadionSlopeDurationRB_write(60);
    InternalMemory.RadionSlopeStartR_write(0);
    InternalMemory.RadionSlopeEndR_write(100);
    InternalMemory.RadionSlopeDurationR_write(60);
    InternalMemory.RadionSlopeStartG_write(0);
    InternalMemory.RadionSlopeEndG_write(100);
    InternalMemory.RadionSlopeDurationG_write(60);
    InternalMemory.RadionSlopeStartB_write(0);
    InternalMemory.RadionSlopeEndB_write(100);
    InternalMemory.RadionSlopeDurationB_write(60);
    InternalMemory.RadionSlopeStartI_write(0);
    InternalMemory.RadionSlopeEndI_write(100);
    InternalMemory.RadionSlopeDurationI_write(60);
    InternalMemory.DelayedStart_write(7);
    InternalMemory.PHExpMax_write(2500);
    InternalMemory.PHExpMin_write(500);
    InternalMemory.WaterLevelMax_write(1300);
    InternalMemory.WaterLevelMin_write(900);
    InternalMemory.SalTempComp_write(750);
    InternalMemory.WaterLevelLow_write(60);
    InternalMemory.WaterLevelHigh_write(65);
    InternalMemory.DP3Timer_write(4);
    InternalMemory.DP3RepeatInterval_write(60);
    InternalMemory.DCPumpMode_write(0);
    InternalMemory.DCPumpSpeed_write(50);
    InternalMemory.DCPumpDuration_write(50);
    InternalMemory.WaterLevel1Max_write(1900);
    InternalMemory.WaterLevel1Min_write(590);
    InternalMemory.WaterLevel2Max_write(1900);
    InternalMemory.WaterLevel2Min_write(590);
    InternalMemory.WaterLevel3Max_write(1900);
    InternalMemory.WaterLevel3Min_write(590);
    InternalMemory.WaterLevel4Max_write(1900);
    InternalMemory.WaterLevel4Min_write(590);

    InternalMemory.IMCheck_write(0xCF06A31E);
    ReefAngel.Init();
    ReefAngel.LCD.DrawText(COLOR_BLACK, COLOR_WHITE, MENU_START_COL+20, MENU_START_ROW*3, "Memory Updated");
    ReefAngel.LCD.DrawText(COLOR_BLACK, COLOR_WHITE, MENU_START_COL+25, MENU_START_ROW*6, "You can now");
    ReefAngel.LCD.DrawText(COLOR_BLACK, COLOR_WHITE, MENU_START_COL+25, MENU_START_ROW*7, "upload your");
    ReefAngel.LCD.DrawText(COLOR_BLACK, COLOR_WHITE, MENU_START_COL+33, MENU_START_ROW*8, "INO code") ;
}

void loop()
{
  wdt_reset();
}
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, I copy/pasted that into Arduino, compiled and uploaded. I then created code to internal memory in Webwizard, generated, and loaded. I pretty much ended up where I started but I think I realize part of the error...

I have to manually load the internal memory code, meaning I have to copy/paste from the Webwizard into Arduino. I tried that but there are errors, apparently because the internal memory code doesn't use the same nomenclature. For instance, internal memory uses "HeaterTempOn", where the file I created uses "StandardHeater1". The internal memory code also doesn't have "CloudPortal". Is it as simple as editing/adding those things to the internal memory code and re-loading both or am I totally out in left-field?

Maybe what you are saying is that I have to use the Wizard from Arduino. This might make the most sense, but that Wizard doesn't include a selection for Cloud Wifi.

Sorry, I feel like I'm an inch away from getting it, but I can't get past that inch.
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 »

You can use the code I posted on the webwizard too.
It is just the internal memory code.
It doesn't do anything else but setting the memory settings.
You will see that the screen will say "Memory Updated. You can load your INO code" after you uploaded it.
Then you can upload your normal code.
If this is too confusing and you are getting lost, just forget about this internal memory code and just update the settings using the head unit or the web based uapp. They will all do the same thing. Change the internal memory settings.
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, I got the Internal Memory code posted and then went through the Arduino Wizard and added to Internal Memory. It doesn't update the parameters either, but it also doesn't include Cloud Wifi. I tried adding ReefAngel.CloudPortal(); to the void loop code, but it didn't recognize and wouldn't complete compiling. I don't mind adding parameters manually, but what I can't get my head around is how to get the listings for those parameters I want to add into memory. For instance, I have set up 3 Time schedules-- main lights, main light fans, and refugium light. However, the Uapp only gives me 1 Time schedule to edit. I have two heaters set-up, but the Uapp only gives me one heater to edit. How do I tell Uapp I have set up 3 Time schedules and two heaters? I have the same issue with the screen on the controller. I can make it show me 4 water levels for my multi-channel water level expansion, but I can't make it show more than 1 light or 1 heater to change parameters for.
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 »

There is no way.
You will need to either create your own function or hard code the settings.
It will only have 1 schedule and 1 heater settings in the apps or portal.
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:There is no way.
You will need to either create your own function or hard code the settings.
It will only have 1 schedule and 1 heater settings in the apps or portal.
So if I alter the time setting in Uapp, which time setting does it really alter-- the one assigned to Port 2, the one assigned to Port 3, the one assigned to Port 4, or all of them? All three are StandardLights in the code.

Also, what do you mean by, "Create your own 'function'?" I don't know where these functions are coming from. It looked to me like they were coming from the InternalMemory lines, possibly allowing something like:
InternalMemory.StdLightsOnHour1_write(9);
InternalMemory.StdLightsOnMinute1_write(0);
InternalMemory.StdLightsOnHour2_write(22);
InternalMemory.StdLightsOnMinute2_write(0);
InternalMemory.StdLightsOffHour1_write(21);
InternalMemory.StdLightsOffMinute1_write(0)
InternalMemory.StdLightsOffHour2_write(8);
InternalMemory.StdLightsOffMinute2_write(0)
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 »

If they are all StandardLights , all of them are going to use those settings.
In order to create your own function, you have to actually code your own function.
Here is what the StandardLights function looks like in the background:
https://github.com/reefangel/Libraries/ ... l.cpp#L967
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:If they are all StandardLights , all of them are going to use those settings.
In order to create your own function, you have to actually code your own function.
Here is what the StandardLights function looks like in the background:
https://github.com/reefangel/Libraries/ ... l.cpp#L967
Ok... I'm with you now. When you use the Webwizard, everything that uses a timer is StandardLights... at least what I've done with no delays or offsets. Unfortunately, I'm waaaayyy better with logic than I am with coding. Now, with this new knowledge, there is probably a logical answer to my riddle:

/// 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 - Time Schedule. Lights on 11:30am, Lights off 5:30pm.
/// Fixture Fans: Port 3 - Time Schedule. Fans on 9:00am, Fans off 9:00pm (matches LED schedule).
/// Refugium LED: Port 4 - Time Schedule. Lights on 10:00pm, Lights off 8:00am.

Hence, I have 3 schedules and 3 inputs (Daylights on/off, Delayed Start, and Actinic Offset). It looks like I should be able to make it work, but I don't really know what Delayed Start and Actinic Offset do. I also don't know how these tie back to ports.

The heater issue is solved because I don't plan to ever use one high/low temperature for one heater and another high/low temperature for the other heater.
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