What's going on for forum/portal?

Related to the Portal
Post Reply
modulok
Posts: 166
Joined: Wed Oct 24, 2012 8:37 am

What's going on for forum/portal?

Post by modulok »

When the portal/forum have been down, my controller is going apeshit. Constantly doing a reset, when in turn stops my return & skimmer pump while their ports are delayed. Causing tons of water level fluctuations and loud scary bubbles that scare the fish.

Sunday around 3am it happened, and this morning around 6am until around 1130am EST.

I don't understand why the forum/portal being down would affect the RA, but I need to figure it out so it stops resetting all the time.
Image
User avatar
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

What's going on for forum/portal?

Post by lnevo »

Not sure why thats happening, but i don't recommend delaying your return...can i ask why? For another user we found a good workaround.
modulok
Posts: 166
Joined: Wed Oct 24, 2012 8:37 am

Re: What's going on for forum/portal?

Post by modulok »

I have 3 flow pumps, so I have those start first, to get the levels between the display area and the pump area in the rear. Also after feeding I like the return delayed so food doesn't get sucked into the pump right away.
Image
User avatar
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

What's going on for forum/portal?

Post by lnevo »

I hear ya..and sorry this is off topic. For the return pump, i recommend extending the feed timer to the time you want return pump off for, and then during your feed mode we can kick on the other flow pumps to match what your doing today.

Doesn't help with your issue overall, but would address return pump being down unintentionally.

As far as the apeshit part, can you post your code? Just want to make sure nothing in there would interfere with portal.
modulok
Posts: 166
Joined: Wed Oct 24, 2012 8:37 am

Re: What's going on for forum/portal?

Post by modulok »

No problem going a bit off topic. That would be cool adjusting the feed mode for the return pump.

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 <Salinity.h>
#include <RF.h>
#include <IO.h>
#include <ORP.h>
#include <AI.h>
#include <PH.h>
#include <WaterLevel.h>
#include <ReefAngel.h>

//--------------------------------- Place global variable code below here ---------------------------------
boolean PowerOutage=false; 
boolean DelayedPowerOutage=false;
// Globals for Params on Custom Main
byte x,y;
char text[10];

//--------------------------------- Custom Menu  ---------------------------------
#include <avr/pgmspace.h>
prog_char menu0_label[] PROGMEM = "Turn Lights On";
prog_char menu1_label[] PROGMEM = "Turn Lights Off";
prog_char menu2_label[] PROGMEM = "Start Feeding";
prog_char menu3_label[] PROGMEM = "Start Water Change";
prog_char menu4_label[] PROGMEM = "Clear Overheat";
prog_char menu5_label[] PROGMEM = "Calibrate pH";
prog_char menu6_label[] PROGMEM = "Display Version";
PROGMEM const char *menu_items[] = {
menu0_label, menu1_label, menu2_label, menu3_label, menu4_label, menu5_label, menu6_label  };

