Issues after library upgrade

Post Reply
dpitalo
Posts: 39
Joined: Mon Dec 12, 2011 6:45 pm

Issues after library upgrade

Post by dpitalo »

So Roberto helped me fixed the LED strobing that was going on, but I'm having some other issues now.

It seems that the controller isn't quite right. All the timers and scheduling appear to be working correctly. The specified ports turn off for Feed and Water Change modes and the wavemaker function is working fine. I'm still having issues with the lights ramping up and down. They ramp up fine, but for whatever reason, won't ramp down.

The other thing that is happening is weird. When I get home from work and go to do daily maintenance, I can't get the screen to come back on either by pushing the button, or moving the joystick around. Today, when I tried it, I pushed the button, and it entered either water change or feeding mode, but the screen went black and I had to cycle the power to the controller to get it to come back on.

Here's the internal memory

Code: Select all

// Autogenerated file by RAGen (v1.2.2.171), (04/02/2012 19:09)
// Memory_040212_1909.ino
//
// This file sets the default values to the Internal Memory
//


#include <ReefAngel_Features.h>
#include <Globals.h>
#include <Time.h>
#include <OneWire.h>
#include <RA_NokiaLCD.h>
#include <avr/pgmspace.h>
#include <InternalEEPROM.h>
#include <Wire.h>
#include <Memory.h>


RA_NokiaLCD e;

void setup()
{
    e.Init();
    e.Clear(COLOR_WHITE,0,0,132,132);
    e.BacklightOn();

    InternalMemory.MHOnHour_write(8);
    InternalMemory.MHOnMinute_write(0);
    InternalMemory.MHOffHour_write(15);
    InternalMemory.MHOffMinute_write(0);
    InternalMemory.StdLightsOnHour_write(8);
    InternalMemory.StdLightsOnMinute_write(0);
    InternalMemory.StdLightsOffHour_write(15);
    InternalMemory.StdLightsOffMinute_write(0);
    InternalMemory.WM1Timer_write(200);
    InternalMemory.WM2Timer_write(354);
    InternalMemory.DP1Timer_write(10);
    InternalMemory.DP2Timer_write(10);
    InternalMemory.FeedingTimer_write(900);
    InternalMemory.LCDTimer_write(600);
    InternalMemory.OverheatTemp_write(1500);
    InternalMemory.LEDPWMDaylight_write(50);
    InternalMemory.LEDPWMActinic_write(50);
    InternalMemory.HeaterTempOn_write(780);
    InternalMemory.HeaterTempOff_write(791);
    InternalMemory.ChillerTempOn_write(810);
    InternalMemory.ChillerTempOff_write(785);
    InternalMemory.ATOTimeout_write(60);
    InternalMemory.PHMax_write(840);
    InternalMemory.PHMin_write(550);
    InternalMemory.MHDelay_write(5);
    InternalMemory.DP1OnHour_write(20);
    InternalMemory.DP1OnMinute_write(0);
    InternalMemory.DP2OnHour_write(22);
    InternalMemory.DP2OnMinute_write(30);
    InternalMemory.ATOHourInterval_write(0);
    InternalMemory.ATOHighHourInterval_write(0);
    InternalMemory.ATOHighTimeout_write(60);
    InternalMemory.DP1RepeatInterval_write(0);
    InternalMemory.DP2RepeatInterval_write(0);
    InternalMemory.SalMax_write(2550);
    InternalMemory.PWMSlopeStartD_write(15);
    InternalMemory.PWMSlopeEndD_write(95);
    InternalMemory.PWMSlopeDurationD_write(120);
    InternalMemory.PWMSlopeStartA_write(15);
    InternalMemory.PWMSlopeEndA_write(100);
    InternalMemory.PWMSlopeDurationA_write(60);
    InternalMemory.RFMode_write(0);
    InternalMemory.RFSpeed_write(100);
    InternalMemory.RFDuration_write(10);
    InternalMemory.PWMSlopeStart0_write(10);
    InternalMemory.PWMSlopeEnd0_write(95);
    InternalMemory.PWMSlopeDuration0_write(60);
    InternalMemory.PWMSlopeStart1_write(10);
    InternalMemory.PWMSlopeEnd1_write(95);
    InternalMemory.PWMSlopeDuration1_write(60);
    InternalMemory.PWMSlopeStart2_write(10);
    InternalMemory.PWMSlopeEnd2_write(95);
    InternalMemory.PWMSlopeDuration2_write(60);
    InternalMemory.PWMSlopeStart3_write(15);
    InternalMemory.PWMSlopeEnd3_write(95);
    InternalMemory.PWMSlopeDuration3_write(80);
    InternalMemory.PWMSlopeStart4_write(15);
    InternalMemory.PWMSlopeEnd4_write(95);
    InternalMemory.PWMSlopeDuration4_write(80);
    InternalMemory.PWMSlopeStart5_write(15);
    InternalMemory.PWMSlopeEnd5_write(95);
    InternalMemory.PWMSlopeDuration5_write(120);
    InternalMemory.IMCheck_write(0x5241494D);
}

