custom main

Related to the development libraries, released by Curt Binder
Post Reply
wijigong
Posts: 51
Joined: Sat Sep 17, 2011 5:03 am

custom main

Post by wijigong »

io

i try my new config

everyting work find exept the custom main!!
the display show the standard display!!! with graph t1 t2 t3 etc

i need only temp1 on big size on center, port status date and time!!!

the french guy

// Autogenerated file by RAGen (v1.0.4.92), (10/05/2011 20:10)
// RA_100511_2010.pde
//
// This version designed for v0.8.5 Beta 12 or later

/* The following features are enabled for this PDE File:
#define DisplayImages
#define SetupExtras
#define WavemakerSetup
#define OverheatSetup
#define VersionMenu
#define ATOSetup
#define MetalHalideSetup
#define DirectTempSensor
#define StandardLightSetup
#define SaveRelayState
*/

#define CUSTOM_MAIN
#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>

//custom dysplay temp+on and off relay
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);
x = 12;
y += MENU_START_ROW+1;
char text[7];
ReefAngel.LCD.Clear(DefaultBGColor, x+16, y+65, x+65, y+16);


ConvertNumToString(text, ReefAngel.Params.Temp1, 10);
y += MENU_START_ROW*2;
x = 10;
ReefAngel.LCD.Clear(DefaultBGColor,x,y,x+(16*4),y+16);
ReefAngel.LCD.DrawHugeNumbers(T1TempColor, DefaultBGColor, x, y, text);
x += (16*4) + 8;

byte TempRelay = ReefAngel.Relay.RelayData;
TempRelay &= ReefAngel.Relay.RelayMaskOff;
TempRelay |= ReefAngel.Relay.RelayMaskOn;
ReefAngel.LCD.DrawOutletBox(12, 92, TempRelay);
}


void DrawCustomGraph()
{
}




void setup()
{
randomSeed(analogRead(0));
ReefAngel.Timer[1].SetInterval(random(InternalMemory.WM1Timer_read()));
ReefAngel.Timer[1].Start();
ReefAngel.Relay.On(Port6);


ReefAngel.Init(); //Initialize controller
ReefAngel.FeedingModePorts = B00110000;
ReefAngel.OverheatShutoffPorts = B00001110;
ReefAngel.WaterChangePorts = B11110001;


// Ports that are always on
ReefAngel.Relay.On(Port8);
ReefAngel.Relay.On(Port7);

}