void MenuEntry1()
{
ReefAngel.DisplayMenuEntry("Item 1");ReefAngel.Relay.RelayMaskOn = ReefAngel.LightsOnPorts;
#ifdef RelayExp
for ( byte i = 0; i < MAX_RELAY_EXPANSION_MODULES; i++ )
{
    ReefAngel.Relay.RelayMaskOnE[i] = ReefAngel.LightsOnPortsE[i];
}
#endif  // RelayExp
ReefAngel.Relay.Write();

}
void MenuEntry2()
{
ReefAngel.DisplayMenuEntry("Item 2");ReefAngel.Relay.RelayMaskOn = 0;
#ifdef RelayExp
for ( byte i = 0; i < MAX_RELAY_EXPANSION_MODULES; i++ )
{
    ReefAngel.Relay.RelayMaskOnE[i] = 0;
}
#endif  // RelayExp
ReefAngel.Relay.Write();

}
void MenuEntry3()
{
ReefAngel.DisplayMenuEntry("Item 3");ReefAngel.FeedingModeStart();

}
void MenuEntry4()
{
ReefAngel.DisplayMenuEntry("Item 4");ReefAngel.WaterChangeModeStart();

}
void MenuEntry5()
{
ReefAngel.DisplayMenuEntry("Item 5");ReefAngel.OverheatClear();

}
void MenuEntry6()
{
ReefAngel.DisplayMenuEntry("Item 6");ReefAngel.SetupCalibratePH();
ReefAngel.DisplayedMenu = ALT_SCREEN_MODE;

}
void MenuEntry7()
{
ReefAngel.DisplayMenuEntry("Item 7");ReefAngel.DisplayVersion();

}
//--------------------------------- End Custom Menu Globals ---------------------------------
//--------------------------------- Place global variable code above here ---------------------------------
//--------------------------------- Begin Custom Main ---------------------------------
void DrawCustomMain()
{
ReefAngel.LCD.DrawDate(5, 2);
ReefAngel.LCD.Clear(COLOR_BLACK, 1, 11, 132, 11);
pingSerial();

// Display T1 Probe Value
ConvertNumToString(text, ReefAngel.Params.Temp[T1_PROBE], 10);
ReefAngel.LCD.DrawHugeNumbers(COLOR_CRIMSON, 255, 5, 14, text);
pingSerial();

// Display pH Text
ReefAngel.LCD.DrawText(COLOR_INDIGO,255,80,14,"pH");
// Display pH Value
ConvertNumToString(text, ReefAngel.Params.PH, 100);
ReefAngel.LCD.DrawLargeText(COLOR_INDIGO, 255, 95, 14, text, Num8x16);
pingSerial();

// Display T3 Probe Text
ReefAngel.LCD.DrawText(COLOR_ROYALBLUE,255,80,24,"Rm");
// Display T3 Probe Value
ConvertNumToString(text, ReefAngel.Params.Temp[T3_PROBE], 10);
ReefAngel.LCD.DrawLargeText(COLOR_ROYALBLUE, 255, 95, 24, text, Num8x16);
pingSerial();
//Moon Phase
ReefAngel.LCD.Clear(DefaultBGColor,5,88,95,95);
ReefAngel.LCD.DrawText(COLOR_CORNFLOWERBLUE,255,5,88,MoonPhaseLabel());
//Dimmable Moon LEDs
ReefAngel.LCD.DrawText(COLOR_NAVY,255,5,98, "MoonLEDs:");
ReefAngel.LCD.Clear(DefaultBGColor,59,98,75,106);
ReefAngel.LCD.DrawText(COLOR_CORNFLOWERBLUE,255,59,98, ReefAngel.PWM.GetActinicValue());
ReefAngel.LCD.DrawText(COLOR_CORNFLOWERBLUE,255,75,98, "%");
  
// Display Main Relay Box
    byte TempRelay = ReefAngel.Relay.RelayData;
    TempRelay &= ReefAngel.Relay.RelayMaskOff;
    TempRelay |= ReefAngel.Relay.RelayMaskOn;
    ReefAngel.LCD.DrawOutletBox( 2, 107, TempRelay );
    pingSerial();

// Display Expansion Relay Box 1
    TempRelay = ReefAngel.Relay.RelayDataE[0];
    TempRelay &= ReefAngel.Relay.RelayMaskOffE[0];
    TempRelay |= ReefAngel.Relay.RelayMaskOnE[0];
    ReefAngel.LCD.DrawOutletBox( 2, 119, TempRelay );
    pingSerial();

}

