Custom Menu Generator

Community contributed apps
User avatar
Posts: 5347
Joined: Fri Jul 20, 2012 9:42 am
PostPosted: Sat Dec 01, 2012 9:13 am
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
User avatar
Posts: 2737
Joined: Fri Mar 18, 2011 6:20 pm
Location: Illinois
PostPosted: Sat Dec 01, 2012 10:03 am
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.

Posts: 31
Joined: Wed Apr 25, 2012 9:26 am
PostPosted: Tue Dec 18, 2012 11:33 pm
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

Posts: 12224
Joined: Fri Mar 18, 2011 6:47 pm
PostPosted: Wed Dec 19, 2012 10:10 am
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
Roberto.

Posts: 31
Joined: Wed Apr 25, 2012 9:26 am
PostPosted: Thu Dec 20, 2012 12:56 am
Hi Roberto

Ive done as you requested

viewtopic.php?f=8&t=2291

Please could you move binder answer to the new thread

Posts: 54
Joined: Sun Mar 03, 2013 7:50 pm
PostPosted: Mon Mar 11, 2013 11:42 pm
How can I run jar file on vista thank you
when it comes to programming i "always need help "

Posts: 12224
Joined: Fri Mar 18, 2011 6:47 pm
PostPosted: Tue Mar 12, 2013 10:23 am
You need java
Roberto.
User avatar
Posts: 1833
Joined: Sun Apr 21, 2013 6:25 am
Location: Davie, FL
PostPosted: Fri Jun 14, 2013 9:03 am
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();

}
User avatar
Posts: 2737
Joined: Fri Mar 18, 2011 6:20 pm
Location: Illinois
PostPosted: Fri Jun 14, 2013 12:26 pm
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
User avatar
Posts: 1833
Joined: Sun Apr 21, 2013 6:25 am
Location: Davie, FL
PostPosted: Fri Jun 14, 2013 12:45 pm
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;
PreviousNext

Return to Apps

Who is online

Users browsing this forum: No registered users and 1 guest

cron