Go Down

Topic: MENWIZ: yet another character lcd menu wizard library (Read 83971 times) previous topic - next topic

brunialti

something like the following (not tested nor compiled, just for example):

Code: [Select]
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()?

brunialti

#211
Dec 11, 2012, 10:05 pm Last Edit: Dec 11, 2012, 10:41 pm by brunialti Reason: 1
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!


Khalid


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
Simply...You can't afford me..

Author Of:
http://my-woodcarving.blogspot.com/
http://www.free3dscans.blogspot.com/
http://my-diysolarwind.blogspot.com/

Oops..some one gave me Karma...:)

Khalid

I am getting following error when i loaded the example with just adding the custom button function. My sketch is also attached.
Simply...You can't afford me..

Author Of:
http://my-woodcarving.blogspot.com/
http://www.free3dscans.blogspot.com/
http://my-diysolarwind.blogspot.com/

Oops..some one gave me Karma...:)

brunialti

#214
Dec 12, 2012, 09:48 pm Last Edit: Dec 12, 2012, 09:50 pm by brunialti Reason: 1
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....

Khalid

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.

Code: [Select]
void savevar(){
  menu.writeEeprom();
  }
 
void loadvar(){
  menu.readEeprom();
  }


Regards
Simply...You can't afford me..

Author Of:
http://my-woodcarving.blogspot.com/
http://www.free3dscans.blogspot.com/
http://my-diysolarwind.blogspot.com/

Oops..some one gave me Karma...:)

brunialti

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.

Khalid

#217
Dec 13, 2012, 12:42 pm Last Edit: Dec 13, 2012, 12:44 pm by Khalid Reason: 1

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
Simply...You can't afford me..

Author Of:
http://my-woodcarving.blogspot.com/
http://www.free3dscans.blogspot.com/
http://my-diysolarwind.blogspot.com/

Oops..some one gave me Karma...:)

brunialti

#218
Dec 13, 2012, 01:28 pm Last Edit: Dec 13, 2012, 01:29 pm by brunialti Reason: 1
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.

Khalid


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.
Simply...You can't afford me..

Author Of:
http://my-woodcarving.blogspot.com/
http://www.free3dscans.blogspot.com/
http://my-diysolarwind.blogspot.com/

Oops..some one gave me Karma...:)

Khalid

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
Simply...You can't afford me..

Author Of:
http://my-woodcarving.blogspot.com/
http://www.free3dscans.blogspot.com/
http://my-diysolarwind.blogspot.com/

Oops..some one gave me Karma...:)

Khalid

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???
Simply...You can't afford me..

Author Of:
http://my-woodcarving.blogspot.com/
http://www.free3dscans.blogspot.com/
http://my-diysolarwind.blogspot.com/

Oops..some one gave me Karma...:)

brunialti

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

Khalid

Okay:).. But kindly must look into the eeprom functionality.
Regards
Simply...You can't afford me..

Author Of:
http://my-woodcarving.blogspot.com/
http://www.free3dscans.blogspot.com/
http://my-diysolarwind.blogspot.com/

Oops..some one gave me Karma...:)

brunialti

#224
Dec 14, 2012, 10:32 pm Last Edit: Dec 14, 2012, 10:35 pm by brunialti Reason: 1
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?

Go Up