void DrawCustomGraph()
{}
//--------------------------------- End Custom Main ---------------------------------
//--------------------------------- Begin Setup ---------------------------------
void setup()
{
    // This must be the first line
    ReefAngel.Init();  //Initialize controller
    // Initialize the menu
    ReefAngel.InitMenu(pgm_read_word(&(menu_items[0])),SIZE(menu_items));
    // Ports toggled in Feeding Mode
    ReefAngel.FeedingModePorts = Port1Bit | Port3Bit | Port4Bit | Port5Bit; //Flow1&3,Return,Skimmer
    ReefAngel.FeedingModePortsE[0] = Port2Bit | Port6Bit; //FrontT5,Heater
    // Ports toggled in Water Change Mode
    ReefAngel.WaterChangePorts = Port1Bit | Port2Bit | Port3Bit | Port4Bit | Port5Bit | Port6Bit; // Flow1-3,Return,Skimmer,DispHeater
    ReefAngel.WaterChangePortsE[0] = Port2Bit | Port3Bit | Port6Bit; //Front+BackT5,SumpHeater
    // Ports toggled when Lights On / Off menu entry selected
    ReefAngel.LightsOnPorts = 0;
    ReefAngel.LightsOnPortsE[0] = Port1Bit | Port2Bit | Port3Bit; //Center+Front+BackT5
    // Ports turned off when Overheat temperature exceeded
    ReefAngel.OverheatShutoffPorts = Port6Bit; //DispHeater
    ReefAngel.OverheatShutoffPortsE[0] = Port2Bit | Port3Bit | Port5Bit | Port6Bit; //Front+BackT5,FugeLight,SumpHeater
    // Use T1 probe as temperature and overheat functions
    ReefAngel.TempProbe = T1_PROBE;
    ReefAngel.OverheatProbe = T1_PROBE;
    // Set the Overheat temperature setting
    InternalMemory.OverheatTemp_write( 825 );
    
    //--------------------------------- Place additional initialization code below here ---------------------------------
    ReefAngel.Timer[1].SetInterval(5);
    //--------------------------------- Place additional initialization code above here ---------------------------------
}
//--------------------------------- End Setup ---------------------------------
//--------------------------------- Begin Loop ---------------------------------
void loop()
{
    // Ports that are always on
    ReefAngel.Relay.On( Port1 ); //Flow1
    ReefAngel.Relay.On( Port2 ); //Flow2
    ReefAngel.Relay.On( Port3 ); //Flow3
    
    // Ports that are delayed on Power Cycle & Feeding & Water Change
    if (PowerOutage && ReefAngel.Relay.IsRelayPresent(EXP1_RELAY))
    {
      PowerOutage=false;
      DelayedPowerOutage=false;
      LastStart=now();
    }
    ReefAngel.Relay.DelayedOn( Port4,4 ); //Return
    ReefAngel.Relay.DelayedOn( Port5,10 ); //Skimmer
    
    // Heaters
    ReefAngel.StandardHeater( Port6,770,774 ); //DispHeater
    ReefAngel.StandardHeater( Box1_Port6,768,772 ); //SumpHeater
//    StandardHeater2( Box1_Port6,768,772 ); //SumpHeater
    
    // T5 Light Schedule
    ReefAngel.StandardLights( Box1_Port1,8,0,20,0 ); //CenterT5 8a-8p
    ReefAngel.StandardLights( Box1_Port2,10,0,18,0 ); //FrontT5 10a-6p
    ReefAngel.StandardLights( Box1_Port3,10,30,18,45 ); //BackT5 1030a-645p
    
    // RSMLED Moonlight Schedule
    if (hour()>=6 && hour()<=8) ReefAngel.StandardLights( Box1_Port4,6,0,7,59 ); //RSMLED Morning 6a-8a
    else if(hour()>=20 && hour()<=23) ReefAngel.StandardLights( Box1_Port4,20,0,23,45 ); //RSMLED Evening 8p-1145p
    else if(hour()>=23 || hour()<=4) if (MoonPhase()>=69) ReefAngel.StandardLights( Box1_Port4,23,46,4,0 ); //RSMLED on for Full Moon 10p-4a
    
    // Fuge Light Schedule
    ReefAngel.StandardLights( Box1_Port5,0,0,8,0 ); //FugeLight 12a-8a
    
    // PWM Dimmable Moonlights Schedule
    if (hour()>=21 || hour()<4) // Turn Dimmable Moonlights on 9p & off 4a
    {
      ReefAngel.PWM.SetActinic(MoonPhase());
      ReefAngel.PWM.SetDaylight(MoonPhase());
    }
    else
    {
      ReefAngel.PWM.SetActinic(0);
      ReefAngel.PWM.SetDaylight(0);
    }
    
    //--------------------------------- Place your custom code below here ---------------------------------
    // Turn on Fuge light during water change mode
    if (ReefAngel.DisplayedMenu==WATERCHANGE_MODE) ReefAngel.Relay.On(Box1_Port5);
    // Power Outage - Only Flow2 port on
    if (!ReefAngel.Relay.IsRelayPresent(EXP1_RELAY)) PowerOutage=true; //Exp1 Relay NOT present
    if (!PowerOutage)
    { 
      ReefAngel.Timer[1].Start();
    } 
    if (ReefAngel.Timer[1].IsTriggered())
    { 
      DelayedPowerOutage=true;
    }
    if (DelayedPowerOutage)
    {
    ReefAngel.Relay.Off (Port1); //Flow1
    ReefAngel.Relay.Off (Port3); //Flow3
    ReefAngel.Relay.Off (Port4); //Return
    ReefAngel.Relay.Off (Port5); //Skimmer
    ReefAngel.Relay.Off (Port6); //Heater
    }
    
    // Skimmer off when Return pump is off.
    if (bitRead(ReefAngel.Relay.RelayMaskOff,3)==0) //Return
    {
        bitClear(ReefAngel.Relay.RelayMaskOff,4); //Skimmer
    }
    
    //////////// Place your custom code above here //////////// 

    // This should always be the last line
    ReefAngel.Portal( "modulok" );
    ReefAngel.ShowInterface();
}
//--------------------------------- End Loop ---------------------------------

