Page 1 of 1

Time problem

Posted: Mon Dec 09, 2013 9:33 pm
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()
{
}

Re: Time problem

Posted: Mon Dec 09, 2013 9:47 pm
by rimai
Make sure the board and com port are correct.

Re: Time problem

Posted: Mon Dec 09, 2013 9:55 pm
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.

Re: Time problem

Posted: Mon Dec 09, 2013 9:57 pm
by rimai
What is the error you are getting?

Re: Time problem

Posted: Mon Dec 09, 2013 9:59 pm
by smcglaughn
All it says is error uploading.

Re: Time problem

Posted: Tue Dec 10, 2013 9:32 am
by rimai
It should show the error in red at the bottom of the window.

Re: Time problem

Posted: Tue Dec 10, 2013 12:09 pm
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.

Re: Time problem

Posted: Tue Dec 10, 2013 5:38 pm
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

Re: Time problem

Posted: Tue Dec 10, 2013 5:42 pm
by rimai
Do you have RA or RA+?

Re: Time problem

Posted: Tue Dec 10, 2013 5:45 pm
by smcglaughn
I believe it the RA.

Re: Time problem

Posted: Tue Dec 10, 2013 5:47 pm
by smcglaughn
It is the RA

Re: Time problem

Posted: Tue Dec 10, 2013 6:08 pm
by rimai
Make sure to change the board to RA w/ optiboot and not RA+ under Tools->Board

Re: Time problem

Posted: Tue Dec 10, 2013 6:21 pm
by smcglaughn
That worked as far as uploading to the controller. However it still didnt change the time on it?

Re: Time problem

Posted: Tue Dec 10, 2013 7:13 pm
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.

Re: Time problem

Posted: Tue Dec 10, 2013 8:13 pm
by smcglaughn
Where does this go? code go?

Re: Time problem

Posted: Tue Dec 10, 2013 8:13 pm
by rimai
your setup()

Re: Time problem

Posted: Tue Dec 10, 2013 8:17 pm
by smcglaughn
Im not real sure where to put it. Can you look at my first entry and show me? Thanks

Re: Time problem

Posted: Tue Dec 10, 2013 8:24 pm
by smcglaughn
Nevermind I got it. Thanks it worked.

Re: Time problem

Posted: Mon Dec 16, 2013 5:10 pm
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()
{
}

Re: Time problem

Posted: Mon Dec 16, 2013 10:08 pm
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);

Re: Time problem

Posted: Tue Dec 17, 2013 6:33 pm
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)'

Re: Time problem

Posted: Tue Dec 17, 2013 6:37 pm
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;

Re: Time problem

Posted: Tue Dec 17, 2013 7:03 pm
by smcglaughn
Where do I put it?

Re: Time problem

Posted: Tue Dec 17, 2013 7:28 pm
by smcglaughn
Nevermind. I think I got it. It seems to work. Thanks again.

Re: Time problem

Posted: Tue Mar 04, 2014 5:32 pm
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?