Time problem

New members questions
Post Reply
smcglaughn
Posts: 67
Joined: Tue Sep 18, 2012 8:00 pm
Location: Spruce Pine Alabama

Time problem

Post by smcglaughn »

I noticed that the time and date on the head unit was wrong. It shows 1/2/00 3:21 Am. I tried uploading my latest code. Nothing changed. I uninstalled the RA installer and uploaded it again. Now when I try to upload my code I get the error uploading message. Any idea what I can do?

[quote]
#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 <AI.h>
#include <RF.h>
#include <IO.h>
#include <ORP.h>
#include <Salinity.h>
#include <PH.h>
#include <WaterLevel.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
  ReefAngel.WaterChangePorts= Port1Bit | Port2Bit | Port3Bit | Port5Bit | Port6Bit;

  // Ports that are always on
  ReefAngel.Relay.On(Port1);
  ReefAngel.Relay.On(Port2);
  ReefAngel.Relay.On(Port3);
  ReefAngel.Relay.On(Port4);
  ////// Place additional initialization code below here


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

void loop()
{
  // Specific functions that use Internal Memory values
  ReefAngel.Wavemaker(Port5,60);
  ReefAngel.Wavemaker(Port6,120);
  ReefAngel.StandardHeater(Port7,757,763);
//  ReefAngel.StandardLights(Port8,17,0,13,0);
  if ( (hour()>=2) && (hour()<5) ) {
ReefAngel.WaterLevelATO(Port8,450,85,90); // 450 seconds timeout, turn on at 85% and turn off at 90%
}
  ReefAngel.PWM.SetDaylight( MoonPhase() );
  ReefAngel.PWM.SetActinic( MoonPhase() );
  ////// Place your custom code below here


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

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


void DrawCustomMain()
{
  int x,y;
  char text[10];
  // Parameters
#if defined DisplayLEDPWM && ! defined RemoveAllLights
  ReefAngel.LCD.DrawMonitor( 15, 14, ReefAngel.Params,
  ReefAngel.PWM.GetDaylightValue(), ReefAngel.PWM.GetActinicValue() );
#else // defined DisplayLEDPWM && ! defined RemoveAllLights
  ReefAngel.LCD.DrawMonitor( 15, 14, ReefAngel.Params );
#endif // defined DisplayLEDPWM && ! defined RemoveAllLights
  pingSerial();

  // Salinity
  ReefAngel.LCD.DrawText( COLOR_DARKKHAKI,DefaultBGColor,15,54, "SAL:" );
  ReefAngel.LCD.DrawText( COLOR_BLACK,DefaultBGColor,39,54, ReefAngel.Params.Salinity );
  pingSerial();

  // Water Level
  ReefAngel.LCD.DrawText( COLOR_DARKGOLDENROD,DefaultBGColor,75,75, "WL:" );
  ReefAngel.LCD.DrawText( COLOR_DARKGOLDENROD,DefaultBGColor,99,75, ReefAngel.WaterLevel.GetLevel() );
  pingSerial();

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

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

void DrawCustomGraph()
{
}
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: Time problem

Post by rimai »

Make sure the board and com port are correct.
Roberto.
smcglaughn
Posts: 67
Joined: Tue Sep 18, 2012 8:00 pm
Location: Spruce Pine Alabama

Re: Time problem

Post by smcglaughn »

They are communicating. I don't get the com port error. The red light flashes when I plug up the cable and when it stars trying to upload.
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: Time problem

Post by rimai »

What is the error you are getting?
Roberto.
smcglaughn
Posts: 67
Joined: Tue Sep 18, 2012 8:00 pm
Location: Spruce Pine Alabama

Re: Time problem

Post by smcglaughn »

All it says is error uploading.
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: Time problem

Post by rimai »

It should show the error in red at the bottom of the window.
Roberto.
smcglaughn
Posts: 67
Joined: Tue Sep 18, 2012 8:00 pm
Location: Spruce Pine Alabama

Re: Time problem

Post by smcglaughn »

Maybe I'm looking in the wrong spot. The screen is split. The top is the code I'm loading. The bottom is what it's loading. In between the two screens. There is a message that says error uploading. The bottom box doesn't show an error that I see. I'll try it again this even I no when I get home and if it still won't update. I'll attach a screen shot.
smcglaughn
Posts: 67
Joined: Tue Sep 18, 2012 8:00 pm
Location: Spruce Pine Alabama

Re: Time problem

Post by smcglaughn »

Here is what it says. This is at the bottom and its the closest thing I see to an error message.

avrdude: stk500v2_receivemessage() timeout
avrdude: stk500v2_getsync() timeout communicating with programmer


avrdude done Thank you
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: Time problem

Post by rimai »

Do you have RA or RA+?
Roberto.
smcglaughn
Posts: 67
Joined: Tue Sep 18, 2012 8:00 pm
Location: Spruce Pine Alabama

Re: Time problem

Post by smcglaughn »

I believe it the RA.
smcglaughn
Posts: 67
Joined: Tue Sep 18, 2012 8:00 pm
Location: Spruce Pine Alabama

Re: Time problem

Post by smcglaughn »

It is the RA
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: Time problem

Post by rimai »

Make sure to change the board to RA w/ optiboot and not RA+ under Tools->Board
Roberto.
smcglaughn
Posts: 67
Joined: Tue Sep 18, 2012 8:00 pm
Location: Spruce Pine Alabama

Re: Time problem

Post by smcglaughn »

That worked as far as uploading to the controller. However it still didnt change the time on it?
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: Time problem

Post by rimai »

It won't change the time.
You can do it easily with the portal or android app, but it looks like you don't have it.
Try adding this to your setup():

Code: Select all

ReefAngel.AddDateTimeMenu();
The standard RA has limited memory, so it may not fit.
If your code gets too big with this, you will have to upload the preloaded code, change the time and upload your code again.
Roberto.
smcglaughn
Posts: 67
Joined: Tue Sep 18, 2012 8:00 pm
Location: Spruce Pine Alabama

Re: Time problem

Post by smcglaughn »

Where does this go? code go?
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: Time problem

Post by rimai »

your setup()
Roberto.
smcglaughn
Posts: 67
Joined: Tue Sep 18, 2012 8:00 pm
Location: Spruce Pine Alabama

Re: Time problem

Post by smcglaughn »

Im not real sure where to put it. Can you look at my first entry and show me? Thanks
smcglaughn
Posts: 67
Joined: Tue Sep 18, 2012 8:00 pm
Location: Spruce Pine Alabama

Re: Time problem

Post by smcglaughn »

Nevermind I got it. Thanks it worked.
smcglaughn
Posts: 67
Joined: Tue Sep 18, 2012 8:00 pm
Location: Spruce Pine Alabama

Re: Time problem

Post by smcglaughn »

I have a new problem.Since I made the change and got the time corrected. The wavemakers do not turn off during feeding mode. I tried loading the older code back to the controller and it still does not work. Ive added the code below.
#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 <AI.h>
#include <RF.h>
#include <IO.h>
#include <ORP.h>
#include <Salinity.h>
#include <PH.h>
#include <WaterLevel.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
  ReefAngel.WaterChangePorts= Port1Bit | Port2Bit | Port3Bit | Port5Bit | Port6Bit;

  // Ports that are always on
  ReefAngel.Relay.On(Port1);
  ReefAngel.Relay.On(Port2);
  ReefAngel.Relay.On(Port3);
  ReefAngel.Relay.On(Port4);
  ////// Place additional initialization code below here


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

void loop()
{
  // Specific functions that use Internal Memory values
  ReefAngel.Wavemaker(Port5,60);
  ReefAngel.Wavemaker(Port6,120);
  ReefAngel.StandardHeater(Port7,757,763);
//  ReefAngel.StandardLights(Port8,17,0,13,0);
  if ( (hour()>=2) && (hour()<5) ) {
ReefAngel.WaterLevelATO(Port8,450,85,90); // 450 seconds timeout, turn on at 85% and turn off at 90%
}
  ReefAngel.PWM.SetDaylight( MoonPhase() );
  ReefAngel.PWM.SetActinic( MoonPhase() );
  ////// Place your custom code below here


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

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


void DrawCustomMain()
{
  int x,y;
  char text[10];
  // Parameters
#if defined DisplayLEDPWM && ! defined RemoveAllLights
  ReefAngel.LCD.DrawMonitor( 15, 14, ReefAngel.Params,
  ReefAngel.PWM.GetDaylightValue(), ReefAngel.PWM.GetActinicValue() );
#else // defined DisplayLEDPWM && ! defined RemoveAllLights
  ReefAngel.LCD.DrawMonitor( 15, 14, ReefAngel.Params );
#endif // defined DisplayLEDPWM && ! defined RemoveAllLights
  pingSerial();

  // Salinity
  ReefAngel.LCD.DrawText( COLOR_DARKKHAKI,DefaultBGColor,15,54, "SAL:" );
  ReefAngel.LCD.DrawText( COLOR_BLACK,DefaultBGColor,39,54, ReefAngel.Params.Salinity );
  pingSerial();

  // Water Level
  ReefAngel.LCD.DrawText( COLOR_DARKGOLDENROD,DefaultBGColor,75,75, "WL:" );
  ReefAngel.LCD.DrawText( COLOR_DARKGOLDENROD,DefaultBGColor,99,75, ReefAngel.WaterLevel.GetLevel() );
  pingSerial();

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

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

void DrawCustomGraph()
{
}
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: Time problem

Post by rimai »

Change this:

Code: Select all

  ReefAngel.Wavemaker(Port5,60);
  ReefAngel.Wavemaker(Port6,120);
To this:

Code: Select all

  ReefAngel.Wavemaker1(Port5,60);
  ReefAngel.Wavemaker2(Port6,120);
Roberto.
smcglaughn
Posts: 67
Joined: Tue Sep 18, 2012 8:00 pm
Location: Spruce Pine Alabama

Re: Time problem

Post by smcglaughn »

When I deleted the old code and added the new code. I got the following error message. No matching function for call to ReefAngelClass::Wavemaker1(int,int)'
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: Time problem

Post by rimai »

Damn... I totally misread your request.
Forget about the change... Sorry.
You need to add this:

Code: Select all

ReefAngel.FeedingModePorts= Port5Bit | Port6Bit;
Roberto.
smcglaughn
Posts: 67
Joined: Tue Sep 18, 2012 8:00 pm
Location: Spruce Pine Alabama

Re: Time problem

Post by smcglaughn »

Where do I put it?
smcglaughn
Posts: 67
Joined: Tue Sep 18, 2012 8:00 pm
Location: Spruce Pine Alabama

Re: Time problem

Post by smcglaughn »

Nevermind. I think I got it. It seems to work. Thanks again.
smcglaughn
Posts: 67
Joined: Tue Sep 18, 2012 8:00 pm
Location: Spruce Pine Alabama

Re: Time problem

Post by smcglaughn »

My water level expansion has quit working. It reads zeros on the screen and when I try to calibrate it . All zeros. I tried unplugging it and redownloading my programming. Neither had any effect. Any ideas or will it have to be replaced?
Post Reply