need custom PDE help

Share you PDE file with our community
jjdezek
Posts: 329
Joined: Fri May 17, 2013 1:35 pm

Re: need custom PDE help

Post by jjdezek »

i changed these numbers and it moved the codes up to the top. what im not understanding is how do i get the ATO to display on the screen?

Code: Select all

ReefAngel.LCD.DrawMonitor(15, 10, ReefAngel.Params,
ReefAngel.PWM.GetDaylightValue(), ReefAngel.PWM.GetActinicValue());
#else // defined DisplayLEDPWM && ! defined RemoveAllLights
ReefAngel.LCD.DrawMonitor(15, 10, ReefAngel.Params.);
Image
User avatar
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

Re: need custom PDE help

Post by lnevo »

You need to add DrawStatus(x,y); inside the DrawCustomMain function. with x and y being the coordinates where you want it.
jjdezek
Posts: 329
Joined: Fri May 17, 2013 1:35 pm

Re: need custom PDE help

Post by jjdezek »

so i would put something like
DrawStatus(15,50)
and just plug it in anywhere in the drawcustommain?
Image
User avatar
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

Re: need custom PDE help

Post by lnevo »

By Jove, I think he's got it!
User avatar
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

Re: need custom PDE help

Post by lnevo »

Don't forget the semicolon after the last parenthesis.
jjdezek
Posts: 329
Joined: Fri May 17, 2013 1:35 pm

Re: need custom PDE help

Post by jjdezek »

haha awesome got it. ok next step. how do you make the temp 1 text larger? along with ph?
Image
jjdezek
Posts: 329
Joined: Fri May 17, 2013 1:35 pm

Re: need custom PDE help

Post by jjdezek »

Image
Image
User avatar
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

Re: need custom PDE help

Post by lnevo »

You'll need to replace the current drawing of those parameters with the other function I gave you.

DrawParams(x,y);
jjdezek
Posts: 329
Joined: Fri May 17, 2013 1:35 pm

Re: need custom PDE help

Post by jjdezek »

so i replace this

Code: Select all

ReefAngel.LCD.DrawMonitor(15, 10, ReefAngel.Params,
ReefAngel.PWM.GetDaylightValue(), ReefAngel.PWM.GetActinicValue());
#else // defined DisplayLEDPWM && ! defined RemoveAllLights
ReefAngel.LCD.DrawMonitor(15, 10, ReefAngel.Params.);
with this

Code: Select all

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;
  ReefAngel.LCD.DrawText(T3TempColor, DefaultBGColor, x+45, y, buf);
}
Image
jjdezek
Posts: 329
Joined: Fri May 17, 2013 1:35 pm

Re: need custom PDE help

Post by jjdezek »

or just plug in the DrawParams (15,10);
Image
User avatar
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

Re: need custom PDE help

Post by lnevo »

I would do the second but either would work. The first one You would have a problem because x and y are not defined in the drawcustommain, so you'd have to edit that bit.

I think your starting to get the hang of it :)
jjdezek
Posts: 329
Joined: Fri May 17, 2013 1:35 pm

Re: need custom PDE help

Post by jjdezek »

with this it didnt turn out. pic to follow.

Code: Select all

// when the parameters are saved
ReefAngel.LCD.DrawDate(6, 112);
pingSerial();
#if defined DisplayLEDPWM && ! defined RemoveAllLights
ReefAngel.LCD.DrawMonitor(15, 10, ReefAngel.Params,
ReefAngel.PWM.GetDaylightValue(), ReefAngel.PWM.GetActinicValue());
#else // defined DisplayLEDPWM && ! defined RemoveAllLights
ReefAngel.LCD.DrawMonitor(15, 10, ReefAngel.Params.);
#endif // defined DisplayLEDPWM && ! defined RemoveAllLig
DrawStatus (20,80);
DrawParams (15,50);
pingSerial();
byte TempRelay = ReefAngel.Relay.RelayData;
TempRelay &= ReefAngel.Relay.RelayMaskOff;
TempRelay |= ReefAngel.Relay.RelayMaskOn;
ReefAngel.LCD.DrawOutletBox(12, 93, TempRelay);
}

////// Place global variable code above here
Image
jjdezek
Posts: 329
Joined: Fri May 17, 2013 1:35 pm

Re: need custom PDE help

Post by jjdezek »

Image
Image
jjdezek
Posts: 329
Joined: Fri May 17, 2013 1:35 pm

Re: need custom PDE help

Post by jjdezek »

with this code set up

Code: Select all

