Pages: 1 ... 14 15 [16] 17 18 ... 33   Go Down
Author Topic: MENWIZ: yet another character lcd menu wizard library  (Read 71698 times)
0 Members and 1 Guest are viewing this topic.
Pakistan
Offline Offline
Sr. Member
****
Karma: 6
Posts: 357
Arduino rocks
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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?
I shall recheck again. However, i am quite sure that when first time the LOAD FROM EEPROM did not work then i cautiously SAVE TO EEPROM again and recheck.

My Questions:
1- Should I press the CONFIRM button after change in individual variable OR After change the values of All variables I only one type press the CONFIRM button?

currently i am pressing CONFIRM button after changes the values of all parameters (float, byte, boolean etc). I confirm here that my CONFIRM button is functional (By viewing Serial.println function).
 


After SAVE TO EEPROM did you powered off the system And then after powering up LOAD FROM EEPROM?... In my case the values retrieve so far as the system is powered on, once you powered off and restart the Arduino LOAD FROM EEPROM didn't work. Which it should be.
« Last Edit: December 14, 2012, 10:04:54 pm by Khalid » Logged


Pakistan
Offline Offline
Sr. Member
****
Karma: 6
Posts: 357
Arduino rocks
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi again,
Can you please tell me what does your following code work?
Code:
   
      s2=menu.addMenu(MW_VAR,s1,F("list"));            //add a terminal node (that is "variable");
          s2->addVar(MW_LIST,&tp);                          //create a variable of type "option list"..
          s2->addItem(MW_LIST,F("option 1"));               //add option to the OPTION LIST
          s2->addItem(MW_LIST,F("option 2"));               //add option to the OPTION LIST
          s2->addItem(MW_LIST,F("option 3"));               //add option to the OPTION LIST
          s2->addItem(MW_LIST,F("option 4"));               //add option to the OPTION LIST
          s2->addItem(MW_LIST,F("option 5")); 
Where are these Options. These options not appear in my menu? How they can be utilized?
Logged


rome
Offline Offline
Sr. Member
****
Karma: 17
Posts: 483
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

CONFIRM button change the values of the currently  variable, before going up one level in the menu hierarchy.
ESCAPE leave the current level without saving the changed value (that is the variable will bew restored to the value it had before entering the current level).

The list behaviour is a real bug. I did not considered that you *must enter* in the option list to select them. I'll do the following change in the collapsed manu: Confirm button dysplay the option list (MW_LIST) as a non-collapsed-menu.
After all that is the reason I need testing :-)
« Last Edit: December 15, 2012, 03:34:56 pm by brunialti » Logged

Pakistan
Offline Offline
Sr. Member
****
Karma: 6
Posts: 357
Arduino rocks
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Thank You brunialti for explanation. smiley It seems to me your menu library will be much completed in future with your hardwork.
Regards
Logged


rome
Offline Offline
Sr. Member
****
Karma: 17
Posts: 483
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

please try the following patched file. it should implement correctly the list management in collapsed menu.

* MENWIZ.cpp (27.78 KB - downloaded 20 times.)
Logged

Pakistan
Offline Offline
Sr. Member
****
Karma: 6
Posts: 357
Arduino rocks
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

wow wow... the List is working great here... I have checked all the three behaviour one by one and found that only 2COLUMNS Beauvoir is working fine, you did great job... the 3COLUMNS behavior trims the strings and not appear in all three column.. The SCROLL HORIZONTAL never worked here, .. I really like the 2COLUMNS beahaviour...:
Code:
         s2->setBehaviour(MW_SCROLL_HORIZONTAL,true);    
//          s2->setBehaviour(MW_LIST_2COLUMNS,true);          
//          s2->setBehaviour(MW_LIST_3COLUMNS,true);

can you please tell us how can we utilize the options?... The main problem i am getting is i am unable to save the variables parameters in EEPROM....
I change the parameters and press CONFIRM, the i go back and press SAVE TO EEPROM. Then i restart the Arduino and when i press LOAD FROM EEPROM no change in variables...
Can you please tell why EEPROM saving not working here?
Any help?
« Last Edit: December 16, 2012, 03:28:42 am by Khalid » Logged


