Feed and water change not working

Do you have a question on how to do something.
Ask in here.
Post Reply
slm222
Posts: 105
Joined: Wed Nov 18, 2015 9:16 pm

Feed and water change not working

Post by slm222 »

Good morning all,
I added a custom wave function I found on the site, its working great but since I changed it my water change/feed mode is not turning off the jebao wavemakers. Could someone please let me know where I went wrong?

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 <Humidity.h>
#include <DCPump.h>
#include <PAR.h>
#include <ReefAngel.h>

////// Place global variable code below here



////// Place global variable code above here


void setup()
{
    // This must be the first line
    ReefAngel.Init();  //Initialize controller
    ReefAngel.AddStandardMenu();  // Add Standard Menu

    ReefAngel.Use2014Screen();  // Let's use 2014 Screen 
    // Ports toggled in Feeding Mode
    ReefAngel.FeedingModePorts = Port2Bit | Port8Bit;
    // Ports toggled in Water Change Mode
    ReefAngel.WaterChangePorts = Port2Bit | Port8Bit;
    // Ports toggled when Lights On / Off menu entry selected
    ReefAngel.LightsOnPorts = 0;
    // Ports turned off when Overheat temperature exceeded
    ReefAngel.OverheatShutoffPorts = Port4Bit;
    // Use T1 probe as temperature and overheat functions
    ReefAngel.TempProbe = T1_PROBE;
    ReefAngel.OverheatProbe = T1_PROBE;
    // Set the Overheat temperature setting
    InternalMemory.OverheatTemp_write( 830 );


    // Feeeding and Water Change mode speed
    ReefAngel.DCPump.FeedingSpeed=0;
    ReefAngel.DCPump.WaterChangeSpeed=0;


    // Ports that are always on
    ReefAngel.Relay.On( Port6 );
    ReefAngel.Relay.On( Port7 );

    ////// Place additional initialization code below here

    // Define labels for 2014 LCD screen
    //box0
    ReefAngel.CustomLabels[0]="T5HO"; 
    ReefAngel.CustomLabels[1]="Skimmer"; 
    ReefAngel.CustomLabels[2]="FugeLight"; 
    ReefAngel.CustomLabels[3]="Heater"; 
    ReefAngel.CustomLabels[4]="ScrubLight"; 
    ReefAngel.CustomLabels[5]="Unused"; 
    ReefAngel.CustomLabels[6]="Return"; 
    ReefAngel.CustomLabels[7]="ATO_Pump";

    ////// Place additional initialization code above here
}

