PaulTurner911 Code

Share you PDE file with our community

Posts: 278
Joined: Wed Jan 23, 2013 12:36 pm
PostPosted: Wed Jun 19, 2013 7:35 pm
I went ahead and put the night mode in thinking it may work, but I was wrong....

Looking forward to hearing what you guys have to say :)
Image
User avatar
Posts: 5350
Joined: Fri Jul 20, 2012 9:42 am
PostPosted: Wed Jun 19, 2013 7:51 pm
Paul,

Thats not from the latest code....i know because i streamlined your feeding mode code and its thats not there, plus you didn't post the night mode portion.

And we need roberto to add custom mode to the portal *cough* *cough* otherwise you'll still have to activate the custom mode from memory manually..

I'll see what i can throw together tomorrow...

Posts: 278
Joined: Wed Jan 23, 2013 12:36 pm
PostPosted: Wed Jun 19, 2013 8:05 pm
You are right! I grabbed that from my OP in the thread...

Its pretty cool to see the DC Pump on the dashboard, but it doesnt show what percentage it is running at in that section, it does show above in the PWM though.
Last edited by Paulturner911 on Mon Jun 24, 2013 11:42 am, edited 1 time in total.
Image

Posts: 278
Joined: Wed Jan 23, 2013 12:36 pm
PostPosted: Wed Jun 19, 2013 8:09 pm
Removed to clean up this thread
Last edited by Paulturner911 on Mon Jun 24, 2013 11:43 am, edited 1 time in total.
Image
User avatar
Posts: 5350
Joined: Fri Jul 20, 2012 9:42 am
PostPosted: Thu Jun 20, 2013 8:01 pm
Try this:

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 <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
// Ports toggled in Feeding Mode
ReefAngel.FeedingModePorts = Port1Bit | Port2Bit | Port7Bit | Port8Bit;
// Ports toggled in Water Change Mode
ReefAngel.WaterChangePorts = Port1Bit | Port2Bit | Port7Bit | Port8Bit;
// Ports toggled when Lights On / Off menu entry selected
ReefAngel.LightsOnPorts = Port2Bit | Port3Bit | Port7Bit | Port8Bit;
// Ports turned off when Overheat temperature exceeded
ReefAngel.OverheatShutoffPorts = Port3Bit | Port7Bit | Port8Bit;
// 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

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


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

