A Few Questions
Posted: Sat Mar 31, 2012 7:27 pm
Need help adding a couple things to my code. First:
i need a little help with my main screen. i want to add a display for my daylights and actinics, i know it should look something like this but i want to put it directly under the LED Dimming tile before the PWM Ch labels with Day being in the left column and act in the right. right now its showing under the right column and covering the Relay list. there is a blank space under the Temp and ph readings, i need to move up my divider, not sure how. The PWM Channels listed need to be changed to show channels 1-4, not 0-3 .I also want to center my banner title.
That's it for the main screen as for the rest:
I would like to use a second temp probe in the hood to shut off the lights if they start to overheat,
i assume it will be similar to the code for my heaters, but how do i set it up so that it turns off ports 6 and 7 when it hits 150 and back on at 140. not sure how to set it up so it won't activate with the first temp probe. finally I want to add a buzzer that goes off when ever there is an error (second float switch is activated, second temp probe shuts off light, ect.) It wired into channel 0 on the PWM mod, i figure i just need to write it to send power when an error occurs, again not sure how.
my code so far
i need a little help with my main screen. i want to add a display for my daylights and actinics, i know it should look something like this
Code: Select all
for (int a=0;a<4;a++)
{
if (a>1) x=75;
if (a==2) y=78;
ReefAngel.LCD.DrawText(COLOR_LIMEGREEN,DefaultBGColor,x,y,"Day:");
ReefAngel.LCD.DrawText(COLOR_LIMEGREEN,DefaultBGColor,x+12,y,a);
v = int( ReefAngel.PWM.GetDaylightValue());
ConvertNumToString(text, v, 1);
strcat(text," ");
ReefAngel.LCD.DrawText(COLOR_LIMEGREEN,DefaultBGColor,x+24,y,text);
y+=10;
}
{
if (a>1) x=75;
if (a==2) y=78;
ReefAngel.LCD.DrawText(COLOR_CORNFLOWERBLUE,DefaultBGColor,x,y,"Act:");
ReefAngel.LCD.DrawText(COLOR_CORNFLOWERBLUE,DefaultBGColor,x+12,y,a);
v = int( ReefAngel.PWM.GetActinicValue());
ConvertNumToString(text, v, 1);
strcat(text," ");
ReefAngel.LCD.DrawText(COLOR_LIMEGREEN,DefaultBGColor,x+24,y,text);
y+=10;
}That's it for the main screen as for the rest:
I would like to use a second temp probe in the hood to shut off the lights if they start to overheat,
i assume it will be similar to the code for my heaters, but how do i set it up so that it turns off ports 6 and 7 when it hits 150 and back on at 140. not sure how to set it up so it won't activate with the first temp probe. finally I want to add a buzzer that goes off when ever there is an error (second float switch is activated, second temp probe shuts off light, ect.) It wired into channel 0 on the PWM mod, i figure i just need to write it to send power when an error occurs, again not sure how.
my code so far
Code: Select all
/*
#define FONT_8X16
#define NUMBERS_8x16
#define DisplayImages
#define DateTimeSetup
#define DirectTempSensor
#define DisplayLEDPWM
#define wifi
#define StandardLightSetup
#define SaveRelayState
#define RelayExp
#define InstalledRelayExpansionModules 1
#define WDT
#define PWMEXPANSION
#define CUSTOM_MAIN
#define RFEXPANSION
#define FONT_8x16
#define NUMBERS_8x16
*/
#include <Salinity.h>
#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 <RF.h>
#include <IO.h>
#include <ORP.h>
#include <ReefAngel.h>
#include <avr/wdt.h>
byte x,y;
char text[10];
#define LEDPWM0 0
#define LEDPWM1 1
#define LEDPWM2 2
#define LEDPWM3 3
byte PWMChannel[]={
0,0,0,0,0,0};
int v;
void DrawCustomGraph()
{
}
void DrawCustomMain()
{
//Top Banner
ReefAngel.LCD.DrawText(COLOR_BLACK, COLOR_SKYBLUE, 9, 2, " Civiello Reef ");
// Display T1 Header Text
ReefAngel.LCD.DrawText(COLOR_CORNFLOWERBLUE,255,8,14,"Tank");
// Display the T1 Temp Value
char text[7];
ConvertNumToString(text, ReefAngel.Params.Temp[T1_PROBE], 10);
ReefAngel.LCD.Clear(255, 4, 21, 37, 37);
ReefAngel.LCD.DrawLargeText(COLOR_CORNFLOWERBLUE, 255, 4, 24, text, Num8x16);
pingSerial();
// Display the T2 Header Text
ReefAngel.LCD.DrawText(COLOR_CRIMSON,255,52,14,"Lights");
// Display the T2 Temp Value
ConvertNumToString(text, ReefAngel.Params.Temp[T2_PROBE], 10);
ReefAngel.LCD.Clear(255, 52, 21, 75, 37);
ReefAngel.LCD.DrawLargeText(COLOR_CRIMSON, 255, 52, 24, text, Num8x16);
pingSerial();
// Display pH Header Text
ReefAngel.LCD.DrawText(COLOR_INDIGO,255,108,14,"pH");
// Display pH Value
ConvertNumToString(text, ReefAngel.Params.PH, 100);
ReefAngel.LCD.Clear(255, 94, 21, 106, 37);
ReefAngel.LCD.DrawLargeText(COLOR_INDIGO, 255, 94, 24, text, Num8x16);
pingSerial();
// Display PMW Expansion Channel Headers and % Values
ReefAngel.LCD.Clear(DefaultFGColor,5,65,127,65);
ReefAngel.LCD.DrawText(COLOR_MAGENTA,DefaultBGColor,31,68,"LED Dimming");
x=15;
y=78;
for (int a=0;a<4;a++)
{
if (a>1) x=75;
if (a==2) y=78;
ReefAngel.LCD.DrawText(COLOR_MAGENTA,DefaultBGColor,x,y,"Ch :");
ReefAngel.LCD.DrawText(COLOR_MAGENTA,DefaultBGColor,x+12,y,a);
v = int(ReefAngel.PWM.GetChannelValue(a)/2.55);
ConvertNumToString(text, v, 1);
strcat(text," ");
ReefAngel.LCD.DrawText(COLOR_MAGENTA,DefaultBGColor,x+24,y,text);
y+=10;
}
pingSerial();
// Display Main Relay Box
byte TempRelay = ReefAngel.Relay.RelayData;
TempRelay &= ReefAngel.Relay.RelayMaskOff;
TempRelay |= ReefAngel.Relay.RelayMaskOn;
ReefAngel.LCD.DrawOutletBox(13, 97, TempRelay);
pingSerial();
//Draw Date & Time
ReefAngel.LCD.DrawDate(6, 123);
pingSerial();
}
void setup()
{
ReefAngel.Init(); //Initialize controller
}
void loop()
{
ReefAngel.SingleATOLow(Port1); //Setup Port1 as Auto Top-Off function with on/off
if (ReefAngel.HighATO.IsActive()) ReefAngel.Relay.Off(Port1); //upper float set as shut off fail safe
//Temp
ReefAngel.StandardHeater(Port3,780,785); // Setup Heater to turn on at 78.0F and off at 78.5F
ReefAngel.StandardHeater(Port4,780,785); // Setup Heater to turn on at 78.0F and off at 78.5F
ReefAngel.StandardFan(Port5,790,785); // Setup Chiller to turn on at 79.0F and off at 78.5F
//Lights
ReefAngel.StandardLights(Port2,21,30,10,30); //Refugium schedule 8:30pm - 10:30am
//Actinics
ReefAngel.PWM.SetActinic(PWMSlope(13,00,19,00,15,25,120,0)); //lights on at 1:00pm off at 7:00pm from 15% to 25% over 120 min
ReefAngel.StandardLights(Port6,12,30,19,30); //Actinic port on at 12:30am of att 7:30pm
//Day
ReefAngel.PWM.SetDaylight(PWMSlope(13,30,19,30,15,25,120,0)); //lights on at 1:30am off at 7:30pm from 15% to 25% over 120 min
ReefAngel.StandardLights(Port7,13,00,20,00); //Daylight port on at 1:00am off at 8:00pm
//Moon
ReefAngel.PWM.SetChannel(1,MoonPhase());
ReefAngel.PWM.SetChannel(2,MoonPhase());
ReefAngel.PWM.SetChannel(3,MoonPhase());
ReefAngel.PWM.SetChannel(4,MoonPhase());
ReefAngel.ShowInterface(); // Draws the standard graphical user interface
}