need custom PDE help

Share you PDE file with our community

Posts: 329
Joined: Fri May 17, 2013 1:35 pm
PostPosted: Sun Jun 09, 2013 5:56 pm
#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


////// 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 = Port5Bit | Port6Bit;
// Ports toggled in Water Change Mode
ReefAngel.WaterChangePorts = Port1Bit;
// Ports toggled when Lights On / Off menu entry selected
ReefAngel.LightsOnPorts = 0;
// Ports turned off when Overheat temperature exceeded
ReefAngel.OverheatShutoffPorts = Port3Bit | Port7Bit;
// Use T1 probe as temperature and overheat functions
ReefAngel.TempProbe = T1_PROBE;
ReefAngel.OverheatProbe = T1_PROBE;
// Set the Overheat temperature setting
InternalMemory.OverheatTemp_write( 800 );


// Ports that are always on
ReefAngel.Relay.On( Port4 );
ReefAngel.Relay.On( Port8 );

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


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

void loop()
{
ReefAngel.StandardATO( Port1,60 );
ReefAngel.StandardLights( Port3,18,0,10,0 );
ReefAngel.WavemakerRandom( Port5,30,100 );
ReefAngel.WavemakerRandom( Port6,30,100 );
ReefAngel.StandardHeater( Port7,752,755 );
ReefAngel.PWM.SetChannel( 0, PWMSlope(7,0,22,0,0,40,180,0) );
ReefAngel.PWM.SetChannel( 1, PWMSlope(7,30,21,30,0,35,180,0) );
ReefAngel.PWM.SetChannel( 2, PWMSlope(7,0,22,0,0,40,180,0) );
ReefAngel.PWM.SetChannel( 3, PWMSlope(7,30,21,30,0,35,180,0) );
ReefAngel.PWM.SetChannel( 4, PWMSlope(7,0,22,0,0,40,180,0) );
ReefAngel.PWM.SetChannel( 5, PWMSlope(7,30,21,30,0,35,180,0) );
////// Place your custom code below here
if (hour()>=8 && hour()<12)
{
ReefAngel.PWM.SetDaylight( ReefCrestMode(100,20,true) ); // ReefCrest at 100% +/- 20% on sync mode
ReefAngel.PWM.SetActinic( ReefCrestMode(100,20,false) ); // ReefCrest at 100% +/- 20% on anti-sync mode
}
else if (hour()>=12 && hour()<18)
{
ReefAngel.PWM.SetDaylight( ShortPulseMode(0,100,200,true) ); // Short pulse at 100% with 200ms pulse on sync mode
ReefAngel.PWM.SetActinic( ShortPulseMode(0,100,200,false) ); // Short pulse at 100% with 200ms pulse on anti-sync mode
}
else
{
ReefAngel.PWM.SetDaylight( LongPulseMode(0,100,10,true) ); // Long pulse at 100% with 10s pulse on sync mode
ReefAngel.PWM.SetActinic( LongPulseMode(0,100,10,false) ); // Long pulse at 6100% with 10s pulse on anti-sync mode
}
if( ReefAngel.DisplayedMenu==FEEDING_MODE )
{
ReefAngel.PWM.SetActinic(0);
ReefAngel.PWM.SetDaylight(0);
}

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

// This should always be the last line
ReefAngel.Portal( "jjdezek" );
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()
{
}
here is my current code
Image

Posts: 235
Joined: Thu Nov 10, 2011 11:49 am
PostPosted: Sun Jun 09, 2013 6:04 pm
What is it your wanting to do?
Image

Posts: 329
Joined: Fri May 17, 2013 1:35 pm
PostPosted: Sun Jun 09, 2013 6:25 pm
sorry got a phone call before i could post that..what im looking for is the ability to be able to switch the wp40 between different wave patterns, and have the fuge light kick on during water change( i like that feature). also like the custom screen display that Inevo has. also i have my leds running on the anolog expansion but i have a custom weather/sunrise and sunset code programmed into the expansion itself
Image
User avatar
Posts: 5362
Joined: Fri Jul 20, 2012 9:42 am
PostPosted: Sun Jun 09, 2013 8:26 pm
What part of my screen were you looking to add?

Your WP40 is currently on a time schedule.. what happens to that schedule if you update from the menu?

To have you fuge light kick in during water change is easy... :)

Code: Select all
  if (ReefAngel.DisplayedMenu==WATERCHANGE_MODE) {
    ReefAngel.Relay.On(Port3);
  }

assuming... Port3 is your fuge light..

Posts: 329
Joined: Fri May 17, 2013 1:35 pm
PostPosted: Sun Jun 09, 2013 8:33 pm
i believe the wp40 is just on random schedule i would like to be able to toggle manually between say reef crest nutrient export etc. i would also like to have the custom display like you have where it shows the ATO switches on the display with the larger temp and ph readings. i like your set up just dont need all the extra's that you have. the only extra's i have is the wp40 that i would like to control manually rather then it just being random.
Image
User avatar
Posts: 5362
Joined: Fri Jul 20, 2012 9:42 am
PostPosted: Sun Jun 09, 2013 8:57 pm
Your not getting a random schedule for your WP40...