/* // Sump Heater Use Sump Temp Probe
void StandardHeater2(byte HeaterRelay, int LowTemp, int HighTemp)
{
    if (ReefAngel.Params.Temp[T2_PROBE] == 0) return;  // Don't turn the heater on if the temp is reading 0
    if (ReefAngel.Params.Temp[T2_PROBE] <= LowTemp && ReefAngel.Params.Temp[T2_PROBE] > 0) ReefAngel.Relay.On(HeaterRelay);  // If sensor temperature <= LowTemp - turn on heater
    if (ReefAngel.Params.Temp[T2_PROBE] >= HighTemp) ReefAngel.Relay.Off(HeaterRelay);  // If sensor temperature >= HighTemp - turn off heater
}*/
Image
User avatar
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

Re: What's going on for forum/portal?

Post by lnevo »

Nothing obvious why portal being down would make the thing go crazy... unless some setting on the wifi module.

I'll try and post some code to change the return pumps to non-delay and the flow to start before feeding timer ends so you at least won't lose your return pump in the future...
modulok
Posts: 166
Joined: Wed Oct 24, 2012 8:37 am

Re: What's going on for forum/portal?

Post by modulok »

Cool thanks.

It's definitely doing a full reset, because I changed the return port to ON from auto and it still was stopping. I could do a test later tonight and see if killing my modem or the RA wifi unit kicks a reset in motion.
Image
User avatar
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

What's going on for forum/portal?

Post by lnevo »

Here's the relevant code I added. I found a bug that was in Paul's code, so you should be good to go. It will currently turn your pumps back on 4 minutes before the feeding timer ends. You can increase your feeding timer 4 minutes to compensate if you like.