void loop()
{
ReefAngel.DayLights( Port1 ); // Return Pump
ReefAngel.StandardFan( Port2 ); // Canopy Fans
ReefAngel.ActinicLights( Port3 ); // Actinic LEDS
//Port4 Kalk/ATO
//Port5 Kalk Stir
//Port 6 NOT USED (Possibly Skimmer)
ReefAngel.DayLights( Port7 ); // MH 1
ReefAngel.DayLights( Port8 ); //MH 2
//Moonlight Phase 9pm-10am (CH4-CH5)
if ( (hour() >=10) && (hour() <21) )
ReefAngel.PWM.SetChannel( 4,(0) );
else
ReefAngel.PWM.SetChannel( 4, MoonPhase() );
if ( (hour() >=10) && (hour() <21) )
ReefAngel.PWM.SetChannel( 5,(0) );
else
ReefAngel.PWM.SetChannel( 5, MoonPhase() );

//Over Flow Protection
if (ReefAngel.HighATO.IsActive())
ReefAngel.Relay.On(Port1);
else
ReefAngel.Relay.Off(Port1);

//ATO Protection
if (ReefAngel.LowATO.IsActive())
ReefAngel.Relay.On(Port4);
else
ReefAngel.Relay.Off(Port4);

//Kalk Dose 50sec @ 8pm-12pm (every 15min)
if (hour() >=20 || hour() < 12)
ReefAngel.Relay.Set(Port4, now()%900<50);
else
ReefAngel.Relay.Off(Port4);

//Kalk Stir 12pm-1pm
if (hour() >=12 & hour() < 13)
ReefAngel.Relay.On(Port5);
else
ReefAngel.Relay.Off(Port5);


ReefAngel.DCPump.UseMemory = true;
ReefAngel.DCPump.DaylightChannel = Sync;
////// Place your custom code below here

///// Place your custom code below here

// Add random mode if we set to Mode to Custom in portal
static int rmode;
static boolean changeMode=true;

// These are the modes we can cycle through. You can add more and even repeat...
byte modes[] = { ReefCrest, TidalSwell, ShortPulse, NutrientTransport };

if (now()%SECS_PER_DAY==0 || changeMode==true) { // Change at midnight or if controller rebooted
rmode=random(100)%sizeof(modes); // Change the mode once per day to pick from our array
changeMode=false;
}

// Are we in custom mode
if (ReefAngel.DCPump.Mode==11) {
  ReefAngel.DCPump.UseMemory=false; // We are going to override the memory (which is currently set to 11..)
  ReefAngel.DCPump.Mode=modes[rmode];  // Put the mode to the random mode :)
} else {
  ReefAngel.DCPump.UseMemory=true;
}

// Set timer when in feeding mode
static unsigned long feeding;
if (ReefAngel.DisplayedMenu==FEEDING_MODE) {
feeding = now();
}

// keep wavemakers off for first 30 minutes of feeding mode.
if (now()-feeding<=1800) { // 30 minutes after
ReefAngel.DCPump.Speed=0;
} else if (now()-feeding<=(1800+3600)) { // // First 30 minutes pump is off.. next 60 minutes will be in NTM
ReefAngel.DCPump.Mode=NutrientTransport;
}


// Add night mode (constant 30%)
if (now()%SECS_PER_DAY<30600 || now()%SECS_PER_DAY >=81000) { // Time is before 8:30am and after 10:30pm
  ReefAngel.DCPump.Speed=30;
}
////// Place your custom code above here

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

void DrawCustomMain()
{
int x,y;
char text[10];
// Dimming Expansion
x = 15;
y = 2;
for ( int a=0;a<6;a++ )
{
if ( a>2 ) x = 75;
if ( a==3 ) y = 2;
ReefAngel.LCD.DrawText( COLOR_DARKGOLDENROD,DefaultBGColor,x,y,"Ch :" );
ReefAngel.LCD.DrawText( COLOR_DARKGOLDENROD,DefaultBGColor,x+12,y,a );
ReefAngel.LCD.DrawText( COLOR_DARKGOLDENROD,DefaultBGColor,x+24,y,ReefAngel.PWM.GetChannelValue(a) );
y += 10;
}
pingSerial();

// Parameters
#if defined DisplayLEDPWM && ! defined RemoveAllLights
ReefAngel.LCD.DrawMonitor( 15, 43, ReefAngel.Params,
ReefAngel.PWM.GetDaylightValue(), ReefAngel.PWM.GetActinicValue() );
#else // defined DisplayLEDPWM && ! defined RemoveAllLights
ReefAngel.LCD.DrawMonitor( 15, 43, ReefAngel.Params );
#endif // defined DisplayLEDPWM && ! defined RemoveAllLights
pingSerial();

// Main Relay Box
byte TempRelay = ReefAngel.Relay.RelayData;
TempRelay &= ReefAngel.Relay.RelayMaskOff;
TempRelay |= ReefAngel.Relay.RelayMaskOn;
ReefAngel.LCD.DrawOutletBox( 12, 84, TempRelay );
pingSerial();

// Date and Time
ReefAngel.LCD.DrawDate( 6, 122 );
pingSerial();
}

void DrawCustomGraph()
{
}

Posts: 278
Joined: Wed Jan 23, 2013 12:36 pm
PostPosted: Thu Jun 20, 2013 9:20 pm
Thank YOU SIR!!!

In order to add and remove modes, do I simply type and or remove them in the following section?

// These are the modes we can cycle through. You can add more and even repeat...
byte modes[] = { ReefCrest, TidalSwell, ShortPulse, xxxxxxxx, NutrientTransport };

Could you give a quick explanation of what tidal swell is?
Image
User avatar
Posts: 5350
Joined: Fri Jul 20, 2012 9:42 am
PostPosted: Fri Jun 21, 2013 1:39 am
Its cool. I like it. Look at ecotech manual.

Posts: 278
Joined: Wed Jan 23, 2013 12:36 pm
PostPosted: Fri Jun 21, 2013 5:54 pm
I'm having an issue with the feedmode, the wp is not turning to NTM at 1800 on the countdown. It's not turning back on once the 3600s times out either. I'm not sure the night mode is activating either, I uploaded late last night and it didn't run at 30.
Image
User avatar
Posts: 5350
Joined: Fri Jul 20, 2012 9:42 am
PostPosted: Fri Jun 21, 2013 11:35 pm
Let me know what it did. I'll look again at the code...

Posts: 278
Joined: Wed Jan 23, 2013 12:36 pm
PostPosted: Sun Jun 23, 2013 11:00 am
Its not activating NTP at 1800 and once the feedmode is complete (3600) the WP pump stays off. Basically once the feed mode is activate it turns the WP pump off until I goto the portal and select a mode other than NTM.
Image
PreviousNext

Return to My PDE/INO file

Who is online

Users browsing this forum: No registered users and 3 guests

cron