You have a time based schedule... 8am-12pm ReefCrest... 12pm-6pm ShortPulse any other time LongPulse

Toggling from the menu involves a lot more thought as to how it will interact. How long will it stay in the set mode? Permanent? Till next time window? It's not as easy.

Here's the relevant code that does the drawing that you want. Just put it at the end of your INO file and then call the two functions with the relevent x / y for your screen. You'll have to remove the existing drawing of those parameters or you'll be drawing twice and overlapping... these should work for you without modification.

Code: Select all
void DrawParams(int x, int y) {
  char buf[16];

  ReefAngel.LCD.DrawText(COLOR_BLACK,DefaultBGColor,x+5,y,"Temp:");
  ReefAngel.LCD.DrawText(COLOR_BLACK,DefaultBGColor,x+80, y, "PH:");
  // Temp and PH
  y+=2;
  ConvertNumToString(buf, ReefAngel.Params.Temp[T2_PROBE], 10);
  ReefAngel.LCD.DrawText(T2TempColor, DefaultBGColor, x+45, y, buf);
  y+=6;
  ConvertNumToString(buf, ReefAngel.Params.Temp[T1_PROBE], 10);
  ReefAngel.LCD.DrawLargeText(T1TempColor, DefaultBGColor, x+5, y, buf, Num8x16);
  ConvertNumToString(buf, ReefAngel.Params.PH, 100);
  ReefAngel.LCD.DrawLargeText(PHColor, DefaultBGColor, x+80, y, buf, Num8x16);
  y+=5;
  ConvertNumToString(buf, ReefAngel.Params.Temp[T3_PROBE], 10);
  ReefAngel.LCD.DrawText(T3TempColor, DefaultBGColor, x+45, y, buf);
}

void DrawStatus(int x, int y) {
  int t=x;
 
  ReefAngel.LCD.DrawLargeText(COLOR_INDIGO,DefaultBGColor,15,y,"High",Font8x16);
  ReefAngel.LCD.DrawLargeText(COLOR_INDIGO,DefaultBGColor,85,y,"Low",Font8x16);
 
  if (ReefAngel.HighATO.IsActive()) {
    ReefAngel.LCD.FillCircle(55,y+3,5,COLOR_GREEN);
  } else {
    ReefAngel.LCD.FillCircle(55,y+3,5,COLOR_RED);
  }
 
  if (ReefAngel.LowATO.IsActive()) {
    ReefAngel.LCD.FillCircle(70,y+3,5,COLOR_GREEN);
  } else {
    ReefAngel.LCD.FillCircle(70,y+3,5,COLOR_RED);
  }
}

Posts: 329
Joined: Fri May 17, 2013 1:35 pm
PostPosted: Mon Jun 10, 2013 5:11 am
so i place that below the very last line

void DrawCustomGraph()
{
}
and that will change my screen display?

Just put it at the end of your INO file and then call the two functions with the relevent x / y for your screen. You'll have to remove the existing drawing of those parameters or you'll be drawing twice and overlapping...
not sure what you mean here.
Image
User avatar
Posts: 5362
Joined: Fri Jul 20, 2012 9:42 am
PostPosted: Mon Jun 10, 2013 5:26 am
No adding it just gives you the functions that will draw the elements you wanted.. You need to modify your DrawCustomMain() function to use them. It's pretty straight forward, you call those functions and pass the x and y locations where you want them drawn on the screen.

Theres a tutorial somewhere on doing custom main screens, i suggest you read through it.

Unfortunately this is not something i can test out for you and drawing screens takes a bit of tweaking to get things where you want them.

I'm happy to help you understand and learn what you are doing, but I can't do everything for you, i just don't have the means to debug and test what you need.
User avatar
Posts: 5362
Joined: Fri Jul 20, 2012 9:42 am
PostPosted: Mon Jun 10, 2013 5:28 am
jjdezek wrote:
lnevo wrote:Just put it at the end of your INO file and then call the two functions with the relevent x / y for your screen. You'll have to remove the existing drawing of those parameters or you'll be drawing twice and overlapping...

not sure what you mean here.


It means you are already drawing your temp and ph. You cant or shouldnt rather draw them twice. Plus they would overlap each other since you probably dont have room for both :)

Posts: 329
Joined: Fri May 17, 2013 1:35 pm
PostPosted: Mon Jun 10, 2013 8:40 am
is this the one your talking about?
http://curtbinder.info/ragen/docs/RA_Cu ... Screen.pdf

I know i found another one on here somewhere last night but im unable to find it now. it said something about putting a couple new lines into the ReefAngel_Features h file. i think that was for more menus to toggle between though. right now im LLMF i think my eyes crossed.
Image
Next

Return to My PDE/INO file

Who is online

Users browsing this forum: No registered users and 2 guests

cron