Adding ATO to developmental PDE

Do you have a question on how to do something.
Ask in here.
YuppiWanna
Posts: 29
Joined: Sun Apr 17, 2011 6:46 pm

Adding ATO to developmental PDE

Post by YuppiWanna »

Okay so I've got everything pretty close to where I want it, except for the ATO. I don't like how the standard ATO works because it uses two floats and eliminates a safety layer.

-I want the lower float to control the on/off and only use the upper float as a backup incase the lower were to fail.
-I also want a text/email alert of the upper float were to ever be activated.

How do I add that to a PDE generated from RAGen??
Last edited by YuppiWanna on Mon Apr 25, 2011 7:17 am, edited 1 time in total.
Image
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: Adding ATO to developmental PDE

Post by rimai »

Let's do one step at a time.
First, let's work on the lower ATO.
You have to make sure you select Single ATO Low on RAGen.
Try that first then we move on to the alert.
Roberto.
YuppiWanna
Posts: 29
Joined: Sun Apr 17, 2011 6:46 pm

Re: Adding ATO to developmental PDE

Post by YuppiWanna »

I'm there, I think.. here is what I created the other day:


Internal Memory Code

Code: Select all

// Autogenerated file by RAGen (v1.0.4.92), (04/23/2011 21:41)
// Memory_042511_0908.pde
//
// This file sets the default values to the Internal Memory
//


#include <ReefAngel_Features.h>
#include <ReefAngel_Globals.h>
#include <Time.h>
#include <OneWire.h>
#include <Phillips6610LCDInv.h>
#include <avr/pgmspace.h>
#include <ReefAngel_EEPROM.h>


Phillips6610LCDInv e;

void setup()
{
    e.lcd_init();
    e.lcd_clear(COLOR_WHITE,0,0,132,132);
    e.lcd_BacklightOn();

    InternalMemory.MHOnHour_write(8);
    InternalMemory.MHOnMinute_write(0);
    InternalMemory.MHOffHour_write(15);
    InternalMemory.MHOffMinute_write(0);
    InternalMemory.MHDelay_write(15);
    InternalMemory.StdLightsOnHour_write(22);
    InternalMemory.StdLightsOnMinute_write(0);
    InternalMemory.StdLightsOffHour_write(6);
    InternalMemory.StdLightsOffMinute_write(0);
    InternalMemory.DP1OnHour_write(20);
    InternalMemory.DP1OnMinute_write(0);
    InternalMemory.DP2OnHour_write(22);
    InternalMemory.DP2OnMinute_write(30);
    InternalMemory.DP1Timer_write(10);
    InternalMemory.DP2Timer_write(10);
    InternalMemory.DP1RepeatInterval_write(60);
    InternalMemory.DP2RepeatInterval_write(60);
    InternalMemory.ATOTimeout_write(60);
    InternalMemory.ATOHighTimeout_write(60);
    InternalMemory.ATOHourInterval_write(0);
    InternalMemory.ATOHighHourInterval_write(0);
    InternalMemory.FeedingTimer_write(900);
    InternalMemory.LCDTimer_write(600);
    InternalMemory.LEDPWMActinic_write(50);
    InternalMemory.LEDPWMDaylight_write(50);
    InternalMemory.WM1Timer_write(200);
    InternalMemory.WM2Timer_write(354);
    InternalMemory.HeaterTempOn_write(780);
    InternalMemory.HeaterTempOff_write(791);
    InternalMemory.ChillerTempOn_write(810);
    InternalMemory.ChillerTempOff_write(799);
    InternalMemory.OverheatTemp_write(1200);
    InternalMemory.PHMax_write(840);
    InternalMemory.PHMin_write(550);
}

