Sketch too big...

Do you have a question on how to do something.
Ask in here.
Post Reply
jedimasterben
Posts: 25
Joined: Tue Dec 25, 2012 5:17 pm

Sketch too big...

Post by jedimasterben »

So I have the standard RA, with the Salinity expansion, Wifi attachment, and switched my relay box to send a 0-10v signal to control my two Tunze powerheads.

Here is 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 <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 = Port1Bit | Port2Bit | Port4Bit;
    // Ports toggled in Water Change Mode
    ReefAngel.WaterChangePorts = Port1Bit | Port2Bit | Port4Bit;
    // 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( 820 );

    // Feeeding and Water Change mode speed
    ReefAngel.DCPump.FeedingSpeed=0;
    ReefAngel.DCPump.WaterChangeSpeed=0;


    // Ports that are always on
    ReefAngel.Relay.On( Port1 );
    ReefAngel.Relay.On( Port2 );
    ReefAngel.Relay.On( Port5 );
    ReefAngel.Relay.On( Port6 );
    ReefAngel.Relay.On( Port7 );
    ReefAngel.Relay.On( Port8 );

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

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

void loop()
{
    ReefAngel.StandardLights( Port3,20,0,14,0 );
    ReefAngel.DosingPumpRepeat( Port4,0,60,125 );
    ReefAngel.DCPump.UseMemory = false;
    ReefAngel.DCPump.SetMode( ReefCrest,100,10 );
    ReefAngel.DCPump.DaylightChannel = Sync;
    ReefAngel.DCPump.ActinicChannel = AntiSync;
    ////// Place your custom code below here
    

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

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

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

    // Salinity
    ReefAngel.LCD.DrawText( COLOR_DARKKHAKI,DefaultBGColor,49,66, "SAL:" );
    ReefAngel.LCD.DrawSingleMonitor( ReefAngel.Params.Salinity,COLOR_DARKKHAKI,73,66, 10 );    
    pingSerial();

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

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

void DrawCustomGraph()
{
}


By having a single expansion and one attachment, have I really filled the memory capacity? Is that all it takes? My code is exactly what the RA Wizard spits out, installed from the latest 1.0.9 installer.
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: Sketch too big...

Post by rimai »

It's the DCPump class...
It is huge because it has to store all wave patterns in the memory, so you can switch to which one you want at will.
If you choose to use the old method of wave pattern, you most likely can fit the code, but you would be limited to one wave pattern only.
http://forum.reefangel.com/viewtopic.php?f=14&t=2895
Roberto.
jedimasterben
Posts: 25
Joined: Tue Dec 25, 2012 5:17 pm

Re: Sketch too big...

Post by jedimasterben »

Gotcha, just didn't expect that to throw it overboard on the size.


Ok, so if I want to run only Reef Crest mode, then I need to put this:

Code: Select all

ReefAngel.PWM.SetDaylight( ReefCrestMode(70,30,true) ); // ReefCrest at 70% +/- 30% on sync mode
ReefAngel.PWM.SetActinic( ReefCrestMode(70,30,false) ); // ReefCrest at 70% +/- 30% on anti-sync mode
between these:

Code: Select all

////// Place your custom code below here
    

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

Redid the sketch with that in place, and it is 31,336 bytes (of a 32,256 byte maximum) LOL, can't cut too much closer than that!
bencollinz
Posts: 151
Joined: Wed Mar 13, 2013 5:36 pm

Re: Sketch too big...

Post by bencollinz »

you don't need to draw the outlets if they're defaulted to on. I rarely look at the RA's screen for anything. my phone for everything.
Image
Post Reply