Upgraded to 1.1.0 library and previous sketch now too big

Related to the development libraries, released by Curt Binder
Post Reply
jedimasterben
Posts: 25
Joined: Tue Dec 25, 2012 5:17 pm

Upgraded to 1.1.0 library and previous sketch now too big

Post by jedimasterben »

Hello all,

I was about to upload a slightly different sketch than my previous one (only change was parabola max 70% instead of 100%), and was notified of new libraries. So, I updated, compiled, and saved it to my laptop for programming since my RA is not near my desktop. Updated libraries on the laptop, and went to upload the sketch, and suddenly, it's too big by around 1000 bytes. Uninstalled the RA stuff, deleted the Arduino folder in my documents, and reinstalled. Made the exact same sketch again, and this time, it was just small enough to be programmable - by 100 bytes or so.

Hopefully this is just a fluke. I have the salinity expansion and wifi attachment, and I have only four of the relays populated, with two regular pumps, one topoff pump (which is actually programmed as a dosing pump to give a measured amount of water), and one bank of lights. Shouldn't be that awful big of a sketch IMHO.
User avatar
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

Re: Upgraded to 1.1.0 library and previous sketch now too bi

Post by lnevo »

Thats actually a pretty big fit for the standard. Stay with the older library version.
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: Upgraded to 1.1.0 library and previous sketch now too bi

Post by rimai »

No, it's not a fluke. That's the trade off on the standard RA. It has very limited memory and it costs less.
The problem is that the wifi codeset that just keeps increasing as we add more and more features.
If you remove the wifi, you will see how drastically your code will shrink.
Maybe we ought to have a minimalist version, but I just don't see what we could decrease in there.
Roberto.
jedimasterben
Posts: 25
Joined: Tue Dec 25, 2012 5:17 pm

Re: Upgraded to 1.1.0 library and previous sketch now too bi

Post by jedimasterben »

rimai wrote:No, it's not a fluke. That's the trade off on the standard RA. It has very limited memory and it costs less.
The problem is that the wifi codeset that just keeps increasing as we add more and more features.
If you remove the wifi, you will see how drastically your code will shrink.
Maybe we ought to have a minimalist version, but I just don't see what we could decrease in there.
I actually played around with it. Tried removing just the salinity expansion, then just the wifi attachment, and then removing both, and it still really didn't change much.

On 1.1.0 libraries, here are the sketch sizes:
With Salinity & wifi: 33,076 bytes
With Salinity (no wifi): 29,936 bytes
With Wifi (no salinity): 32,054 bytes
With neither: 29,060 bytes

Here is my full sketch if anyone is interested.

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;
    // Ports toggled in Water Change Mode
    ReefAngel.WaterChangePorts = Port1Bit | Port2Bit;
    // Ports toggled when Lights On / Off menu entry selected
    ReefAngel.LightsOnPorts = Port3Bit;
    // 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 );


    // 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,11,0,23,0 );
    ReefAngel.DosingPumpRepeat( Port4,0,240,180 );
    ReefAngel.PWM.SetDaylight( PWMParabola(11,0,23,0,1,70,1) );
    ReefAngel.PWM.SetActinic( PWMParabola(11,0,23,0,1,70,1) );
    ////// 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()
{
}

Monitoring salinity and having a way to check up on the controller via wifi are two very common things that I'd imagine are all that the 'average Joe' would want to do, but it seems that going forward, they cannot do that with the 'basic' controller version now. The page that goes through the 'basic vs plus' mentions that as more expansions are added that you will limited on adding them, but I think that just having the basic monitoring included with the RA and being limited to one expansion OR connecting via wifi may reduce the amount of people choosing the RA.

I also just made a sketch as if I also had added a calcium reactor, two wavemakers on random, and a chiller, and the sketch increased to 30,000 bytes, meaning that wifi could not be added at all. Just something to think about.
User avatar
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

Re: Upgraded to 1.1.0 library and previous sketch now too bi

Post by lnevo »

The wording should probably be changed on the "basic vs plus" to as more expansions and improvements are made to the libraries...

Regardless, you can go to the older versions and probably get everything to fit. End of the day there is an upgrade path and we're going to have a lot more people come on with the software unable to fit. If you bought an expansion recently with the idea of getting it working on a standard, then the previous wording applies and no issues..
Post Reply