My last PDE

Share you PDE file with our community
Post Reply
lukeluke
Posts: 88
Joined: Mon Apr 04, 2011 4:12 am
Location: Rome, Italy

My last PDE

Post by lukeluke »

This is my last PDE.

I customize the monitor and use the SIMPLE MENU.

The monitor show:

- date
- PWM
- bigggg T1
- big PH
- small T2 & T3
- My stored value for Dosometric 1 , 2 & 3
- My Relay

Image

With this pde i make:
- ATO
- Fan
- Heater
- Skimmer Delay
- LED PWM Ramp
- 2 Dosometric pump split into 4 daily integration
- 1 Dosometric pump 1 daily integration

It's my pde:

Code: Select all

// RAMenus.pde
//
// This version designed for v0.8.5 Beta 10 and later

#include <ReefAngel_Features.h>
#include <ReefAngel_Globals.h>
#include <ReefAngel_Wifi.h>
#include <Wire.h>
#include <OneWire.h>
#include <Time.h>
#include <DS1307RTC.h>
#include <ReefAngel_EEPROM.h>
#include <ReefAngel_NokiaLCD.h>
#include <ReefAngel_ATO.h>
#include <ReefAngel_Joystick.h>
#include <ReefAngel_LED.h>
#include <ReefAngel_TempSensor.h>
#include <ReefAngel_Relay.h>
#include <ReefAngel_PWM.h>
#include <ReefAngel_Timer.h>
#include <ReefAngel_Memory.h>
#include <ReefAngel.h>

int DP3_Timer = InternalMemory.DP1Timer_read() * 4;

//Disegno schermo principale

void ConvertNumToString(char* string, int num, byte decimal)
{
	char temptxt[3];
	int Temp = num;
	if (Temp==0xFFFF) Temp=0;
		itoa(Temp/decimal,string,10);
	if (decimal>1)
	{
		itoa(Temp%decimal,temptxt,10);
		strcat(string, ".");
		if (Temp%decimal<10 && decimal==100) strcat(string, "0");
			strcat(string, temptxt);
	}
}

void DrawCustomMain()
{
	byte x = 6;
	byte y = 2;
	byte t;
	ReefAngel.LCD.DrawDate(6, 2);
	ReefAngel.LCD.Clear(COLOR_BLACK, 1, 11, 132, 11);
	pingSerial();
	x = 12;
	y += MENU_START_ROW+2;
	ReefAngel.LCD.DrawSingleMonitor(ReefAngel.PWM.GetDaylightValue(),DPColor, x, y, 1);
	t = intlength(ReefAngel.PWM.GetDaylightValue()) + 1;
	t *= 5;
	ReefAngel.LCD.DrawText(DPColor, DefaultBGColor, x+t, y, "%");
	t += 10;
	x += t;
	ReefAngel.LCD.DrawSingleMonitor(ReefAngel.PWM.GetActinicValue(),APColor, x, y, 1);
	t = intlength(ReefAngel.PWM.GetActinicValue()) + 1;
	t *= 5;
	ReefAngel.LCD.DrawText(APColor, DefaultBGColor, x+t, y, "%");
	t += 10;
	x += t;
	char text[7];
	ConvertNumToString(text, ReefAngel.Params.PH, 100);
	ReefAngel.LCD.Clear(DefaultBGColor, x+16, y, x+45, y+16);
	ReefAngel.LCD.DrawLargeText(PHColor, DefaultBGColor, x+16, y, text,Font8x16);
	pingSerial();
	ConvertNumToString(text, ReefAngel.Params.Temp1, 10);
	y += MENU_START_ROW*2;
	x = 10;
	ReefAngel.LCD.Clear(DefaultBGColor,x,y,x+(16*4),y+16);
	pingSerial();
	ReefAngel.LCD.DrawHugeNumbers(T1TempColor, DefaultBGColor, x, y, text);
	pingSerial();
	x += (16*4) + 8;
	ReefAngel.LCD.DrawText(T2TempColor,DefaultBGColor,x,y,"T2:");
	ReefAngel.LCD.DrawSingleMonitor(ReefAngel.Params.Temp2, T2TempColor, x+18, y, 10);
	ReefAngel.LCD.DrawText(T3TempColor,DefaultBGColor,x,y+10,"T3:");
	ReefAngel.LCD.DrawSingleMonitor(ReefAngel.Params.Temp3, T3TempColor, x+18, y+10, 10);
	y += 16*2;
	x = 8;
	ReefAngel.LCD.DrawText(DefaultFGColor, DefaultBGColor, x, y, "DP1:");
	ReefAngel.LCD.DrawText(DefaultFGColor, DefaultBGColor, x+25, y, InternalMemory.DP1Timer_read());
	ReefAngel.LCD.DrawText(DefaultFGColor, DefaultBGColor, x+37, y, "DP2:");
	ReefAngel.LCD.DrawText(DefaultFGColor, DefaultBGColor, x+62, y, InternalMemory.DP2Timer_read());
	ReefAngel.LCD.DrawText(DefaultFGColor, DefaultBGColor, x+75, y, "DP3:");
	ReefAngel.LCD.DrawText(DefaultFGColor, DefaultBGColor, x+101, y, DP3_Timer);
	x = 12;
	y += 15*3;
	byte TempRelay = ReefAngel.Relay.RelayData;
	TempRelay &= ReefAngel.Relay.RelayMaskOff;
	TempRelay |= ReefAngel.Relay.RelayMaskOn;
	ReefAngel.LCD.DrawOutletBox(x, y, TempRelay);
}

void DrawCustomGraph()
{
 // ReefAngel.LCD.DrawGraph(5,50);
}