Code: Select all

    ReefAngel.Relay.On( Port4 ); //Return

    //Feed Mode Delay on Pump
    static boolean feeding=false;
    static unsigned long feedingstarted = now();
    if (ReefAngel.DisplayedMenu==FEEDING_MODE)
    {
      if (!feeding)
      {
      feeding=true;
      feedingstarted = now();
      }
    } else {
      feeding=false;
    }

    int pumpdelay=InternalMemory.FeedingTimer_read()-240; // 4 minute delay
    if (now()-feedingstarted<=pumpdelay) {
      ReefAngel.Relay.Off( Port1 ); //Flow1
      //ReefAngel.Relay.Off( Port2 ); //Flow2
      ReefAngel.Relay.Off( Port3 ); //Flow3
    }
  
Here's your full ino with the changes made and changes to feeding ports as well.

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 <Salinity.h>
#include <RF.h>
#include <IO.h>
#include <ORP.h>
#include <AI.h>
#include <PH.h>
#include <WaterLevel.h>
#include <ReefAngel.h>

//--------------------------------- Place global variable code below here ---------------------------------
boolean PowerOutage=false; 
boolean DelayedPowerOutage=false;
// Globals for Params on Custom Main
byte x,y;
char text[10];

//--------------------------------- Custom Menu  ---------------------------------
#include <avr/pgmspace.h>
prog_char menu0_label[] PROGMEM = "Turn Lights On";
prog_char menu1_label[] PROGMEM = "Turn Lights Off";
prog_char menu2_label[] PROGMEM = "Start Feeding";
prog_char menu3_label[] PROGMEM = "Start Water Change";
prog_char menu4_label[] PROGMEM = "Clear Overheat";
prog_char menu5_label[] PROGMEM = "Calibrate pH";
prog_char menu6_label[] PROGMEM = "Display Version";
PROGMEM const char *menu_items[] = {
menu0_label, menu1_label, menu2_label, menu3_label, menu4_label, menu5_label, menu6_label  };

void MenuEntry1()
{
ReefAngel.DisplayMenuEntry("Item 1");ReefAngel.Relay.RelayMaskOn = ReefAngel.LightsOnPorts;
#ifdef RelayExp
for ( byte i = 0; i < MAX_RELAY_EXPANSION_MODULES; i++ )
{
    ReefAngel.Relay.RelayMaskOnE[i] = ReefAngel.LightsOnPortsE[i];
}
#endif  // RelayExp
ReefAngel.Relay.Write();

}
void MenuEntry2()
{
ReefAngel.DisplayMenuEntry("Item 2");ReefAngel.Relay.RelayMaskOn = 0;
#ifdef RelayExp
for ( byte i = 0; i < MAX_RELAY_EXPANSION_MODULES; i++ )
{
    ReefAngel.Relay.RelayMaskOnE[i] = 0;
}
#endif  // RelayExp
ReefAngel.Relay.Write();

}
void MenuEntry3()
{
ReefAngel.DisplayMenuEntry("Item 3");ReefAngel.FeedingModeStart();

}
void MenuEntry4()
{
ReefAngel.DisplayMenuEntry("Item 4");ReefAngel.WaterChangeModeStart();

}
void MenuEntry5()
{
ReefAngel.DisplayMenuEntry("Item 5");ReefAngel.OverheatClear();

}
void MenuEntry6()
{
ReefAngel.DisplayMenuEntry("Item 6");ReefAngel.SetupCalibratePH();
ReefAngel.DisplayedMenu = ALT_SCREEN_MODE;

}
void MenuEntry7()
{
ReefAngel.DisplayMenuEntry("Item 7");ReefAngel.DisplayVersion();

}
//--------------------------------- End Custom Menu Globals ---------------------------------
//--------------------------------- Place global variable code above here ---------------------------------
//--------------------------------- Begin Custom Main ---------------------------------
void DrawCustomMain()
{
ReefAngel.LCD.DrawDate(5, 2);
ReefAngel.LCD.Clear(COLOR_BLACK, 1, 11, 132, 11);
pingSerial();

// Display T1 Probe Value
ConvertNumToString(text, ReefAngel.Params.Temp[T1_PROBE], 10);
ReefAngel.LCD.DrawHugeNumbers(COLOR_CRIMSON, 255, 5, 14, text);
pingSerial();

// Display pH Text
ReefAngel.LCD.DrawText(COLOR_INDIGO,255,80,14,"pH");
// Display pH Value
ConvertNumToString(text, ReefAngel.Params.PH, 100);
ReefAngel.LCD.DrawLargeText(COLOR_INDIGO, 255, 95, 14, text, Num8x16);
pingSerial();

// Display T3 Probe Text
ReefAngel.LCD.DrawText(COLOR_ROYALBLUE,255,80,24,"Rm");
// Display T3 Probe Value
ConvertNumToString(text, ReefAngel.Params.Temp[T3_PROBE], 10);
ReefAngel.LCD.DrawLargeText(COLOR_ROYALBLUE, 255, 95, 24, text, Num8x16);
pingSerial();
//Moon Phase
ReefAngel.LCD.Clear(DefaultBGColor,5,88,95,95);
ReefAngel.LCD.DrawText(COLOR_CORNFLOWERBLUE,255,5,88,MoonPhaseLabel());
//Dimmable Moon LEDs
ReefAngel.LCD.DrawText(COLOR_NAVY,255,5,98, "MoonLEDs:");
ReefAngel.LCD.Clear(DefaultBGColor,59,98,75,106);
ReefAngel.LCD.DrawText(COLOR_CORNFLOWERBLUE,255,59,98, ReefAngel.PWM.GetActinicValue());
ReefAngel.LCD.DrawText(COLOR_CORNFLOWERBLUE,255,75,98, "%");
  
// Display Main Relay Box
    byte TempRelay = ReefAngel.Relay.RelayData;
    TempRelay &= ReefAngel.Relay.RelayMaskOff;
    TempRelay |= ReefAngel.Relay.RelayMaskOn;
    ReefAngel.LCD.DrawOutletBox( 2, 107, TempRelay );
    pingSerial();

// Display Expansion Relay Box 1
    TempRelay = ReefAngel.Relay.RelayDataE[0];
    TempRelay &= ReefAngel.Relay.RelayMaskOffE[0];
    TempRelay |= ReefAngel.Relay.RelayMaskOnE[0];
    ReefAngel.LCD.DrawOutletBox( 2, 119, TempRelay );
    pingSerial();

}

