Status App + ATO Timeout

Community contributed apps
Post Reply
peitro
Posts: 13
Joined: Sat Oct 22, 2011 5:19 pm

Status App + ATO Timeout

Post by peitro »

Is it possible to reset the ATO Timeout Alarm using the ReefAngel Status App?

For some reason when my controller LCD goes into sleep mode, it does not wake up. All I get is a blank screen. The controller works fine, I just can't do anything that need me to look at the menu's (although pushing the button 3 times activates feeding mode, so the controller still works fine). If I reboot the controller, the LCD starts working again.
binder
Posts: 2871
Joined: Fri Mar 18, 2011 6:20 pm
Location: Illinois
Contact:

Re: Status App + ATO Timeout

Post by binder »

Currently there is not a way to reset the ATO timeout alarm or Overheat timeout alarm via the wifi interface. It can only be done from the menu.

With that being said, I can add in this functionality and then incorporate it into the Status App (I'm working on an update for the Status App too). It may take me a couple weeks to get something working though given my work schedule and the Christmas Holiday coming up.

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

Re: Status App + ATO Timeout

Post by rimai »

I use this trick:

Code: Select all

  if (ReefAngel.Relay.RelayMaskOffE[0]==127)
  {
    ReefAngel.ATOClear();
  }
I have ATO on my Expansion Box1 Relay8 and when I mask off that relay, it clears the ATO :)
The I just mask back to auto to resume normal ATO.
But it is very strange that LCD won't wake up.
Can you post your code?
Roberto.
peitro
Posts: 13
Joined: Sat Oct 22, 2011 5:19 pm

Re: Status App + ATO Timeout

Post by peitro »

It is almost as if there is some kind of interference, when I try to wake up the screen it is either all white and blank or blank with flickering lines running across it.

Code: Select all

// Autogenerated file by RAGen (v1.1.0.127), (10/22/2011 09:08)
// Modified to add moonlight control, light control, heater control 
// RA_102311_BASELN.pde
//
// This version designed for v0.8.5 Beta 17 or later
//
// MEMORY LOCATIONS USED
// 103, 113 STRIP LIGHT ON/OFF HOUR
// 102, 112 MAIN LIGHT ON/OFF HOUR
// 121, 122 WAVE MAKER RANDOM LIMITS
// 11, 12, 13, 14, 15 PERCENTAGES FOR MOONLIGHTS

/* The following features are enabled for this PDE File: 
#define DisplayImages
#define WavemakerSetup
#define DateTimeSetup
#define VersionMenu
#define ATOSetup
#define DirectTempSensor
#define DisplayLEDPWM
#define wifi
#define StandardLightSetup
#define SaveRelayState
#define WDT
*/


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

#include <avr/pgmspace.h>
// Labels for the web banner
prog_char id_label[] PROGMEM = "peitro";
prog_char probe1_label[] PROGMEM = "Sump";
prog_char probe2_label[] PROGMEM = "Refugium";
prog_char probe3_label[] PROGMEM = "Room";
prog_char relay1_label[] PROGMEM = "ATO";
prog_char relay2_label[] PROGMEM = "LED%20Main";
prog_char relay3_label[] PROGMEM = "LED%20Strip";
prog_char relay4_label[] PROGMEM = "Powerhead%202";
prog_char relay5_label[] PROGMEM = "Powerhead%201";
prog_char relay6_label[] PROGMEM = "Powerhead%203";
prog_char relay7_label[] PROGMEM = "Heater";
prog_char relay8_label[] PROGMEM = "Skimmer";
PROGMEM const char *webbanner_items[] = {
    id_label, probe1_label, probe2_label, probe3_label, relay1_label, relay2_label,
	relay3_label, relay4_label, relay5_label, relay6_label, relay7_label, relay8_label};

// variables for heater logic
int TFlag1 = 0; 
int TFlag2 = 0; 
int TFlag3 = 0;

    void setup()
    {
        ReefAngel.Init();  //Initialize controller
        // Initialize and start the web banner timer
        ReefAngel.LoadWebBanner(pgm_read_word(&(webbanner_items[0])), SIZE(webbanner_items));
        ReefAngel.Timer[4].SetInterval(180);  // set interval to 180 seconds
        ReefAngel.Timer[4].Start();
        ReefAngel.FeedingModePorts = B01100101;
        ReefAngel.WaterChangePorts = B01100000;
        ReefAngel.OverheatShutoffPorts = B00100100;

       
        // random timer for wavemaker
       randomSeed(analogRead(0));
       ReefAngel.Init();  //Initialize controller   
       ReefAngel.Timer[1].SetInterval(random(InternalMemory.read(121),InternalMemory.read(122))); //read times from internal memory
       ReefAngel.Timer[1].Start();
       ReefAngel.Relay.On(Port5);
       ReefAngel.Relay.Off(Port4);

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

    void loop()
    {
        // Specific functions
        // turn on top off pump 4 times a day if float switch allows
        if (hour() % 6 == 0){
        ReefAngel.SingleATOHigh(Port1);
        }
        else{
          ReefAngel.Relay.Off(Port1);
        }
       
        //turn on main light
        //use memory 102 and 112
        ReefAngel.StandardLights(2,InternalMemory.read(102),30,InternalMemory.read(112),30);
        //turn on strip light
        //use memory 103 and 113
        ReefAngel.StandardLights(3,InternalMemory.read(103),00,InternalMemory.read(113),00);

        // Turn off Port 7 when the temp of 2 of T1, T2, T3 gets above 82.0 degrees
        // Turn back on when temp goes below 78
       if ( ReefAngel.Params.Temp1 >= 820 ) {
          TFlag1 = 1;
       } 
       if ( ReefAngel.Params.Temp2 >= 820 ) {
          TFlag2 = 1;
       } 
       if ( ReefAngel.Params.Temp3 >= 820 ) {
          TFlag3 = 1;
       }    
       if ( ReefAngel.Params.Temp1 <= 780 ) {
          TFlag1 = 0;
       } 
       if ( ReefAngel.Params.Temp2 <= 780 ) {
          TFlag2 = 0;
       } 
       if ( ReefAngel.Params.Temp3 <= 780 ) {
          TFlag3 = 0;
       }     
       
       if ( (TFlag1 + TFlag2 + TFlag3) > 1 ) ReefAngel.Relay.Off(Port7);
       else ReefAngel.Relay.On(Port7);

       // Turn on moon lights based at different levels.
       // use memory 11, 12, 13, 14 for levels
       if (hour()>=19 || hour()<7)
       {
          if (hour()>=18 && hour()<21) {
             ReefAngel.PWM.SetActinic(InternalMemory.read(11));
             ReefAngel.PWM.SetDaylight(InternalMemory.read(11));
          }
          if (hour()>=21 && hour()<23) {
             ReefAngel.PWM.SetActinic(InternalMemory.read(12));
             ReefAngel.PWM.SetDaylight(InternalMemory.read(12));
          }
          if (hour()>=23 && hour()<1) {
             ReefAngel.PWM.SetActinic(InternalMemory.read(13));
             ReefAngel.PWM.SetDaylight(InternalMemory.read(13));
          }
          if (hour()>=1 && hour()<5) {
             ReefAngel.PWM.SetActinic(InternalMemory.read(12));
             ReefAngel.PWM.SetDaylight(InternalMemory.read(12));
          }
          if (hour()>=5 && hour()<7) {
             ReefAngel.PWM.SetActinic(InternalMemory.read(11));
             ReefAngel.PWM.SetDaylight(InternalMemory.read(11));
          }
       } else {
          ReefAngel.PWM.SetActinic(InternalMemory.read(14));
          ReefAngel.PWM.SetDaylight(InternalMemory.read(14));
       }
           
       // wavemaker code   
       if ( ReefAngel.Timer[1].IsTriggered() )
       {
          ReefAngel.Timer[1].SetInterval(random(InternalMemory.read(121),InternalMemory.read(122)));
          ReefAngel.Timer[1].Start();
          ReefAngel.Relay.Toggle(Port5);
          ReefAngel.Relay.Toggle(Port4);
       }

        // Web Banner stuff
        if(ReefAngel.Timer[4].IsTriggered())
        {
            ReefAngel.Timer[4].Start();
            ReefAngel.WebBanner();
        }

       ReefAngel.ShowInterface();
    }

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

Re: Status App + ATO Timeout

Post by rimai »

That interference is most likely caused by the inductance spike coming from your wavemaker pump.
Try placing the wavemakers on port 5 and 6, instead of 4 and 5.
Ports 5 and 6 have some special dampening components that minimize this effect.
In any case, to use the same trick I use to reset ATO through any app, place this in your code:

Code: Select all

  if (ReefAngel.Relay.RelayMaskOff==254)
  {
    ReefAngel.ATOClear();
  }
Roberto.
peitro
Posts: 13
Joined: Sat Oct 22, 2011 5:19 pm

Re: Status App + ATO Timeout

Post by peitro »

Moving the wavemaker from port 4 to port 6 seems to have made a difference so far.

Thanks!
peitro
Posts: 13
Joined: Sat Oct 22, 2011 5:19 pm

Re: Status App + ATO Timeout

Post by peitro »

On the next version of the libraries, would it be possible to change the ATO function to allow a fraction of an hour for the ATO Timeout Interval? Or to choose minutes instead of hours?

Not a biggie since I can work around it by only activating the ATO on minutes % 15 == 0, but it would be nice to be able to just use the standard ATO function and change the value in memory.
hoyo
Posts: 2
Joined: Tue Dec 27, 2011 8:57 pm

Re: Status App + ATO Timeout

Post by hoyo »

Hi,

I am using relay box port 1 to control my ATO, so which number can I use for this coding

Code: Select all

  if (ReefAngel.Relay.RelayMaskOff==254)
  {
    ReefAngel.ATOClear();
  }
thanks
JL
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: Status App + ATO Timeout

Post by rimai »

Should be the same.
When you mask the relay off, it should clear the ATO flag for you.
Roberto.
hoyo
Posts: 2
Joined: Tue Dec 27, 2011 8:57 pm

Re: Status App + ATO Timeout

Post by hoyo »

Thanks Roberto,

I did try last night, I was using the iphone app, but it didn't work, should i place this code in the loop? what does the number 254 mean?
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: Status App + ATO Timeout

Post by rimai »

Yes, in the loop()
254 means you have only the port 1 masked off.
254 is the same as 11111110 in binary, where each bit represents on port.
Roberto.
Post Reply