Page 3 of 3

Re: need custom PDE help

Posted: Tue Jun 11, 2013 12:07 pm
by lnevo
You just gotta play with the x and y's now. You don't define x and y in your DrawCustomMain I believe so you shouldn't have them in your DrawText and stuff... for the 4 lines you added, just start changing the x and y values to what works...

Now it's just a matter of moving things aroudn where you want them.

Re: need custom PDE help

Posted: Tue Jun 11, 2013 12:16 pm
by jjdezek
ok still have a problem with the temp and ph showing up correctly. the big numbers overlap the words temp and ph. how do you offset the words from the numbers in each set of coding is that what the x+80,y+10 are for?

Re: need custom PDE help

Posted: Tue Jun 11, 2013 12:18 pm
by lnevo
Yes, exactly. So just play around with it. You could always take out the x+ and y+ and just put hard coded numbers. It's odd that the temp and ph are offset though because the placement of the labels and variables should all be relative to each other, but not sure what's going on.

Either way you're on the right track.

Re: need custom PDE help

Posted: Tue Jun 11, 2013 12:24 pm
by jjdezek
heres my 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 <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,25,5, "Jeremy's Reef");
pingSerial();

DrawStatus (20,80);
DrawParams (5,40);
DrawParamsa (0,10);
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 DrawParamsa(int x, int y){
char buf[16];
  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);

}

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+=10;

  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;

 }

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()
{
}

Re: need custom PDE help

Posted: Tue Jun 11, 2013 12:37 pm
by jjdezek
Here is the screen

Image

Re: need custom PDE help

Posted: Tue Jun 11, 2013 12:45 pm
by lnevo
Looking good. Looks like the only thing left is to move the WP40R and WP40L labels over to the left. Something to keep in mind is that characters are 8pixels wide and you replaced two characters (AP and DP) with 5. That should tell you a bit how much to move them over.

Re: need custom PDE help

Posted: Tue Jun 11, 2013 2:02 pm
by jjdezek
For the wp40 I have it set at 0,10 and that's where it placed it. It's acting like the temp 1,2,and3 are still there.

Re: need custom PDE help

Posted: Tue Jun 11, 2013 2:49 pm
by lnevo
Lets see the code. Its acting like the temps are still there because that was there default location when i copied the code for you. I suspect its not 0 and 10 as you think

Re: need custom PDE help

Posted: Tue Jun 11, 2013 3:48 pm
by jjdezek
I posted the code above the last screen shot

Re: need custom PDE help

Posted: Tue Jun 11, 2013 4:07 pm
by lnevo
I see that! Kudos on creating your own function!!!!

You are indeed passing in 0,10 to your DrawParamsa function but inside that function the first draw is x+60!!!

So now go into your new function and adjust the values. You are well on your way!!

I feel like a proud poppa :D

Re: need custom PDE help

Posted: Tue Jun 11, 2013 5:15 pm
by jjdezek
yup that fixed it now its showing the full wp40L and wp40R centered in the screen

Re: need custom PDE help

Posted: Tue Jun 11, 2013 5:24 pm
by jjdezek
Image

Re: need custom PDE help

Posted: Tue Jun 11, 2013 5:25 pm
by lnevo
Sweet! Great job! Sorry I couldn't just do all that for you, but I do most of my replies from my phone or at work and don't have the compiler handy and drawing elements you really need the screen to test and see what you're doing. But it seems your picking it up pretty well and you built an awesome looking display! And now you can add C programmer to your resume!

Re: need custom PDE help

Posted: Tue Jun 11, 2013 5:27 pm
by jjdezek
Yeah I noticed that updated with correct one. Thanks for your time and help.

Re: need custom PDE help

Posted: Tue Jun 11, 2013 5:36 pm
by jjdezek
Yeah not yet still have some learning to do before I can put that on a resume. Next thing is to set up a toggle for the different wave patterns :D