Page 1 of 1
Custom Menu Generator
Posted: Wed Sep 05, 2012 6:53 pm
by binder
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:
- Main Screen
- MenuGeneratorMain.png (24.7 KiB) Viewed 17664 times
- Output Screen
- MenuGeneratorOutput.png (27.98 KiB) Viewed 17664 times
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/
Custom Menu Generator
Posted: Wed Sep 05, 2012 7:03 pm
by lnevo
Awesome!!!
Re: Custom Menu Generator
Posted: Wed Sep 05, 2012 7:16 pm
by DrewPalmer04
Thanks
Re: Custom Menu Generator
Posted: Wed Sep 05, 2012 7:18 pm
by rimai
Cool!!
Re: Custom Menu Generator
Posted: Thu Sep 06, 2012 4:21 am
by agentgreen
Yet another reason this controller is #1.
Re: Custom Menu Generator
Posted: Mon Sep 10, 2012 6:57 am
by binder
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.
Re: Custom Menu Generator
Posted: Thu Sep 13, 2012 7:03 pm
by binder
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.
Re: Custom Menu Generator
Posted: Sun Nov 18, 2012 11:37 pm
by alexwbush
Are menus inside menus possible (i.e. a calibration menu for pH, salinity, and water level)?
Also, water level calibration is missing
Re: Custom Menu Generator
Posted: Tue Nov 20, 2012 4:37 pm
by binder
alexwbush wrote:Are menus inside menus possible (i.e. a calibration menu for pH, salinity, and water level)?
Also, water level calibration is missing
no, you cannot have nested menus.
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
Posted: Fri Nov 30, 2012 5:06 pm
by alexwbush
binder wrote:alexwbush wrote:Are menus inside menus possible (i.e. a calibration menu for pH, salinity, and water level)?
Also, water level calibration is missing
no, you cannot have nested menus.
i haven't updated it and didn't realize that water level calibration was in the libraries. guess i had better update it.
Is there any push for it in the future?
Re: Custom Menu Generator
Posted: Sat Dec 01, 2012 9:13 am
by lnevo
binder wrote:[
no, you cannot have nested menus.
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..
What's the current limit on number of menu items?
Thanks,
Lee
Re: Custom Menu Generator
Posted: Sat Dec 01, 2012 10:03 am
by binder
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.
Re: Custom Menu Generator
Posted: Tue Dec 18, 2012 11:33 pm
by Toolboy
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
Re: Custom Menu Generator
Posted: Wed Dec 19, 2012 10:10 am
by rimai
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
Can you create a new post for this?
There may be easier solutions other than menu entries
Re: Custom Menu Generator
Posted: Thu Dec 20, 2012 12:56 am
by Toolboy
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
Re: Custom Menu Generator
Posted: Mon Mar 11, 2013 11:42 pm
by Redadeath
How can I run jar file on vista thank you
Re: Custom Menu Generator
Posted: Tue Mar 12, 2013 10:23 am
by rimai
You need java
Re: Custom Menu Generator
Posted: Fri Jun 14, 2013 9:03 am
by Sacohen
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():
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
Posted: Fri Jun 14, 2013 12:26 pm
by binder
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
Re: Custom Menu Generator
Posted: Fri Jun 14, 2013 12:45 pm
by Sacohen
Yeah I do.
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
Posted: Fri Jun 14, 2013 1:23 pm
by lnevo
Can you post the full code?
Re: Custom Menu Generator
Posted: Fri Jun 14, 2013 1:37 pm
by Sacohen
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
Posted: Fri Jun 14, 2013 1:41 pm
by rimai
Try this:
Code: Select all
void MenuEntry4()
{
ReefAngel.LightsOn();
}
void MenuEntry5()
{
ReefAngel.LightsOff();
}
Re: Custom Menu Generator
Posted: Fri Jun 14, 2013 4:21 pm
by Sacohen
Tried that Roberto and same thing. Nothing happened.
Re: Custom Menu Generator
Posted: Fri Jun 14, 2013 4:26 pm
by rimai
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.
Re: Custom Menu Generator
Posted: Fri Jun 14, 2013 5:42 pm
by Sacohen
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.