Customizing code... Upload Errors

Share you PDE file with our community
Post Reply
alexwbush
Posts: 327
Joined: Tue Mar 22, 2011 12:45 am
Location: San Diego, CA

Customizing code... Upload Errors

Post by alexwbush »

Well, I am not getting compling errors, it's having trouble uploading for some reason. It was fine a couple hours ago, but I got more and more coding done on my custom screen and it started acting up. Now I can't even upload an old oni file.

Here are the errors:

Code: Select all

The following features were automatically added:
Watchdog Timer
Version Menu

The following features were detected:
Dimming Signal
Salinity Expansion Module
Wifi Attachment
Custom Main Screen
Exceed Flagging
Relay Expansion Module
Number of Relay Expansion Modules: 1
Simple Menu
Binary sketch size: 30,286 bytes (of a 30,720 byte maximum)
C:\Program Files\Reef Angel Controller\hardware/tools/avr/bin/avrdude -CC:\Program Files\Reef Angel Controller\hardware/tools/avr/etc/avrdude.conf -v -v -v -v -patmega328p -cstk500v1 -P\\.\COM6 -b57600 -D -Uflash:w:C:\Users\ONABOA~1\AppData\Local\Temp\build362447910769804697.tmp\sketch_sep16b.cpp.hex:i 

avrdude: Version 6.0, compiled on Apr  6 2012 at 19:29:19
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
         Copyright (c) 2007-2009 Joerg Wunsch

         System wide configuration file is "C:\Program Files\Reef Angel Controller\hardware/tools/avr/etc/avrdude.conf"

         Using Port                    : \\.\COM6
         Using Programmer              : stk500v1
         Overriding Baud Rate          : 57600
avrdude: Send: 0 [30]   [20] 
avrdude: Send: 0 [30]   [20] 
avrdude: Send: 0 [30]   [20] 
avrdude: Recv: 
avrdude: stk500_getsync(): not in sync: resp=0x0c

avrdude done.  Thank you.
Here is the code I want to see uploaded:

Code: Select all