void setup()
{
    ReefAngel.Init(); //Initialize controller
    ReefAngel.SetTemperatureUnit(1);  // set to Celsius Temperature
    ReefAngel.PWM.SetActinic(0);
    ReefAngel.PWM.SetDaylight(0);

    // Set the ports that get toggled on & off during the following modes
    // To enable a port to be toggled, place a 1 in the appropriate position
    // Uncomment and update as needed
    // Port 87654321
    ReefAngel.FeedingModePorts = B00000000;
    ReefAngel.WaterChangePorts = B00000000;
    //ReefAngel.OverheatShutoffPorts = B00001100;
    //ReefAngel.LightsOnPorts = B00000110;

    // Ports that are always on

//    ReefAngel.Relay.On(Port4);  //Turn the Skimmer
    ReefAngel.Relay.On(Port2);
   // ReefAngel.Relay.On(Port1);
   int DP3_Timer = InternalMemory.DP1Timer_read() * 4;
}

void loop()
{
    ReefAngel.ShowInterface();

    // Specific functions

    ReefAngel.SingleATOHigh(Port6);
    ReefAngel.StandardFan(Port1);
    ReefAngel.StandardHeater(Port8);
    ReefAngel.DelayedOn(Port4,10);

    ReefAngel.PWM.SetActinic(PWMSlope(12,15,23,45,0,InternalMemory.LEDPWMActinic_read(),90,ReefAngel.PWM.GetActinicValue()));
    ReefAngel.PWM.SetDaylight(PWMSlope(13,30,22,30,0,InternalMemory.LEDPWMDaylight_read(),30,ReefAngel.PWM.GetDaylightValue()));

    ReefAngel.DosingPump(Port3, 1, 23, 00, InternalMemory.DP1Timer_read());
    ReefAngel.DosingPump(Port3, 1, 05, 00, InternalMemory.DP1Timer_read());
    ReefAngel.DosingPump(Port3, 1, 11, 00, InternalMemory.DP1Timer_read());
    ReefAngel.DosingPump(Port3, 1, 17, 00, InternalMemory.DP1Timer_read());


    ReefAngel.DosingPump(Port5, 2, 23, 10, InternalMemory.DP2Timer_read());
    ReefAngel.DosingPump(Port5, 2, 05, 10, InternalMemory.DP2Timer_read());
    ReefAngel.DosingPump(Port5, 2, 11, 10, InternalMemory.DP2Timer_read());
    ReefAngel.DosingPump(Port5, 2, 17, 10, InternalMemory.DP2Timer_read());

    ReefAngel.DosingPump(Port7, 4, 23, 20, DP3_Timer); // Setup Dosing Pump 3 Oligo
}
Now, with the help of Curt, i'ld want add to display the ATO Alarm and the Overheat Alarm, so when the status LED is RED i can know why... ;-)
serhiyi
Posts: 50
Joined: Thu Jul 21, 2011 8:59 pm

Re: My last PDE

Post by serhiyi »

I tried your code to see what it does and could not compile it successfully

Binary sketch size: 32674 bytes (of a 30720 byte maximum)


Any advice how to fix it?

Thanks.
binder
Posts: 2871
Joined: Fri Mar 18, 2011 6:20 pm
Location: Illinois
Contact:

Re: My last PDE

Post by binder »

serhiyi wrote:I tried your code to see what it does and could not compile it successfully

Binary sketch size: 32674 bytes (of a 30720 byte maximum)


Any advice how to fix it?

Thanks.
Disable DateTimeSetup and also enable SIMPLE_MENU

Add this line to ReefAngel_Features.h for the simple menu

Code: Select all

#define SIMPLE_MENU
and then make sure that DateTimeSetup is not enabled (not inside the features file)

That will allow for the simplified menu system, which means you should use the Client Suite to handle your web banner and changing any values for lights, wavemakers, heaters, etc.

curt
serhiyi
Posts: 50
Joined: Thu Jul 21, 2011 8:59 pm

Re: My last PDE

Post by serhiyi »

Thanks! Missed this one line.
Adding #define SIMPLE_MENU helped!
serhiyi
Posts: 50
Joined: Thu Jul 21, 2011 8:59 pm

Re: My last PDE

Post by serhiyi »

Hm... Uploaded code and did not get same result.

I have graph at the top and all text is the same size. Only change I did was convert temp to F.

This is my features file

Code: Select all

// AutoGenerated file by RAGen (v1.0.4.92), (08/26/2011 17:42)

/*
 * Copyright 2010 / Curt Binder
 *
 * Licensed under the Apache License, Version 2.0 (the "License")
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */


#ifndef __REEFANGEL_FEATURES_H__
#define __REEFANGEL_FEATURES_H__

#define SIMPLE_MENU
#define DisplayLEDPWM
#define wifi

#define FONT_8x8
#define NUMBERS_16x16


#endif  // __REEFANGEL_FEATURES_H__
binder
Posts: 2871
Joined: Fri Mar 18, 2011 6:20 pm
Location: Illinois
Contact:

Re: My last PDE

Post by binder »

you will also need to add this statement to the features file.

Code: Select all

#define CUSTOM_MAIN
sorry for not mentioning it earlier, i thought it was implied since this was a custom main screen. no worries. this should fix things for you.

also, check out this thread. it's got a manual on how to enable and configure the custom main screens and the example that lukeluke based his screen off of.

http://forum.reefangel.com/viewtopic.php?f=14&t=109


curt
serhiyi
Posts: 50
Joined: Thu Jul 21, 2011 8:59 pm

Re: My last PDE

Post by serhiyi »

Thank you! That was it.
Post Reply