void DrawCustomGraph()
{}
//--------------------------------- End Custom Main ---------------------------------
//--------------------------------- Begin Setup ---------------------------------
void setup()
{
    // This must be the first line
    ReefAngel.Init();  //Initialize controller
    // Initialize the menu
    ReefAngel.InitMenu(pgm_read_word(&(menu_items[0])),SIZE(menu_items));
    // Ports toggled in Feeding Mode
    ReefAngel.FeedingModePorts = Port4Bit | Port5Bit; // Return,Skimmer
    ReefAngel.FeedingModePortsE[0] = Port2Bit | Port6Bit; //FrontT5,Heater
    // Ports toggled in Water Change Mode
    ReefAngel.WaterChangePorts = Port1Bit | Port2Bit | Port3Bit | Port4Bit | Port5Bit | Port6Bit; // Flow1-3,Return,Skimmer,DispHeater
    ReefAngel.WaterChangePortsE[0] = Port2Bit | Port3Bit | Port6Bit; //Front+BackT5,SumpHeater
    // Ports toggled when Lights On / Off menu entry selected
    ReefAngel.LightsOnPorts = 0;
    ReefAngel.LightsOnPortsE[0] = Port1Bit | Port2Bit | Port3Bit; //Center+Front+BackT5
    // Ports turned off when Overheat temperature exceeded
    ReefAngel.OverheatShutoffPorts = Port6Bit; //DispHeater
    ReefAngel.OverheatShutoffPortsE[0] = Port2Bit | Port3Bit | Port5Bit | Port6Bit; //Front+BackT5,FugeLight,SumpHeater
    // Use T1 probe as temperature and overheat functions
    ReefAngel.TempProbe = T1_PROBE;
    ReefAngel.OverheatProbe = T1_PROBE;
    // Set the Overheat temperature setting
    InternalMemory.OverheatTemp_write( 825 );
    
    //--------------------------------- Place additional initialization code below here ---------------------------------
    ReefAngel.Timer[1].SetInterval(5);
    //--------------------------------- Place additional initialization code above here ---------------------------------
}
//--------------------------------- End Setup ---------------------------------
//--------------------------------- Begin Loop ---------------------------------
void loop()
{
    // Ports that are always on
    ReefAngel.Relay.On( Port1 ); //Flow1
    ReefAngel.Relay.On( Port2 ); //Flow2
    ReefAngel.Relay.On( Port3 ); //Flow3
    ReefAngel.Relay.On( Port4 ); //Return

    //Feed Mode Delay on Pump
    static boolean feeding=false;
    static unsigned long feedingstarted = now();
    if (ReefAngel.DisplayedMenu==FEEDING_MODE)
    {
      if (!feeding)
      {
      feeding=true;
      feedingstarted = now();
      }
    } else {
      feeding=false;
    }

    int pumpdelay=InternalMemory.FeedingTimer_read()-240; // 4 minute delay
    if (now()-feedingstarted<=pumpdelay) {
      ReefAngel.Relay.Off( Port1 ); //Flow1
      //ReefAngel.Relay.Off( Port2 ); //Flow2
      ReefAngel.Relay.Off( Port3 ); //Flow3
    }
    
    // Ports that are delayed on Power Cycle & Feeding & Water Change
    if (PowerOutage && ReefAngel.Relay.IsRelayPresent(EXP1_RELAY))
    {
      PowerOutage=false;
      DelayedPowerOutage=false;
      LastStart=now();
    }
    ReefAngel.Relay.DelayedOn( Port5,10 ); //Skimmer
    
    // Heaters
    ReefAngel.StandardHeater( Port6,770,774 ); //DispHeater
    ReefAngel.StandardHeater( Box1_Port6,768,772 ); //SumpHeater
//    StandardHeater2( Box1_Port6,768,772 ); //SumpHeater
    
    // T5 Light Schedule
    ReefAngel.StandardLights( Box1_Port1,8,0,20,0 ); //CenterT5 8a-8p
    ReefAngel.StandardLights( Box1_Port2,10,0,18,0 ); //FrontT5 10a-6p
    ReefAngel.StandardLights( Box1_Port3,10,30,18,45 ); //BackT5 1030a-645p
    
    // RSMLED Moonlight Schedule
    if (hour()>=6 && hour()<=8) ReefAngel.StandardLights( Box1_Port4,6,0,7,59 ); //RSMLED Morning 6a-8a
    else if(hour()>=20 && hour()<=23) ReefAngel.StandardLights( Box1_Port4,20,0,23,45 ); //RSMLED Evening 8p-1145p
    else if(hour()>=23 || hour()<=4) if (MoonPhase()>=69) ReefAngel.StandardLights( Box1_Port4,23,46,4,0 ); //RSMLED on for Full Moon 10p-4a
    
    // Fuge Light Schedule
    ReefAngel.StandardLights( Box1_Port5,0,0,8,0 ); //FugeLight 12a-8a
    
    // PWM Dimmable Moonlights Schedule
    if (hour()>=21 || hour()<4) // Turn Dimmable Moonlights on 9p & off 4a
    {
      ReefAngel.PWM.SetActinic(MoonPhase());
      ReefAngel.PWM.SetDaylight(MoonPhase());
    }
    else
    {
      ReefAngel.PWM.SetActinic(0);
      ReefAngel.PWM.SetDaylight(0);
    }
    
    //--------------------------------- Place your custom code below here ---------------------------------
    // Turn on Fuge light during water change mode
    if (ReefAngel.DisplayedMenu==WATERCHANGE_MODE) ReefAngel.Relay.On(Box1_Port5);
    // Power Outage - Only Flow2 port on
    if (!ReefAngel.Relay.IsRelayPresent(EXP1_RELAY)) PowerOutage=true; //Exp1 Relay NOT present
    if (!PowerOutage)
    { 
      ReefAngel.Timer[1].Start();
    } 
    if (ReefAngel.Timer[1].IsTriggered())
    { 
      DelayedPowerOutage=true;
    }
    if (DelayedPowerOutage)
    {
    ReefAngel.Relay.Off (Port1); //Flow1
    ReefAngel.Relay.Off (Port3); //Flow3
    ReefAngel.Relay.Off (Port4); //Return
    ReefAngel.Relay.Off (Port5); //Skimmer
    ReefAngel.Relay.Off (Port6); //Heater
    }
    
    // Skimmer off when Return pump is off.
    if (bitRead(ReefAngel.Relay.RelayMaskOff,3)==0) //Return
    {
        bitClear(ReefAngel.Relay.RelayMaskOff,4); //Skimmer
    }
    
    //////////// Place your custom code above here //////////// 

    // This should always be the last line
    ReefAngel.Portal( "modulok" );
    ReefAngel.ShowInterface();
}
//--------------------------------- End Loop ---------------------------------

