Help with Custom Menus

Would you like to help?
Share your walkthrough tutorial with others
Post Reply
Bruz4023
Posts: 33
Joined: Mon Oct 07, 2013 10:11 am

Help with Custom Menus

Post by Bruz4023 »

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();
    
}

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

Re: Custom Menus

Post by rimai »

Is it for the standard dimming channels or expansion module?
Roberto.
Bruz4023
Posts: 33
Joined: Mon Oct 07, 2013 10:11 am

Re: Custom Menus

Post by Bruz4023 »

Expansion Module i am using channels 0-3
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: Custom Menus

Post by rimai »

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.
Bruz4023
Posts: 33
Joined: Mon Oct 07, 2013 10:11 am

Re: Custom Menus

Post by Bruz4023 »

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
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

Re: Custom Menus

Post by lnevo »

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
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: Custom Menus

Post by rimai »

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.
Bruz4023
Posts: 33
Joined: Mon Oct 07, 2013 10:11 am

Re: Custom Menus

Post by Bruz4023 »

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.
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: Custom Menus

Post by rimai »

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.
Bruz4023
Posts: 33
Joined: Mon Oct 07, 2013 10:11 am

Re: Custom Menus

Post by Bruz4023 »

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!
Bruz4023
Posts: 33
Joined: Mon Oct 07, 2013 10:11 am

Re: Custom Menus

Post by Bruz4023 »

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!
Bruz4023
Posts: 33
Joined: Mon Oct 07, 2013 10:11 am

Re: Custom Menus

Post by Bruz4023 »

ok I just checked and it says 1.0.9 that is the older version right? what steps do i need to take to ensure it is installed with up to date libraries?
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: Custom Menus

Post by rimai »

Yes, 1.0.9 is the latest.
I could swear those functions were introduced on 1.0.8, but now you made me doubt it.
Let me double check
Roberto.
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: Custom Menus

Post by rimai »

Oh, sorry...
That one function is queued for next release :(
Try this then:

Code: Select all

void MenuEntry8()
{
  if (ReefAngel.PWM.ExpansionChannelOverride[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.
Bruz4023
Posts: 33
Joined: Mon Oct 07, 2013 10:11 am

Re: Custom Menus

Post by Bruz4023 »

so it accepted that code but it didnt do anything when I selected it? should there be a delay or something?
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: Help with Custom Menus

Post by rimai »

I just tested it and it is working just fine here.
Roberto.
Post Reply