PaulTurner911 Code
-
- Posts: 288
- Joined: Wed Jan 23, 2013 12:36 pm
Re: PaulTurner911 Code
Somethings not right with the current code. The day after feedmode was activated the WP is at zero. Im guessing after NTM it never resumes our random custom mode. Also could you refresh me on the memory location of feedmode timer? Where could I find a list of all memory locations?
Re: PaulTurner911 Code
It's in the file in libraries/Globals/Globals.
Look for the string VarsStart.
Look for the string VarsStart.
-
- Posts: 288
- Joined: Wed Jan 23, 2013 12:36 pm
Re: PaulTurner911 Code
Any chance you could revisit your logic on the feedmode? I've set the feedtime in the memloc to 900 and once that completes the return pump AND the wp turn. I'd like the wp to run NTM for a while before the returns kick on. Any help would be great.
Re: PaulTurner911 Code
Set the feed mode to however long you want them off. 900 is when ntm kicks on.
-
- Posts: 288
- Joined: Wed Jan 23, 2013 12:36 pm
Re: PaulTurner911 Code
This doesn't seem to be the case. I've currently set the feedmode to 1800.... At the 900 mark nothing happens, and 0 all pumps turn on and run NTM.
Re: PaulTurner911 Code
Did you change 900 in your code at all? The code I posted above sets the speed to 0 only for the first 900 seconds after feeding mode started..then its NTM until 4500 seconds.
Can you set the feeding mode time longer than 1800 and tell me what happens at the 1800 mark?
What is port1 port2 port7 and port8?
Can you set the feeding mode time longer than 1800 and tell me what happens at the 1800 mark?
What is port1 port2 port7 and port8?
-
- Posts: 288
- Joined: Wed Jan 23, 2013 12:36 pm
Re: PaulTurner911 Code
I dont have an appropriate file reader to read globals/globals for memory locations.
Ive set the feedmode to 1860 and at 1800 nothing happens. Im assuming that at 960 the NTM should activate, it doesnt.
Port1- RETURN PUMP
2-FANS
7-MH
8-MH
these all turn off in feed mode
this is my code:
// Feeding Mode is 30 minutes
if (now()-feeding<=900) {
// First 15 minutes after feeding mode. Pump is off
ReefAngel.DCPump.UseMemory=false;
ReefAngel.DCPump.Speed=0;
} else if (now()-feeding<=(900+3600)) {
// NTM after 15 minutes for the next 60 minutes
ReefAngel.DCPump.UseMemory=false;
ReefAngel.DCPump.Mode=NutrientTransport;
ReefAngel.DCPump.Speed=InternalMemory.DCPumpSpeed_read(); // Resume previous speed
// Night mode (go to 30%)
ReefAngel.DCPump.UseMemory=false;
ReefAngel.DCPump.Mode=Constant;
ReefAngel.DCPump.Speed=30;
} else if (InternalMemory.DCPumpMode_read()==11) {
// Custom Mode and nothing else going on
ReefAngel.DCPump.UseMemory=false;
ReefAngel.DCPump.Mode=modes[rmode]; // Put the mode to the random mode
ReefAngel.DCPump.Speed=InternalMemory.DCPumpSpeed_read(); // Set speed from portal
} else {
ReefAngel.DCPump.UseMemory=true; // Will reset all values from memory
}
////// Place your custom code above here
Ive set the feedmode to 1860 and at 1800 nothing happens. Im assuming that at 960 the NTM should activate, it doesnt.
Port1- RETURN PUMP
2-FANS
7-MH
8-MH
these all turn off in feed mode
this is my code:
// Feeding Mode is 30 minutes
if (now()-feeding<=900) {
// First 15 minutes after feeding mode. Pump is off
ReefAngel.DCPump.UseMemory=false;
ReefAngel.DCPump.Speed=0;
} else if (now()-feeding<=(900+3600)) {
// NTM after 15 minutes for the next 60 minutes
ReefAngel.DCPump.UseMemory=false;
ReefAngel.DCPump.Mode=NutrientTransport;
ReefAngel.DCPump.Speed=InternalMemory.DCPumpSpeed_read(); // Resume previous speed
// Night mode (go to 30%)
ReefAngel.DCPump.UseMemory=false;
ReefAngel.DCPump.Mode=Constant;
ReefAngel.DCPump.Speed=30;
} else if (InternalMemory.DCPumpMode_read()==11) {
// Custom Mode and nothing else going on
ReefAngel.DCPump.UseMemory=false;
ReefAngel.DCPump.Mode=modes[rmode]; // Put the mode to the random mode
ReefAngel.DCPump.Speed=InternalMemory.DCPumpSpeed_read(); // Set speed from portal
} else {
ReefAngel.DCPump.UseMemory=true; // Will reset all values from memory
}
////// Place your custom code above here
Re: PaulTurner911 Code
Im baffled here too...between you and sacohen i feel like im losing my mind...
Roberto binder anyone need a second set of eyes...speed and mode should be reset at 901 seconds..
Roberto binder anyone need a second set of eyes...speed and mode should be reset at 901 seconds..
Re: PaulTurner911 Code
Sorry... what is exactly that you want?
Sent from my SPH-L710 using Tapatalk 4
Sent from my SPH-L710 using Tapatalk 4
Roberto.
Re: PaulTurner911 Code
I know what the problem is. I'll post something tomorrow. Can you post your full code again.
Re: PaulTurner911 Code
Try this:
[/quote]
This was the section I modified
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 60sec @ 11pm-12pm (every 15min)
if (hour() >=23 || hour() < 12)
ReefAngel.Relay.Set(Port4, now()%900<60);
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;
}
// Set timer when in feeding mode
static unsigned long feeding;
static boolean startFeeding=false;
if (ReefAngel.DisplayedMenu==FEEDING_MODE && startFeeding) {
feeding = now();
startFeeding=false;
} else {
startFeeding = true;
}
// Set timer when in feeding mode
static boolean feedingStarted;
static unsigned long feeding;
if (ReefAngel.DisplayedMenu==FEEDING_MODE && !feedingStarted) {
feedingStarted=true;
feeding = now();
} else {
feedingStarted=false;
}
// Feeding Mode is 30 minutes
if (now()-feeding<=900) {
// First 15 minutes after feeding mode. Pump is off
ReefAngel.DCPump.UseMemory=false;
ReefAngel.DCPump.Speed=0;
} else if (now()-feeding<=900+3600)) {
// NTM after 15 minutes for the next 60 minutes
ReefAngel.DCPump.UseMemory=false;
ReefAngel.DCPump.Mode=NutrientTransport;
ReefAngel.DCPump.Speed=InternalMemory.DCPumpSpeed_read(); // Resume previous speed
// Night mode (go to 30%)
ReefAngel.DCPump.UseMemory=false;
ReefAngel.DCPump.Mode=Constant;
ReefAngel.DCPump.Speed=30;
} else if (InternalMemory.DCPumpMode_read()==11) {
// Custom Mode and nothing else going on
ReefAngel.DCPump.UseMemory=false;
ReefAngel.DCPump.Mode=modes[rmode]; // Put the mode to the random mode :)
ReefAngel.DCPump.Speed=InternalMemory.DCPumpSpeed_read(); // Set speed from portal
} else {
ReefAngel.DCPump.UseMemory=true; // Will reset all values from memory
}
////// 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()
{
}
This was the section I modified
Code: Select all
// Set timer when in feeding mode
static unsigned long feeding;
static boolean startFeeding=false;
if (ReefAngel.DisplayedMenu==FEEDING_MODE && startFeeding) {
feeding = now();
startFeeding=false;
} else {
startFeeding = true;
}
-
- Posts: 288
- Joined: Wed Jan 23, 2013 12:36 pm
Re: PaulTurner911 Code
Thanks Lee, Ill let you know in the next few days. I really appreciate it.
-
- Posts: 288
- Joined: Wed Jan 23, 2013 12:36 pm
Re: PaulTurner911 Code
No bueno. Ive run the feedmode 3 times set at 1200 and the oven timer set at 15min. the NTM mode does not kick in at 901 (299 in countdown on LCD) Infact, the WP is not calling anymode untill I power cycle the unit, then it calls NTM. Any help would be great.
Here is my current code:
Here is my current code:
Code: Select all
// 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 60sec @ 11pm-12pm (every 15min)
if (hour() >=23 || hour() < 12)
ReefAngel.Relay.Set(Port4, now()%900<60);
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;
}
// Set timer when in feeding mode
static unsigned long feeding;
static boolean startFeeding=false;
if (ReefAngel.DisplayedMenu==FEEDING_MODE && startFeeding) {
feeding = now();
startFeeding=false;
} else {
startFeeding = true;
}
// Feeding Mode is 30 minutes
if (now()-feeding<=900) {
// First 15 minutes after feeding mode. Pump is off
ReefAngel.DCPump.UseMemory=false;
ReefAngel.DCPump.Speed=0;
} else if (now()-feeding<=(900+3600)) {
// NTM after 15 minutes for the next 60 minutes
ReefAngel.DCPump.UseMemory=false;
ReefAngel.DCPump.Mode=NutrientTransport;
ReefAngel.DCPump.Speed=InternalMemory.DCPumpSpeed_read(); // Resume previous speed
// Night mode (go to 30%)
ReefAngel.DCPump.UseMemory=false;
ReefAngel.DCPump.Mode=Constant;
ReefAngel.DCPump.Speed=30;
} else if (InternalMemory.DCPumpMode_read()==11) {
// Custom Mode and nothing else going on
ReefAngel.DCPump.UseMemory=false;
ReefAngel.DCPump.Mode=modes[rmode]; // Put the mode to the random mode :)
ReefAngel.DCPump.Speed=InternalMemory.DCPumpSpeed_read(); // Set speed from portal
} else {
ReefAngel.DCPump.UseMemory=true; // Will reset all values from memory
}
////// Place your custom code above here
Re: PaulTurner911 Code
Alright will look at it again soon...are u sure you poaded this code successfully...the full code not editing ur existing????
Re: PaulTurner911 Code
It looks also like you messed up the if block because i don't see the conditional to go into night mode...the ntm section goes right into night mode. Please also post your full code. Stop pasting blocks.
I believe the code worked but went into night mode instead. Post the full code ill fix it and we'll try again.
I believe the code worked but went into night mode instead. Post the full code ill fix it and we'll try again.
Re: PaulTurner911 Code
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 60sec @ 11pm-12pm (every 15min)
if (hour() >=23 || hour() < 12)
ReefAngel.Relay.Set(Port4, now()%900<60);
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;
}
// Set timer when in feeding mode
static unsigned long feeding;
static boolean startFeeding=false;
if (ReefAngel.DisplayedMenu==FEEDING_MODE && startFeeding) {
feeding = now();
startFeeding=false;
} else {
startFeeding = true;
}
// Set timer when in feeding mode
static boolean feedingStarted;
static unsigned long feeding;
if (ReefAngel.DisplayedMenu==FEEDING_MODE && !feedingStarted) {
feedingStarted=true;
feeding = now();
} else {
feedingStarted=false;
}
// Feeding Mode is 30 minutes
if (now()-feeding<=900) {
// First 15 minutes after feeding mode. Pump is off
ReefAngel.DCPump.UseMemory=false;
ReefAngel.DCPump.Speed=0;
} else if (now()-feeding<=900+3600)) {
// NTM after 15 minutes for the next 60 minutes
ReefAngel.DCPump.UseMemory=false;
ReefAngel.DCPump.Mode=NutrientTransport;
ReefAngel.DCPump.Speed=InternalMemory.DCPumpSpeed_read(); // Resume previous speed
// Night mode (go to 30%)
} else if (now()%SECS_PER_DAY<30600 || now()%SECS_PER_DAY>=81000) { // 8:30am / 10:30pm
ReefAngel.DCPump.UseMemory=false;
ReefAngel.DCPump.Mode=Constant;
ReefAngel.DCPump.Speed=30;
} else if (InternalMemory.DCPumpMode_read()==11) {
// Custom Mode and nothing else going on
ReefAngel.DCPump.UseMemory=false;
ReefAngel.DCPump.Mode=modes[rmode]; // Put the mode to the random mode :)
ReefAngel.DCPump.Speed=InternalMemory.DCPumpSpeed_read(); // Set speed from portal
} else {
ReefAngel.DCPump.UseMemory=true; // Will reset all values from memory
}
////// 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()
{
}
Re: PaulTurner911 Code
Ok not sure where the missing line went between NTM and night mode it was gone for the past few pages. Please try the above code.
Re: PaulTurner911 Code
I've been following this thread, because I want to set this up eventually and I saw this..lnevo wrote:Im baffled here too...between you and sacohen i feel like im losing my mind....
Sorry man.
Re: PaulTurner911 Code
No worries... I believe I found the errors... hopefully it should work. You just want the random piece, no?
Re: PaulTurner911 Code
Yes the randomness of the water modes and the Nutrient Transport Mode after feeding, but like you said wait until we have the other stuff working first.
I've just been following along for now.
I've just been following along for now.
-
- Posts: 288
- Joined: Wed Jan 23, 2013 12:36 pm
Re: PaulTurner911 Code
Thanks Lee, Ive been tied up and hadnt tried the revised code. The previous COMPLETE code you had posted gave me an error, so I cut in the "modified section" Thats how I ended up with the last (my current) code. Ill use your new code in its entirety and run it this afternoon.
Thank you again for all of your help and patience with us "noncoders"
Thank you again for all of your help and patience with us "noncoders"
Re: PaulTurner911 Code
Let me know if there's a compile error. I'd rather review it then have you potentially load bad code.
Thanks!
Thanks!
-
- Posts: 288
- Joined: Wed Jan 23, 2013 12:36 pm
Re: PaulTurner911 Code
Compile error:
static unsigned long feeding;
redeclaration of 'long unsigned int feeding'
static unsigned long feeding;
redeclaration of 'long unsigned int feeding'
Re: PaulTurner911 Code
Try this:
That was one of the result of constant merging
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 60sec @ 11pm-12pm (every 15min)
if (hour() >=23 || hour() < 12)
ReefAngel.Relay.Set(Port4, now()%900<60);
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;
}
// Set timer when in feeding mode
static boolean feedingStarted;
static unsigned long feeding;
if (ReefAngel.DisplayedMenu==FEEDING_MODE && !feedingStarted) {
feedingStarted=true;
feeding = now();
} else {
feedingStarted=false;
}
// Feeding Mode is 30 minutes
if (now()-feeding<=900) {
// First 15 minutes after feeding mode. Pump is off
ReefAngel.DCPump.UseMemory=false;
ReefAngel.DCPump.Speed=0;
} else if (now()-feeding<=900+3600)) {
// NTM after 15 minutes for the next 60 minutes
ReefAngel.DCPump.UseMemory=false;
ReefAngel.DCPump.Mode=NutrientTransport;
ReefAngel.DCPump.Speed=InternalMemory.DCPumpSpeed_read(); // Resume previous speed
// Night mode (go to 30%)
} else if (now()%SECS_PER_DAY<30600 || now()%SECS_PER_DAY>=81000) { // 8:30am / 10:30pm
ReefAngel.DCPump.UseMemory=false;
ReefAngel.DCPump.Mode=Constant;
ReefAngel.DCPump.Speed=30;
} else if (InternalMemory.DCPumpMode_read()==11) {
// Custom Mode and nothing else going on
ReefAngel.DCPump.UseMemory=false;
ReefAngel.DCPump.Mode=modes[rmode]; // Put the mode to the random mode :)
ReefAngel.DCPump.Speed=InternalMemory.DCPumpSpeed_read(); // Set speed from portal
} else {
ReefAngel.DCPump.UseMemory=true; // Will reset all values from memory
}
////// 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: 288
- Joined: Wed Jan 23, 2013 12:36 pm
Re: PaulTurner911 Code
Compile error:
} else if (now()-feeding<=900+3600)) {
expected primary-expression before ')' token
} else if (now()-feeding<=900+3600)) {
expected primary-expression before ')' token
Re: PaulTurner911 Code
Code: Select all
} else if (now()-feeding<=(900+3600)) {