/* // Sump Heater Use Sump Temp Probe
void StandardHeater2(byte HeaterRelay, int LowTemp, int HighTemp)
{
    if (ReefAngel.Params.Temp[T2_PROBE] == 0) return;  // Don't turn the heater on if the temp is reading 0
    if (ReefAngel.Params.Temp[T2_PROBE] <= LowTemp && ReefAngel.Params.Temp[T2_PROBE] > 0) ReefAngel.Relay.On(HeaterRelay);  // If sensor temperature <= LowTemp - turn on heater
    if (ReefAngel.Params.Temp[T2_PROBE] >= HighTemp) ReefAngel.Relay.Off(HeaterRelay);  // If sensor temperature >= HighTemp - turn off heater
}*/
 
modulok
Posts: 166
Joined: Wed Oct 24, 2012 8:37 am

Re: What's going on for forum/portal?

Post by modulok »

That's awesome Lee. Thanks so much for the code. I will hopefully be able to try it tomorrow night, I don't feel like playing with code at this hour of the night.
Image
modulok
Posts: 166
Joined: Wed Oct 24, 2012 8:37 am

Re: What's going on for forum/portal?

Post by modulok »

Ok I finally got a chance to add the code. Only problem is flow 1 and 3 don't start up right away.

Sent from my mobile communication device
Image
User avatar
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