void loop()
{
    // display the values
    char buf[128];
    sprintf(buf, "MH %2d:%02d-%2d:%02d,%d", InternalMemory.MHOnHour_read(), InternalMemory.MHOnMinute_read(),
                                         InternalMemory.MHOffHour_read(), InternalMemory.MHOffMinute_read(),
                                         InternalMemory.MHDelay_read());
    e.lcd_draw_text(COLOR_BLACK, COLOR_WHITE, MENU_START_COL, MENU_START_ROW, buf);
    sprintf(buf, "Std %2d:%02d-%2d:%02d", InternalMemory.StdLightsOnHour_read(), InternalMemory.StdLightsOnMinute_read(),
                                          InternalMemory.StdLightsOffHour_read(), InternalMemory.StdLightsOffMinute_read());
    e.lcd_draw_text(COLOR_BLACK, COLOR_WHITE, MENU_START_COL, MENU_START_ROW*2, buf);
    sprintf(buf, "LED A: %d%% D: %d%%", InternalMemory.LEDPWMActinic_read(), InternalMemory.LEDPWMDaylight_read());
    e.lcd_draw_text(COLOR_BLACK, COLOR_WHITE, MENU_START_COL, MENU_START_ROW*3, buf);
    sprintf(buf, "WM1: %ds", InternalMemory.WM1Timer_read());
    e.lcd_draw_text(COLOR_BLACK, COLOR_WHITE, MENU_START_COL, MENU_START_ROW*4, buf);
    sprintf(buf, "WM2: %ds", InternalMemory.WM2Timer_read());
    e.lcd_draw_text(COLOR_BLACK, COLOR_WHITE, MENU_START_COL, MENU_START_ROW*5, buf);
    sprintf(buf, "F: %ds", InternalMemory.FeedingTimer_read());
    e.lcd_draw_text(COLOR_BLACK, COLOR_WHITE, MENU_START_COL, MENU_START_ROW*6, buf);
    sprintf(buf, "S: %ds", InternalMemory.LCDTimer_read());
    e.lcd_draw_text(COLOR_BLACK, COLOR_WHITE, MENU_START_COL, MENU_START_ROW*7, buf);
    sprintf(buf, "H On: %d -> %d", InternalMemory.HeaterTempOn_read(), InternalMemory.HeaterTempOff_read());
    e.lcd_draw_text(COLOR_BLACK, COLOR_WHITE, MENU_START_COL, MENU_START_ROW*9, buf);
    sprintf(buf, "C On: %d -> %d", InternalMemory.ChillerTempOn_read(), InternalMemory.ChillerTempOff_read());
    e.lcd_draw_text(COLOR_BLACK, COLOR_WHITE, MENU_START_COL, MENU_START_ROW*10, buf);
    sprintf(buf, "PH %d - %d", InternalMemory.PHMax_read(), InternalMemory.PHMin_read());
    e.lcd_draw_text(COLOR_BLACK, COLOR_WHITE, MENU_START_COL, MENU_START_ROW*11, buf);

    delay(10000);
    e.lcd_clear(COLOR_WHITE,0,0,132,132);

    sprintf(buf, "OH: %dF", InternalMemory.OverheatTemp_read());
    e.lcd_draw_text(COLOR_BLACK, COLOR_WHITE, MENU_START_COL, MENU_START_ROW, buf);
    sprintf(buf, "ATO L: %ds (%dh)", InternalMemory.ATOTimeout_read(), InternalMemory.ATOHourInterval_read());
    e.lcd_draw_text(COLOR_BLACK, COLOR_WHITE, MENU_START_COL, MENU_START_ROW*2, buf);
    sprintf(buf, "ATO H: %ds (%dh)", InternalMemory.ATOHighTimeout_read(), InternalMemory.ATOHighHourInterval_read());
    e.lcd_draw_text(COLOR_BLACK, COLOR_WHITE, MENU_START_COL, MENU_START_ROW*3, buf);

    sprintf(buf, "DP1: %2d:%02d", InternalMemory.DP1OnHour_read(), InternalMemory.DP1OnMinute_read());
    e.lcd_draw_text(COLOR_BLACK, COLOR_WHITE, MENU_START_COL, MENU_START_ROW*5, buf);
    sprintf(buf, "     %ds", InternalMemory.DP1Timer_read());
    e.lcd_draw_text(COLOR_BLACK, COLOR_WHITE, MENU_START_COL, MENU_START_ROW*6, buf);
    sprintf(buf, "DP2: %2d:%02d", InternalMemory.DP2OnHour_read(), InternalMemory.DP2OnMinute_read());
    e.lcd_draw_text(COLOR_BLACK, COLOR_WHITE, MENU_START_COL, MENU_START_ROW*7, buf);
    sprintf(buf, "     %ds", InternalMemory.DP2Timer_read());
    e.lcd_draw_text(COLOR_BLACK, COLOR_WHITE, MENU_START_COL, MENU_START_ROW*8, buf);

    delay(10000);
    e.lcd_clear(COLOR_WHITE,0,0,132,132);
}