void loop()
{
    // display success screen
    e.DrawText(COLOR_BLACK, COLOR_WHITE, MENU_START_COL, MENU_START_ROW*2, "Internal Memory Set");
    e.DrawText(COLOR_BLACK, COLOR_WHITE, MENU_START_COL, MENU_START_ROW*4, "Now load your");
    e.DrawText(COLOR_BLACK, COLOR_WHITE, MENU_START_COL, MENU_START_ROW*5, "   RA code file");
    delay(5000);
}
And here's the INO.

Code: Select all

//#include <Salinity.h>
#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 <ReefAngel.h>

/*
Ports assignment:

Port1 - Standard ATO 
Port2 - Skimmer
Port3 - Always On
Port4 - Heater 
Port5 - Wavemaker 1
Port6 - Wavemaker 2
Port7 - SeaSwirl
Port8 - Return
*/

//** Start Global Variables
#define PWMRB1            0
#define PWMRB2            1
#define PWMRB3            2
#define PWMWT1            3
#define PWMWT2            4
#define PWMHN             5


byte PWMChannel[]={
  0,0,0,0,0,0};

// Globals Needed for Params on Custom Main
byte x,y;
char text[10];
int v;

//** End Global Variables

//** Start Custom Main Screen
void DrawCustomMain()
{
        //Top Banner
        ReefAngel.LCD.DrawText(COLOR_BLACK, COLOR_SKYBLUE, 9, 2, " Dave's 40g Reef "); 
        
        // Display T1 Header Text
        ReefAngel.LCD.DrawText(COLOR_BLACK,255,20,14,"Tank");
  
        // Display the T1 Temp Value
        char text[7];
        ConvertNumToString(text, ReefAngel.Params.Temp[T1_PROBE], 10);
        ReefAngel.LCD.Clear(255, 4, 21, 37, 37);
        ReefAngel.LCD.DrawLargeText(COLOR_BLACK, 255, 20, 24, text, Num8x16);
        pingSerial();

        // Display pH Header Text
        ReefAngel.LCD.DrawText(COLOR_INDIGO,255,70,14,"pH");
  
        // Display pH Value
        ConvertNumToString(text, ReefAngel.Params.PH, 100);
        ReefAngel.LCD.Clear(255, 94, 21, 106, 37);
        ReefAngel.LCD.DrawLargeText(COLOR_INDIGO, 255, 70, 24, text, Num8x16);
        pingSerial();
        
        //Start Moon Phase Display
        ReefAngel.LCD.DrawText(COLOR_BLACK, COLOR_WHITE, 12, 45, "Moon Phase:");
        if (ReefAngel.PWM.GetActinicValue() ==0) ReefAngel.LCD.DrawText(20,255,81,45,"Off");
        else if(ReefAngel.PWM.GetActinicValue() >=1 && ReefAngel.PWM.GetActinicValue() < 20) ReefAngel.LCD.DrawText(20,255,81,45,"New");
        else if(ReefAngel.PWM.GetActinicValue() >=20 && ReefAngel.PWM.GetActinicValue() < 35) ReefAngel.LCD.DrawText(20,255,81,45,"Cresent");
        else if(ReefAngel.PWM.GetActinicValue() >=35 && ReefAngel.PWM.GetActinicValue() < 45) ReefAngel.LCD.DrawText(20,255,81,45,"Half");
        else if(ReefAngel.PWM.GetActinicValue() >=45 && ReefAngel.PWM.GetActinicValue() < 60) ReefAngel.LCD.DrawText(20,255,81,45,"Gibbous");
        else if(ReefAngel.PWM.GetActinicValue() >=60 && ReefAngel.PWM.GetActinicValue() < 80) ReefAngel.LCD.DrawText(20,255,81,45,"Full");
        //End Display Moon Phase Display

 
        
        // Display Main Relay Box
        byte TempRelay = ReefAngel.Relay.RelayData;
        TempRelay &= ReefAngel.Relay.RelayMaskOff;
        TempRelay |= ReefAngel.Relay.RelayMaskOn;
        ReefAngel.LCD.DrawOutletBox(13, 108, TempRelay);
        pingSerial();
        
        //Draw Date & Time
        ReefAngel.LCD.DrawDate(6, 123);
        pingSerial();
}