#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 <ReefAngel.h>
// Initialize Buzzer variables
byte buzzer=0;
byte overheatflag=0;
byte atoflag=0;
////// 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 | Port7Bit | Port8Bit;
    ReefAngel.FeedingModePortsE[0] = 0;
    // Ports toggled in Water Change Mode
    ReefAngel.WaterChangePorts = Port3Bit | Port4Bit | Port5Bit | Port7Bit | Port8Bit;
    ReefAngel.WaterChangePortsE[0] = Port5Bit | Port6Bit;
    // Ports toggled when Lights On / Off menu entry selected
    ReefAngel.LightsOnPorts = Port1Bit | Port2Bit | Port6Bit;
    ReefAngel.LightsOnPortsE[0] = 0;
    // Ports turned off when Overheat temperature exceeded
    ReefAngel.OverheatShutoffPorts = Port1Bit | Port2Bit | Port3Bit | Port7Bit;
    ReefAngel.OverheatShutoffPortsE[0] = 0;
    // Use T1 probe as temperature and overheat functions
    ReefAngel.TempProbe = T1_PROBE;
    ReefAngel.OverheatProbe = T1_PROBE;

    // Ports that are always on
    ReefAngel.Relay.On( Port1 ); //left radion
    ReefAngel.Relay.On( Port2 ); //right radion
    ReefAngel.Relay.On( Port5 ); //ATO
    ReefAngel.Relay.On( Port8 ); //return
    ReefAngel.Relay.On( Box1_Port7 ); //TBD
    ReefAngel.Relay.On( Box1_Port8 ); //TBD
    ////// Place additional initialization code below here
    
    ////// Place additional initialization code above here
}
void loop()
{
    ReefAngel.StandardHeater( Port3 );
    //ReefAngel.SingleATOLow( Port5 );
    ReefAngel.Relay.DelayedOn( Port7 );
    ReefAngel.DosingPumpRepeat1( Box1_Port5 );
    ReefAngel.DosingPumpRepeat2( Box1_Port6 );
    overheatflag = InternalMemory.read( Overheat_Exceed_Flag );
    atoflag = InternalMemory.read( ATO_Exceed_Flag );
    buzzer = overheatflag + atoflag;
    if ( buzzer >= 1 ) buzzer = 100;
    ReefAngel.PWM.SetDaylight( buzzer );
    ////// Place your custom code below here
    
    /* Auto feeding mode starts.  
       Feeder set for 17:30, start feeding more at 17:35. */
    if ( hour() == 17 && minute() == 25 && second() ==0 ) //if time is 17:25:00
    {
        ReefAngel.FeedingModeStart(); //start feeding mode
    }
    
    // Run Vortech during day only.  Vortech is on from 09:00-20:00.
    ReefAngel.StandardLights(Port4,9,0,20,0);
    ////// Place your custom code above here
    // This should always be the last line
    ReefAngel.Portal( "wolfpack" );
    ReefAngel.ShowInterface();
}
void DrawCustomMain()
{
  byte x = 6;
  byte y = 2;
  byte t;
  char text[7];
  static byte vtechmode=0;
  
  /* Drawing this:
  
   01/01/12 00:00:00 AM
  ----------------------
   Disp 79.9  pH  8.00
   Sump 79.9  Sal 0.60
   Room 77.7
  
      1 2 3 4 5 6 7 8
      1 2 3 4 5 6 7 8
      
   Moon Waning Crescent
   Intensity 88%
   Sunrise   06:15
   Sunset    18:12
  */

  ReefAngel.LCD.DrawDate(6, 2);
  ReefAngel.LCD.Clear(COLOR_BLACK, 1, 11, 128, 11);
  pingSerial();
    
  //ReefAngel.LCD.DrawText(fcolor,bcolor,x,y,"text");
  
  //Line 1 - Display Temp & pH
  x = 8;
  y = 15;
  ReefAngel.LCD.DrawText(0,255,x,y,"Disp");
  x += 30;
  ReefAngel.LCD.DrawSingleMonitor(ReefAngel.Params.Temp[T1_PROBE], COLOR_CORNFLOWERBLUE, x, y, 10);
  x = 64; 
  ReefAngel.LCD.DrawText(0,255,x,y,"pH");
  x += 30;
  ReefAngel.LCD.DrawSingleMonitor(ReefAngel.Params.PH, COLOR_CORNFLOWERBLUE, x, y, 100);
  
  //Line 2 - Sump & Salinity
  x = 8;
  y += 10; 
  ReefAngel.LCD.DrawText(0,255,x,y,"Sump");
  x += 30;
  ReefAngel.LCD.DrawSingleMonitor(ReefAngel.Params.Temp[T2_PROBE], COLOR_CORNFLOWERBLUE, x, y, 10);
  x = 64; 
  ReefAngel.LCD.DrawText(0,255,x,y,"Sal");
  x += 30;
  ReefAngel.LCD.DrawSingleMonitor(ReefAngel.Params.Salinity, COLOR_CORNFLOWERBLUE, x, y, 100);
  
  //Line 3 - Room
  x = 8;
  y += 10; 
  ReefAngel.LCD.DrawText(0,255,x,y,"Room");
  x += 30;
  ReefAngel.LCD.DrawSingleMonitor(ReefAngel.Params.Temp[T3_PROBE], COLOR_CORNFLOWERBLUE, x, y, 10);
  
  //Lines 4 and 5 - Relays
  x = 12; 
  y += 15;
  // draw main relay
  byte TempRelay = ReefAngel.Relay.RelayData;
  TempRelay &= ReefAngel.Relay.RelayMaskOff;
  TempRelay |= ReefAngel.Relay.RelayMaskOn;
  ReefAngel.LCD.DrawOutletBox(x, y, TempRelay);
  #ifdef RelayExp
    // draw 1st expansion relay
    y += 12 ;
    TempRelay = ReefAngel.Relay.RelayDataE[0];
    TempRelay &= ReefAngel.Relay.RelayMaskOffE[0];
    TempRelay |= ReefAngel.Relay.RelayMaskOnE[0];
    ReefAngel.LCD.DrawOutletBox(x, y, TempRelay);
  #endif  // RelayExp
  
  //Line 6 - Moon
  x = 8;
  y += 17;
  ReefAngel.LCD.DrawText(0,255,x,y,"Moon");
  
  //Line 7 - Intensity
  x = 8;
  y += 10; 
  ReefAngel.LCD.DrawText(0,255,x,y,"Intensity");  
  
  //Line 8 - Sunrise
  x = 8;
  y += 10; 
  ReefAngel.LCD.DrawText(0,255,x,y,"Sunrise");
  
  //Line 9 - Sunset
  x = 8;
  y += 10; 
  ReefAngel.LCD.DrawText(0,255,x,y,"Sunset");
 
  pingSerial();
}
void DrawCustomGraph()
{
}
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: Customizing code... Upload Errors