void loop()
{
    ReefAngel.MHLights( Port1,12,30,14,30,5 ); //t5ho
    ReefAngel.MHLights( Port2,5,0,22,0,5 ); //skimmer
    ReefAngel.StandardLights( Port3,18,0,10,0 ); //fugelight
    ReefAngel.StandardHeater( Port4,780,788 ); //heater
    ReefAngel.StandardLights( Port5,18,0,10,0 ); //scrubber light
    ReefAngel.SingleATO( true,Port8,300,0 ); // ato

    
    ////// Place your custom code below here

// Wave Makers
if (hour()>=7 && hour()<10)
{ ReefAngel.PWM.SetDaylight( SineMode(0,100,300,true) ); // Long pulse at 100% with 300s pulse on sync mode
  ReefAngel.PWM.SetActinic( SineMode(0,100,300,false) ); // Long pulse at 100% with 300s pulse on anti-sync mode }
else if (hour()>=10 && hour()<12)
{ ReefAngel.PWM.SetDaylight( SineMode(0,100,180,true) ); // Sine Wave at 100% with 180s pulse on sync mode
  ReefAngel.PWM.SetActinic( SineMode(0,100,180,false) ); // Sine Wave at 100% with 180s pulse on anti-sync mode }
else if (hour()>=12 && hour()<15)
{ ReefAngel.PWM.SetDaylight( ReefCrestMode(80,20,true) ); // ReefCrest at 80% +/- 20% on sync mode
  ReefAngel.PWM.SetActinic( ReefCrestMode(80,20,false) ); // ReefCrest at 80% +/- 20% on anti-sync mode }
else if (hour()>=15 && hour()<17)
{ ReefAngel.PWM.SetDaylight( SineMode(0,100,180,true) ); // Sine Wave at 100% with 180s pulse on sync mode
  ReefAngel.PWM.SetActinic( SineMode(0,100,180,false) ); // Sine Wave at 100% with 180s pulse on anti-sync mode }
else if (hour()>=17 && hour()<20)
{ ReefAngel.PWM.SetDaylight( SineMode(0,100,300,true) ); // Long pulse at 100% with 300s pulse on sync mode
  ReefAngel.PWM.SetActinic( SineMode(0,100,300,false) ); // Long pulse at 100% with 300s pulse on anti-sync mode }
else
{ ReefAngel.PWM.SetDaylight( SineMode(0,35,400,true) ); // Sine Wave at 35% with 300s pulse on sync mode
  ReefAngel.PWM.SetActinic( SineMode(0,35,400,false) ); // Sine Wave at 35% with 300s pulse on anti-sync mode }
    

    ////// Place your custom code above here

    // This should always be the last line
    ReefAngel.ShowInterface();
}

Lionfan
Posts: 166
Joined: Wed Nov 26, 2014 8:53 am

Re: Feed and water change not working

Post by Lionfan »

slm222 wrote:Good morning all,
I added a custom wave function I found on the site, its working great but since I changed it my water change/feed mode is not turning off the jebao wavemakers. Could someone please let me know where I went wrong?

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 <Humidity.h>
#include <DCPump.h>
#include <PAR.h>
#include <ReefAngel.h>

////// Place global variable code below here



////// Place global variable code above here


void setup()
{
    // This must be the first line
    ReefAngel.Init();  //Initialize controller
    ReefAngel.AddStandardMenu();  // Add Standard Menu

    ReefAngel.Use2014Screen();  // Let's use 2014 Screen 
    // Ports toggled in Feeding Mode
    ReefAngel.FeedingModePorts = Port2Bit | Port8Bit;
    // Ports toggled in Water Change Mode
    ReefAngel.WaterChangePorts = Port2Bit | Port8Bit;
    // Ports toggled when Lights On / Off menu entry selected
    ReefAngel.LightsOnPorts = 0;
    // Ports turned off when Overheat temperature exceeded
    ReefAngel.OverheatShutoffPorts = Port4Bit;
    // Use T1 probe as temperature and overheat functions
    ReefAngel.TempProbe = T1_PROBE;
    ReefAngel.OverheatProbe = T1_PROBE;
    // Set the Overheat temperature setting
    InternalMemory.OverheatTemp_write( 830 );


    // Feeeding and Water Change mode speed
    ReefAngel.DCPump.FeedingSpeed=0;
    ReefAngel.DCPump.WaterChangeSpeed=0;


    // Ports that are always on
    ReefAngel.Relay.On( Port6 );
    ReefAngel.Relay.On( Port7 );

    ////// Place additional initialization code below here

    // Define labels for 2014 LCD screen
    //box0
    ReefAngel.CustomLabels[0]="T5HO"; 
    ReefAngel.CustomLabels[1]="Skimmer"; 
    ReefAngel.CustomLabels[2]="FugeLight"; 
    ReefAngel.CustomLabels[3]="Heater"; 
    ReefAngel.CustomLabels[4]="ScrubLight"; 
    ReefAngel.CustomLabels[5]="Unused"; 
    ReefAngel.CustomLabels[6]="Return"; 
    ReefAngel.CustomLabels[7]="ATO_Pump";

    ////// Place additional initialization code above here
}

void loop()
{
    ReefAngel.MHLights( Port1,12,30,14,30,5 ); //t5ho
    ReefAngel.MHLights( Port2,5,0,22,0,5 ); //skimmer
    ReefAngel.StandardLights( Port3,18,0,10,0 ); //fugelight
    ReefAngel.StandardHeater( Port4,780,788 ); //heater
    ReefAngel.StandardLights( Port5,18,0,10,0 ); //scrubber light
    ReefAngel.SingleATO( true,Port8,300,0 ); // ato

    
    ////// Place your custom code below here

// Wave Makers
if (hour()>=7 && hour()<10)
{ ReefAngel.PWM.SetDaylight( SineMode(0,100,300,true) ); // Long pulse at 100% with 300s pulse on sync mode
  ReefAngel.PWM.SetActinic( SineMode(0,100,300,false) ); // Long pulse at 100% with 300s pulse on anti-sync mode }
else if (hour()>=10 && hour()<12)
{ ReefAngel.PWM.SetDaylight( SineMode(0,100,180,true) ); // Sine Wave at 100% with 180s pulse on sync mode
  ReefAngel.PWM.SetActinic( SineMode(0,100,180,false) ); // Sine Wave at 100% with 180s pulse on anti-sync mode }
else if (hour()>=12 && hour()<15)
{ ReefAngel.PWM.SetDaylight( ReefCrestMode(80,20,true) ); // ReefCrest at 80% +/- 20% on sync mode
  ReefAngel.PWM.SetActinic( ReefCrestMode(80,20,false) ); // ReefCrest at 80% +/- 20% on anti-sync mode }
else if (hour()>=15 && hour()<17)
{ ReefAngel.PWM.SetDaylight( SineMode(0,100,180,true) ); // Sine Wave at 100% with 180s pulse on sync mode
  ReefAngel.PWM.SetActinic( SineMode(0,100,180,false) ); // Sine Wave at 100% with 180s pulse on anti-sync mode }
else if (hour()>=17 && hour()<20)
{ ReefAngel.PWM.SetDaylight( SineMode(0,100,300,true) ); // Long pulse at 100% with 300s pulse on sync mode
  ReefAngel.PWM.SetActinic( SineMode(0,100,300,false) ); // Long pulse at 100% with 300s pulse on anti-sync mode }
else
{ ReefAngel.PWM.SetDaylight( SineMode(0,35,400,true) ); // Sine Wave at 35% with 300s pulse on sync mode
  ReefAngel.PWM.SetActinic( SineMode(0,35,400,false) ); // Sine Wave at 35% with 300s pulse on anti-sync mode }
    

    ////// Place your custom code above here

    // This should always be the last line
    ReefAngel.ShowInterface();
}


Your feeding speed command is set to DC.pump, but since you've done a custom code and your pumps are being run as PWM.Daylight, the controller doesn't know to turn the PWM channels down to 0.
I'm not good enough with Reef Angel to write the code you need to have the controller recognize that it needs to turn PWM channels to zero, but it should be as simple as an argument.
Image
slm222
Posts: 105
Joined: Wed Nov 18, 2015 9:16 pm

Re: Feed and water change not working

Post by slm222 »

thank you for the response. Found the proper coding to turn off the pumps.

Code: Select all

if( ReefAngel.DisplayedMenu==FEEDING_MODE )
{
 ReefAngel.PWM.SetActinic(0);
 ReefAngel.PWM.SetDaylight(0);
}

if( ReefAngel.DisplayedMenu==WATERCHANGE_MODE )
{
 ReefAngel.PWM.SetActinic(0);
 ReefAngel.PWM.SetDaylight(0);
}
Post Reply