Custom Menu

Related to the development libraries, released by Curt Binder
Post Reply

Would you like the ability to create a custom menu on the controller?

Yes, I would like to create my own menu
54
87%
Maybe, if it will give me more memory I would
3
5%
No, I like the default menu
0
No votes
Don't care, I don't really use the menu
3
5%
There's a menu on the controller?
2
3%
 
Total votes: 62

binder
Posts: 2871
Joined: Fri Mar 18, 2011 6:20 pm
Location: Illinois
Contact:

Custom Menu

Post by binder »

Since memory on the controller has always been an issue, I'm working on simplifying things and hopefully trimming some stuff down. The menu system I created for setting the values on the controller is great. It makes things much easier to use. The downside is that the code involved to display it does require some memory usage (how much I do not exactly know). I know that the code to display the Date / Time setup screen can take up almost 2000 bytes (of a maximum about 30720).

From my dev versions 0.8.5.13 and later, the ability to update the "internal memory" values on the controller through the wifi interface (usb or wifi) has existed. This interface will allow the values to be read and written over the wifi interface by a custom client. Meaning people can create an interface, application or web app, that can communicate with the controller to update the values remotely. I know Dave's Client Suite is going to have this ability built in to it.

Having this ability can lessen the need to have a complex menu on the controller itself. One would still like to have some simple functionality from the controller but could do without having the ability to change the "internal memory" values from an interface on the controller.

I know a few people have asked about how to create their own custom menu. They liked the default but wanted to put their own little twist on it and add in their own menu items. This is great and the whole purpose behind the controller....giving you the ability to customize it to fit your needs.

I'm in the process of creating a simple, stripped down menu for people that want just the basics on the controller and plan on using the Client Suite or the SetInternalMemory PDE to update their internal memory values.

I just wanted to get some feedback from people on this topic.

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

Re: Custom Menu

Post by rimai »

I think it would be awesome.
When Dave has some time available, maybe he could even implement that on his iPhone app too :)
Roberto.
astralmind
Posts: 99
Joined: Fri Apr 01, 2011 10:53 am

Re: Custom Menu

Post by astralmind »

Absolutely awesome ! Once the feature gets included in RA Client that would be perfect, no need to use the head unit for setting values.

iPhone app is nice but comon guys, in an open source world who doesn't like the little green man ? ;) I wish I could code an android app by myself..
alexwbush
Posts: 327
Joined: Tue Mar 22, 2011 12:45 am
Location: San Diego, CA

Re: Custom Menu

Post by alexwbush »

astralmind wrote:Absolutely awesome ! Once the feature gets included in RA Client that would be perfect, no need to use the head unit for setting values.

iPhone app is nice but comon guys, in an open source world who doesn't like the little green man ? ;) I wish I could code an android app by myself..
I concur. When I think of apple, I don't think open source.
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: Custom Menu

Post by rimai »

I also agree, but we don't have anyone that knows how to get an adroid app together just yet.
It'll come soon enough.
Roberto.
binder
Posts: 2871
Joined: Fri Mar 18, 2011 6:20 pm
Location: Illinois
Contact:

Re: Custom Menu

Post by binder »

I got the simple menu working today. It still needs to be tested more with all the features but I'm pretty sure it's gonna work just fine. I have pushed my changes to my github account. Please make sure you read the ReefAngel_Features.h file and the comments at the bottom of the file on how to use the feature. It also explains what features will work with the simple menu and what will be ignored.

Here's what the menu looks like:
Simple Menu
Simple Menu
simple_menu.JPG (55.52 KiB) Viewed 27852 times
I'm still working on the ability to have a custom menu.

Lastly, the important part that everybody will love to hear. Using this menu will actually save you about 4566 bytes. Yes, that's about 4,500 bytes of extra memory available for other stuff. That's the value that I got from using my RAMenus PDE file with the default features enabled and the default functions. The only thing I did different was enable SIMPLE_MENU and I noticed the 4566 bytes difference.

Anyways, feel free to grab the latest and test it out if you like.

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

Re: Custom Menu

Post by rimai »

Awesome!!!
Roberto.
alexwbush
Posts: 327
Joined: Tue Mar 22, 2011 12:45 am
Location: San Diego, CA

