Custom Menu Generator
Custom Menu Generator
Since RAGen is no longer in use, there is not an easy way to create a custom menu for your controller. I took the custom menu section from RAGen and converted it into a Java application.
It will generate the code and display it in a window to be pasted into your INO file. You have the option to save the menu to an XML file for easy sharing. You can also load the menu from an XML file.
Here are a couple screenshots to show you what it looks like: I have it released and ready for use. There is a Windows/Linux version which is just the JAR file that you can download and run. The Mac version is a DMG file. The DMG file just opens up and allows you to run the application or you can install it in your Applications by dragging it into your app folder.
Grab a copy and see what you think. Feedback is always welcome.
Java Version: http://curtbinder.info/apps/MenuGenerator-1.0.0.jar
Mac Version: http://curtbinder.info/apps/MenuGenerator-1.0.0.dmg
All apps: http://curtbinder.info/apps/
It will generate the code and display it in a window to be pasted into your INO file. You have the option to save the menu to an XML file for easy sharing. You can also load the menu from an XML file.
Here are a couple screenshots to show you what it looks like: I have it released and ready for use. There is a Windows/Linux version which is just the JAR file that you can download and run. The Mac version is a DMG file. The DMG file just opens up and allows you to run the application or you can install it in your Applications by dragging it into your app folder.
Grab a copy and see what you think. Feedback is always welcome.
Java Version: http://curtbinder.info/apps/MenuGenerator-1.0.0.jar
Mac Version: http://curtbinder.info/apps/MenuGenerator-1.0.0.dmg
All apps: http://curtbinder.info/apps/
Last edited by binder on Sun Feb 10, 2013 5:54 pm, edited 2 times in total.
Reason: Updated download links
Reason: Updated download links
- DrewPalmer04
- Posts: 818
- Joined: Tue May 29, 2012 2:12 pm
- Location: Christopher, IL
Re: Custom Menu Generator
Thanks
-
- Posts: 97
- Joined: Wed Jul 06, 2011 6:45 am
Re: Custom Menu Generator
Yet another reason this controller is #1.
Re: Custom Menu Generator
just a quick update...
i have the loading from xml file working. i have only tested it out on a windows 7 machine. i am going to test it on linux and mac later today (hopefully). if all goes well with it, i will be releasing version 1 in the next couple days.
i have the loading from xml file working. i have only tested it out on a windows 7 machine. i am going to test it on linux and mac later today (hopefully). if all goes well with it, i will be releasing version 1 in the next couple days.
Re: Custom Menu Generator
I edited the original post but forgot to comment to tell everybody that I released the Menu Generator.
In the original post, there are links to download it. One download for Linux & Windows and another for Mac. The Mac version is just a DMG with the application inside of it. There's not a fancy installer for it. The Linux & Windows version just needs to download the JAR file and run it.
Feedback is always welcome. Enjoy.
In the original post, there are links to download it. One download for Linux & Windows and another for Mac. The Mac version is just a DMG with the application inside of it. There's not a fancy installer for it. The Linux & Windows version just needs to download the JAR file and run it.
Feedback is always welcome. Enjoy.
Re: Custom Menu Generator
Are menus inside menus possible (i.e. a calibration menu for pH, salinity, and water level)?
Also, water level calibration is missing
Also, water level calibration is missing
Re: Custom Menu Generator
no, you cannot have nested menus.alexwbush wrote:Are menus inside menus possible (i.e. a calibration menu for pH, salinity, and water level)?
Also, water level calibration is missing
i haven't updated it and didn't realize that water level calibration was in the libraries. guess i had better update it.
Re: Custom Menu Generator
Is there any push for it in the future?binder wrote:no, you cannot have nested menus.alexwbush wrote:Are menus inside menus possible (i.e. a calibration menu for pH, salinity, and water level)?
Also, water level calibration is missing
i haven't updated it and didn't realize that water level calibration was in the libraries. guess i had better update it.
Re: Custom Menu Generator
Are nested menus doable at all? I'd love to be able to setup a Calibration menu for instance with pH, and Water Level and whatever else may go in there... or a "Lights" menu, so forth and so forth..binder wrote:[
no, you cannot have nested menus.
What's the current limit on number of menu items?
Thanks,
Lee
Re: Custom Menu Generator
Currently, there is a limit of 9 menu items (that fills up the screen). It can only be a flat menu (single list). This is the limitations with using a Custom Menu.
As you know, the default menu has nested menus. This works because the menus do not change and are embedded within the libraries itself. It is much easier this way to handle one level deep with the menu system embedded.
When I was initially creating the menu system, I wanted to do nested menus but as I tried various things to get it to work, the code base increased (bad when working with limited memory) and other errors were occurring that were big errors (system locking up, screen freezing, etc). I was trying to use pointers and dynamically create the menu on the fly. Since the controller has limited RAM, I was running out of RAM and pointers were getting overwritten and it was a disaster. There hasn't been a lot of requests to have a custom nested menu. Ideally, I would like to separate out the UI from the core libraries so you can have the basics in the libraries and then a separate UI to handle the displaying. This would have been important had some of the other custom displays been developed.
It sounds like I may need to revisit this topic and see if I can come up with another way to handle it.
As you know, the default menu has nested menus. This works because the menus do not change and are embedded within the libraries itself. It is much easier this way to handle one level deep with the menu system embedded.
When I was initially creating the menu system, I wanted to do nested menus but as I tried various things to get it to work, the code base increased (bad when working with limited memory) and other errors were occurring that were big errors (system locking up, screen freezing, etc). I was trying to use pointers and dynamically create the menu on the fly. Since the controller has limited RAM, I was running out of RAM and pointers were getting overwritten and it was a disaster. There hasn't been a lot of requests to have a custom nested menu. Ideally, I would like to separate out the UI from the core libraries so you can have the basics in the libraries and then a separate UI to handle the displaying. This would have been important had some of the other custom displays been developed.
It sounds like I may need to revisit this topic and see if I can come up with another way to handle it.
Re: Custom Menu Generator
The limit of 9 menu items. Does that include the ones already preloaded on my reef angel?
Reason Im asking is cause my LED unit is going to be 6 colours and need to be able to set each one at the max % that I want to get to achieve the colour Im looking for. eg White 100% Blue 100% UV 40% red 30% ect and then let the pwm slope do ramping up and down
Reason Im asking is cause my LED unit is going to be 6 colours and need to be able to set each one at the max % that I want to get to achieve the colour Im looking for. eg White 100% Blue 100% UV 40% red 30% ect and then let the pwm slope do ramping up and down
Re: Custom Menu Generator
Can you create a new post for this?Toolboy wrote:The limit of 9 menu items. Does that include the ones already preloaded on my reef angel?
Reason Im asking is cause my LED unit is going to be 6 colours and need to be able to set each one at the max % that I want to get to achieve the colour Im looking for. eg White 100% Blue 100% UV 40% red 30% ect and then let the pwm slope do ramping up and down
There may be easier solutions other than menu entries
Roberto.
Re: Custom Menu Generator
Hi Roberto
Ive done as you requested
http://forum.reefangel.com/viewtopic.php?f=8&t=2291
Please could you move binder answer to the new thread
Ive done as you requested
http://forum.reefangel.com/viewtopic.php?f=8&t=2291
Please could you move binder answer to the new thread
Re: Custom Menu Generator
How can I run jar file on vista thank you
when it comes to programming i "always need help "
Re: Custom Menu Generator
I created a custom menu last night and everything seems to be working, but the lights on/off aren't working.
I entered this in the setup function after ReefAngel.init():
And this is entered in the Global section.
I entered this in the setup function after ReefAngel.init():
Code: Select all
// Initialize the menu
ReefAngel.InitMenu(pgm_read_word(&(menu_items[0])),SIZE(menu_items));
And this is entered in the Global section.
Code: Select all
#include <avr/pgmspace.h>
prog_char menu0_label[] PROGMEM = "Feeding";
prog_char menu1_label[] PROGMEM = "Water Change";
prog_char menu2_label[] PROGMEM = "Accilmate";
prog_char menu3_label[] PROGMEM = "Lights On";
prog_char menu4_label[] PROGMEM = "Lights Off";
prog_char menu5_label[] PROGMEM = "Calibrate PH";
prog_char menu6_label[] PROGMEM = "Calibrate Water Level";
prog_char menu7_label[] PROGMEM = "Clear ATO ";
prog_char menu8_label[] PROGMEM = "Clear Overheat";
PROGMEM const char *menu_items[] = {
menu0_label, menu1_label, menu2_label, menu3_label, menu4_label, menu5_label, menu6_label, menu7_label, menu8_label };
void MenuEntry1()
{
ReefAngel.DisplayMenuEntry("Item 1");ReefAngel.FeedingModeStart();
}
void MenuEntry2()
{
ReefAngel.DisplayMenuEntry("Item 2");ReefAngel.WaterChangeModeStart();
}
void MenuEntry3()
{
ReefAngel.DisplayMenuEntry("Item 3");ReefAngel.Relay.Override(Port6, ~bitRead(ReefAngel.Relay.RelayMaskOff, Port6Bit)*2);
ReefAngel.DisplayedMenu = RETURN_MAIN_MODE;
}
void MenuEntry4()
{
ReefAngel.DisplayMenuEntry("Item 4");ReefAngel.Relay.RelayMaskOn = ReefAngel.LightsOnPorts;
#ifdef RelayExp
for ( byte i = 0; i < MAX_RELAY_EXPANSION_MODULES; i++ )
{
ReefAngel.Relay.RelayMaskOnE[i] = ReefAngel.LightsOnPortsE[i];
}
#endif // RelayExp
ReefAngel.Relay.Write();
}
void MenuEntry5()
{
ReefAngel.DisplayMenuEntry("Item 5");ReefAngel.Relay.RelayMaskOn = 0;
#ifdef RelayExp
for ( byte i = 0; i < MAX_RELAY_EXPANSION_MODULES; i++ )
{
ReefAngel.Relay.RelayMaskOnE[i] = 0;
}
#endif // RelayExp
ReefAngel.Relay.Write();
}
void MenuEntry6()
{
ReefAngel.DisplayMenuEntry("Item 6");ReefAngel.SetupCalibratePH();
ReefAngel.DisplayedMenu = ALT_SCREEN_MODE;
}
void MenuEntry7()
{
ReefAngel.DisplayMenuEntry("Item 7");{
ReefAngel.SetupCalibrateWaterLevel();
ReefAngel.DisplayedMenu = ALT_SCREEN_MODE;
}
}
void MenuEntry8()
{
ReefAngel.DisplayMenuEntry("Item 8");ReefAngel.ATOClear();
}
void MenuEntry9()
{
ReefAngel.DisplayMenuEntry("Item 9");ReefAngel.OverheatClear();
}
Re: Custom Menu Generator
you have to make sure you have the lights on ports set in your ino file in order for it to work properly.
Sent from my iPad mini
Sent from my iPad mini
Re: Custom Menu Generator
Yeah I do.
The are on Ports1 and Ports2 and work properly under the original menu and the Andriod App.
The are on Ports1 and Ports2 and work properly under the original menu and the Andriod App.
Code: Select all
// Ports toggled when Lights On / Off menu entry selected
ReefAngel.LightsOnPorts = Port1Bit | Port2Bit;
Re: Custom Menu Generator
Here you go.
Code: Select all
a#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 <ReefAngel.h>
////// Place global variable code below here
#include <avr/pgmspace.h>
prog_char menu0_label[] PROGMEM = "Feeding";
prog_char menu1_label[] PROGMEM = "Water Change";
prog_char menu2_label[] PROGMEM = "Accilmate";
prog_char menu3_label[] PROGMEM = "Lights On";
prog_char menu4_label[] PROGMEM = "Lights Off";
prog_char menu5_label[] PROGMEM = "Calibrate PH";
prog_char menu6_label[] PROGMEM = "Calibrate Water Level";
prog_char menu7_label[] PROGMEM = "Clear ATO ";
prog_char menu8_label[] PROGMEM = "Clear Overheat";
PROGMEM const char *menu_items[] = {
menu0_label, menu1_label, menu2_label, menu3_label, menu4_label, menu5_label, menu6_label, menu7_label, menu8_label };
void MenuEntry1()
{
ReefAngel.DisplayMenuEntry("Item 1");ReefAngel.FeedingModeStart();
}
void MenuEntry2()
{
ReefAngel.DisplayMenuEntry("Item 2");ReefAngel.WaterChangeModeStart();
}
void MenuEntry3()
{
ReefAngel.DisplayMenuEntry("Item 3");ReefAngel.Relay.Override(Port6, ~bitRead(ReefAngel.Relay.RelayMaskOff, Port6Bit)*2);
ReefAngel.DisplayedMenu = RETURN_MAIN_MODE;
}
void MenuEntry4()
{
ReefAngel.DisplayMenuEntry("Item 4");ReefAngel.Relay.RelayMaskOn = ReefAngel.LightsOnPorts;
#ifdef RelayExp
for ( byte i = 0; i < MAX_RELAY_EXPANSION_MODULES; i++ )
{
ReefAngel.Relay.RelayMaskOnE[i] = ReefAngel.LightsOnPortsE[i];
}
#endif // RelayExp
ReefAngel.Relay.Write();
}
void MenuEntry5()
{
ReefAngel.DisplayMenuEntry("Item 5");ReefAngel.Relay.RelayMaskOn = 0;
#ifdef RelayExp
for ( byte i = 0; i < MAX_RELAY_EXPANSION_MODULES; i++ )
{
ReefAngel.Relay.RelayMaskOnE[i] = 0;
}
#endif // RelayExp
ReefAngel.Relay.Write();
}
void MenuEntry6()
{
ReefAngel.DisplayMenuEntry("Item 6");ReefAngel.SetupCalibratePH();
ReefAngel.DisplayedMenu = ALT_SCREEN_MODE;
}
void MenuEntry7()
{
ReefAngel.DisplayMenuEntry("Item 7");{
ReefAngel.SetupCalibrateWaterLevel();
ReefAngel.DisplayedMenu = ALT_SCREEN_MODE;
}
}
void MenuEntry8()
{
ReefAngel.DisplayMenuEntry("Item 8");ReefAngel.ATOClear();
}
void MenuEntry9()
{
ReefAngel.DisplayMenuEntry("Item 9");ReefAngel.OverheatClear();
}
unsigned long ATOUpdate=0;
////// Place global variable code above here
void setup()
{
// This must be the first line
ReefAngel.Init(); //Initialize controller
// Initialize the menu
ReefAngel.InitMenu(pgm_read_word(&(menu_items[0])),SIZE(menu_items));
// Ports toggled in Feeding Mode
ReefAngel.FeedingModePorts = 0;
// Ports toggled in Water Change Mode
ReefAngel.WaterChangePorts = Port4Bit | Port6Bit;
// Ports toggled when Lights On / Off menu entry selected
ReefAngel.LightsOnPorts = Port1Bit | Port2Bit;
// Ports turned off when Overheat temperature exceeded
ReefAngel.OverheatShutoffPorts = Port1Bit | Port2Bit;
// Use T2 probe as temperature and overheat functions
ReefAngel.TempProbe = T2_PROBE;
ReefAngel.OverheatProbe = T2_PROBE;
// Set the Overheat temperature setting
InternalMemory.OverheatTemp_write( 825 );
// Ports that are always on
ReefAngel.Relay.On( Port4 );
////// Place additional initialization code below here
////// Place additional initialization code above here
}
void loop()
{
ReefAngel.StandardLights( Port1,12,0,22,0 );
ReefAngel.StandardLights( Port2,13,0,21,0 );
ReefAngel.Relay.Set( Port3, !ReefAngel.Relay.Status( Port1 ) );
ReefAngel.StandardLights( Port7,13,0,21,0 );
ReefAngel.Relay.Set(Port5,(now()-3600)%21600<1200); // Runs for 1200s every 21600 seconds
ReefAngel.Relay.Set(Port8,((now()-3600)-1200)%21600<1200); // Runs for 1200s every 21600 seconds with 1200s offset
ReefAngel.WaterLevelATO(Port6,720,30,30); // Enable ATO the ATO
if (ReefAngel.Relay.Status(Port5)) // Check to see if port 5 is on and update time is empty
{
ATOUpdate = now(); // If so, set the update time to now
}
if (now() - ATOUpdate < 120) // If it hasnt been 120 seconds turn off the port
{
ReefAngel.WaterLevelATO(Port6,720,0,1);
}
ReefAngel.PWM.SetActinic(MyCustomWave(50));
if( ReefAngel.DisplayedMenu==FEEDING_MODE ) ReefAngel.PWM.SetActinic(0);
if( ReefAngel.DisplayedMenu==WATERCHANGE_MODE ) ReefAngel.PWM.SetActinic(0);
if (hour()<12 || hour()>=22) ReefAngel.PWM.SetActinic(30);
////// Place your custom code below here
////// Place your custom code above here
// This should always be the last line
ReefAngel.Portal( "Sacohen","Seth0310" );
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();
// Water Level
ReefAngel.LCD.DrawText( COLOR_DARKGOLDENROD,DefaultBGColor,75,66, "WL:" );
ReefAngel.LCD.DrawText( COLOR_DARKGOLDENROD,DefaultBGColor,99,66, ReefAngel.WaterLevel.GetLevel() );
pingSerial();
// Main Relay Box
byte TempRelay = ReefAngel.Relay.RelayData;
TempRelay &= ReefAngel.Relay.RelayMaskOff;
TempRelay |= ReefAngel.Relay.RelayMaskOn;
ReefAngel.LCD.DrawOutletBox( 12, 92, TempRelay );
pingSerial();
// Date and Time
ReefAngel.LCD.DrawDate( 6, 122 );
pingSerial();
}
void DrawCustomGraph()
{
}
byte MyCustomWave(byte maxspeed)
{
static byte randomspeed=0;
if (now()%11<5)
{
return randomspeed;
}
else if (now()%11>=5 && now()%11<10)
{
return maxspeed;
}
else
{
randomspeed=random(35,maxspeed);
return 0;
}
}
Re: Custom Menu Generator
Try this:
Code: Select all
void MenuEntry4()
{
ReefAngel.LightsOn();
}
void MenuEntry5()
{
ReefAngel.LightsOff();
}
Roberto.
Re: Custom Menu Generator
Tried that Roberto and same thing. Nothing happened.
Re: Custom Menu Generator
It's showing your ports are on. Nothing is going to happen when ports are on. LightsOn() would override on and LightsOff() just cancels the override. It doesn't actually override it off.
So, if your lights are already on, overriding it on would do nothing.
So, if your lights are already on, overriding it on would do nothing.
Roberto.
Re: Custom Menu Generator
Ok. Sorry. I thought it would over ride then to turn off if they were on too.
They are working properly.
The other code I had probably worked too.
They are working properly.
The other code I had probably worked too.