rome
Offline
Sr. Member
Karma: 13
Posts: 348
|
 |
« Reply #210 on: December 10, 2012, 11:45:31 am » |
something like the following (not tested nor compiled, just for example): long startdarkness=0, lastread=0; void setup(){ }
void loop(){
if ((millis()-lastread)>10000)){ // first read after 10 secs since start if (checkligth() { // ligth outside startdarkness=0; lastread=millis(); // store last check time } else{ //dark outside if(stardarkness==0) // no darkness in previous check startdarkness=millis(); } } if( (millis()-startdarknes)< LAPTIME){ //... DO YOUR STUFF.... } menu.draw(); }
byte checkligth(){
// this function must return 0 if dark, 1 otherwise
}
by the way what is readbuttons()?
|
|
|
|
|
Logged
|
|
|
|
|
rome
Offline
Sr. Member
Karma: 13
Posts: 348
|
 |
« Reply #211 on: December 11, 2012, 04:05:14 pm » |
Hi guys! I need test volunteers for the 1.1.0 version here attached before github publishing. This version introduces the following improvements: - smaller footprint. About 1.6 Kb less of progmem (and few tens of bytes of heap). As the library does not use anymore sprintf function, in order to save the above mentioned memory amount, the user code need to avoid sprintf as well
- implementation of the "collapsed menu" rendering. This behaviour is available only in the 6 buttons mode (as I could not find an interaction model for the 4 buttons mode...)
Please test at first with existing code, in order to be sure i did'nt introduce regressive errors. After test the new behaviour Thanks!
|
|
|
|
« Last Edit: December 11, 2012, 04:41:50 pm by brunialti »
|
Logged
|
|
|
|
|
Pakistan
Offline
Sr. Member
Karma: 5
Posts: 318
Arduino rocks
|
 |
« Reply #212 on: December 12, 2012, 08:34:30 am » |
something like the following (not tested nor compiled, just for example):
by the way what is readbuttons()?
That is some brilliant piece of code i was looking for:) Thank you very much... The readbuttons() is a custom function for reading a state of button using analogpin of arduino and it is working very well here:) I will test today the collapse menu new features of MENWIZ and let you tell the results. Thank you again. Regards
|
|
|
|
|
Logged
|
|
|
|
|
Pakistan
Offline
Sr. Member
Karma: 5
Posts: 318
Arduino rocks
|
 |
« Reply #213 on: December 12, 2012, 11:18:47 am » |
I am getting following error when i loaded the example with just adding the custom button function. My sketch is also attached.
|
|
|
|
|
Logged
|
|
|
|
|
rome
Offline
Sr. Member
Karma: 13
Posts: 348
|
 |
« Reply #214 on: December 12, 2012, 03:48:16 pm » |
addUsrNav has now two parameters. The first one is the callback function expected to give back the button code, the other one is the number of buttons emulated by the call back function declared as first parameter (allowed values: 6 or 4). You do not need anymore to set the *internal* variable MW_navbtn (you can delete following code line in the sketch!) in your case the correct call is:
menu.addUsrNav(navMenu,6);
I need to explicitly describe the syntax in the manual....
|
|
|
|
« Last Edit: December 12, 2012, 03:50:19 pm by brunialti »
|
Logged
|
|
|
|
|
Pakistan
Offline
Sr. Member
Karma: 5
Posts: 318
Arduino rocks
|
 |
« Reply #215 on: December 13, 2012, 03:24:21 am » |
Okay, Now its running fine and i can enter into submenu "MEASURE SUBMENU" as i am using only 4 buttons (CONFIRM, ESCAPE, UP and DOWN) so i am unable to change the Variable parameters. I think the LEFT and RIGHT buttons are intended to do the same. As i have the six button but two buttons are not implemented so unable but soon i will update the code of all six buttons and will let you tell. The menu by the way is working very good and i really like the collapsing feature. It will save a lot of space on the screen and organizing the program. Keep in mind i am using custom function for controlling the six keys keypad that is driven by one Analogue pin of Arduino. Brilliant:) Whats coming up next:) Now how to store an integer value in EEPROM? you have given loadvar and savevar functions but can you define how we put the integer value (2 bytes) in EEPROM address say 0 and 1. void savevar(){ menu.writeEeprom(); } void loadvar(){ menu.readEeprom(); } Regards
|
|
|
|
|
Logged
|
|
|
|
|
rome
Offline
Sr. Member
Karma: 13
Posts: 348
|
 |