Offline Offline
Newbie
*
Karma: 1
Posts: 4
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi brunialti

I use your Menu library Version 1.0.0, but have not enough memory for all my menus I want. I will test your new version 1.1.0.

 I use a 2 line LCD with 20 characters, so i initialize it with

Code:
menu.begin(&lcd,20,2);

Then I want my custom menu for my analog buttons. What is the second parameter of the
Code:
menu.addUsrNav(navMenu,1);

function for? My nav Menu works...but maybe it's a important int?  smiley
Edit: Ok, I found the parameter in the cpp file. It is 4 or 6 for four button or six button mode. Something for the manual...  smiley

I want use the Splash screen. You write, that I should not use the sprintf function. But in the demo code you have it with sprintf. Could you explain the the code with the following example

Code:
 static  char buf[7];
  strcat(menu.sbuf,"Uptime (s): ");strcat(menu.sbuf,itoa((int)(millis()/1000),buf,10));//2nd lcd line
  strcat(menu.sbuf,"\nFree mem  : ");strcat(menu.sbuf,itoa((int)menu.freeRam(),buf,10));//3rd lcd line
  menu.drawUsrScreen(menu.sbuf);

This is for the default menu (not Splash, but it's the same problem)
I tried to modify the code, but it does not work. (Only a white screen and the arduino hangs...)

Sorry for my bad english... smiley

greets mike


« Last Edit: December 16, 2012, 07:53:38 am by mkom » Logged

Offline Offline
Newbie
*
Karma: 1
Posts: 4
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

In 1.1.0 per default when you run a function you not need a confirmation? I have to set

Code:
s1->setBehaviour(MW_ACTION_CONFIRM,true);

manually to recieve a confirmation... does it change from 1.00 to 1.1.0 or is it a bug?
---------------------------------
When I use the 4 button mode
 
Code:
menu.addUsrNav(navMenu,4);
I can not change the values of a integer or something else. I click on the int value but can not change it... is it a bug?
---------------------------------

When I use my own navMenu, are there any library files, that I can delete?

Code:
#include <LCD.h>  <--- Do I need this library?
#include <LiquidCrystal.h>
#include <buttons.h> <--- Do I need this library?
#include <MENWIZ.h>
#include <EEPROM.h> 

Maybe it saves me more memory?


« Last Edit: December 16, 2012, 07:58:40 am by mkom » Logged

Pakistan
Offline Offline
Sr. Member
****
Karma: 6
Posts: 357
Arduino rocks
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi,
The new version only work with the 6 buttons. The Left and Right button will change the parameters. Just read all such things few post back.
EDIT:
Mike did you able to save parameters in EEPROM and retrieve them back?
« Last Edit: December 16, 2012, 08:55:48 am by Khalid » Logged


The Netherlands
Offline Offline
Sr. Member
****
Karma: 4
Posts: 331
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
#include <LCD.h>  <--- Do I need this library?
#include <LiquidCrystal.h>
#include <buttons.h> <--- Do I need this library?
#include <MENWIZ.h>
#include <EEPROM.h>

#include <LCD.h>  <--- Do I need this library? Yes you do!
#include <LiquidCrystal.h>
#include <buttons.h> <--- Do I need this library? Yes you do!
#include <MENWIZ.h>
#include <EEPROM.h>

When there is not enough Sram you need to switch to a MEGA 2560 or add hardware SPI Sram.

Paco
Logged

Never to old to learn and I learn every day

Pakistan
Offline Offline
Sr. Member
****
Karma: 6
Posts: 357
Arduino rocks
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi again,
I have checked that the EEPROM SAVE works good but LOAD EEPROM not working at all. Some simple test i did following are my MENWIZ variable declaration:
Code:
int      LightPoint=800;      //1~1000 step50/ Lower this number if you want the tracker to continue tracking
                           // under darker light before reverting back to its default position.
 int tp=0;              //Just a list vriable with 5 options
byte     NGT_HOUR=1;  ///This variable keep the value for how long the suntracker will return in night(0 ~5 and step increase 1)
byte     M_PWM=50;  ///This variable keep the PWM value of the Motor(30 ~100 and step increase 5)
byte     SENSITIVITY=12   // This keep the sensitivity value of LDR

Here is my menu definition,
Code:
r=menu.addMenu(MW_ROOT,NULL,F("Main menu:"));              //create a root menu at first (required)
    s1=menu.addMenu(MW_SUBMENU,r,F("Basic parameters"));     //add a child (submenu) node to the root menu
    s1->setBehaviour(MW_MENU_COLLAPSED,true);          
    
      s2=menu.addMenu(MW_VAR,s1,F("list"));            //add a terminal node (that is "variable");
          s2->addVar(MW_LIST,&tp);                          //create a variable of type "option list"..
          s2->addItem(MW_LIST,F("option 1"));               //add option to the OPTION LIST
          s2->addItem(MW_LIST,F("option 2"));               //add option to the OPTION LIST
          s2->addItem(MW_LIST,F("option 3"));               //add option to the OPTION LIST
          s2->addItem(MW_LIST,F("option 4"));               //add option to the OPTION LIST
          s2->addItem(MW_LIST,F("option 5"));               //add option to the OPTION LIST
         s2->setBehaviour(MW_LIST_2COLUMNS,true);          
        
      //Add MENU MOTOR PWM                                
      s2=menu.addMenu(MW_VAR,s1,F("MotorPWM"));      
          s2->addVar(MW_AUTO_BYTE,&M_PWM,30,100,5);        
                                                        
      //Add MENU LDR SENSITIVITY PWM                                
      s2=menu.addMenu(MW_VAR,s1,F("Sensitivity"));        //add a terminal node (that is "variable");
          s2->addVar(MW_AUTO_BYTE,&SENSITIVITY,5,30,1);         //create a variable of type "byte"...
       //Add MENU NIGHT HOUR - How many hours after night the suntracker will return back to the EAST
      s2=menu.addMenu(MW_VAR,s1,F("NightHour"));        //add a terminal node (that is "variable");
          s2->addVar(MW_AUTO_BYTE,&NGT_HOUR,0,5,1);         //create a variable of type "byte"...
  
 
       //Add MENU LIGHTPOINT                                //...associated to the terminal node and bind it to the app variable "f" of type float
      s2=menu.addMenu(MW_VAR,s1,F("LightPoint"));        //add a terminal node (that is "variable");
          s2->addVar(MW_AUTO_INT,&LightPoint,1,1000,50);         //create a variable of type "byte"...
                
    s1=menu.addMenu(MW_VAR,r,F("EEPROM save"));          
      s1->addVar(MW_ACTION,savevar);                    

    s1=menu.addMenu(MW_VAR,r,F("Load EEPROM"));      
      s1->addVar(MW_ACTION,loadvar);    
      s1->addVar(MW_ACTION,act);                
      

I CONFIRM EEPROM save and then loaded another sketch to check whether the values are saved or not to EEPROM.
I serial print and found the following saved values:

Address       Value Stored
0                 3   (Address 0 and 1,  is 'tp' int variable and the value 3 was correct, as my option-4 was ticked) Why list is integer why not byte??
1                 0
2                 65  (Address 2 is M_PWM variable which is byte and the values saved are correct)
3                 15  (Address 3 is SENSITIVITY variable which is byte and values stored is correct)
4                   4   (Address 4 is NGT_HOUR variable which is byte and values stored is correct)
5                 38  (Address 5 and 6 is 'LightPoint' variable which is integer and value i saved was 550 which seems incorrect)
6                  2



EEPROM adresss 5, 6 values i can not understand...

When I press LOAD EEPROM no values loaded in the parameters...
« Last Edit: December 16, 2012, 10:57:39 am by Khalid » Logged


Pakistan
Offline Offline
Sr. Member
****
Karma: 6
Posts: 357
Arduino rocks
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

I just commented // the third line of following and all working great now.. Tested several time and work great for me...
Code:
   s1=menu.addMenu(MW_VAR,r,F("Load EEPROM"));        //add a terminal node (that is "variable") create an "action" associated to the terminal node...
      s1->addVar(MW_ACTION,loadvar);                     //the act function as default will be called when enter button is pushed
      //s1->addVar(MW_ACTION,act);

Now if anybody want to load the parameeters of the variables after starting the Arduino then he must keep the following function at the last of Void Setup(), after creation of all menues.

Code:
//LOAD VARIABLES FROM EEPROM
loadvar();
« Last Edit: December 16, 2012, 10:56:02 am by Khalid » Logged


rome
Offline Offline
Sr. Member
****
Karma: 17
Posts: 483
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

@khalid
the addVar method adds to the current _menu object a variable by a pointer setting. if you repeat the addVar method with the same _menu object the latest pointer is saved, and the previous are lost. This is the reason why load menu entry in the code did'nt work. Remember that EEPROM memory has a limited number of write cycles (order of many thousands)

@backbone
You are rigth. i will try to use compiler option as EEPROM support in order to not use Buttons library if not used. The drawback is the code is less readable an maintainable

@mkom
It is true. The default for action confirmation should be true. Fixed now
menu.addUsrNav(navMenu,4); the collapsed menus cannot work in 4 buttons model (until somebody tells me how to use the 4 buttons to do it :-)) . the "normal" menus does.
About sprintf. If you call sprintf in any point of the code the compiler will link the asm code for it (>1.5 kbyte). So try to avoid to use it until you have short sketch code and available memory...

