Help with Custom Menus

Would you like to help?
Share your walkthrough tutorial with others

Posts: 33
Joined: Mon Oct 07, 2013 10:11 am
PostPosted: Fri Oct 18, 2013 8:19 pm
So I am having successes with the custom menus but what i want is an option to turn my lights on at anytime to full brightness. it says that the class PWMSetPercent doesnt exist but you had said in the manual that it does. what am I missing

Code: Select all
#include <RT_PWM.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 <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>
#include <avr/pgmspace.h>

byte RoyalBluePWMValue=0;
byte WhitePWMValue=0;
byte BluePWMValue=0;
byte PinkPWMValue=0;

////// Place global variable code below here

  prog_char menu0_label[] PROGMEM = "Feeding";
  prog_char menu1_label[] PROGMEM = "Water Change";
  prog_char menu2_label[] PROGMEM = "ATO Clear";
  prog_char menu3_label[] PROGMEM = "Overheat Clear";
  prog_char menu4_label[] PROGMEM = "PH Calibration";
  prog_char menu5_label[] PROGMEM = "Date / Time";
  prog_char menu6_label[] PROGMEM = "Version";
  prog_char menu7_label[] PROGMEM = "Lighting";

  PROGMEM const char *menu_items[] = {
  menu0_label, menu1_label, menu2_label,
  menu3_label, menu4_label, menu5_label,
  menu6_label,menu7_label//, menu7_label, menu8_label
  };

void MenuEntry1()
{
ReefAngel.FeedingModeStart();
}
void MenuEntry2()
{
ReefAngel.WaterChangeModeStart();
}
void MenuEntry3()
{
ReefAngel.ATOClear();
ReefAngel.DisplayMenuEntry("Clear ATO Timeout");
}
void MenuEntry4()
{
ReefAngel.OverheatClear();
ReefAngel.DisplayMenuEntry("Clear Overheat");
}
void MenuEntry5()
{
ReefAngel.SetupCalibratePH();
ReefAngel.DisplayedMenu = ALT_SCREEN_MODE;
}
void MenuEntry6()
{
ReefAngel.SetupDateTime();

ReefAngel.DisplayedMenu = ALT_SCREEN_MODE;
}
void MenuEntry7()
{
ReefAngel.DisplayVersion();
}
void MenuEntry8()
{
ReefAngel.PWMSetPercent(byte p);
}

////// Place global variable code above here


