Portal isn't updating for me today...

Related to the Portal
TanksNStuff
Posts: 188
Joined: Fri Dec 30, 2011 6:57 am

Portal isn't updating for me today...

Post by TanksNStuff »

Not sure why, but the Portal page isn't updating nor loading for me today at all.

My Android app is working fine and is getting data just fine, but the portal shows

Last Update: Never
Displaying data from: "Unavailable".

My sig picture shows it was last updated on 8/14/2012 7:26:47 AM... so it was working fine until yesterday morning. :?: :?:

Today, I've tried using the actual IP address and also switched to the dynamic dns website name... neither seems to be working. My android app is setup using xxxxxxxx.dyndns.xxx:2000.

Anyway, if anyone can help that would be appreciated.
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: Portal isn't updating for me today...

Post by rimai »

can you connect to the controller with your phone?
Roberto.
TanksNStuff
Posts: 188
Joined: Fri Dec 30, 2011 6:57 am

Re: Portal isn't updating for me today...

Post by TanksNStuff »

Yes. Everything displays correctly on the phone and i can make changes with the app too.

Portal just doesn't seem to want to connect.

Sent from my DROID RAZR using Tapatalk 2
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: Portal isn't updating for me today...

Post by rimai »

Are you sure you didn't change anything in the portal, like security key?
Have you uploaded a new code to the controller around that time?
Roberto.
TanksNStuff
Posts: 188
Joined: Fri Dec 30, 2011 6:57 am

Re: Portal isn't updating for me today...

Post by TanksNStuff »

Sorry I didn't reply back right away Roberto... been a lil busy with other things in life and didn't get a chance to come back here.

I haven't done anything with security key nor did I upload new code (except for the attempts at loading the weather sim code to the dimming module, but that was on Saturday the 11th... and I switched it all back to the default when it didn't work for me.)

Anyway, I just tried the portal page again before the reply and it connected fine. Not sure why it wasn't working before because I haven't done anything to my controller since my last post on wednesday. It just magically worked today, lol. My signature monitor has still been saying the "last update" was 8/14/12 until just now.

EDIT the signature monitor still shows last update at 8/14/12, but I just manually updated/refreshed the portal page a minute ago and it seems to be working. :?:
TanksNStuff
Posts: 188
Joined: Fri Dec 30, 2011 6:57 am

Re: Portal isn't updating for me today...

Post by TanksNStuff »

OK, the web banner in my sig seems to be updating correctly now too. Not sure how this got broken or how it got fixed, but all is good now. :D
TanksNStuff
Posts: 188
Joined: Fri Dec 30, 2011 6:57 am

Re: Portal isn't updating for me today...

Post by TanksNStuff »

Well, correction... the Portal is still working fine, but the web banner isn't updating for me now.

I'm puzzled since I haven't changed anything throughout all of this.
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: Portal isn't updating for me today...

Post by rimai »

I think it may be the timeouts I've been seeing lately, but they usually don't last that long and the controller eventually sends data.
I changed something on the ext release, but if you would like to try in advance, take a look at this post:
http://forum.reefangel.com/viewtopic.php?p=13102#p13102
Roberto.
TanksNStuff
Posts: 188
Joined: Fri Dec 30, 2011 6:57 am

Re: Portal isn't updating for me today...

Post by TanksNStuff »

Thanks for the quick reply as usual Roberto!

The "fix" you have in that link appears to need me to re-upload code to my controller... which I'm too tired to do right now.

I'm going on vacation on Saturday morning, so hopefully I'll get a chance to test the fix before then.
TanksNStuff
Posts: 188
Joined: Fri Dec 30, 2011 6:57 am

Re: Portal isn't updating for me today...

Post by TanksNStuff »

Just following up on this. I added the fix Roberto suggested and it seemed to work for a while. It didn't update as often as I'd like, but it was at least once per day for a while.

As of right now, Portal isn't updating for me at all since 10/8/2012 @ 7:59:34 AM (EST).

When I go to the Portal page now, it just says:
Reef Angel wifi address: xxxxxxx.dyndns.info:2000 (update)
My reefangelid: TanksNStuff
Connection Status:

Last Update: Never
Displaying data from: Unavailable
and never updates.

I've tried using my current external IP address as well as the dyn.dns one that has worked in the past and is currently working for the Android App right now... but not working for the Portal.

