Pages: 1 ... 5 6 [7] 8 9 ... 14   Go Down
Author Topic: Menu for Display  (Read 13243 times)
0 Members and 1 Guest are viewing this topic.
Germany
Offline Offline
Edison Member
*
Karma: 133
Posts: 1444
If you believe something is right, you won't see what's wrong (David Straker).
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

great  smiley
Oliver
Logged

Offline Offline
Sr. Member
****
Karma: 2
Posts: 428
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Ciao Oliver :-)

so how are you :-) so I've tried your suggest and it's working :-) thanks ...

so now I would ask to you ... in my program I've stored my devices status and if are active timer ...

My devices numeration start from 0 until 31 ... do you know a simply way for display this stored value into into the menu ? below reported an example:

N° dev: 0 State: Active Timer: Inactive ... mainly I need to find a easy way to have all under control ... the best should be in a unique windows but I know that with a display 20,4 lcd is not easy ...

however thanks for the support,
have nice day,
Andrea

Logged

Germany
Offline Offline
Edison Member
*
Karma: 133
Posts: 1444
If you believe something is right, you won't see what's wrong (David Straker).
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi Andrea

Glad to read that you still work with m2tklib on your menu. Hope that all required functionality is included.

Quote
My devices numeration start from 0 until 31 ... do you know a simply way for display this stored value into into the menu ?

The following examples assume, that the device is in a global variable "device"
uint8_t device;

Method 1:
Use M2_U8NUM(xyz, "r1", &device) with a read only flag if you only want to display the value.

Method 2:
char linebuf[30];
...
sprintf(linebuf, "blabla dev:%d more blabla", device);
Use M2_LABEL(xyz, NULL, linebuf)
The full line is rendered into a buffer of sufficient size. Disadvantage: "linebuf" needs to be updated when device is changed.

Method 3:
Use M2_LABELFN() similar to Method 2, but the callback procedure returns the string. See Wiki... Removes the disadvantage from above.

Method 4:
You can always do a LiquidCrystal.print directly on the screen. This is not a problem as long as your output does not overlap the menues. Usually you want this output only if a selected root element is active (similar to the problem with the initial splash screen)

Oliver



Logged

Offline Offline
Sr. Member
****
Karma: 2
Posts: 428
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks Oliver however great :-) !

so from my point of view i think that the best could be "Method 2" or "Method 3" if not understood bad the difference is that with the "Method 3" is possible run a procedure ?

with this method for example could i do a cycle for change the "linebuf" ? I will be update automatically on display ? or each time will be necessary press button for update it ?

another thing that I would like to ask you is that ... on my menu now for example when I entry into the menu for "turn on" or "turn off" off the devices I see a strange value example:

Actually Menu:
----------------------
Dev: 85 State: 255
back ok zero
-----------------------

How should be:
-----------------------
Dev: 00 State: 0
back ok zero
-----------------------

when I press select button the value come back to 0 like should be and also the state after press select button come back to 0 like should be ...

for sure the variable are initialized to 0 before entry into the menu

Thanks 1000
Andrea



 
Logged

Germany
Offline Offline
Edison Member
*
Karma: 133
Posts: 1444
If you believe something is right, you won't see what's wrong (David Straker).
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
with this method for example could i do a cycle for change the "linebuf" ? I will be update automatically on display ? or each time will be necessary press button for update it ?

The content of linebuf will be displayed whenever you execute m2.draw(). Anything else is under your control. This means: If you update linebuf you should call m2.draw() to make your changes visiable.

Quote
Actually Menu:
----------------------
Dev: 85 State: 255
back ok zero
-----------------------
M2tklib will display the value of the "connected" variable. Nothing else. Are you sure that there is no programming error, assigning 85 to the device value?

Oliver
Logged

Offline Offline
Sr. Member
****
Karma: 2
Posts: 428
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks for the information,
I've intercept the issues ... I've change the type of variable from uint8_t to byte ...
the logical part was ok, but probably there was a "memory overlapping" between variable ... is possible ?


Thanks I'll let you know about the next steps :-)

ps it's pleasure working with your library :-)

thanks
gnux
« Last Edit: February 15, 2013, 11:32:04 am by gnusso » Logged