void setup()
{
    // This must be the first line
    ReefAngel.Init();  //Initialize controller
    ReefAngel.InitMenu(pgm_read_word(&(menu_items[0])),SIZE(menu_items));
    // Ports toggled in Feeding Mode
    ReefAngel.FeedingModePorts = Port5Bit | Port6Bit | Port8Bit;
    // Ports toggled in Water Change Mode
    ReefAngel.WaterChangePorts = Port5Bit | Port6Bit | Port8Bit;
    // Ports toggled when Lights On / Off menu entry selected
    ReefAngel.LightsOnPorts = Port3Bit | Port4Bit;
    // Ports turned off when Overheat temperature exceeded
    ReefAngel.OverheatShutoffPorts = Port7Bit;
    // Use T1 probe as temperature and overheat functions
    ReefAngel.TempProbe = T1_PROBE;
    ReefAngel.OverheatProbe = T1_PROBE;
    // Set the Overheat temperature setting
    InternalMemory.OverheatTemp_write( 850 );


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

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

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

void loop()
{
    ReefAngel.StandardATO( Port1,1800 );
    ReefAngel.StandardLights( Port3,7,0,22,0 );
    ReefAngel.StandardLights( Port4,11,0,23,0 );
    ReefAngel.StandardHeater( Port7,780,790 );
    RoyalBluePWMValue= PWMSlope(7,0,23,0,0,100,90,RoyalBluePWMValue) ;
    WhitePWMValue=PWMParabola(10,0,22,0,0,100,WhitePWMValue) ;
    BluePWMValue=PWMParabola(8,30,20,0,0,100,BluePWMValue) ;
    PinkPWMValue=PWMSlope(7,30,22,30,0,100,90,PinkPWMValue) ;
    CheckCloud();
    ReefAngel.PWM.SetChannel( 0, RoyalBluePWMValue);
    ReefAngel.PWM.SetChannel( 1, WhitePWMValue );
    ReefAngel.PWM.SetChannel( 2, BluePWMValue );
    ReefAngel.PWM.SetChannel( 3, PinkPWMValue  );
    ////// Place your custom code below here


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


Posts: 12247
Joined: Fri Mar 18, 2011 6:47 pm
PostPosted: Sat Oct 19, 2013 8:18 am
Is it for the standard dimming channels or expansion module?
Roberto.

Posts: 33
Joined: Mon Oct 07, 2013 10:11 am
PostPosted: Sat Oct 19, 2013 9:57 am
Expansion Module i am using channels 0-3

Posts: 12247
Joined: Fri Mar 18, 2011 6:47 pm
PostPosted: Sat Oct 19, 2013 5:04 pm
Try this:
Code: Select all
void MenuEntry8()
{
  if (ReefAngel.PWM.GetChannelOverrideValue(0)<=100)
  {
    ReefAngel.PWM.SetChannelOverride(0,255);
    ReefAngel.PWM.SetChannelOverride(1,255);
    ReefAngel.PWM.SetChannelOverride(2,255);
  }
  else
  {
    ReefAngel.PWM.SetChannelOverride(0,100);
    ReefAngel.PWM.SetChannelOverride(1,100);
    ReefAngel.PWM.SetChannelOverride(2,100);
  }
}
Roberto.

Posts: 33
Joined: Mon Oct 07, 2013 10:11 am
PostPosted: Sun Oct 20, 2013 3:54 pm
rimai wrote:Try this:
Code: Select all
void MenuEntry8()
{
  if (ReefAngel.PWM.GetChannelOverrideValue(0)<=100)
  {
    ReefAngel.PWM.SetChannelOverride(0,255);
    ReefAngel.PWM.SetChannelOverride(1,255);
    ReefAngel.PWM.SetChannelOverride(2,255);
  }
  else
  {
    ReefAngel.PWM.SetChannelOverride(0,100);
    ReefAngel.PWM.SetChannelOverride(1,100);
    ReefAngel.PWM.SetChannelOverride(2,100);
  }
}




So That logically makes sense to me but i got an error

" Clouds2:91: error: 'class RA_PWMClass' has no member named 'GetChannelOverrideValue' "

Thats the same problem I was having



Another question in the code you gave I understand the 0, 1, 2 those correspond to the channels but what is the 255? and why cant you just force it to go full brightness why do you need the if and else statements?
User avatar
Posts: 5349
Joined: Fri Jul 20, 2012 9:42 am
PostPosted: Sun Oct 20, 2013 4:03 pm
If the lights are overriden, put them back to normal otherwise override them.

255 is the default (non overriden value)

Sounds like you have older libraries. Try installing the latest versionx

Posts: 12247
Joined: Fri Mar 18, 2011 6:47 pm
PostPosted: Sun Oct 20, 2013 4:58 pm
Yeah, if you override them to 100%, you would need a way to put them back to normal mode, right?
That's why I made the if...else statement or you would be forever in 100% :cry:
Roberto.

Posts: 33
Joined: Mon Oct 07, 2013 10:11 am
PostPosted: Sun Oct 20, 2013 6:57 pm
That makes perfect sense! so I just uninstalled and re installed the reef controller program. no luck it is giving me the same issue.


What are the eagle files? i haven't figured out what they are or where they go? I am kinda assuming that missing them is my problem.

Posts: 12247
Joined: Fri Mar 18, 2011 6:47 pm
PostPosted: Mon Oct 21, 2013 9:01 am
What do you get when you do to Tools->Reef Angel Libraries Version?
Eagle files are the files to create the PCB. You don't need them.
http://www.cadsoftusa.com/
Roberto.

Posts: 33
Joined: Mon Oct 07, 2013 10:11 am
PostPosted: Mon Oct 21, 2013 9:05 am
O ok that looks cool I will check tonight when I get home What version should I have?

I did delete all files and re install the RA arduino program, so i should have the most up to date!
Next

Return to Tutorials

Who is online

Users browsing this forum: No registered users and 1 guest