Post by rimai »

Make sure that you are indeed using COM6 and that the cable is properly connected on RA.
Roberto.
alexwbush
Posts: 327
Joined: Tue Mar 22, 2011 12:45 am
Location: San Diego, CA

Re: Customizing code... Upload Errors

Post by alexwbush »

I wasn't plugging correctly into the RA. I missed by one pin :oops: how embarrassing.

Note: Don't work on this thing at 3am when you're exhausted with no lights on in the room where you're trying to plug in your RA. :lol:

Can I ask you one other question? Do you know how to draw shapes on the RA? Like a circle or ellipse?
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: Customizing code... Upload Errors

Post by rimai »

This is referenced inside the RA_NokiaLCD.h

Code: Select all

	void DrawCircleOutline(byte x, byte y, byte radius, byte bordercolor);
	void FillCircle(byte x, byte y, byte radius, byte fillcolor);
Use it like this:

Code: Select all

ReefAngel.LCD.DrawCircleOutline(10,10,10,COLOR_BLACK);
Roberto.
alexwbush
Posts: 327
Joined: Tue Mar 22, 2011 12:45 am
Location: San Diego, CA

Re: Customizing code... Upload Errors

Post by alexwbush »

rimai wrote:This is referenced inside the RA_NokiaLCD.h

Code: Select all

	void DrawCircleOutline(byte x, byte y, byte radius, byte bordercolor);
	void FillCircle(byte x, byte y, byte radius, byte fillcolor);
Use it like this:

Code: Select all

ReefAngel.LCD.DrawCircleOutline(10,10,10,COLOR_BLACK);
awesome! I'll be working on that moon mode.

Also, any idea why I can't get custom colors to work? I make changes, but they're not showing.

My code:

Code: Select all

