skimmer code help

Do you have a question on how to do something.
Ask in here.
Post Reply
troylong45
Posts: 214
Joined: Sat Oct 10, 2015 9:17 pm

skimmer code help

Post by troylong45 »

im trying to get this to work for me .

i want when the float active then skimmer is auto,on or delayedon to override
when the float is deactive it turns off but when active again it turns back to auto,on or delayedon to override



im doing this

Code: Select all

if(ReefAngel.HighATO.IsActive()!=1){ReefAngel.Relay.Override(SKIMMER,0);} else {ReefAngel.Relay.Override( SKIMMER,2 );}

and it is ignoring the relay off for waterchangemode,feedmode but the delayon is working

full code

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 below here
       
        // Define Custom Memory Locations
        #define Mem_B_AtoHourInterval     101    //MB101
        #define Mem_B_LightsOffPerc       102    //MB102
        #define Mem_I_ReturnDelay         103    //MI103
        
void init_memory() {
         
         // Initialize Custom Memory Locations
          
          InternalMemory.write(Mem_B_AtoHourInterval,1);       //MB101 "(Mem_B_AtoHourInterval,X)"X=hour
          InternalMemory.write(Mem_B_LightsOffPerc,0);         //MB102
          InternalMemory.write(Mem_I_ReturnDelay,300);         //MI103 "(Mem_I_ReturnDelay,X)"X=sec
        }
        
         // Define Relay Ports by Name
    #define AUTOTOPOFF        1
    #define SKIMMER           2 
    #define BLUELED           3
    #define WHITELED          4
    #define HEATER            5
    #define POWERHEAD         6
    #define FAN               7
    #define RETURN            8
    
    //dimmingchannel call out 
    // 0    blue led channel
    // 1    white led channel
    // 2
    // 3
    // 4    powerhead left
    // 5    powerhead right

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