Re: Custom Menu

Post by alexwbush »

first bootloader and now this?!? AWESOME! Should have plenty of memory for now!

I just switched to the "simple" menu and its great! Perfect timing as I just ran out of memory playing with the custom headunit screen and couldn't run the client. But it all works great now. Thanks!
binder
Posts: 2871
Joined: Fri Mar 18, 2011 6:20 pm
Location: Illinois
Contact:

Re: Custom Menu

Post by binder »

Glad you guys like it. It should work out nicely for people too. Or let me rephrase it, it should work out nicely for those who want lots of customization's on their controller. :geek:

curt
lukeluke
Posts: 88
Joined: Mon Apr 04, 2011 4:12 am
Location: Rome, Italy

Re: Custom Menu

Post by lukeluke »

beautiful... but i don't need of feeding, but i need the single dose and the PWM... :-D
mbertalha
Posts: 30
Joined: Tue Jul 12, 2011 1:35 pm
Location: São Paulo - Brazil

Re: Custom Menu

Post by mbertalha »

When the tutorial is ready?

tanks

Marcelo
binder
Posts: 2871
Joined: Fri Mar 18, 2011 6:20 pm
Location: Illinois
Contact:

Re: Custom Menu

Post by binder »

mbertalha wrote:When the tutorial is ready?

tanks

Marcelo
There is no tutorial for creating a custom menu. The ability to create a custom menu does not exist yet. The only thing that you can do is utilize the simple menu.

curt
binder
Posts: 2871
Joined: Fri Mar 18, 2011 6:20 pm
Location: Illinois
Contact:

Re: Custom Menu

Post by binder »

Well, I must say that I have a preliminary working (yes, I did say working) version of the custom menu. It can be defined and all contained within the PDE file. You can create your own menu entries and have it perform all the tasks that you want. This will open up all sorts of possibilities and possibly some confusion as well with the menu events but that's just how it goes when you want lots of customizing opportunities.

Some stuff will have to be repeated unless I create custom functions for them (like displaying a setup menu and stuff like that). I haven't created those functions because they increase code size. However, at the expense of increasing the code size a little for simplicity of the menus I think it would be manageable.

In this working example I have so far, you cannot display any of the setup screens. I'm thinking that some people would want to have access to some specific setup screens, like maybe an ATO or Lights or something. Although this is not necessary now that we have the memory page on the Client Suite and also my Status application.

Another limitation is that you an only have 1 menu screen with a max of 9 entries. This should be more than adequate for everybody.

Anyways, here's a sample screenshot that I created of all 9 entries in use. I still have more testing to make sure things work as expected. If anybody would like to help me test out, keep an eye on my github account for the "custom_menu" branch.
custom menu
custom menu
P9060957.JPG (46.4 KiB) Viewed 24608 times
Feedback (comments and suggestions) are always welcomed.

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

Re: Custom Menu

Post by rimai »

Cool
Roberto.
User avatar
Xender
Posts: 105
Joined: Sun Mar 20, 2011 12:38 am
Location: France

Re: Custom Menu

Post by Xender »

Cool Thanks curt !
I will test it I guess for all stuff I need in my fresh Water ;-)
Fresh Water Aquarium 180*60*80
Salt Water Aquarium 60*60*60
Click Here to see the Video of my Fresh Water Aquarium
Image
binder
Posts: 2871
Joined: Fri Mar 18, 2011 6:20 pm
Location: Illinois
Contact:

Re: Custom Menu

Post by binder »

Xender wrote:Cool Thanks curt !
I will test it I guess for all stuff I need in my fresh Water ;-)
There is most likely some finishing touches that I need to add with it though. It will most likely require a guide on how to use it with examples, otherwise people would get confused. I'll be working on this through the week and into the weekend. We shall see what all I come up with.

curt
mbertalha
Posts: 30
Joined: Tue Jul 12, 2011 1:35 pm
Location: São Paulo - Brazil

Re: Custom Menu

Post by mbertalha »

Very cool, Curt.
Thanks for your contribution...

Marcelo
wolfador
Posts: 241
Joined: Sun Sep 04, 2011 9:59 am
Location: Pittsburgh, PA

Re: Custom Menu