void DrawCustomGraph()  // Not Used
{
}
//** End Custom Main



void setup()
{
  ReefAngel.Init(); 
  ReefAngel.FeedingModePorts = Port2Bit | Port5Bit | Port6Bit | Port8Bit; // Turn off Ports 2,5,6,8 when feeding mode is activated
  ReefAngel.WaterChangePorts = Port2Bit | Port4Bit | Port8Bit; // Turn off Ports 2,4,8 when water change mode is activated
  ReefAngel.Relay.On(Port2); // Turn on Skimmer
  ReefAngel.Relay.On(Port3); // Turn on Always On port
  ReefAngel.Relay.On(Port7); // Turn on SeaSwirl
  ReefAngel.Relay.On(Port8); // Turn on return
}

void loop()
{
  ReefAngel.StandardATO(Port1, 60); // ATO with 60 seconds timeout
  ReefAngel.StandardHeater(Port4,770,780); //Standard heater comes on at 77 degrees and off at 78 degrees
  ReefAngel.WavemakerRandom1(Port5,15,60);//Turn on/off Wavemaker 1 random cycles from 15 to 60 seconds
  ReefAngel.WavemakerRandom2(Port6,15,60);//Turn on/off Wavemaker 1 random cycles from 15 to 60 seconds
  //** Moonphase Code Start Here
    if (hour ()>=21 || hour ()<10)
    {
      ReefAngel.PWM.SetActinic(MoonPhase());
    }
    else
    {
      ReefAngel.PWM.SetActinic(0);
    }
  //** Moonphase Code Ends Here
  
  //** Daylight PWM Channel Code Starts Here
    if (hour()>=21 || hour()<12)
    {
      ReefAngel.PWM.SetDaylight(0);
    }
    else
    {
      //ReefAngel.PWM.SetDaylight(PWMSlope(12,00,20,30,13,95,120,13));   //XP-G Cool Whites - Right Side
      ReefAngel.PWM.SetDaylight(PWMParabola(12,00,20,30,15,95,15));
    }
    //** Daylight PWM Channel Code Ends Here
    
    //** PWM Expansion Module Code Starts Here
    
      //PWMChannel[PWMRB2]=PWMSlope(9,30,21,20,10,95,60,PWMChannel[PWMRB2]);        //Royal Blue - Left Bank
      PWMChannel[PWMRB2]=PWMParabola(9,30,21,20,28,95,28);
      //PWMChannel[PWMRB3]=PWMSlope(9,50,21,40,10,95,60,PWMChannel[PWMRB3]);       //Royal Blue - Middle Bank
      PWMChannel[PWMRB3]=PWMParabola(9,50,21,40,28,95,28);
      //PWMChannel[PWMRB1]=PWMSlope(10,10,22,00,10,95,60,PWMChannel[PWMRB1]);       //Royal Blue - Right Bank
      PWMChannel[PWMRB1]=PWMParabola(10,10,22,00,11,95,11);

      //PWMChannel[PWMWT2]=PWMSlope(11,00,21,00,10,95,80,PWMChannel[PWMWT2]);       //XP-E Cool Whites - Left Side  
      PWMChannel[PWMWT2]=PWMParabola(11,00,21,00,18,95,18);
      //PWMChannel[PWMWT1]=PWMSlope(11,10,21,30,10,95,80,PWMChannel[PWMWT1]);       //XP-E Cool Whites - Right Side
      PWMChannel[PWMWT1]=PWMParabola(11,10,21,30,18,95,18);

      //PWMChannel[PWMHN]=PWMSlope(12,00,20,00,10,95,120,PWMChannel[PWMHN]);        //XP-G Cool Whites - Left Side
      PWMChannel[PWMHN]=PWMParabola(12,00,20,00,12,95,12);
     
     
    for (int a=0;a<6;a++)
    {
    ReefAngel.PWM.SetChannel(a,PWMChannel[a]); 
    }
      
    //** PWM Expansion Module Code Ends Here
  
  
  ReefAngel.ShowInterface(); //Draw the Standard Interface
  
}
Help??