"PDE" Code

Code: Select all

// Autogenerated file by RAGen (v1.0.4.92), (04/23/2011 21:43)
// RA_042311_2143.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 DateTimeSetup
#define VersionMenu
#define ATOSetup
#define DirectTempSensor
#define SingleATOSetup
#define StandardLightSetup
*/


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


void setup()
{
    ReefAngel.Init();  //Initialize controller

    ReefAngel.FeedingModePorts = B10011010;
    ReefAngel.WaterChangePorts = B11100001;
    ReefAngel.LightsOnPorts = B00000100;

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

void loop()
{
    ReefAngel.ShowInterface();

    // Specific functions
    ReefAngel.SingleATOLow(Port1);
    ReefAngel.StandardLights(Port3);
    ReefAngel.Wavemaker1(Port4);
    ReefAngel.Wavemaker2(Port5);
    ReefAngel.StandardFan(Port6);
    ReefAngel.StandardHeater(Port7);
    

}
I created both and loaded the Internal Memory to the controller first and following that I uploaded the "PDE" file to the controller. I had a hard time getting my float to even work consistently but eventually figured out it was a poor connection from the two-prong jack and the controller itself.
Image
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: Adding ATO to developmental PDE

Post by rimai »

Great!!!
Now that you got the first part done, let's work on the second one.
I know that Dave's client does not have the capability of sending an email by monitoring ATO ports.
So, we'll have to go with another solution.
Do you have the wifi attachment?
Roberto.
YuppiWanna
Posts: 29
Joined: Sun Apr 17, 2011 6:46 pm

Re: Adding ATO to developmental PDE

Post by YuppiWanna »

No wifi yet.. waiting for them to be back in stock.
Image
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: Adding ATO to developmental PDE

Post by rimai »

Drop in a request for Dave to add this functionality in his Client Suite app.
Roberto.
YuppiWanna
Posts: 29
Joined: Sun Apr 17, 2011 6:46 pm

Re: Adding ATO to developmental PDE

Post by YuppiWanna »

I don't run a computer 24/7 so I can't rely on the Client Suite for notifications. I thought I saw a few threads in the google group about code for an email notification when a certain condition is triggered?? I’m just not sure how to implement this within a PDE created in RAGen.

More importantly, I still need to add the emergency cutoff if the upper float is activated. I won't run the ATO until that's available.

I figured this would be a relatively simple thing do to, especially since they're both related to the same event. Thanks for your help to this point though.. I have faith we (well, mostly y'all) can figure this out =)
Image
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: Adding ATO to developmental PDE

Post by rimai »

The emergency cutoff can be implemented with this line:

Code: Select all

    if (ReefAngel.HighATO.IsActive()) ReefAngel.Relay.Off(Port1);
Where "Port1" is the port you assigned to your ATO.
If you currently don't have the wifi yet and your computer is not connected 24/7, there is just no way the controller would have internet access, making it impossible to send emails.
We can certanly get to that when the time comes, ok?
Roberto.
YuppiWanna
Posts: 29
Joined: Sun Apr 17, 2011 6:46 pm

Re: Adding ATO to developmental PDE

Post by YuppiWanna »

Great, I'll throw that in tonight.

I'll have the wifi as soon as they're available again--any idea when that will be?
Image
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: Adding ATO to developmental PDE

Post by rimai »

Pretty soon
Roberto.
astralmind
Posts: 99
Joined: Fri Apr 01, 2011 10:53 am

Re: Adding ATO to developmental PDE

Post by astralmind »

YuppiWanna wrote:Okay so I've got everything pretty close to where I want it, except for the ATO. I don't like how the standard ATO works because it uses two floats and eliminates a safety layer.