#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 <ReefAngel.h>
// Initialize Buzzer variables
byte buzzer=0;
byte overheatflag=0;
byte atoflag=0;
////// 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 | Port7Bit | Port8Bit;
  ReefAngel.FeedingModePortsE[0] = 0;
  // Ports toggled in Water Change Mode
  ReefAngel.WaterChangePorts = Port3Bit | Port4Bit | Port5Bit | Port7Bit | Port8Bit;
  ReefAngel.WaterChangePortsE[0] = Port5Bit | Port6Bit;
  // Ports toggled when Lights On / Off menu entry selected
  ReefAngel.LightsOnPorts = Port1Bit | Port2Bit | Port6Bit;
  ReefAngel.LightsOnPortsE[0] = 0;
  // Ports turned off when Overheat temperature exceeded
  ReefAngel.OverheatShutoffPorts = Port1Bit | Port2Bit | Port3Bit | Port7Bit;
  ReefAngel.OverheatShutoffPortsE[0] = 0;
  // Use T1 probe as temperature and overheat functions
  ReefAngel.TempProbe = T1_PROBE;
  ReefAngel.OverheatProbe = T1_PROBE;

  // Ports that are always on
  ReefAngel.Relay.On( Port1 ); //left radion
  ReefAngel.Relay.On( Port2 ); //right radion
  ReefAngel.Relay.On( Port5 ); //ATO
  ReefAngel.Relay.On( Port8 ); //return
  ReefAngel.Relay.On( Box1_Port7 ); //TBD
  ReefAngel.Relay.On( Box1_Port8 ); //TBD
  ////// Place additional initialization code below here
  InternalMemory.ATOHourInterval_write(0);
  ////// Place additional initialization code above here
}
void loop()
{
  ReefAngel.StandardHeater( Port3 );
  //ReefAngel.SingleATOLow( Port5 );
  ReefAngel.Relay.DelayedOn( Port7 );
  ReefAngel.DosingPumpRepeat1( Box1_Port5 );
  ReefAngel.DosingPumpRepeat2( Box1_Port6 );
  overheatflag = InternalMemory.read( Overheat_Exceed_Flag );
  atoflag = InternalMemory.read( ATO_Exceed_Flag );
  buzzer = overheatflag + atoflag;
  if ( buzzer >= 1 ) buzzer = 100;
  ReefAngel.PWM.SetDaylight( buzzer );
  ////// Place your custom code below here

  /* Auto feeding mode starts.  
   Feeder set for 17:30, start feeding more at 17:35. */
  if ( hour() == 17 && minute() == 25 && second() ==0 ) //if time is 17:25:00
  {
    ReefAngel.FeedingModeStart(); //start feeding mode
  }

  // Run Vortech during day only.  Vortech is on from 09:00-20:00.
  ReefAngel.StandardLights(Port4,9,0,20,0);
  ////// Place your custom code above here
  // This should always be the last line
  ReefAngel.Portal( "wolfpack" );
  ReefAngel.ShowInterface();
}
void DrawCustomMain()
{
  byte x = 6;
  byte y = 2;
  byte t;
  char text[7];

  /* Drawing this:
   
   01/01/12 00:00:00 AM
   ----------------------
   Disp 79.9  pH  8.00
   Sump 79.9  Sal 0.60
   Room 77.7  ATO Ok
   
   1 2 3 4 5 6 7 8
   1 2 3 4 5 6 7 8
   
   Moon Waning Crescent
   Intensity 88%
   Sunrise   06:15
   Sunset    18:12
  */
   
  /* Colors used in this script:
     DefaultFGColor   - For basic font and line
     DefaultBGColor   - For background color
     PHColor          - For values that may change
     OutletOnBGColor  - For okay water level
     OutletOffBGColor - For low water level
     
     To change colors, modify these values in ReefAngel_CustomColors.h file
  */

  ReefAngel.LCD.DrawDate(6, 2);
  ReefAngel.LCD.Clear(DefaultFGColor, 1, 11, 128, 11);
  pingSerial();

  //ReefAngel.LCD.DrawText(fcolor,bcolor,x,y,"text");

  //Line 1 - Display Temp & pH
  x = 8;
  y = 15;
  ReefAngel.LCD.DrawText(DefaultFGColor,DefaultBGColor,x,y,"Disp");
  x += 30;
  ReefAngel.LCD.DrawSingleMonitor(ReefAngel.Params.Temp[T1_PROBE], PHColor, x, y, 10);
  x = 70; 
  ReefAngel.LCD.DrawText(DefaultFGColor,DefaultBGColor,x,y,"pH");
  x += 30;
  ReefAngel.LCD.DrawSingleMonitor(ReefAngel.Params.PH, PHColor, x, y, 100);

  //Line 2 - Sump & Salinity
  x = 8;
  y += 10; 
  ReefAngel.LCD.DrawText(DefaultFGColor,DefaultBGColor,x,y,"Sump");
  x += 30;
  ReefAngel.LCD.DrawSingleMonitor(ReefAngel.Params.Temp[T2_PROBE], PHColor, x, y, 10);
  x = 70; 
  ReefAngel.LCD.DrawText(DefaultFGColor,DefaultBGColor,x,y,"Sal");
  x += 30;
  ReefAngel.LCD.DrawSingleMonitor(ReefAngel.Params.Salinity, PHColor, x, y, 100);

  //Line 3 - Room
  x = 8;
  y += 10; 
  ReefAngel.LCD.DrawText(DefaultFGColor,DefaultBGColor,x,y,"Room");
  x += 30;
  ReefAngel.LCD.DrawSingleMonitor(ReefAngel.Params.Temp[T3_PROBE], PHColor, x, y, 10);
  x = 70;
  if (ReefAngel.LowATO.IsActive())
      ReefAngel.LCD.DrawText(OutletOffBGColor,DefaultBGColor,x,y,"WtrLvl Low");
  else
      ReefAngel.LCD.DrawText(OutletOnBGColor,DefaultBGColor,x,y,"WtrLvl Ok");
  

  //Lines 4 and 5 - Relays
  x = 12; 
  y += 15;
  // draw main relay
  byte TempRelay = ReefAngel.Relay.RelayData;
  TempRelay &= ReefAngel.Relay.RelayMaskOff;
  TempRelay |= ReefAngel.Relay.RelayMaskOn;
  ReefAngel.LCD.DrawOutletBox(x, y, TempRelay);
#ifdef RelayExp
  // draw 1st expansion relay
  y += 12 ;
  TempRelay = ReefAngel.Relay.RelayDataE[0];
  TempRelay &= ReefAngel.Relay.RelayMaskOffE[0];
  TempRelay |= ReefAngel.Relay.RelayMaskOnE[0];
  ReefAngel.LCD.DrawOutletBox(x, y, TempRelay);
#endif  // RelayExp

  //Line 6 - Moon
  x = 8;
  y += 17;
  ReefAngel.LCD.DrawText(DefaultFGColor,DefaultBGColor,x,y,"Moon");

  //Line 7 - Intensity
  x = 8;
  y += 10; 
  ReefAngel.LCD.DrawText(DefaultFGColor,DefaultBGColor,x,y,"Intensity");  

  //Line 8 - Sunrise
  x = 8;
  y += 10; 
  ReefAngel.LCD.DrawText(DefaultFGColor,DefaultBGColor,x,y,"Sunrise");

  //Line 9 - Sunset
  x = 8;
  y += 10; 
  ReefAngel.LCD.DrawText(DefaultFGColor,DefaultBGColor,x,y,"Sunset");

  pingSerial();
}
void DrawCustomGraph()
{
}
And you'll see all the changes to RA_CustomColors.h just to see if it works (I don't really want a red and yellow screen :D ):