Thanks,
Dave
binder
Posts: 2871
Joined: Fri Mar 18, 2011 6:20 pm
Location: Illinois
Contact:

Re: Issues after library upgrade

Post by binder »

I wonder if it has something to do with the PWMParabola function? That's the only thing that I can think of that would be causing that problem with it not sloping down correctly.
dpitalo
Posts: 39
Joined: Mon Dec 12, 2011 6:45 pm

Re: Issues after library upgrade

Post by dpitalo »

If it's of any consequence, it was doing the same thing using PWMSlope. I switched it over to parabola to see if that made any difference.
dpitalo
Posts: 39
Joined: Mon Dec 12, 2011 6:45 pm

Re: Issues after library upgrade

Post by dpitalo »

Curt,

Another update on this issue. I'm still having random lockups on my Reef Angel, but it's nothing major. Occasionally it won't come back out of water change mode, but again, I can deal with that stuff. One thing I did notice is what happens when I put the max value on the PWMParabola function at 100. For whatever reason, once everything gets to 100%, it won't start ramping down. I changed it to 99% and it works fine.

Not that 1% is going to make a whole lot of difference, but any idea why that would happen?

-Dave
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: Issues after library upgrade

Post by rimai »

Did you enable Watchdog Timer feature?
Everything on the code looks good.
Roberto.
dpitalo
Posts: 39
Joined: Mon Dec 12, 2011 6:45 pm

Re: Issues after library upgrade

Post by dpitalo »

Hi Roberto,

I just went through my features file and all of the Watchdog stuff is commented out. Like I said, the issues I'm having now, I'm able to deal with. Maybe me controller doesn't like me anymore. :-)

-Dave
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: Issues after library upgrade

Post by rimai »

You need to uncomment it.
The watchdog timer is what monitors the controller.
I'm also wondering if the parabola has anything to do with it.
Would you be able to use slope and see if it makes a difference?
Roberto.
dpitalo
Posts: 39
Joined: Mon Dec 12, 2011 6:45 pm

Re: Issues after library upgrade

Post by dpitalo »

Hey Roberto,

I just enabled all the watchdog stuff. I also switched back over to the Slope function to see if it makes a difference. I do have the max value set at 99 instead of 100, but I'll report back later with results.

-Dave
Post Reply