WiFi attachment is blinking Green as normal and Android App works like a charm with everything I try. Portal just won't connect?
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: Portal isn't updating for me today...

Post by rimai »

Can you browse http://xxxx.dyndns.info:2000 ??
If you can, the portal should too.
Roberto.
TanksNStuff
Posts: 188
Joined: Fri Dec 30, 2011 6:57 am

Re: Portal isn't updating for me today...

Post by TanksNStuff »

I can, but this is all the page shows:
Reef Angel Controller Web Server (in large font).

What is the command to view the data? /r ?
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: Portal isn't updating for me today...

Post by rimai »

/r99
Did you ever use tera term or putty?
Roberto.
TanksNStuff
Posts: 188
Joined: Fri Dec 30, 2011 6:57 am

Re: Portal isn't updating for me today...

Post by TanksNStuff »

No, I've never used tera term or putty

/r99 gives me the following output:

Code: Select all

- <RA>
  <T1>766</T1> 
  <T2>768</T2> 
  <T3>703</T3> 
  <PH>817</PH> 
  <R>244</R> 
  <RON>0</RON> 
  <ROFF>255</ROFF> 
  <R1>79</R1> 
  <RON1>0</RON1> 
  <ROFF1>255</ROFF1> 
  <R2>0</R2> 
  <RON2>0</RON2> 
  <ROFF2>255</ROFF2> 
  <R3>0</R3> 
  <RON3>0</RON3> 
  <ROFF3>255</ROFF3> 
  <R4>0</R4> 
  <RON4>0</RON4> 
  <ROFF4>255</ROFF4> 
  <R5>0</R5> 
  <RON5>0</RON5> 
  <ROFF5>255</ROFF5> 
  <R6>0</R6> 
  <RON6>0</RON6> 
  <ROFF6>255</ROFF6> 
  <R7>0</R7> 
  <RON7>0</RON7> 
  <ROFF7>255</ROFF7> 
  <R8>0</R8> 
  <RON8>0</RON8> 
  <ROFF8>255</ROFF8> 
  <ATOLOW>0</ATOLOW> 
  <ATOHIGH>0</ATOHIGH> 
  <EM>3</EM> 
  <REM>1</REM> 
  <PWMA>0</PWMA> 
  <PWMD>0</PWMD> 
  <PWME0>92</PWME0> 
  <PWME1>92</PWME1> 
  <PWME2>66</PWME2> 
  <PWME3>66</PWME3> 
  <PWME4>0</PWME4> 
  <PWME5>0</PWME5> 
  <RFM>0</RFM> 
  <RFS>100</RFS> 
  <RFD>20</RFD> 
  <RFW>0</RFW> 
  <RFRB>0</RFRB> 
  <RFR>0</RFR> 
  <RFG>0</RFG> 
  <RFB>0</RFB> 
  <RFI>0</RFI> 
  </RA>
TanksNStuff
Posts: 188
Joined: Fri Dec 30, 2011 6:57 am

Re: Portal isn't updating for me today...

Post by TanksNStuff »

I get the same output when using my external ip address with :2000/r99 also.

Seems like the data is being sent, but Portal is not updating.
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: Portal isn't updating for me today...

Post by rimai »

I'm curious to know what you have in your settings.
Can you download putty and connect to the wifi attachment through serial at 57600 baud?
To enter command mode, you need to type $$$ within half a second. The module should respond with CMD.
Then, send this command:
get c
It should return with some settings.
Copy and paste here
Roberto.
TanksNStuff
Posts: 188
Joined: Fri Dec 30, 2011 6:57 am

Re: Portal isn't updating for me today...

Post by TanksNStuff »

I just downloaded Putty, but not quite sure how to use it yet. Can it be used remotely? I'm at work right now.

If I go to the serial connection page, it only asks for a COM port and speed, etc. Nothing to add an IP address to connect remotely.

Do I need to do it through the proxy connection? Sorry for my ignorance, I'm just not familiar with this prog yet.
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: Portal isn't updating for me today...

Post by rimai »

You must connect through serial cable.
Roberto.
TanksNStuff
Posts: 188
Joined: Fri Dec 30, 2011 6:57 am

Re: Portal isn't updating for me today...

Post by TanksNStuff »

OK, I'll do this tonight when I get home then.

For what it's worth, I tried connecting to the IP/port via Telnet and entered $$$ as the window popped up.

It gave me this:

Code: Select all

$$$
CMD


<2.23> get c
get c

OPEN=
CLOSE=
REMOTE=
FlushSize=1420
MatchChar=0
FlushTimer=10
IdleTimer=3
CmdChar=$
<2.23>
Is that what you're looking for?
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: Portal isn't updating for me today...

Post by rimai »

yes, that's what I wanted to see.
Can you do the same thing bu with "get e". This will dump all settings.
Roberto.
TanksNStuff
Posts: 188
Joined: Fri Dec 30, 2011 6:57 am

Re: Portal isn't updating for me today...

Post by TanksNStuff »

Code: Select all

$$$
CMD


<2.23> get e
get e

WiFly Ver 2.23, 04-26-2011 on 131C11
Beacon=100
Probe=5
OPEN=
CLOSE=
REMOTE=
FlushSize=1420
MatchChar=0
FlushTimer=10
IdleTimer=3
CmdChar=$
IF=UP
DHCP=ON
IP=192.168.1.117:2000
NM=255.255.255.0
GW=192.168.1.1
HOST=198.171.134.6:80
PROTO=TCP,
MTU=1524
FLAGS=0x6
BACKUP=0.0.0.0
DNS=75.75.75.75
Name=www.reefangel.com
Backup=backup2
FTP=208.109.14.133:21
File=wifly-GSX.img
User=roving
Pass=Pass123
Dir=public
Timeout=40
FTP_mode=0x0
SSID=xxxxxxxx   <~~~~~ Changed for privacy
Chan=0
ExtAnt=0
Join=1
Auth=OPEN
Mask=0x1fff
Rate=12, 24 Mb
Linkmon=0
Passphrase=xxxxxxxx   <~~~~~ Changed for privacy
SleepTmr=0
WakeTmr=0
Trigger=0x10
Autoconn=0
IoFunc=0x0
IoMask=0x20f0
IoValu=0x0
PrintLvl=0x0
TimeEna=0
TIMEADR=129.6.15.28:123
Zone=7
Baudrate=57600
Flow=0x0
Mode=0x2
JoinTmr=1000
Replace=0x24
DeviceId=ReefAngelWifi
Password=
Format=0x0
Signal=0
Average=5
BCAST=255.255.255.255:55555
Interval=0x7
Sensor=0x0
SensePwr=0x0
<2.23>
I edited out my network name and password for privacy. Didn't want to share that on a public forum for obvious reasons.
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: Portal isn't updating for me today...

Post by rimai »

yeah, everything looks good.
Not sure why it is not connecting.
Roberto.
TanksNStuff
Posts: 188
Joined: Fri Dec 30, 2011 6:57 am

Re: Portal isn't updating for me today...

Post by TanksNStuff »

Hmm, OK.

Is it preferred to use the external IP address or the dyndns.info for the portal? I know either will probably work, but which is more "failsafe" to use?
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: Portal isn't updating for me today...

Post by rimai »

The portal automatically changes it to the latest ip address when it receives data, so no matter what you put in, eventually it gets changed by the Portal anyway.
But if it doesn't receive data, it has no way of telling which ip address you are sending it from.
Roberto.
TanksNStuff
Posts: 188
Joined: Fri Dec 30, 2011 6:57 am

Re: Portal isn't updating for me today...

Post by TanksNStuff »

I think that might be the issue then. Any way to "push" the data to the Portal manually so that it gets a latest IP address?

What if I tried removing all the portal info from my profile and saving, then re-entering it from scratch?
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: Portal isn't updating for me today...

Post by rimai »

No, it has to do with the controller not communicating with the server.
I'm checking the log and I don't see any connection from your controller.
The libraries I pushed today has a change on the submission page.
Can you try that?
Roberto.
TanksNStuff
Posts: 188
Joined: Fri Dec 30, 2011 6:57 am

Re: Portal isn't updating for me today...

Post by TanksNStuff »

What do you mean? Update my libraries? I'll look into that when I get home tonight. Leaving work now and have to run an errand before I get home so I'll be away for a couple hours.
TanksNStuff
Posts: 188
Joined: Fri Dec 30, 2011 6:57 am

Re: Portal isn't updating for me today...

Post by TanksNStuff »

OK Roberto. Updating the Libraries seems to have fixed my portal. It's working again!

My webbanner doesn't seem to have been updated though. Do I need to put a command in my .ino to update the webbanner or does that get updated automatically through the portal?
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: Portal isn't updating for me today...

Post by rimai »

You need the Portal() function.
Roberto.
TanksNStuff
Posts: 188
Joined: Fri Dec 30, 2011 6:57 am

Re: Portal isn't updating for me today...

Post by TanksNStuff »

I do have that in my code though:

Code: Select all

// Autogenerated file by RAGen (v1.2.1.158), (03/08/2012 22:54)
// RA_030812_2254.ino
//
// This version designed for v0.9.0 or later

/* The following features are enabled for this File: 
#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 <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 <RF.h>
#include <ReefAngel.h>
#include <avr/wdt.h>

//*********************************************************************************************************************************
//--------------------------------------------------- Start of Global Variables ---------------------------------------------------
// This is just how we are going to reference the PWM expansion ports within the code.
// You can change the labels if you would like, just as long as they are changed all throughout the code too.
#define LEDPWM0 0
#define LEDPWM1 1
#define LEDPWM2 2
#define LEDPWM3 3
#define LEDPWM4 4
#define LEDPWM5 5

// Initial values to all 6 PWM channels at startup. They will always be 0.
byte PWMChannel[]={
0,0,0,0,0,0};

// Globals Needed for Params on Custom Main
byte x,y;
char text[10];
int v;

// Globals Needed for RF Mode on Custom Main
byte vtechmode;
boolean bFeeding=false;
//------------------------------------------------------ End of Global Variables --------------------------------------------------
//*********************************************************************************************************************************
//---------------------------------------------Custom Main for PWM Expansion Module------------------------------------------------

void DrawCustomMain()
{
        //Top Banner
        ReefAngel.LCD.DrawText(COLOR_BLACK, COLOR_SKYBLUE, 9, 2, " George's 75G 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,53,14,"Sump");
  
        // 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 Vortech MP40wES Mode Header Text
        ReefAngel.LCD.Clear(DefaultFGColor,5,39,127,39);
        ReefAngel.LCD.DrawText(0,255,18,42,"EcoSmart Vortech");

        // Display EcoSmart Mode Value      
        ReefAngel.LCD.Clear(255, 1, 49, 128, 64);
        if (vtechmode == 0) ReefAngel.LCD.DrawLargeText(COLOR_LIMEGREEN,255,35,50,"Constant");
        else if (vtechmode == 1) ReefAngel.LCD.DrawLargeText(COLOR_GOLD,255,42,50,"Lagoon");
        else if (vtechmode == 2) ReefAngel.LCD.DrawLargeText(COLOR_GOLD,255,25,50,"Reef Crest");
        else if (vtechmode == 3) ReefAngel.LCD.DrawLargeText(COLOR_CORNFLOWERBLUE,255,22,50,"Short Pulse");
        else if (vtechmode == 4) ReefAngel.LCD.DrawLargeText(COLOR_PINK,255,25,50,"Long Pulse");
        else if (vtechmode == 5) ReefAngel.LCD.DrawLargeText(COLOR_MAGENTA,255,8,50,"Nutrient Trnsp.");
        else if (vtechmode == 6) ReefAngel.LCD.DrawLargeText(COLOR_MAGENTA,255,23,50,"Tidal Swell");
        else if (vtechmode == 9) ReefAngel.LCD.DrawLargeText(COLOR_WHITE,0,45,50,"Night");

        // Display PMW Expansion Channel Headers and % Values
        ReefAngel.LCD.Clear(DefaultFGColor,5,65,127,65);
        ReefAngel.LCD.DrawText(COLOR_DARKGOLDENROD,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_DARKGOLDENROD,DefaultBGColor,x,y,"Ch :");
          ReefAngel.LCD.DrawText(COLOR_DARKGOLDENROD,DefaultBGColor,x+12,y,a);
          //v = int(ReefAngel.PWM.GetChannelValue(a));
          v = int(ReefAngel.PWM.GetChannelValue(a)/2.55);
          ConvertNumToString(text, v, 1);
          strcat(text,"  ");
          ReefAngel.LCD.DrawText(COLOR_DARKGOLDENROD,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();
 
        // Display Expansion Relay Box 1
        TempRelay = ReefAngel.Relay.RelayDataE[0];
        TempRelay &= ReefAngel.Relay.RelayMaskOffE[0];
        TempRelay |= ReefAngel.Relay.RelayMaskOnE[0];
        ReefAngel.LCD.DrawOutletBox(13, 109, TempRelay);
        pingSerial();
        
        //Draw Date & Time
        ReefAngel.LCD.DrawDate(6, 123);
        pingSerial();
}

void DrawCustomGraph()  // Not Used
{
}
//------------------------------------------------------ End Custom Main ----------------------------------------------------------
//*********************************************************************************************************************************
//-------------------------------------------------------- Begin Setup ------------------------------------------------------------
void setup()
{
    ReefAngel.Init();  //Initialize controller
    
    ReefAngel.TempProbe = T1_PROBE;
    ReefAngel.OverheatProbe = T1_PROBE; // Will change to T3_PROBE when can extend the T3 Probe to reach canopy.
    ReefAngel.FeedingModePorts = Port1Bit;
    ReefAngel.WaterChangePorts = Port1Bit | Port2Bit | Port3Bit | Port4Bit | Port6Bit | Port7Bit |Port8Bit;
    ReefAngel.OverheatShutoffPorts = Port2Bit;
    ReefAngel.OverheatShutoffPortsE[0] = Port2Bit | Port4Bit;
    ReefAngel.LightsOnPortsE[0] = Port1Bit | Port2Bit | Port3Bit | Port4Bit;

    // Ports that are always on
//    ReefAngel.Relay.On(Port1);  Temporary taking this out to see if StandardATO code works
    ReefAngel.Relay.On(Port3);
    ReefAngel.Relay.On(Port5);
    ReefAngel.Relay.On(Port6);
    ReefAngel.Relay.On(Port7);
    ReefAngel.Relay.On(Port8);
    ReefAngel.Relay.On(Box1_Port7);
//    ReefAngel.Relay.On(Box1_Port8);
//--------------------------------------------------------- RF Module Setup -------------------------------------------------------
// This section commented out because it prevented RF Module from syncing with Vortech
/*    ReefAngel.RF.SetMode(Slave_Start,0,0);
    
    If you get a compile error similar to this:
    'class ReefAngelClass' has no member named 'RF'
    Please make sure that you enabled RF Expansion on your features file.
  
    Open RAGen and make sure you have RF Expansion checked under the Features tab.

    Or, you can manually edit the file.
    The file is located at "Documents\Arduino\libraries\ReefAngel_Features.h" file and has to include this line in it:
    #define RFEXPANSION  
    
    InternalMemory.RFMode_write(0);
    InternalMemory.RFSpeed_write(128);
    InternalMemory.RFDuration_write(10);
*/    
//------------------------------------------------------ End RF Module Setup ------------------------------------------------------  
}
//---------------------------------------------------------- End Setup ------------------------------------------------------------
//*********************************************************************************************************************************
//--------------------------------------------------------- Begin Loop ------------------------------------------------------------
void loop()
{
    // Specific functions
    ReefAngel.Refresh();  //WDT check
    ReefAngel.StandardATOExtended(Port1); // ATO using Internal Memory for timeout
    ReefAngel.StandardHeater(Port2);
    ReefAngel.StandardFan(Box1_Port7);

    ReefAngel.ActinicLights(Box1_Port1); //Left Blue LEDs
    ReefAngel.ActinicLights(Box1_Port2); //Right Blue LEDs
    ReefAngel.DayLights(Box1_Port3); //Left White LEDs
    ReefAngel.DayLights(Box1_Port4); //Right White LEDs
    ReefAngel.MoonLights(Box1_Port5); //Left Moonlight
    ReefAngel.MoonLights(Box1_Port6); //Right Moonlight
    ReefAngel.MoonLights(Port4); //Fuge light on when main lights are out
    
//------------------------------------------------ Start PWM Expansion Code for Slope ----------------------------------------------

    ReefAngel.PWM.SetChannel(LEDPWM0,int(PWMChannel[LEDPWM0]));
    ReefAngel.PWM.SetChannel(LEDPWM1,int(PWMChannel[LEDPWM1]));
    ReefAngel.PWM.SetChannel(LEDPWM2,int(PWMChannel[LEDPWM2]));
    ReefAngel.PWM.SetChannel(LEDPWM3,int(PWMChannel[LEDPWM3]));

    ReefAngel.PWM.Channel0PWMParabola(InternalMemory.ActinicOffset_read());
    ReefAngel.PWM.Channel1PWMParabola(InternalMemory.ActinicOffset_read());
    ReefAngel.PWM.Channel2PWMParabola();
    ReefAngel.PWM.Channel3PWMParabola();


//------------------------------------------------- End PWM Expansion Code for Slope ----------------------------------------------

//------------------------------------------------ Start Time-of-Day Based Functions ----------------------------------------------
//-------------------------------------------------------- Moonlight Schedule -----------------------------------------------------
    if ( NumMins(hour(),minute()) < 450 )  // Turn off Moonlights from Midnight to 7:30 MAM
    {
      ReefAngel.Relay.Off(Box1_Port5);
      ReefAngel.Relay.Off(Box1_Port6);
    }

//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ These are the mode numbers for the RF Expansion Module for reference ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    //#define Constant      0
    //#define Random1       1 // Lagoonal
    //#define Random2       2 // Reef Crest
    //#define ShortWave     3
    //#define LongWave      4
    //#define Smart_NTM     5 // Nutrient Transport Mode
    //#define Smart_TSM     6 // Tidal Swell Mode
    //#define Feeding_Start 7
    //#define Feeding_Stop  8
    //#define Night         9
    //#define Slave_Start   97
    //#define Slave_Stop    98
    //#define None          99
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

//------------------------------ Start Feeding Mode Schedule (Start 1st Feeding at 9:55 AM and 2nd at 1:55 PM)---------------------
    // if the hour is 9a or 1p, minute is 55 and seconds is 0
    // start the feeding mode
    if ( ((hour() == 9) || (hour() == 13)) && 
       (minute() == 55) && 
       (second() == 0) ) 
    {
      ReefAngel.FeedingModeStart();
      vtechmode = InternalMemory.RFMode_read();     
    }
//------------------------------------------------------ End of Feeding Mode Schedule ---------------------------------------------

//-------------------------------------------------------- Start RF Daytime Control -----------------------------------------------
  if (hour() >=8 && hour() <= 22)
  {  
    if (ReefAngel.DisplayedMenu==FEEDING_MODE) bFeeding=true;
    if (ReefAngel.DisplayedMenu==DEFAULT_MENU && bFeeding )
    {
      bFeeding=false; 
      ReefAngel.RF.UseMemory=false;
      ReefAngel.RF.SetMode(Smart_NTM,155,5);
      ReefAngel.Timer[4].SetInterval(1800); // Timer for 30min
      ReefAngel.Timer[4].Start();
      vtechmode = 5;
    }
    if (ReefAngel.DisplayedMenu==DEFAULT_MENU && ReefAngel.Timer[4].IsTriggered())
    {
      ReefAngel.RF.UseMemory=true;
      vtechmode = InternalMemory.RFMode_read();
    }  
  }
//---------------------------------------------------------- End RF Daytime Control -----------------------------------------------   

//-------------------------------------------------------- Start RF Nightmode Control ---------------------------------------------    

  if (hour()>=23 || hour()<7) // Defining "Nightmode" hours for VorTech = between 11 PM and 7 AM
    {
      ReefAngel.RF.UseMemory=false;
      ReefAngel.RF.SetMode(Night,15,0);
      vtechmode = 9;
    }
  else
    {
      ReefAngel.RF.SetMode(Feeding_Stop,0,0); //Temp fix for coming out of Night mode
      ReefAngel.RF.UseMemory=true;
      vtechmode = InternalMemory.RFMode_read();
    } 

    // This sends all the data to the portal
    // Do not add any custom code that changes any relay status after this line
    // The only code after this line should be the ShowInterface function
    ReefAngel.Portal("TanksNStuff");

    // This should always be the last line
    ReefAngel.ShowInterface();    
//---------------------------------------------------------- End RF Nightmode Control ---------------------------------------------
//------------------------------------------------------ End Time-of-Day Based Functions ------------------------------------------
}
//--------------------------------------------------------------- End Loop --------------------------------------------------------
//*********************************************************************************************************************************

// ToDo List Functions that still need to be added above:
// 1. Add Sunrise/Sunset/MoonPhase/Cloud Chance, etc. (PWM Slope data may be altered by these?)
// 2. *Option for later date* Relay box Ports 7 and 8 changed to "Off" normally, then add line in Loop to power them on if Overheat 
//    Shutoff is active (when I get fans to plug into those ports.)   
Post Reply