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
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
}