void loop()
{
ReefAngel.ShowInterface();

// Specific functions
//ReefAngel.StandardATO(Port1);
ReefAngel.StandardLights(Port2, 11, 00, 20, 00);
ReefAngel.StandardLights(Port3, 10, 00, 22, 00);
ReefAngel.StandardHeater(Port4);

{

//wave maker fonction with night mode
if ( (hour() >= 22) || (hour() <= 8) ) // from 10p - 8a
{

ReefAngel.Relay.Off(Port6);
ReefAngel.Relay.On(Port5);
}
else
{
// during the day
if ( ReefAngel.Timer[1].IsTriggered() )
{
ReefAngel.Timer[1].SetInterval(random(25,50));
ReefAngel.Timer[1].Start();
ReefAngel.Relay.Toggle(Port6);
ReefAngel.Relay.Toggle(Port5);

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

Re: custom main

Post by binder »

The line

Code: Select all

#define CUSTOM_MAIN
needs to be placed inside the ReefAngel_Features.h file.

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

That topic has a guide on how to create it.
Also, if you are running 0.8.5.18 libraries, you do not need to include the ConvertNumToString function, it is already included in the libraries.

curt
wijigong
Posts: 51
Joined: Sat Sep 17, 2011 5:03 am

Re: custom main

Post by wijigong »

ok good

finalie its ok for the display i add custom main to the reef angel feature

but to call the ConvertNumToString function how i make this???
another question it is possible to set the screensaver on the display day on night off

now i have littre trouble with my wavemaker
i have 2 wavemaker, i need is on and off alternate

i try this
void setup

randomSeed(analogRead(0));
ReefAngel.Timer[1].SetInterval(random(InternalMemory.WM1Timer_read()));
ReefAngel.Timer[1].Start();
ReefAngel.Relay.On(Port6);

void loop

//wave maker fonction with night mode
if ( (hour() >= 22) || (hour() <= 8) ) // from 10p - 8a
{

ReefAngel.Relay.Off(Port6);
ReefAngel.Relay.On(Port5);
}
else
{
// during the day
if ( ReefAngel.Timer[1].IsTriggered() )
{
ReefAngel.Timer[1].SetInterval(random(25,50));
ReefAngel.Timer[1].Start();
ReefAngel.Relay.Toggle(Port6);
ReefAngel.Relay.Toggle(Port5);


but the two wavemaker is come on and off at the same time
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: custom main

Post by rimai »

The code above shows you have alternating port 5 and 6.
When 5 is on, port 6 will be off and vice versa.
Isn't it what you want?
Or you want both at totally random and different timers?
Roberto.
wijigong
Posts: 51
Joined: Sat Sep 17, 2011 5:03 am

Re: custom main

Post by wijigong »

yes, is what i need When 5 is on, port 6 will be off and vice versa

but is not working
if i upload this the two wavemaker come on and off at the same time

i don't no for what reason but i have working one time, after i upload again for change something on the display, is stop working

full pde

// Autogenerated file by RAGen (v1.0.4.92), (10/05/2011 20:10)
// RA_100511_2010.pde
//
// This version designed for v0.8.5 Beta 12 or later

/* The following features are enabled for this PDE File:
#define DisplayImages
#define SetupExtras
#define WavemakerSetup
#define OverheatSetup
#define VersionMenu
#define ATOSetup
#define MetalHalideSetup
#define DirectTempSensor
#define StandardLightSetup
#define SaveRelayState
*/

#define CUSTOM_MAIN
#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>

//custom dysplay temp+on and off relay
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);
x = 12;
y += MENU_START_ROW+1;
char text[7];
ReefAngel.LCD.Clear(DefaultBGColor, x+16, y+65, x+65, y+16);


ConvertNumToString(text, ReefAngel.Params.Temp1, 10);
y += MENU_START_ROW*2;
x = 10;
ReefAngel.LCD.Clear(DefaultBGColor,x,y,x+(16*4),y+16);
ReefAngel.LCD.DrawHugeNumbers(T1TempColor, DefaultBGColor, x, y, text);
x += (16*4) + 8;

byte TempRelay = ReefAngel.Relay.RelayData;
TempRelay &= ReefAngel.Relay.RelayMaskOff;
TempRelay |= ReefAngel.Relay.RelayMaskOn;
ReefAngel.LCD.DrawOutletBox(12, 92, TempRelay);
}


void DrawCustomGraph()
{
}




void setup()
{
randomSeed(analogRead(0));
ReefAngel.Timer[1].SetInterval(random(InternalMemory.WM1Timer_read()));
ReefAngel.Timer[1].Start();
ReefAngel.Relay.On(Port6);


ReefAngel.Init(); //Initialize controller
ReefAngel.FeedingModePorts = B00110000;
ReefAngel.OverheatShutoffPorts = B00001110;
ReefAngel.WaterChangePorts = B11110001;


// Ports that are always on
ReefAngel.Relay.On(Port8);
ReefAngel.Relay.On(Port7);

}

void loop()
{
ReefAngel.ShowInterface();

// Specific functions
//ReefAngel.StandardATO(Port1);
ReefAngel.StandardLights(Port2, 11, 00, 20, 00);
ReefAngel.StandardLights(Port3, 10, 00, 22, 00);
ReefAngel.StandardHeater(Port4);

{

//wave maker fonction with night mode
if ( (hour() >= 22) || (hour() <= 8) ) // from 10p - 8a
{

ReefAngel.Relay.Off(Port6);
ReefAngel.Relay.On(Port5);
}
else
{
// during the day
if ( ReefAngel.Timer[1].IsTriggered() )
{
ReefAngel.Timer[1].SetInterval(random(25,50));
ReefAngel.Timer[1].Start();
ReefAngel.Relay.Toggle(Port6);
ReefAngel.Relay.Toggle(Port5);

}
}
}
}

i need to define something on my reef angel feature ?????
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: custom main

Post by rimai »

Reboot the controller and let me know if it starts working.
Roberto.
binder
Posts: 2871
Joined: Fri Mar 18, 2011 6:20 pm
Location: Illinois
Contact:

Re: custom main

Post by binder »

There were a few things wrong with your code. I've cleaned it up and fixed it up again. Most notably you were trying to work with some of the variables before initializing the class. Inside the setup function, ReefAngel.Init() should be the first thing that is called. Otherwise, you will have problems.
This is what was causing your wavemaker problem. I also put in a minimum value of 10s for the wavemaker intervals. This will help make sure that one wavemaker does not get stuck on or off.

I noticed that initially, you are reading the interval from memory but when it goes to toggling in the loop function, you are picking a random number between 25 and 50 seconds. Is this correct or did you mean for it to be different than that?

Also, like I said earlier, you need to remove the ConvertNumToString function. It's already in the libraries. you can use it just by calling it. It's just there to use, no more having to create it.
Also the #define CUSTOM_MAIN does not need to be in the PDE file, but it must be inside the ReefAngel_Features.h file.

Here's the code for you:

Code: Select all


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

//custom dysplay temp+on and off relay 
void DrawCustomMain()
{
	byte x = 6;
	byte y = 2;
	byte t;
	ReefAngel.LCD.DrawDate(6, 2);
	ReefAngel.LCD.Clear(COLOR_BLACK, 1, 11, 132, 11);
	x = 12;
	y += MENU_START_ROW+1;
	char text[7];
	ReefAngel.LCD.Clear(DefaultBGColor, x+16, y+65, x+65, y+16); 

	ConvertNumToString(text, ReefAngel.Params.Temp1, 10);
	y += MENU_START_ROW*2;
	x = 10;
	ReefAngel.LCD.Clear(DefaultBGColor,x,y,x+(16*4),y+16);
	ReefAngel.LCD.DrawHugeNumbers(T1TempColor, DefaultBGColor, x, y, text);
	x += (16*4) + 8;

	byte TempRelay = ReefAngel.Relay.RelayData;
	TempRelay &= ReefAngel.Relay.RelayMaskOff;
	TempRelay |= ReefAngel.Relay.RelayMaskOn;
	ReefAngel.LCD.DrawOutletBox(12, 92, TempRelay);
}


void DrawCustomGraph()
{
}

void setup()
{
	ReefAngel.Init(); //Initialize controller
	
	randomSeed(analogRead(0));
	ReefAngel.Timer[1].SetInterval(random(10,InternalMemory.WM1Timer_read()));
	ReefAngel.Timer[1].Start();
	ReefAngel.Relay.On(Port6);
	
	ReefAngel.FeedingModePorts = B00110000;
	ReefAngel.OverheatShutoffPorts = B00001110;
	ReefAngel.WaterChangePorts = B11110001;

	// Ports that are always on
	ReefAngel.Relay.On(Port8);
	ReefAngel.Relay.On(Port7);
}

void loop()
{
	ReefAngel.ShowInterface();

	// Specific functions
	//ReefAngel.StandardATO(Port1);
	ReefAngel.StandardLights(Port2, 11, 00, 20, 00);
	ReefAngel.StandardLights(Port3, 10, 00, 22, 00);
	ReefAngel.StandardHeater(Port4);

	//wave maker fonction with night mode 
	if ( (hour() >= 22) || (hour() <= 8) ) // from 10p - 8a
	{
		ReefAngel.Relay.Off(Port6);
		ReefAngel.Relay.On(Port5);
	}
	else
	{
		// during the day
		if ( ReefAngel.Timer[1].IsTriggered() )
		{
			ReefAngel.Timer[1].SetInterval(random(25,50));
			ReefAngel.Timer[1].Start();
			ReefAngel.Relay.Toggle(Port6);
			ReefAngel.Relay.Toggle(Port5);
		} 
	}
}
This should help with your problem and get things working properly for you.

While reading through your code, you have it set to turn off Port6 and turn on Port 5 from 22 to 8. So during that time only Port 5 will be on and running. Then you will go back to toggling the wavemakers during the day. Is that correct?


curt
wijigong
Posts: 51
Joined: Sat Sep 17, 2011 5:03 am

Re: custom main

Post by wijigong »

roberto and curt thank you i work great with

ReefAngel.Timer[1].SetInterval(random(10,InternalMemory.WM1Timer_read()));


I begin to understand little by little

last question for set the screen saver time??? day on, night off

thank you again

is confirmed i love my RA
binder
Posts: 2871
Joined: Fri Mar 18, 2011 6:20 pm
Location: Illinois
Contact:

Re: custom main

Post by binder »

wijigong wrote:last question for set the screen saver time??? day on, night off
I'm not sure if I follow this question correctly. When you are talking about the screen saver time, are you referring to the amount of time before the screen turns off automatically? Example: You press the up arrow to display/show the screen then you don't do anything and the screen goes dark again.
Is this what you are referring to?

If it is, there is only one universal timeout for that. The default value is 10 minutes before it shuts off. If this is not desirable, it can be changed to a smaller amount of time. However, with the current code you cannot change this timeout value for different times of the day. That would require a little extra coding to be done.

If what I mentioned is exactly what you want, would you please provide the time in which you want the day/night screen saver timeouts to be effective for.

If this is not what you want, I think we will require some more information from you to be able to understand better.

curt
wijigong
Posts: 51
Joined: Sat Sep 17, 2011 5:03 am

Re: custom main

Post by wijigong »

yes is exactly that

the best for my is
on the day on 8h am to 10h pm is already on and the night is come black

but if y push on the joystick on the night the screen display normaly
Last edited by wijigong on Mon Oct 10, 2011 3:54 pm, edited 1 time in total.
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: custom main

Post by rimai »

One thing you can do is set the timeout to something over 24hrs.
It has to be tested to make sure the timer will take this value.
Then, you can use the ReefAngel.LCD.BacklightOn() and ReefAngel.LCD.BacklightOff() for night and day.
Something like this:

Code: Select all


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

//custom dysplay temp+on and off relay 
void DrawCustomMain()
{
   byte x = 6;
   byte y = 2;
   byte t;
   ReefAngel.LCD.DrawDate(6, 2);
   ReefAngel.LCD.Clear(COLOR_BLACK, 1, 11, 132, 11);
   x = 12;
   y += MENU_START_ROW+1;
   char text[7];
   ReefAngel.LCD.Clear(DefaultBGColor, x+16, y+65, x+65, y+16); 

   ConvertNumToString(text, ReefAngel.Params.Temp1, 10);
   y += MENU_START_ROW*2;
   x = 10;
   ReefAngel.LCD.Clear(DefaultBGColor,x,y,x+(16*4),y+16);
   ReefAngel.LCD.DrawHugeNumbers(T1TempColor, DefaultBGColor, x, y, text);
   x += (16*4) + 8;

   byte TempRelay = ReefAngel.Relay.RelayData;
   TempRelay &= ReefAngel.Relay.RelayMaskOff;
   TempRelay |= ReefAngel.Relay.RelayMaskOn;
   ReefAngel.LCD.DrawOutletBox(12, 92, TempRelay);
}


void DrawCustomGraph()
{
}

void setup()
{
   ReefAngel.Init(); //Initialize controller
   
   randomSeed(analogRead(0));
   ReefAngel.Timer[1].SetInterval(random(10,InternalMemory.WM1Timer_read()));
   ReefAngel.Timer[1].Start();
   ReefAngel.Relay.On(Port6);
   
   ReefAngel.FeedingModePorts = B00110000;
   ReefAngel.OverheatShutoffPorts = B00001110;
   ReefAngel.WaterChangePorts = B11110001;

   // Ports that are always on
   ReefAngel.Relay.On(Port8);
   ReefAngel.Relay.On(Port7);
   ReefAngel.Timer[LCD_TIMER].SetInterval(90000);
}

void loop()
{
   ReefAngel.ShowInterface();

   // Specific functions
   //ReefAngel.StandardATO(Port1);
   ReefAngel.StandardLights(Port2, 11, 00, 20, 00);
   ReefAngel.StandardLights(Port3, 10, 00, 22, 00);
   ReefAngel.StandardHeater(Port4);

   //wave maker fonction with night mode 
   if ( (hour() >= 22) || (hour() <= 8) ) // from 10p - 8a
   {
      ReefAngel.Relay.Off(Port6);
      ReefAngel.Relay.On(Port5);
      ReefAngel.LCD.BacklightOff();
   }
   else
   {
      // during the day
      if ( ReefAngel.Timer[1].IsTriggered() )
      {
         ReefAngel.Timer[1].SetInterval(random(25,50));
         ReefAngel.Timer[1].Start();
         ReefAngel.Relay.Toggle(Port6);
         ReefAngel.Relay.Toggle(Port5);
      } 
      ReefAngel.LCD.BacklightOn();
   }
}
Roberto.
wijigong
Posts: 51
Joined: Sat Sep 17, 2011 5:03 am

Re: custom main

Post by wijigong »

hehhee

tank you

i try it
binder
Posts: 2871
Joined: Fri Mar 18, 2011 6:20 pm
Location: Illinois
Contact:

Re: custom main

Post by binder »

rimai wrote:One thing you can do is set the timeout to something over 24hrs.
It has to be tested to make sure the timer will take this value.
The max value a timer can hold is something like 4 billion because it's an unsigned long (4 byte) variable. The problem you will get into though is that the function to set the interval is only an int (2 byte) variable which can only hold a value like 32,767. There is 86,400 seconds in a day. You "might" be able to set the value manually but you won't be able to store it in the internal memory the way it is because the LCD Timer is set to be an int storage. You will also have to manually set that timeout inside the setup function too. So you would need something like this inside your setup function:

Code: Select all

void setup()
{
    ReefAngel.Init();
    ReefAngel.Timer[LCD_TIMER].SetInterval(86400);  // LCD Sleep Mode timer
    ReefAngel.Timer[LCD_TIMER].Start();  // start timer
    // rest of functions here
}
It's worth a shot to test.

curt
wijigong
Posts: 51
Joined: Sat Sep 17, 2011 5:03 am

Re: custom main

Post by wijigong »

hello

i try this last weekend, i work find but when the screen is black(after 22h) if i push the jostick the screen dont come on

i think is need somethin like if (ReefAngel.Joystick.IsButtonPressed()) with minimum time for the screen

thank you again
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: custom main

Post by rimai »

Try this one:

Code: Select all


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

//custom dysplay temp+on and off relay 
void DrawCustomMain()
{
   byte x = 6;
   byte y = 2;
   byte t;
   ReefAngel.LCD.DrawDate(6, 2);
   ReefAngel.LCD.Clear(COLOR_BLACK, 1, 11, 132, 11);
   x = 12;
   y += MENU_START_ROW+1;
   char text[7];
   ReefAngel.LCD.Clear(DefaultBGColor, x+16, y+65, x+65, y+16); 

   ConvertNumToString(text, ReefAngel.Params.Temp1, 10);
   y += MENU_START_ROW*2;
   x = 10;
   ReefAngel.LCD.Clear(DefaultBGColor,x,y,x+(16*4),y+16);
   ReefAngel.LCD.DrawHugeNumbers(T1TempColor, DefaultBGColor, x, y, text);
   x += (16*4) + 8;

   byte TempRelay = ReefAngel.Relay.RelayData;
   TempRelay &= ReefAngel.Relay.RelayMaskOff;
   TempRelay |= ReefAngel.Relay.RelayMaskOn;
   ReefAngel.LCD.DrawOutletBox(12, 92, TempRelay);
}


void DrawCustomGraph()
{
}

void setup()
{
   ReefAngel.Init(); //Initialize controller
   
   randomSeed(analogRead(0));
   ReefAngel.Timer[1].SetInterval(random(10,InternalMemory.WM1Timer_read()));
   ReefAngel.Timer[1].Start();
   ReefAngel.Relay.On(Port6);
   
   ReefAngel.FeedingModePorts = B00110000;
   ReefAngel.OverheatShutoffPorts = B00001110;
   ReefAngel.WaterChangePorts = B11110001;

   // Ports that are always on
   ReefAngel.Relay.On(Port8);
   ReefAngel.Relay.On(Port7);
}

void loop()
{
   ReefAngel.ShowInterface();

   // Specific functions
   //ReefAngel.StandardATO(Port1);
   ReefAngel.StandardLights(Port2, 11, 00, 20, 00);
   ReefAngel.StandardLights(Port3, 10, 00, 22, 00);
   ReefAngel.StandardHeater(Port4);

   //wave maker fonction with night mode 
   if ( (hour() >= 22) || (hour() <= 8) ) // from 10p - 8a
   {
      ReefAngel.Relay.Off(Port6);
      ReefAngel.Relay.On(Port5);
      ReefAngel.Timer[LCD_TIMER].SetInterval(60);
      ReefAngel.LCD.BacklightOff();
   }
   else
   {
      // during the day
      if ( ReefAngel.Timer[1].IsTriggered() )
      {
         ReefAngel.Timer[1].SetInterval(random(25,50));
         ReefAngel.Timer[1].Start();
         ReefAngel.Relay.Toggle(Port6);
         ReefAngel.Relay.Toggle(Port5);
      } 
      ReefAngel.Timer[LCD_TIMER].SetInterval(90000);
      ReefAngel.LCD.BacklightOn();
   }
}
Roberto.
wijigong
Posts: 51
Joined: Sat Sep 17, 2011 5:03 am

Re: custom main

Post by wijigong »

finaly is very simple

i juste keep the line

ReefAngel.LCD.BacklightOn();

and is work great

the day is alway on and after 10pm i use the memory setting
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: custom main

Post by rimai »

Cool :)
Nice and easy :)
Roberto.
Post Reply