Things to add to a custom menu
Posted: Mon Feb 20, 2012 8:17 pm
I'd like to add two items to my menu.
1. Force Cloud
2. Force Thunderstorm
but have no idea where to begin.
I attempted to follow the instructions in the PWM Module User guide with no luck.
My LED's are configured like this
3 Banks of 12 Royal Blues
2 Banks of XP-E Cool Whites
2 Banks of XP-G Cool Whites
If possible, I'd like to do a rolling cloud effect. Maybe having all the blues dim slightly and the whites on one side dim followed by the other side. The other thing that would be neat would be to just have the XP-E's for lightining and everything else just get a little dimmer.
Here's my PDE...
1. Force Cloud
2. Force Thunderstorm
but have no idea where to begin.
I attempted to follow the instructions in the PWM Module User guide with no luck.
My LED's are configured like this
3 Banks of 12 Royal Blues
2 Banks of XP-E Cool Whites
2 Banks of XP-G Cool Whites
If possible, I'd like to do a rolling cloud effect. Maybe having all the blues dim slightly and the whites on one side dim followed by the other side. The other thing that would be neat would be to just have the XP-E's for lightining and everything else just get a little dimmer.
Here's my PDE...
Code: Select all
#define SIMPLE_MENU
#define DisplayLEDPWM
#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>
#define AutoTopOff 1
#define Actinic 2
#define Chiller 3
#define Heater 4
#define Skimmer 5
#define MetalHalide 6
#define SeaSwirl 7
#define Return 8
#define PWMRB1 0
#define PWMRB2 1
#define PWMRB3 2
#define PWMWT1 3
#define PWMWT2 4
#define PWMHN 5
byte PWMChannel[]={
0,0,0,0,0,0};
#include <avr/pgmspace.h>
//Create the menu entries
prog_char menu1_label[] PROGMEM= "Chow Time";
prog_char menu2_label[] PROGMEM= "h2o Change";
prog_char menu3_label[] PROGMEM= "Clear ATO Warning";
prog_char menu4_label[] PROGMEM= "ph Calibration";
prog_char menu5_label[] PROGMEM= "Set Date Time";
//Group menu entries together
PROGMEM const char *menu_items[] = {
menu1_label, menu2_label, menu3_label, menu4_label, menu5_label
};
void MenuEntry1()
{
ReefAngel.FeedingModeStart();
}
void MenuEntry2()
{
ReefAngel.WaterChangeModeStart();
}
void MenuEntry3()
{
ReefAngel.ATOClear();
ReefAngel.DisplayMenuEntry("Clear ATO Timeout");
}
void MenuEntry4()
{
ReefAngel.SetupCalibratePH();
ReefAngel.DisplayedMenu = ALT_SCREEN_MODE;
}
void MenuEntry5()
{
ReefAngel.SetupDateTime();
ReefAngel.DisplayedMenu = ALT_SCREEN_MODE;
}
void DrawCustomMain()
{
byte x = 6;
byte y = 2;
byte t;
ReefAngel.LCD.DrawLargeText(COLOR_BLACK, COLOR_WHITE, 6, 3, "Dave's 40g Reef");
ReefAngel.LCD.DrawDate(6, 120);
ReefAngel.LCD.Clear(COLOR_BLACK, 1, 14, 131, 14);
//pingSerial();
x = 12;
y += MENU_START_ROW+1;
ReefAngel.LCD.DrawText(COLOR_BLUE, COLOR_WHITE, x, y+6, "Temp: pH:");
char text[7];
ConvertNumToString(text, ReefAngel.Params.PH, 100);
ReefAngel.LCD.Clear(DefaultBGColor, x+16, y+65, x+65, y+16);
ReefAngel.LCD.DrawLargeText(PHColor, DefaultBGColor, x+75, y+18, text);
//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();
//Start Moon Phase Display
x += (16*4) + 8;
y += MENU_START_ROW+3;
ReefAngel.LCD.DrawText(COLOR_BLACK, COLOR_WHITE, 12, 55, "Moon Phase:");
if (ReefAngel.PWM.GetActinicValue() ==0) ReefAngel.LCD.DrawText(20,255,81,55,"Off");
else if(ReefAngel.PWM.GetActinicValue() >=1 && ReefAngel.PWM.GetActinicValue() < 20) ReefAngel.LCD.DrawText(20,255,81,55,"New");
else if(ReefAngel.PWM.GetActinicValue() >=20 && ReefAngel.PWM.GetActinicValue() < 35) ReefAngel.LCD.DrawText(20,255,81,55,"Cresent");
else if(ReefAngel.PWM.GetActinicValue() >=35 && ReefAngel.PWM.GetActinicValue() < 45) ReefAngel.LCD.DrawText(20,255,81,55,"Half");
else if(ReefAngel.PWM.GetActinicValue() >=45 && ReefAngel.PWM.GetActinicValue() < 60) ReefAngel.LCD.DrawText(20,255,81,55,"Gibbous");
else if(ReefAngel.PWM.GetActinicValue() >=60 && ReefAngel.PWM.GetActinicValue() < 80) ReefAngel.LCD.DrawText(20,255,81,55,"Full");
//End Display Moon Phase Display
byte TempRelay = ReefAngel.Relay.RelayData;
TempRelay &= ReefAngel.Relay.RelayMaskOff;
TempRelay |= ReefAngel.Relay.RelayMaskOn;
ReefAngel.LCD.DrawOutletBox(12, 102, TempRelay);
}
void DrawCustomGraph()
{
}
void setup()
{
ReefAngel.Init(); //Initialize controller
ReefAngel.InitMenu(pgm_read_word(&(menu_items[0])),SIZE(menu_items));
ReefAngel.Relay.On(Return); //Turn Return on at startup
ReefAngel.Relay.On(Skimmer); //Turn Skimmer on at startup
ReefAngel.Relay.On(SeaSwirl); //Turn SeaSwirl on at startup
}
void loop()
{
ReefAngel.StandardATO(AutoTopOff,30); //Setup AutoTopOff as Auto Top-Off function with 30s timeout
ReefAngel.MHLights(MetalHalide,14,30,21,00,15); //Daylight schedule 1:00pm - 9:30pm with 15min cool down
ReefAngel.StandardLights(Actinic,13,00,21,30); //Actinic schedule 1:00pm - 9:30pm
ReefAngel.StandardHeater(Heater,788,792); // Setup Heater to turn on at 78.8F and off at 79.2F
ReefAngel.StandardFan(Chiller,797,80); // Setup Chiller to turn on at 81.1F and off at 79.7F
if (hour()>=21 || hour()<10)
{
ReefAngel.PWM.SetActinic(MoonPhase());
}
else
{
ReefAngel.PWM.SetActinic(0);
}
//************************************************************ Start of PWM Expansion Code for Slope
PWMChannel[PWMRB2]=PWMSlope(9,30,21,30,0,90,60,PWMChannel[PWMRB2]); //Royal Blue - Right Bank
PWMChannel[PWMRB3]=PWMSlope(9,45,21,45,0,90,60,PWMChannel[PWMRB3]); //Royal Blue - Middle Bank
PWMChannel[PWMRB1]=PWMSlope(10,00,22,00,0,90,60,PWMChannel[PWMRB1]); //Royal Blue - Left Bank
PWMChannel[PWMWT2]=PWMSlope(11,00,21,00,0,90,90,PWMChannel[PWMWT2]); //XP-E Cool Whites - Left Side
PWMChannel[PWMWT1]=PWMSlope(11,30,21,30,0,90,90,PWMChannel[PWMWT1]); //XP-E Cool Whites - Right Side
PWMChannel[PWMHN]=PWMSlope(12,00,20,00,0,90,120,PWMChannel[PWMHN]); //XP-G Cool Whites - Left Side
if (hour()>=21 || hour()<12)
{
ReefAngel.PWM.SetDaylight(0);
}
else
{
ReefAngel.PWM.SetDaylight(PWMSlope(12,30,20,30,0,90,120,ReefAngel.PWM.GetDaylightValue())); //XP-G Cool Whites - Right Side
}
for (int a=0;a<6;a++)
{
ReefAngel.PWM.Expansion(a,int(2.55*PWMChannel[a]));
}
//************************************************************* End of PWM Expansion Code for Slope
ReefAngel.ShowInterface(); //Draw the Standard Interface
}