-I want the lower float to control the on/off and only use the upper float as a backup incase the lower were to fail.
-I also want a text/email alert of the upper float were to ever be activated.

How do I add that to a PDE generated from RAGen??

This is exactly what I'd like to achieve but with the Wifi attachment (I also have a PC running 24 7 if that matters). I have just placed my order but would like to have an idea how to achieve this either by actually coding it or simply by using RAgen/RAClient. As far as I can see, this is the only "non standard" function I'd like to achieve.

I have also seen in another thread that the "open/closed" parameter had to be inverted in the code since the HighATO switch is by default considered to be upside down with the wires ending up in the water. How would I code this and where should I add that code (and ... how I guess)

Thanks a lot :)
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: Adding ATO to developmental PDE

Post by rimai »

To get email alerts, you have to use this code:

Code: Select all

Wrong code...
Please continue reading the thread
And configure the wifi attachment to start forwarding requests to reefangel.com with these commands:

Code: Select all

set u m 2 
set d n www.reefangel.com 
set i h 198.171.134.6 
set i r 80 
save 
reboot 
Last edited by rimai on Wed May 04, 2011 2:46 pm, edited 1 time in total.
Roberto.
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: Adding ATO to developmental PDE

Post by rimai »

astralmind wrote:I have also seen in another thread that the "open/closed" parameter had to be inverted in the code since the HighATO switch is by default considered to be upside down with the wires ending up in the water. How would I code this and where should I add that code (and ... how I guess)
You will be using SingleATO() function and will not have this problem.
Roberto.
astralmind
Posts: 99
Joined: Fri Apr 01, 2011 10:53 am

Re: Adding ATO to developmental PDE

Post by astralmind »

Thank you!
YuppiWanna
Posts: 29
Joined: Sun Apr 17, 2011 6:46 pm

Re: Adding ATO to developmental PDE

Post by YuppiWanna »

Is Reef Angel able to do text alerts?
Image
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: Adding ATO to developmental PDE

Post by rimai »

You can use the email-sms gateway from your cell phone provider.
http://en.wikipedia.org/wiki/List_of_SMS_gateways
Roberto.
binder
Posts: 2871
Joined: Fri Mar 18, 2011 6:20 pm
Location: Illinois
Contact:

Re: Adding ATO to developmental PDE

Post by binder »

rimai wrote:To get email alerts, you have to use this code:

Code: Select all

    if (ReefAngel.HighATO.IsActive())
    {
        ReefAngel.Relay.Off(Port1);
        Serial.print("GET /status/alert.asp?e=roberto@imlogo.com&id=64\n\n");
    }
Aren't you thoughtful having this functionality available through reefangel.com. :D

That is a pretty slick feature to have and a simple way to have it implemented. I'm not sure if there would be a way for me to get RAGen to be able to implement something along this line or not (meaning having the ability to pick when an alert is triggered and have it send the notification).

Also, what are the parameters for the alert.asp script?
e - email address
id - id of some sort, how is this determined or chosen? is it assigned? or is it the same for everybody?

are there any other parameters?

curt
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: Adding ATO to developmental PDE

Post by rimai »

I'm sorry...
Actually the code I gave above won't work.
I remember now what the problem was.
That code will fire off a ton of emails to your inbox. Don't use it.
Here is the function that you need to add at the end of your code:

Code: Select all

void WifiSendAlert(byte id, boolean IsAlert)
{
  static byte alert_status;

  if (IsAlert)
  {
    if ((alert_status & 1<<(id-1))==0)
    {
      alert_status|=1<<(id-1);
      Serial.print("GET /status/alert.asp?e=bmhair03@hotmail.com&id=");
      Serial.println(alert_status,DEC);
      Serial.println("\n\n");
    }
  }
  else
  {
    if (id==0)
    {
      alert_status=0;
      delay(900);
    }
    else
    {
      alert_status&=~(1<<(id-1)); 
    }
  }
}
The id parameter is:
1="Auto top-off timeout"
2="T1 too high"
3="T1 too low"
4="T2 too high"
5="PH too high"
6="PH too low"
7="Custom Alert"

Then, to get the alert messages, you can simply use comparison statements in your loop() section like this:

Code: Select all

  //This will send an alert if T1 is below 76 and reset if above 77
  if (ReefAngel.Params.Temp1<760 && ReefAngel.Params.Temp1>0) WifiSendAlert(3,true); 
  if (ReefAngel.Params.Temp1>770 && ReefAngel.Params.Temp1<1850) WifiSendAlert(3,false);
  //This will send an alert if ATO timeout flag is raised
  if(bitRead(ReefAngel.Relay.RelayData,Port1-1)==0 && ReefAngel.LowATO.IsTopping()) WifiSendAlert(1,true); else WifiSendAlert(1,false);
  //This will send an alert if ATO High is triggered
  if (ReefAngel.HighATO.IsActive()) WifiSendAlert(7,true); else WifiSendAlert(7,false);
  //This will resend an email reminder of your alerts. It's set to remind every full hour.
  if (now()%3600==0) WifiSendAlert(0, false);
Roberto.
binder
Posts: 2871
Joined: Fri Mar 18, 2011 6:20 pm
Location: Illinois
Contact:

Re: Adding ATO to developmental PDE

Post by binder »

Excellent. I can work out a way to incorporate that into RAGen somehow or even into the Globals file (this will require some work though).

Regardless, I will manage to find a way to get the code incorporated and make it "easier" to utilize. It may take me some time unfortunately because my computer setup isn't fully operational but it will be added in. :)

curt
YuppiWanna
Posts: 29
Joined: Sun Apr 17, 2011 6:46 pm

Re: Adding ATO to developmental PDE

Post by YuppiWanna »

Sweet!
Image
astralmind
Posts: 99
Joined: Fri Apr 01, 2011 10:53 am

Re: Adding ATO to developmental PDE

Post by astralmind »

Definitly looking forward to those additions Curt! :D
binder
Posts: 2871
Joined: Fri Mar 18, 2011 6:20 pm
Location: Illinois
Contact:

Re: Adding ATO to developmental PDE

Post by binder »

With this code, if we trigger the alert by passing true to the isalert parameter, do we have to pass in false to clear the alert? It appears that we have to based on your code, but I wanted to be certain.

curt
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: Adding ATO to developmental PDE

Post by rimai »

Yeap, you are correct.
Roberto.
serhiyi
Posts: 50
Joined: Thu Jul 21, 2011 8:59 pm

Re: Adding ATO to developmental PDE

Post by serhiyi »

Hey guys.
I'm trying to implement messagin from controller via email using wifi module.

I can't tell it dows not work, but in some cases i'm not getting email whenI should.

I have LowATO set to turn pump on and off.
HightATO suppose to tell me when water level in fresh container is low. I used code from this thread. For some reason I'm not getting email every time I trigger HightATO.

Also, my wifi module flashes 3 yellow lights for some time (like 10-30 seconds) accasionally.
I'm not sure yet, but looks like this triggered by me setting alert from ATO, but I'm not sure as it also starts by itself.

Did anyone have somilar issue?

Thanks.
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: Adding ATO to developmental PDE

Post by rimai »

Can you post your code and features file?
Roberto.
serhiyi
Posts: 50
Joined: Thu Jul 21, 2011 8:59 pm

Re: Adding ATO to developmental PDE

Post by serhiyi »

Sure. Sorry I did not do it before:

Code:

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>