What's going on for forum/portal?

Post by lnevo »

Change the declaration for the static boolean feeding to true instead of false and the default for feedingstarted to 0 instead of now().

That way it wont default to feeding mode when it starts up.
modulok
Posts: 166
Joined: Wed Oct 24, 2012 8:37 am

Re: What's going on for forum/portal?

Post by modulok »

OK, that is working well now. Thanks for the help!

I am guessing I was the only one to have the issue of the forum being down and my RA resetting itself. Or the forum has been up for the last few weeks without being down.
Image
enigma32
Posts: 74
Joined: Fri Apr 26, 2013 11:48 am
Location: Los Angeles and NYC

Re: What's going on for forum/portal?

Post by enigma32 »

I haven't seen the forum down...
I did experience an issue where the RA reset itself when the wifi module was *disconnected* from the unit; probably is related to what you experienced.
I'm guessing it was the watchdog timer causing this to happen, but I didn't see anywhere in the code that should lead to this condition.
Current setup:
60g 24" custom cube (fish and softies right now)
AI Sol Blue, Ecotech MP-10wES
Coralife skimmer
100% customer controller, transitioning to ReefAngel
User avatar
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

What's going on for forum/portal?

Post by lnevo »

There was a day where the portal was down for a little while...otherwise quite stable (knock on wood)
Post Reply