Code: Select all

/*
 * Copyright 2010 Curt Binder
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#ifndef __RA_CUSTOMCOLORS_H__
#define __RA_CUSTOMCOLORS_H__

#include <RA_Colors.h>

/*
Ability to completely customize all colors of the screen
To change an aspect of the screen, you simply need to change the color defined for the variable.
The variables are labeled intuitively.  Please note that when changing the entire screen color
to another color, you must make sure that all the corresponding BG colors (background colors) match
otherwise you will have a non-consistent background screen.  This is primarily the case when displaying
the main screen / homepage.

Also note that if you intend to change the colors, you will want to experiment to find a good color
combination.  If the background color is changed, you will most likely need to alter all of the other
colors in order for the screen to be easily readable.

You can use any of the colors specified above OR you can specify your own colors in hex code.
The values can range from 0x00 to 0xFF.  Most of the common colors are specified above, so the use
of your own hex code (number) is most likely not needed.  If you want to see what the colors will look like,
on the ReefAngel Google Groups page is a Color Chart image that will show you the colors.
*/
#define T1TempColor         COLOR_RED  // Text color for the T1 temp probe (homescreen)
#define T2TempColor         COLOR_CHOCOLATE  // Text color for the T2 temp probe (homescreen)
#define T3TempColor         COLOR_MEDIUMORCHID  // Text color for the T3 temp probe (homescreen)
#define PHColor             COLOR_ORANGE  //originally 0x34, Text color for the PH probe (homescreen)
#define DPColor             COLOR_SADDLEBROWN // Text color for Daylight PWM value (homescreen)
#define APColor             COLOR_DARKSLATEBLUE  //originally 0x49, Text color for the Actinic PWM value (homescreen)
#define CalibrateColor      COLOR_RED  // color of the PH calibration text values
#define ModeScreenColor     COLOR_BLUE  // color of the text on Feeding Mode, Water Change Mode and Version screens
#define DateTextColor       COLOR_RED  // color of the date on home screen
#define OutletBorderColor   0x54  // Border around the outlet box on home screen
#define OutletOnBGColor     COLOR_GREEN  // Outlet box background color when outlet is on (homescreen)
#define OutletOnFGColor     COLOR_WHITE  // Outlet box text (number) color when outlet is on (homescreen)
#define OutletOffBGColor    COLOR_LIGHTGRAY  // Outlet box background color when outlet is off (homescreen)
#define OutletOffFGColor    COLOR_WHITE  // Outlet box text (number) color when outlet is off (homescreen)
#define BtnBorderColor      COLOR_BLACK  // OK & Cancel button border color (setup screens)
#define BtnActiveColor      COLOR_GRAY  // OK & Cancel button ACTIVE (selected) background color (seup screens)
#define BtnInactiveColor    COLOR_LIGHTGRAY  // OK & Cancel button INACTIVE (not selected) background color (setup screens)
#define SelectionBGColor    COLOR_BLUE  // Background color for selected items (Menu & Setup screens)
#define SelectionFGColor    COLOR_WHITE  // Foreground (text) color for selected items (Menu & Setup screens)
#define DefaultBGColor      COLOR_RED  // Default background color
#define DefaultFGColor      COLOR_YELLOW  // Default text color
#define GraphDotLineColor   0x49    // color of the dotted line in the middle of the graph


#endif  // __RA_CUSTOMCOLORS_H__
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: Customizing code... Upload Errors

Post by rimai »

next libraries update.
Roberto.
Post Reply