Post by wolfador »

I modified the simple menu to remove the ATO and add in an option to turn on my moon lights since I don't run them all the time. If I wake up early before the mains come on sometimes I would like to turn on the moon.

So far I can get them to turn on but can't figure out how to get them to turn back off. I either get everything to turn off/on.
John
ReefAngel and ReefAngel-HD developer
If the RA iOS app has helped please consider a donation
Image
binder
Posts: 2871
Joined: Fri Mar 18, 2011 6:20 pm
Location: Illinois
Contact:

Re: Custom Menu

Post by binder »

wolfador wrote:I modified the simple menu to remove the ATO and add in an option to turn on my moon lights since I don't run them all the time. If I wake up early before the mains come on sometimes I would like to turn on the moon.

So far I can get them to turn on but can't figure out how to get them to turn back off. I either get everything to turn off/on.
What code are you using to turn them on?

curt
wolfador
Posts: 241
Joined: Sun Sep 04, 2011 9:59 am
Location: Pittsburgh, PA

Re: Custom Menu

Post by wolfador »

binder wrote: What code are you using to turn them on?

curt

Code: Select all

void ReefAngelClass::MoonLightStart()
{
	// turn off ports
	
#ifdef SaveRelayState
	// TODO Test SaveRelayState
	byte CurrentRelayState = Relay.RelayData;
#endif  // SaveRelayState
	Relay.RelayMaskOn = MoonLightPorts;
	Relay.Write();
	LCD.DrawText(ModeScreenColor, DefaultBGColor, 30, 10, "Moon Mode");
}

In the .PDE file I have

Code: Select all

ReefAngel.MoonLightPorts = B10000000;
For the button press to turn off

Code: Select all

				case MOONLIGHT_MODE:
			{
				LastStart = now();  // Set the time normal mode is started
				if ( Joystick.IsButtonPressed() )
				{
					// we're finished, so let's clear the screen and return
					ClearScreen(DefaultBGColor);
					Timer[LCD_TIMER].Start();  // start LCD shutoff timer

#ifdef SaveRelayState
					Relay.RelayData = CurrentRelayState;
#endif  // SaveRelayState

					// turn on ports
					Relay.RelayMaskOn = ~MoonLightPorts;

					// Compare the delayed on ports with the previous port states
					Relay.RelayData &= ~(MoonLightPorts & DelayedOnPorts);
					Relay.Write();

					// Draw main screen
					SelectedMenuItem = DEFAULT_MENU_ITEM;
					DisplayedMenu = DEFAULT_MENU;

Currently that switches the moon lights off and the all other ports on.
John
ReefAngel and ReefAngel-HD developer
If the RA iOS app has helped please consider a donation
Image
binder
Posts: 2871
Joined: Fri Mar 18, 2011 6:20 pm
Location: Illinois
Contact:

Re: Custom Menu

Post by binder »

ill have a closer look at things when i get my setup up and running later this weekend. It most likely is something simple.

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

Re: Custom Menu

Post by rimai »

I think you really should avoid creating functions inside the library, but I do understand that this particular piece of the library is still not finalized.
The reason being is that whenever Curt releases updates, your code will be overwritten and you will have to keep updating your own set of libraries everytime, but I'm pretty sure you know how to merge them.
Anyway, on your code, I think you should release the RelayMaskOn to its running state, which is 0 and not invert it.
When you invert the mask, you are making the mask becode B01111111, which means turn all relays on except number 8.
So, that line should be

Code: Select all

Relay.RelayMaskOn =0;
Or, if you want to just return the relay 8 to its original state:

Code: Select all

Relay.RelayMaskOn &= ~MoonLightPorts;
Let me know if this works out.
Roberto.
wolfador
Posts: 241
Joined: Sun Sep 04, 2011 9:59 am
Location: Pittsburgh, PA

Re: Custom Menu

Post by wolfador »

rimai wrote:
Or, if you want to just return the relay 8 to its original state:

Code: Select all

Relay.RelayMaskOn &= ~MoonLightPorts;
Let me know if this works out.
Used this and it works great. Thanks!
John
ReefAngel and ReefAngel-HD developer
If the RA iOS app has helped please consider a donation
Image
Post Reply