Code: Select all
// Versione 1.0
#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 <AI.h>
#include <RF.h>
#include <IO.h>
#include <ORP.h>
#include <Salinity.h>
#include <PH.h>
#include <WaterLevel.h>
#include <ReefAngel.h>
boolean PowerCoralActive=true;
boolean ScaredFish=false;
byte ScaredFishOnHour;
byte ScaredFishOnMinute;
prog_char menu1_label[] PROGMEM = "Alimentazione pesci";
prog_char menu2_label[] PROGMEM = "Alimentazione coralli";
prog_char menu3_label[] PROGMEM = "On luce";
prog_char menu4_label[] PROGMEM = "Off luce";
prog_char menu5_label[] PROGMEM = "Cambio acqua";
prog_char menu6_label[] PROGMEM = "ATO Clear";
prog_char menu7_label[] PROGMEM = "Overheat Clear";
prog_char menu8_label[] PROGMEM = "PH Calibration";
prog_char menu9_label[] PROGMEM = "Version";
PROGMEM const char *menu_items[] = {
menu1_label, menu2_label, menu3_label, menu4_label, menu5_label, menu6_label, menu7_label, menu8_label, menu9_label };
void MenuEntry1()
{
ReefAngel.FeedingModeStart();
}
void MenuEntry2()
{
PowerCoralActive=false;
ReefAngel.Timer[1].Start();
ReefAngel.DisplayedMenu=RETURN_MAIN_MODE;
}
void MenuEntry3()
{
ScaredFish=true;
ScaredFishOnHour=hour();
ScaredFishOnMinute=minute();
ReefAngel.Relay.RelayMaskOn|=Port4Bit;
ReefAngel.DisplayedMenu=RETURN_MAIN_MODE;
}
void MenuEntry4()
{
ScaredFish=false;
ReefAngel.Relay.RelayMaskOn=0;
ReefAngel.DisplayedMenu=RETURN_MAIN_MODE;
}
void MenuEntry5()
{
ReefAngel.WaterChangeModeStart();
}
void MenuEntry6()
{
ReefAngel.ATOClear();
ReefAngel.DisplayMenuEntry("Clear ATO Timeout");
}
void MenuEntry7()
{
ReefAngel.OverheatClear();
ReefAngel.DisplayMenuEntry("Clear Overheat");
}
void MenuEntry8()
{
ReefAngel.SetupCalibratePH();
ReefAngel.DisplayedMenu = ALT_SCREEN_MODE;
}
void MenuEntry9()
{
ReefAngel.DisplayVersion();
}
void setup()
{
ReefAngel.Init();
ReefAngel.SetTemperatureUnit( Celsius );
ReefAngel.InitMenu(pgm_read_word(&(menu_items[0])),SIZE(menu_items));
InternalMemory.FeedingTimer_write(600);
InternalMemory.OverheatTemp_write( 280 );
ReefAngel.PWM.SetActinic(0);
ReefAngel.PWM.SetDaylight(0);
ReefAngel.WaterChangePorts = Port1Bit | Port2Bit | Port3Bit | Port5Bit | Port6Bit | Port7Bit | Port8Bit;
ReefAngel.FeedingModePorts = Port1Bit | Port2Bit | Port5Bit | Port6Bit;
ReefAngel.LightsOnPorts = 0;
ReefAngel.OverheatShutoffPorts = Port7Bit;
ReefAngel.TempProbe = T1_PROBE;
ReefAngel.OverheatProbe = T1_PROBE;
ReefAngel.Timer[1].SetInterval(10800);
ReefAngel.Relay.On( Port2 );
}
void loop()
{
ReefAngel.Relay.DelayedOn( Port1,2 );
ReefAngel.SingleATO(true,Port3,60,0);
ReefAngel.StandardLights( Port4,10,59,19,5 );
ReefAngel.StandardLights( Port5,7,0,19,0 );
ReefAngel.Relay.Set( Port6, !ReefAngel.Relay.Status( Port5 ) );
ReefAngel.StandardHeater( Port7,239,241 );
ReefAngel.StandardFan( Port8,239,281 );
if (ScaredFish)
{
ReefAngel.PWM.SetDaylight( PWMSlope(ScaredFishOnHour,ScaredFishOnMinute,19,0,5,60,10,5) );
ReefAngel.PWM.SetActinic( PWMSlope(ScaredFishOnHour,ScaredFishOnMinute,17,0,5,30,10,5) );
}
else
{
ReefAngel.PWM.SetDaylight( PWMSlope(11,0,19,0,5,60,120,5) );
ReefAngel.PWM.SetActinic( PWMSlope(12,0,17,0,5,30,120,5) );
}
if (ReefAngel.Timer[1].IsTriggered()) PowerCoralActive=true;
ReefAngel.Relay.Set(Port1,PowerCoralActive);
ReefAngel.Portal("adrynapoletano", "bisboccia");
ReefAngel.ShowInterface();
}