Page 1 of 1

Date and time issue

Posted: Tue Jul 09, 2013 10:52 am
by Blawson
Not sure what's going on. I have everything coded from the wizard and I am running the dimming module. For some reason, the lights are not staying on schedule. They don't come on at the right time and the dimming is not staying on schedule. When I go to the portal and update time, it jumps back in line. I have to do this at least 2x a day. Any thoughts?

Re: Date and time issue

Posted: Tue Jul 09, 2013 10:59 am
by rimai
It jumps back in time right when you update it through the portal or later on?

Re: Date and time issue

Posted: Tue Jul 09, 2013 11:06 am
by Blawson
Right when I update it.

Re: Date and time issue

Posted: Tue Jul 09, 2013 11:09 am
by rimai
Does it do the same if you use android?

Re: Date and time issue

Posted: Tue Jul 09, 2013 11:15 am
by Blawson
It does the same with my iPhone. Don't have android.

Re: Date and time issue

Posted: Tue Jul 09, 2013 11:23 am
by rimai
I learned something today...
I didn't know iphone had support to update date/time :oops:

Re: Date and time issue

Posted: Tue Jul 09, 2013 11:27 am
by Blawson
Glad to be the one to bring that little nugget to light.

Still not sure why the lights and dimming do not keep on schedule unless I do an update to the time/date.

Could it have to do with the internal memory?

Re: Date and time issue

Posted: Tue Jul 09, 2013 12:05 pm
by lnevo
I had an issue with the battery in my RA. One terminal was loose so anytiem the controller reset I lost the time... just something to consider looking at..

Re: Date and time issue

Posted: Tue Jul 09, 2013 10:36 pm
by Blawson
I had to do it three times today and then it wouldn't even turn the lights off.

I ran the initial memory script and then just built everything into the pde. That should erase the internal memory and all run straight off the pde right?

Re: Date and time issue

Posted: Tue Jul 09, 2013 10:46 pm
by rimai
Is the time on RA correct?

Re: Date and time issue

Posted: Tue Jul 09, 2013 10:54 pm
by Blawson
Yes. It seems to be keeping the right time.

Re: Date and time issue

Posted: Wed Jul 10, 2013 8:56 am
by rimai
Does it keep the time if you power off RA and bring the power back on? Just to be sure, wait about 10 seconds before you power back on.
I'm not quite understanding yet how it is not following the schedule, so I want to make sure that the time is correct and that it is keeping the time correctly and following it correctly before we move on to something else.

Re: Date and time issue

Posted: Wed Jul 10, 2013 9:15 pm
by Blawson
Nope - I unplugged it and it came back on 25 minutes earlier. Was 9:15 and now it's 8:52

Then I go back to the iPhone app and update time and it goes back.

Re: Date and time issue

Posted: Thu Jul 11, 2013 6:56 am
by Blawson
When I got up this morning the time on the controller was 12:46am - actual time 6:48am.

Re: Date and time issue

Posted: Thu Jul 11, 2013 8:49 am
by rimai
Yeah, it's loosing the time.
PM me for RMA.

Re: Date and time issue

Posted: Thu Jul 11, 2013 9:25 am
by Blawson
Ok. Am I sending everything back or just the board?

Re: Date and time issue

Posted: Thu Jul 11, 2013 9:32 am
by rimai
Just the board

Re: Date and time issue

Posted: Thu Jul 11, 2013 9:41 am
by Blawson
I still have the 32 bit board from the upgrade. I can swap out the plus board and send it - might need some help slimming Down the code to run on the old board.

Re: Date and time issue

Posted: Thu Jul 11, 2013 9:44 am
by rimai
Ok. Post the code and we can pack as much as we can.

Re: Date and time issue

Posted: Wed Jul 17, 2013 10:02 pm
by Blawson
Here is the code:
#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 <Salinity.h>
#include <RF.h>
#include <IO.h>
#include <ORP.h>
#include <AI.h>
#include <PH.h>
#include <WaterLevel.h>
#include <Humidity.h>
#include <DCPump.h>
#include <ReefAngel.h>

////// Place global variable code below here


////// Place global variable code above here


void setup()
{
    // This must be the first line
    ReefAngel.Init(); //Initialize controller
    // Ports toggled in Feeding Mode
    ReefAngel.FeedingModePorts = Port4Bit | Port6Bit | Port7Bit;
    // Ports toggled in Water Change Mode
    ReefAngel.WaterChangePorts = Port4Bit | Port5Bit | Port6Bit | Port7Bit;
    // Ports toggled when Lights On / Off menu entry selected
    ReefAngel.LightsOnPorts = 0;
    // Ports turned off when Overheat temperature exceeded
    ReefAngel.OverheatShutoffPorts = 0;
    // Use T1 probe as temperature and overheat functions
    ReefAngel.TempProbe = T1_PROBE;
    ReefAngel.OverheatProbe = T1_PROBE;
    // Set the Overheat temperature setting
    InternalMemory.OverheatTemp_write( 850 );


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

    ////// Place additional initialization code below here
    

    ////// Place additional initialization code above here
}

void loop()
{
    ReefAngel.DosingPumpRepeat( Port1,0,360,4 );
    ReefAngel.DosingPumpRepeat( Port2,0,360,4 );
    ReefAngel.StandardLights( Port3,10,0,22,0 );
    ReefAngel.Relay.DelayedOn( Port4,10 );
    ReefAngel.StandardHeater( Port5,795,805 );
    ReefAngel.Relay.Set( Port8, !ReefAngel.Relay.Status( Port3 ) );
    ReefAngel.PWM.SetChannel( 0, PWMParabola(10,0,22,0,10,35,10) );
    ReefAngel.PWM.SetChannel( 1, PWMParabola(10,30,21,30,0,30,0) );
    ReefAngel.PWM.SetChannel( 2, PWMParabola(10,30,21,30,0,5,0) );
    ReefAngel.PWM.SetChannel( 3, PWMParabola(10,30,21,30,0,10,0) );
    ////// Place your custom code below here
    

    ////// Place your custom code above here

    // This should always be the last line
    ReefAngel.Portal( "blawson" );
    ReefAngel.ShowInterface();
}

void DrawCustomMain()
{
    int x,y;
    char text[10];
    // Dimming Expansion
    x = 15;
    y = 2;
    for ( int a=0;a<6;a++ )
    {
      if ( a>2 ) x = 75;
      if ( a==3 ) y = 2;
      ReefAngel.LCD.DrawText( COLOR_DARKGOLDENROD,DefaultBGColor,x,y,"Ch :" );
      ReefAngel.LCD.DrawText( COLOR_DARKGOLDENROD,DefaultBGColor,x+12,y,a );
      ReefAngel.LCD.DrawText( COLOR_DARKGOLDENROD,DefaultBGColor,x+24,y,ReefAngel.PWM.GetChannelValue(a) );
      y += 10;
    }
    pingSerial();

    // Parameters
#if defined DisplayLEDPWM && ! defined RemoveAllLights
    ReefAngel.LCD.DrawMonitor( 15, 43, ReefAngel.Params,
    ReefAngel.PWM.GetDaylightValue(), ReefAngel.PWM.GetActinicValue() );
#else // defined DisplayLEDPWM && ! defined RemoveAllLights
    ReefAngel.LCD.DrawMonitor( 15, 43, ReefAngel.Params );
#endif // defined DisplayLEDPWM && ! defined RemoveAllLights
    pingSerial();

    // Main Relay Box
    byte TempRelay = ReefAngel.Relay.RelayData;
    TempRelay &= ReefAngel.Relay.RelayMaskOff;
    TempRelay |= ReefAngel.Relay.RelayMaskOn;
    ReefAngel.LCD.DrawOutletBox( 12, 84, TempRelay );
    pingSerial();

    // Date and Time
    ReefAngel.LCD.DrawDate( 6, 122 );
    pingSerial();
}

void DrawCustomGraph()
{
}

Please let me know how I can slim this down to work with the 32 bit board...

Thanks,
Brian

Re: Date and time issue

Posted: Wed Jul 17, 2013 10:14 pm
by rimai
It's pretty close, but I think it already does.

Re: Date and time issue

Posted: Wed Jul 17, 2013 10:58 pm
by Blawson
Well how about that. Guess I didn't need the upgraded board. :)

Re: Date and time issue

Posted: Thu Jul 18, 2013 8:39 pm
by Blawson
So this is interesting... The old board is keeping time fine. When I came home from work, the LEDs didn't look right - too much blue. So I check the time and it was spot on. The screen showed the right led levels. I unplugged the dimmer box and only two sets of the four LEDs lit. Plugged it back in and nothing lit. I played with it I bit and then decided to check if the new board would light them. Switched the boards and viola they worked. Switched the boards back and they are working again.

I have no ideal what happened but wanted to see if anyone had some thoughts?