void setup()
{
    // This must be the first line
    ReefAngel.Init();  //Initialize controller
    ReefAngel.Use2014Screen();  // Let's use 2014 Screen 
    // Ports toggled in Feeding Mode
    ReefAngel.FeedingModePorts = Port1Bit | Port2Bit | Port5Bit | Port6Bit | Port8Bit ; 
    // Ports toggled in Water Change Mode
    ReefAngel.WaterChangePorts = Port1Bit | Port2Bit | Port5Bit | Port6Bit | Port8Bit ;
    // Ports toggled when Lights On / Off menu entry selected
    ReefAngel.LightsOnPorts = Port3Bit | Port4Bit ;
    // Ports turned off when Overheat temperature exceeded
    ReefAngel.OverheatShutoffPorts = Port5Bit ;
    // Use T1 probe as temperature and overheat functions
    ReefAngel.TempProbe = T1_PROBE;
    ReefAngel.OverheatProbe = T1_PROBE;

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


    // Ports that are always on
//    ReefAngel.Relay.On( SKIMMER );
    ReefAngel.Relay.On( POWERHEAD );
    ReefAngel.Relay.On( FAN );
    ReefAngel.Relay.On( RETURN );
    // Ports that are delayed on
    
    ////// Place additional initialization code below here
    

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

void loop()
{
    ReefAngel.Relay.DelayedOn( SKIMMER );
    ReefAngel.SingleATO(true, AUTOTOPOFF , InternalMemory.ATOExtendedTimeout_read(), InternalMemory.read(Mem_B_AtoHourInterval));
    ReefAngel.StandardHeater ( HEATER );
    ReefAngel.PWM.Channel0PWMParabola();
    ReefAngel.PWM.Channel1PWMParabola();
    ReefAngel.DCPump.UseMemory = true;
//REMOVE    ReefAngel.DCPump.DaylightChannel = None;
//REMOVE    ReefAngel.DCPump.ActinicChannel = None;
//REMOVE    ReefAngel.DCPump.ExpansionChannel[0] = None;
//REMOVE    ReefAngel.DCPump.ExpansionChannel[1] = None;
//REMOVE    ReefAngel.DCPump.ExpansionChannel[2] = None;
//REMOVE    ReefAngel.DCPump.ExpansionChannel[3] = None;
    ReefAngel.DCPump.ExpansionChannel[4] = Sync;
    ReefAngel.DCPump.ExpansionChannel[5] = AntiSync;
if(ReefAngel.HighATO.IsActive()!=1){ReefAngel.Relay.Override(SKIMMER,0);} else {ReefAngel.Relay.Override( SKIMMER,2 );}
//if ( ReefAngel.HighATO.IsActive() == 1 ) {ReefAngel.Relay.Override( SKIMMER,2 );} else {ReefAngel.Relay.Off( SKIMMER );}
//REMOVE    if ( ReefAngel.HighATO.IsActive() != 1 ) ReefAngel.Relay.Off( SKIMMER );
     
    ////// Place your custom code below here

//C blue led relay port 3/BLUELED +dimming channel 0
if (ReefAngel.PWM.GetChannelValue(0) >  InternalMemory.read(Mem_B_LightsOffPerc)) {
   // Value over MB102
   ReefAngel.Relay.On(BLUELED);
} else { 
   // otherwise, value IS MB102 or less (which should never happen)
   ReefAngel.Relay.Off(BLUELED);
}
//C blue led relay port 3/BLUELED +dimming channel 0

//C white led relay port 4/WHITELED +dimming channel 1
    if (ReefAngel.PWM.GetChannelValue(1) >  InternalMemory.read(Mem_B_LightsOffPerc)) {
   // Value over MB102
   ReefAngel.Relay.On(WHITELED);
} else { 
   // otherwise, value IS MB102 or less (which should never happen)
   ReefAngel.Relay.Off(WHITELED);
}
//C white led relay port 4/WHITELED +dimming channel 1

//C First X minutes after feeding mode disable return
    static time_t FMTimer=0;
    if (ReefAngel.DisplayedMenu == FEEDING_MODE) FMTimer=now();
    if (now()-FMTimer >= 0 && now()-FMTimer < InternalMemory.read(Mem_I_ReturnDelay))
    {ReefAngel.Relay.Off(RETURN);}else{ReefAngel.Relay.On(RETURN);}
//C First X minutes after feeding mode disable return


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

    // This should always be the last line
    ReefAngel.Portal( "troylong45" );
    ReefAngel.ShowInterface();
}
Last edited by troylong45 on Sat Jun 09, 2018 3:48 pm, edited 5 times in total.
Image
binder
Posts: 2871
Joined: Fri Mar 18, 2011 6:20 pm
Location: Illinois
Contact:

Re: skimmer code help

Post by binder »

the On function overrides the DelayedOn function.
you should remove the DelayedOn call right before the if statement. then I would replace the On with DelayedOn.
the way your statement reads is if the condition is true it's on, otherwise it's off. you want it to be DelayedOn if it's going to be on.

Sent from my XT1585 using Tapatalk
binder
Posts: 2871
Joined: Fri Mar 18, 2011 6:20 pm
Location: Illinois
Contact:

Re: skimmer code help

Post by binder »

just re-read your original question, my answer is only part right. you need to have a more complex if statement with other clauses to get your full answer. the way your code is, the float switch controls the port.

Sent from my XT1585 using Tapatalk
troylong45
Posts: 214
Joined: Sat Oct 10, 2015 9:17 pm

Re: skimmer code help

Post by troylong45 »

binder wrote:just re-read your original question, my answer is only part right. you need to have a more complex if statement with other clauses to get your full answer. the way your code is, the float switch controls the port.

Sent from my XT1585 using Tapatalk
I came up with a new code and working but it is ignoreing relay off when feed/water change mode
I just updated the above post

I also can not manualy turn the relay off .
Image
binder
Posts: 2871
Joined: Fri Mar 18, 2011 6:20 pm
Location: Illinois
Contact:

Re: skimmer code help

Post by binder »

yes, when you use the Override function, it ignores the feed and water change settings. in fact, it ignores all programmed settings and uses whatever setting is overridden with.

Sent from my XT1585 using Tapatalk
troylong45
Posts: 214
Joined: Sat Oct 10, 2015 9:17 pm

Re: skimmer code help

Post by troylong45 »

I'm at a loss to code this i tryed lol I even been searching all day. I thought i got close since it did everything but letting me manualy change it or the feed mode,wc off mode, if i take the else off it does everything besides reset its self to auto when the float reactives but I use it as a level monitor for sump to turn off and on the skimmer when the water raises for feed mode but then I also want it as a fail safe if some how the water raised with out feed mode

Its only the else part that's the issue I'm trying to think of something to fix that
Image
Post Reply