« Reply #216 on: December 13, 2012, 03:32:43 am » |
The EEPROM save/load functions apply only to the MENWIZ variables. The save function stores the variable in FIFO mode (first to be declared, first to be saved). So in theory the first defined variable *should* be stored in the first 2 bytes of EEPROM space.
|
|
|
|
|
Logged
|
|
|
|
|
Pakistan
Offline
Sr. Member
Karma: 5
Posts: 318
Arduino rocks
|
 |
« Reply #217 on: December 13, 2012, 06:42:05 am » |
The EEPROM save/load functions apply only to the MENWIZ variables. The save function stores the variable in FIFO mode (first to be declared, first to be saved). So in theory the first defined variable *should* be stored in the first 2 bytes of EEPROM space.
You are Genius ..This means i have no worries about storing the variables (int, float etc) in EEPROM. Your MENWIZ is taking care of it by storing and retrieving the variables info  I also think that once program/sketch burns in the Arduino. The location of variables in the EEPROM will be always same. Suppose the first variable stored in 0 and 1 address of EEPROM. It will always store and retrieve from the same address throughout the life of the program. I really like the ease of your library. Thank you for all of your hardwork. What are your future plans  Regards
|
|
|
|
« Last Edit: December 13, 2012, 06:44:44 am by Khalid »
|
Logged
|
|
|
|
|
rome
Offline
Sr. Member
Karma: 13
Posts: 348
|
 |
« Reply #218 on: December 13, 2012, 07:28:00 am » |
Yes. You have not to take care about allocation. It is a MENWIZ duty .... All variables are stored/loaded togheter with one function call.
All is in the example.
|
|
|
|
« Last Edit: December 13, 2012, 07:29:34 am by brunialti »
|
Logged
|
|
|
|
|
Pakistan
Offline
Sr. Member
Karma: 5
Posts: 318
Arduino rocks
|
 |
« Reply #219 on: December 13, 2012, 08:28:52 am » |
Yes. You have not to take care about allocation. It is a MENWIZ duty .... All variables are stored/loaded togheter with one function call.
All is in the example.
Thats Cool features .. Your programming is unbelievable..Just saw the MENWIZ.cpp and Header file and your programming skills are at par excellence.
|
|
|
|
|
Logged
|
|
|
|
|
Pakistan
Offline
Sr. Member
Karma: 5
Posts: 318
Arduino rocks
|
 |
« Reply #220 on: December 14, 2012, 07:29:12 am » |
Hi, I implemented the Left and Right button in the sketch. But in your new COLLAPSE MENU i think the Left and Right buttons are not implemented for the List : 1/4???? When i entered into BASIC PARAMETERS, i can change following variables parameters: float Variable:26.0 byte var:50 boolean var:[0]
but i can not change the list: 1/4
|
|
|
|
|
Logged
|
|
|
|
|
Pakistan
Offline
Sr. Member
Karma: 5
Posts: 318
Arduino rocks
|
 |
« Reply #221 on: December 14, 2012, 07:49:12 am » |
Another Observation is: Saving and Loading from EEPROM is not functioning. For example when i presss change the parameters of variables SAVE TO EEPROM, then i shutdown the Arduino. When i power up the Arduino, and press LOAD THE EEPROM nothing happen. No values of BASIC PARAMETERS loaded. Any thing wrong???
|
|
|
|
|
Logged
|
|
|
|
|
rome
Offline
Sr. Member
Karma: 13
Posts: 348
|
 |
« Reply #222 on: December 14, 2012, 09:22:40 am » |
It seems to me that for lists does not make any sense manage the index. I have to introduce some correct behaviour. But still i do nt know what. I'll check eeprom funcs
|
|
|
|
|
Logged
|
|
|
|
|
Pakistan
Offline
Sr. Member
Karma: 5
Posts: 318
Arduino rocks
|
 |
« Reply #223 on: December 14, 2012, 09:36:54 am » |
Okay:).. But kindly must look into the eeprom functionality. Regards
|
|
|
|
|
Logged
|
|
|
|
|
rome
Offline
Sr. Member
Karma: 13
Posts: 348
|
 |
« Reply #224 on: December 14, 2012, 04:32:58 pm » |
I cannot replicate the problem. The eeprom functions seems to work properly in my environment. Check the following: - sequence: SAVE TO EPROM/LOAD FROM EPROM . Once this "error" arose because the user mistakenly used the WRITE TO SERIAL entry instead of SAVE TO EPROM menu entry - after value changes did you confirmed with "enter" button?
|
|
|
|
« Last Edit: December 14, 2012, 04:35:35 pm by brunialti »
|
Logged
|
|
|
|
|
|