////// Place global variable code below here
void DrawCustomMain()
{
// the graph is drawn/updated when we exit the main menu &
// when the parameters are saved
ReefAngel.LCD.DrawDate(6, 112);
pingSerial();

DrawStatus (20,80);
DrawParams (15,50);
pingSerial();
byte TempRelay = ReefAngel.Relay.RelayData;
TempRelay &= ReefAngel.Relay.RelayMaskOff;
TempRelay |= ReefAngel.Relay.RelayMaskOn;
}

////// Place global variable code above here
Image
jjdezek
Posts: 329
Joined: Fri May 17, 2013 1:35 pm

Re: need custom PDE help

Post by jjdezek »

I get this

Image
Image
User avatar
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

Re: need custom PDE help

Post by lnevo »

Sorry, you need to add this to get the large numbers. This goes right after the // Place global variable code below here. Not inside the functions.

Code: Select all

#define NUMBERS_8x16
As far as the alignment if it doesn't get fixed after that, try changing the x to 5.
jjdezek
Posts: 329
Joined: Fri May 17, 2013 1:35 pm

Re: need custom PDE help

Post by jjdezek »

all that did was make the text bigger still have the smaller numbers overlapping and those numbers a glitching.
Image
jjdezek
Posts: 329
Joined: Fri May 17, 2013 1:35 pm

Re: need custom PDE help

Post by jjdezek »

it looks like the word temp and ph are behind the numbers instead of above them. I also noticed that when i removed the old params codes i removed the pwm block. is there away i can keep the pwm on the screen and remove the old params?
Image
User avatar
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

Re: need custom PDE help

Post by lnevo »

Lets address the pwm values after. That will be easy. Can you post your current code and screenshot.
jjdezek
Posts: 329
Joined: Fri May 17, 2013 1:35 pm

Re: need custom PDE help

Post by jjdezek »

well while i was waiting for your response i did a little playing with the code. i got my name displayed across the top and put the params back in. so right now this is what i have.

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 <ReefAngel.h>

////// Place global variable code below here
#define NUMBERS_8x16
void DrawCustomMain()
{
// the graph is drawn/updated when we exit the main menu &
// when the parameters are saved
ReefAngel.LCD.DrawDate(6, 112);
ReefAngel.LCD.DrawText(COLOR_INDIGO, COLOR_WHITE,20,5, "Jeremy's Reef");
pingSerial();
#if defined DisplayLEDPWM && ! defined RemoveAllLights
ReefAngel.LCD.DrawMonitor(15, 30, ReefAngel.Params,
ReefAngel.PWM.GetDaylightValue(), ReefAngel.PWM.GetActinicValue());
#endif // defined DisplayLEDPWM && ! defined RemoveAllLig
DrawStatus (20,80);
DrawParams (5,60);
pingSerial();
byte TempRelay = ReefAngel.Relay.RelayData;
TempRelay &= ReefAngel.Relay.RelayMaskOff;
TempRelay |= ReefAngel.Relay.RelayMaskOn;
ReefAngel.LCD.DrawOutletBox(12, 93, TempRelay);
}

////// 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( Port2 );
    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 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[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;
  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);
  }
}


void DrawCustomGraph()
{
}
Image
jjdezek
Posts: 329
Joined: Fri May 17, 2013 1:35 pm

Re: need custom PDE help

Post by jjdezek »

I want to keep the DP AP part of the params and delete the rest. is it easy to change the name from DP to say WP40L and AP to say WP40R?


Image
Image
User avatar
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

Re: need custom PDE help

Post by lnevo »

Yes it's all very easy.

You will take out the block of code that is drawing the rest of the parameters and add something like this:

Code: Select all

DrawText(DPColor,DefaultBGColor,x+60,y+10,"DP:");
DrawSingleMonitor(ReefAngel.PWM.GetDaylightValue(), DPColor, x+78, y+10,1);
DrawText(APColor,DefaultBGColor,x+60,y+20,"AP:");
DrawSingleMonitor(ReefAngel.PWM.GetActinicValue(), APColor, x+78, y+20,1);
you will need to play with the x and y and change the DP and AP to what you want

The DrawText function prints your label and the DrawSingleMonitor draws the values.
jjdezek
Posts: 329
Joined: Fri May 17, 2013 1:35 pm

Re: need custom PDE help

Post by jjdezek »

easy for someone who knows what there doing maybe but is it easy for someone like me lol. ok so whats the x+60 mean, is that where its placing it on the screen? I tried plugging it in and get error not defined in scope?
Image
jjdezek
Posts: 329
Joined: Fri May 17, 2013 1:35 pm

Re: need custom PDE help

Post by jjdezek »

is this what you mean by changing the DP and AP?

Code: Select all

DrawText(WP40LColor,DefaultBGColor,x+60,y+10,"WP40L:");
DrawSingleMonitor(ReefAngel.PWM.GetDaylightValue(), WP40LColor, x+78, y+10,1);
DrawText(WP40RColor,DefaultBGColor,x+60,y+20,"WP40R:");
DrawSingleMonitor(ReefAngel.PWM.GetActinicValue(),WP40RPColor, x+78, y+20,1);
Image
User avatar
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

Re: need custom PDE help

Post by lnevo »

yes but don't change it for the colors... since WP40LColor and WP40RPColor are not defined... :)
jjdezek
Posts: 329
Joined: Fri May 17, 2013 1:35 pm

Re: need custom PDE help

Post by jjdezek »

so like this? now where do i put this exactly? in the bottom section or in the section between the global variable? I tried both but got the error saying not declared in this scope.
DrawText(DPColor,DefaultBGColor,x+60,y+10,"WP40L:");
DrawSingleMonitor(ReefAngel.PWM.GetDaylightValue(), DPColor, x+78, y+10,1);
DrawText(APColor,DefaultBGColor,x+60,y+20,"WP40R:");
DrawSingleMonitor(ReefAngel.PWM.GetActinicValue(),APColor, x+78, y+20,1);
Image
User avatar
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

Re: need custom PDE help

Post by lnevo »

This would all go inside your DrawCustomMain() function like you did with DrawStatus() and DrawParams(),

I see what the error is. I copied the code directly from the library function that does DrawMonitor...

so to use it in your code, you need to change DrawText to ReefAngel.LCD.DrawText and change DrawSingleMonitor to ReefAngel.LCD.DrawSingleMonitor.

Sorry about that.
jjdezek
Posts: 329
Joined: Fri May 17, 2013 1:35 pm

Re: need custom PDE help

Post by jjdezek »

so i changed it like this

Code: Select all

ReefAngel.LCD.DrawText(DPColor,DefaultBGColor,x+60,y+10,"WP40L:");
ReefAngel.LCD.DrawSingleMonitor(ReefAngel.PWM.GetDaylightValue(), DPColor, x+78, y+10,1);
ReefAngel.LCD.DrawText(APColor,DefaultBGColor,x+60,y+20,"WP40R:");
ReefAngel.LCD.DrawSingleMonitor(ReefAngel.PWM.GetActinicValue(),APColor, x+78, y+20,1);
and put it in here

Code: Select all

{
// the graph is drawn/updated when we exit the main menu &
// when the parameters are saved
ReefAngel.LCD.DrawDate(6, 112);
ReefAngel.LCD.DrawText(COLOR_INDIGO, COLOR_WHITE,25,5, "Jeremy's Reef");
pingSerial();
ReefAngel.LCD.DrawText(DPColor,DefaultBGColor,x+60,y+10,"WP40L:");
ReefAngel.LCD.DrawSingleMonitor(ReefAngel.PWM.GetDaylightValue(), DPColor, x+78, y+10,1);
ReefAngel.LCD.DrawText(APColor,DefaultBGColor,x+60,y+20,"WP40R:");
ReefAngel.LCD.DrawSingleMonitor(ReefAngel.PWM.GetActinicValue(),APColor, x+78, y+20,1);
DrawStatus (20,80);
DrawParams (5,60);
pingSerial();
byte TempRelay = ReefAngel.Relay.RelayData;
TempRelay &= ReefAngel.Relay.RelayMaskOff;
TempRelay |= ReefAngel.Relay.RelayMaskOn;
ReefAngel.LCD.DrawOutletBox(12, 93, TempRelay);
}
and got error the x and y are not declaired in this scope
Image
jjdezek
Posts: 329
Joined: Fri May 17, 2013 1:35 pm

Re: need custom PDE help

Post by jjdezek »

ok i moved it into the bottom portion with the custom params section and it loaded. just got to figure out the placement.
Image
jjdezek
Posts: 329
Joined: Fri May 17, 2013 1:35 pm

Re: need custom PDE help

Post by jjdezek »

thats not working all my params i.e. temp ph and pwm readings are all ontop of eachother.
ok did some more playing and created a new paramsa section to put the pwm files in so i can place them in there own area. :D
Last edited by jjdezek on Tue Jun 11, 2013 12:12 pm, edited 1 time in total.
Image
Post Reply