About the footprint. That is the weak point. I'll try to reduce it. But it is quite difficult.
Resuming the test status:
- I still need to check 2/3 rows behavihour. But remmber that in 3 rows mode the string trimming is unavoidable if strings are larger than the column width...
- any other pending bug?
« Last Edit: December 16, 2012, 02:50:17 pm by brunialti » Logged

Pakistan
Offline Offline
Sr. Member
****
Karma: 6
Posts: 357
Arduino rocks
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

@khalid
the addVar method adds to the current _menu object a variable by a pointer setting. if you repeat the addVar method with the same _menu object the latest pointer is saved, and the previous are lost. This is the reason why load menu entry in the code did'nt work. Remember that EEPROM memory has a limited number of write cycles (order of many thousands)

Actually, load menu entry in the code work and that was not a bug. Only the bug i think was the third line in the following. This third line when i commented Load the variable parameters. If i un-comment it, then this become the bug and parameters are not loaded from the  EEPROM..I dont know why..:
Code:
 s1=menu.addMenu(MW_VAR,r,F("Load EEPROM"));  
      s1->addVar(MW_ACTION,loadvar);            
      //s1->addVar(MW_ACTION,act);

Now, some improvement if possible:
1- If you can check whether the last parameters of the variable is still not change then do not write to the EEPROM.

I am contineously running the menu and it working flawlessly. The MENWIZ is great and i think its bug free ... Its great MENWIZ for small and medium type of projects.. Thank You for your hard work...
« Last Edit: December 17, 2012, 03:31:08 am by Khalid » Logged


rome
Offline Offline
Sr. Member
****
Karma: 17
Posts: 483
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

As explained you cannot use twice addVar with the same menu item, as the last one will overwrite the first (at each menu node only a variable can be defined!). It is a sketch code mistake.

I understand you would like MENWIZ only wrote to eeprom the recently touched (changed) variables. That is not possible as the write function write all the variables at once, for consistency reason. In fact if you change the order of variable declarared in in the sketch, the variable position inside eeprom changes. That could  lead to a messy situation when the sketch try to read back variables from eeprom, due to the misalignment.
 
Logged

Pages: 1 ... 14 15 [16] 17 18 ... 33   Go Up
Jump to: