Date and time issue

Do you have a question on how to do something.
Ask in here.
Post Reply
Blawson
Posts: 37
Joined: Sat Apr 14, 2012 10:02 pm

Date and time issue

Post 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?
Image
rimai
Posts: 12857
Joined: Fri Mar 18, 2011 6:47 pm

Re: Date and time issue

Post by rimai »

It jumps back in time right when you update it through the portal or later on?
Roberto.
Blawson
Posts: 37
Joined: Sat Apr 14, 2012 10:02 pm

Re: Date and time issue

Post by Blawson »

Right when I update it.
Image
rimai
Posts: 12857
Joined: Fri Mar 18, 2011 6:47 pm

Re: Date and time issue

Post by rimai »

Does it do the same if you use android?
Roberto.
Blawson
Posts: 37
Joined: Sat Apr 14, 2012 10:02 pm

Re: Date and time issue

Post by Blawson »

It does the same with my iPhone. Don't have android.
Image
rimai
Posts: 12857
Joined: Fri Mar 18, 2011 6:47 pm

Re: Date and time issue

Post by rimai »

I learned something today...
I didn't know iphone had support to update date/time :oops:
Roberto.
Blawson
Posts: 37
Joined: Sat Apr 14, 2012 10:02 pm

Re: Date and time issue

Post 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?
Image
User avatar
lnevo
Posts: 5422
Joined: Fri Jul 20, 2012 9:42 am

Re: Date and time issue

Post 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..
Blawson
Posts: 37
Joined: Sat Apr 14, 2012 10:02 pm

Re: Date and time issue

Post 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?
Image
rimai
Posts: 12857
Joined: Fri Mar 18, 2011 6:47 pm

Re: Date and time issue

Post by rimai »

Is the time on RA correct?
Roberto.
Blawson
Posts: 37
Joined: Sat Apr 14, 2012 10:02 pm

Re: Date and time issue

Post by Blawson »

Yes. It seems to be keeping the right time.
Image
rimai
Posts: 12857
Joined: Fri Mar 18, 2011 6:47 pm

Re: Date and time issue

Post 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.
Roberto.
Blawson
Posts: 37
Joined: Sat Apr 14, 2012 10:02 pm

Re: Date and time issue

Post 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.
Image
Blawson
Posts: 37
Joined: Sat Apr 14, 2012 10:02 pm

Re: Date and time issue

Post by Blawson »

When I got up this morning the time on the controller was 12:46am - actual time 6:48am.
Image
rimai
Posts: 12857
Joined: Fri Mar 18, 2011 6:47 pm

Re: Date and time issue

Post by rimai »

Yeah, it's loosing the time.
PM me for RMA.
Roberto.
Blawson
Posts: 37
Joined: Sat Apr 14, 2012 10:02 pm

Re: Date and time issue

Post by Blawson »

Ok. Am I sending everything back or just the board?
Image
rimai
Posts: 12857
Joined: Fri Mar 18, 2011 6:47 pm

Re: Date and time issue

Post by rimai »

Just the board
Roberto.
Blawson
Posts: 37
Joined: Sat Apr 14, 2012 10:02 pm

Re: Date and time issue

Post 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.
Image
rimai
Posts: 12857
Joined: Fri Mar 18, 2011 6:47 pm

Re: Date and time issue

Post by rimai »

Ok. Post the code and we can pack as much as we can.
Roberto.
Blawson
Posts: 37
Joined: Sat Apr 14, 2012 10:02 pm

Re: Date and time issue

Post 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
Image
rimai
Posts: 12857
Joined: Fri Mar 18, 2011 6:47 pm

Re: Date and time issue

Post by rimai »

It's pretty close, but I think it already does.
Roberto.
Blawson
Posts: 37
Joined: Sat Apr 14, 2012 10:02 pm

Re: Date and time issue

Post by Blawson »

Well how about that. Guess I didn't need the upgraded board. :)
Image
Blawson
Posts: 37
Joined: Sat Apr 14, 2012 10:02 pm

Re: Date and time issue

Post 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?
Image
Post Reply