void WifiSendAlert(byte id, boolean IsAlert)
{
  static byte alert_status;

  if (IsAlert)
  {
    if ((alert_status & 1<<(id-1))==0)
    {
      alert_status|=1<<(id-1);
      Serial.print("GET /status/alert.asp?e=serhiyi@gmail.com&id=");
      Serial.println(alert_status,DEC);
      Serial.println("\n\n");
    }
  }
  else
  {
    if (id==0)
    {
      alert_status=0;
      delay(900);
    }
    else
    {
      alert_status&=~(1<<(id-1)); 
    }
  }
}


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;
   char text[7];


   ReefAngel.LCD.DrawDate(6, 2);
   ReefAngel.LCD.Clear(COLOR_BLACK, 1, 11, 132, 11);
   pingSerial();

   x = 4;
   y += 12;
   ReefAngel.LCD.DrawText(COLOR_BLACK, DefaultBGColor, x, y, "Temperature:");

   y += 10;
   ConvertNumToString(text, ReefAngel.Params.Temp1, 10);
   pingSerial();
   ReefAngel.LCD.DrawHugeNumbers(T1TempColor, DefaultBGColor, x, y, text);
   x = 76;
   ReefAngel.LCD.DrawText(T2TempColor,DefaultBGColor,x,y,"LED");
   ReefAngel.LCD.DrawSingleMonitor(ReefAngel.Params.Temp2, T2TempColor, x+28, y, 10);
   ReefAngel.LCD.DrawText(T3TempColor,DefaultBGColor,x,y+9,"ROOM");
   ReefAngel.LCD.DrawSingleMonitor(ReefAngel.Params.Temp3, T3TempColor, x+28, y+9, 10);
   pingSerial();

   ReefAngel.LCD.Clear(COLOR_BLACK, 1, 42, 132, 42);

   x = 4;
   y = 45;
   ReefAngel.LCD.DrawText(PHColor,DefaultBGColor,x,y,"pH");
   ReefAngel.LCD.DrawSingleMonitor(ReefAngel.Params.PH, PHColor, x+28, y, 100);
   y = 55;
//   ReefAngel.LCD.DrawText(COLOR_BLACK,DefaultBGColor,x,y,"ATO");
//   atoH = "Off";
//   if (ReefAngel.HighATO.IsActive()) atoH = "On";
//   atoL = "Off";
//   if (ReefAngel.LowATO.IsActive()) atoL = "On";
//   ReefAngel.LCD.DrawText(COLOR_BLACK,DefaultBGColor,x+28,y,"Hi "+atoH+" Low "+atoL);



   x = 76;
   y = 45;
   ReefAngel.LCD.DrawText(DPColor,DefaultBGColor,x,y,"DayL");
   x=104;
   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, "%");

   x = 76;
   y = 55;
   ReefAngel.LCD.DrawText(APColor,DefaultBGColor,x,y,"ActL");
   x=104;
   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, "%");

   pingSerial();


   x = 12;
   y = 118;
   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(0);
    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 = B11110000;
    ReefAngel.WaterChangePorts = B11110000;
    ReefAngel.OverheatShutoffPorts = B01011100;
    ReefAngel.LightsOnPorts = B00001110;

    ReefAngel.Relay.On(Port7); // Return Pump
    ReefAngel.Relay.On(Port8); // Skimmer
}

void loop()
{
    ReefAngel.ShowInterface();
    ReefAngel.Relay.On(Port7); // Return Pump
    ReefAngel.Relay.On(Port8); // Skimmer

    // Specific functions

    ReefAngel.SingleATOLow(Port1);
    if (ReefAngel.HighATO.IsActive()) {   // Overwrite ATO OFF - no water fresh water
      ReefAngel.Relay.Off(Port1);       
      if (ReefAngel.LowATO.IsActive()) {  // ATO low and high ON - no water
        ReefAngel.Relay.Off(Port7);       // Return Pump OFF
        ReefAngel.Relay.Off(Port8);       // Skimmer OFF
      }
    }

    
    ReefAngel.StandardFan(Port2);
    ReefAngel.MHLights(Port3);        // For LED Daylight
    ReefAngel.StandardLights(Port4);  // For LED Actinic
    ReefAngel.Wavemaker1(Port5);
    ReefAngel.Wavemaker1(Port6);

    ReefAngel.PWM.SetActinic(PWMSlope(InternalMemory.StdLightsOnHour_read(),InternalMemory.StdLightsOnMinute_read(),InternalMemory.StdLightsOffHour_read(),InternalMemory.StdLightsOffMinute_read(),0,InternalMemory.LEDPWMActinic_read(),90,ReefAngel.PWM.GetActinicValue()));
    ReefAngel.PWM.SetDaylight(PWMSlope(InternalMemory.MHOnHour_read(),InternalMemory.MHOnMinute_read(),InternalMemory.MHOffHour_read(),InternalMemory.MHOffMinute_read(),0,InternalMemory.LEDPWMDaylight_read(),60,ReefAngel.PWM.GetDaylightValue()));
    
  if (ReefAngel.Params.Temp1<760 && ReefAngel.Params.Temp1>0) WifiSendAlert(3,true); 
  if (ReefAngel.Params.Temp1>770 && ReefAngel.Params.Temp1<1850) WifiSendAlert(3,false);
  if(bitRead(ReefAngel.Relay.RelayData,Port1-1)==0 && ReefAngel.LowATO.IsTopping()) WifiSendAlert(1,true); else WifiSendAlert(1,false);
  if (ReefAngel.HighATO.IsActive()) WifiSendAlert(7,true); else WifiSendAlert(7,false);
  if (now()%3600==0) WifiSendAlert(0, false);
    
}
ReadAngel_Features.h

Code: Select all

#ifndef __REEFANGEL_FEATURES_H__
#define __REEFANGEL_FEATURES_H__

#define SIMPLE_MENU
#define DisplayLEDPWM
#define wifi

#define NUMBERS_16x16
#define CUSTOM_MAIN


#endif  // __REEFANGEL_FEATURES_H__
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: Adding ATO to developmental PDE

Post by rimai »

Everything seems correct.
Did you try leaving just the HighATO trigger?

Code: Select all

//  if (ReefAngel.Params.Temp1<760 && ReefAngel.Params.Temp1>0) WifiSendAlert(3,true); 
//  if (ReefAngel.Params.Temp1>770 && ReefAngel.Params.Temp1<1850) WifiSendAlert(3,false);
//  if(bitRead(ReefAngel.Relay.RelayData,Port1-1)==0 && ReefAngel.LowATO.IsTopping()) WifiSendAlert(1,true); else WifiSendAlert(1,false);
  if (ReefAngel.HighATO.IsActive()) WifiSendAlert(7,true); else WifiSendAlert(7,false);
//  if (now()%3600==0) WifiSendAlert(0, false);
Comment out the others and let me know if the emails still do not get sent.
Roberto.
serhiyi
Posts: 50
Joined: Thu Jul 21, 2011 8:59 pm

Re: Adding ATO to developmental PDE

Post by serhiyi »

Something strange is going on with my setup.

Loaded code with email notification for ATOHight only:
if (ReefAngel.HighATO.IsActive()) WifiSendAlert(7,true); else WifiSendAlert(7,false);

I reset wifi and loaded everything fresh on it. I tested wifi by loading code and got temperature readings in terminal as I should.
Loaded my code to RA and connected wifi. Green and yellow led on wifi wew blinking for about 35 seconds.
After that I got slow blinking of green.

Triggered ATO and got green/yellow dancing for long time again, but I got email.

The wifi is going crazy with green and yellow lights, only stops for few seconds to blink just green.

Connected to RA via http://192.168.1.112:2000/wifi.
First I got "Unknown request", after refresh I got controller's page and lights on WiFi became normal (slow green with occational yellow).
Closed RA web page.
Triggered ATO High.
Yellow led blinked at trigger. For about 5 seconds looked normal and now it is green/yellow crazy dance again.

No email this time (I was able to get couple of emails before during many times of re-uploads and resets).

Looks like getting RA web page stops lights from going nuts, but I had to hit refresh several times.

Just in case, cleared ATO warnings on controller (red status led was not on, but tried anyway).

WiFi still looks good and internal pages lods quickly with no issues.

Triggered ATO again and wifi is going crazy again. But I know for sure that trying to get internal web page makes it "normal".


I'm totally lost. What can I check or do to make it work?
Looks like it only happens when email notification is triggered. I just loaded code with all notifications commented out and wifi looks normal.
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: Adding ATO to developmental PDE

Post by rimai »

This seems to be the same bug that was fixed on the last patch.
Are you using latest version?
Roberto.
serhiyi
Posts: 50
Joined: Thu Jul 21, 2011 8:59 pm

Re: Adding ATO to developmental PDE

Post by serhiyi »

I'm using v0.8.5.16 dev libraries.
Was fix there or in standard?

Thanks.
Post Reply