Page 1 of 1

Help with Custom Menus

Posted: Fri Oct 18, 2013 8:19 pm
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();
    
}


Re: Custom Menus

Posted: Sat Oct 19, 2013 8:18 am
by rimai
Is it for the standard dimming channels or expansion module?

Re: Custom Menus

Posted: Sat Oct 19, 2013 9:57 am
by Bruz4023
Expansion Module i am using channels 0-3

Re: Custom Menus

Posted: Sat Oct 19, 2013 5:04 pm
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);
  }
}

Re: Custom Menus

Posted: Sun Oct 20, 2013 3:54 pm
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?

Re: Custom Menus

Posted: Sun Oct 20, 2013 4:03 pm
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

Re: Custom Menus

Posted: Sun Oct 20, 2013 4:58 pm
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:

Re: Custom Menus

Posted: Sun Oct 20, 2013 6:57 pm
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.

Re: Custom Menus

Posted: Mon Oct 21, 2013 9:01 am
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/

Re: Custom Menus

Posted: Mon Oct 21, 2013 9:05 am
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!

Re: Custom Menus

Posted: Mon Oct 21, 2013 9:05 am
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!

Re: Custom Menus

Posted: Mon Oct 21, 2013 2:26 pm
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?

Re: Custom Menus

Posted: Mon Oct 21, 2013 2:42 pm
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

Re: Custom Menus

Posted: Mon Oct 21, 2013 2:49 pm
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);
  }
}

Re: Custom Menus

Posted: Mon Oct 21, 2013 7:17 pm
by Bruz4023
so it accepted that code but it didnt do anything when I selected it? should there be a delay or something?

Re: Help with Custom Menus

Posted: Mon Oct 21, 2013 8:29 pm
by rimai
I just tested it and it is working just fine here.