Offline Offline
Sr. Member
****
Karma: 2
Posts: 428
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Ciao Oliver,
during the weekend, I've thought how to use ... so I'll try to use a mixed mode to put &null element to display for disable the menu and then enable the menu again ...

So, Id like to do is also ... so now i didn't have the exit button ... and for didn't wasting memory I was thing to this:

I want that when I'm inside my menu when I click on something the menu will go on the welcome screen ...
for do that I've thing to put a "Exit" voices into the menu is possible ? Is possible also do something without didn't a sub menu ? so for example to the voice exit when I click the select but will go directly to welcome screen ...

Thanks for the information :-)

warm regards,
gnux




Logged

Germany
Offline Offline
Edison Member
*
Karma: 133
Posts: 1444
If you believe something is right, you won't see what's wrong (David Straker).
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi

This should work with the "HOME" button. This means, do not use the Exit button, but instead the HOME button (M2_KEY_HOME). Assign the "home" menu with setHome(). This also could be the &null element.

Oliver
Logged

Offline Offline
Sr. Member
****
Karma: 2
Posts: 428
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Good Morning Oliver,
And for do that I need physically another button correct ? :-) so it's very complete your menu ! Many Congratulations ... !!! :-) So I promise to you that when I'll finish the project I'll send to you a gift :-) please send to me in private if you want without you I was completely lost ...

So the final things that I want do for the moment is that ... in attachment you can see a a combo menu ... I've take this simple example from a library ... one time that i will press ok I will store the value devices and the "Is" name (only the index) inside my array ... for example like this:

array[0][13] = idx;
array[0][0] = &u8num;

Then I would like retrieve this value inside another menù:
I would like that for example when I'm inside the menu device when I click on "Dev: 01" Will appear kitchen ...
In this way I can say what Im managing ...

Could be possible for you ? make sense ? :-)

Thanks again :-)
gnux


* Schermata 2013-02-20 a 07.19.48.png (5.09 KB, 144x60 - viewed 34 times.)
Logged

Offline Offline
Sr. Member
****
Karma: 2
Posts: 428
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I think can I use
M2_LABELFN();
:-)

looking the tutorial seems fine :-)
correct ?

regards,
gnux
Logged

Germany
Offline Offline
Edison Member
*
Karma: 133
Posts: 1444
If you believe something is right, you won't see what's wrong (David Straker).
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi

You do not need another button. Replace the one for the Exit with the Home Button: Exchange EXIT with HOME...

And yes, M2_LABELFN will do the job.
A one or two pictures of your device would be the best reward that i can imagine.

Oliver
Logged

Offline Offline
Sr. Member
****
Karma: 2
Posts: 428
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

hi Oliver,
i will add another button like home button because at the moment im using only next and select pin :-)

so now after a few times that i use the tutorial it's more clear it a very good library :-)

for is there a way for calculate how many variable can i use and in which part of memory are stored ? for example u8int ?
thanks 100000 :-)
Logged

Germany
Offline Offline
Edison Member
*
Karma: 133
Posts: 1444
If you believe something is right, you won't see what's wrong (David Straker).
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi

You can calculate the amount of initially occupied RAM and ROM memory.
Use "avr-size" for this task. You need to locate and find the .elf file on your file system.

Also, have a look here: http://www.nongnu.org/avr-libc/user-manual/malloc.html
Variables are usually stored in .data or .bss area. This depends on there init value.

Oliver
Logged

Offline Offline
Sr. Member
****
Karma: 2
Posts: 428
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Great Thanks you !

So, I did you this questions because this morning i was doing the final menu and one time that I've the third menu the has stop to work ... I've tried both in serial and on lcd ... removing this menu everything was working ok ... and my sketch is only 25000 I've avaiable again 8000 byte if i not wrong ... also taking another menu from an example is the same ...



do you have any suggest for fix it ?

thanks
gnux
Logged

Offline Offline
Sr. Member
****
Karma: 2
Posts: 428
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

for sure the code seems correct ... I didn't see any big changes between the other only I've used 2 Label function ... so in 4 hour that im working on that I've tried a lot's of thing change variable type from u8int to char ... but nothing to do ... Now I go for launch because Im completely fuse ...
thanks for help me,
gnux
« Last Edit: February 21, 2013, 06:14:08 am by gnusso » Logged

Pages: 1 ... 5 6 [7] 8 9 ... 14   Go Up
Jump to: