Pages: 1 2 3 [4] 5 6 ... 33   Go Down
Author Topic: MENWIZ: yet another character lcd menu wizard library  (Read 71393 times)
0 Members and 1 Guest are viewing this topic.
The Netherlands
Offline Offline
Sr. Member
****
Karma: 4
Posts: 331
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Step by step... :-)

So would it be better RAM wise to make them all submenu's with only one var inside?

Paco
Logged

Never to old to learn and I learn every day

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

No, it is the same or even worse.
If it is usefull for you, it could be as following

MAIN MENU
 Settings
    SpeedStart
    SpeedCurve
    Brake
    Model
 Triggers
    Min
    Max
 Actions
    Reset
    Calibrate

Logged

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

Thats makes more sense to me.

Will change.

Paco
Logged

Never to old to learn and I learn every day

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

This is what Imade of it.

When the splash screen is active the display blinks each second?
Is this rewriting of the values?

Paco
Code:
//create the menu tree
  r=menu.addMenu(MW_ROOT,NULL,"MAIN MENU");              //create a root menu at first (required)
    s1=menu.addMenu(MW_SUBMENU,r,"Settings 1");          //add a submenu node to the root menu
        s2=menu.addMenu(MW_VAR,s1,"SpeedStart");         //add a terminal node in the menu tree (that is "variable");
          s2->addVar(MW_AUTO_INT,&gp,1,125,5);           //Set value
        s2=menu.addMenu(MW_VAR,s1,"SpeedCurve");         //add a terminal node in the menu tree (that is "variable");
          s2->addVar(MW_AUTO_INT,&gp,1,125,5);           //Set value
        s2=menu.addMenu(MW_VAR,s1,"Brake");              //add a terminal node in the menu tree (that is "variable");
          s2->addVar(MW_AUTO_INT,&gp,1,125,5);           //Set value
        s2=menu.addMenu(MW_VAR,s1,"Model");              //add a terminal node in the menu tree (that is "variable");
          s2->addVar(MW_AUTO_INT,&gp,1,10,1);            //Set value
    s1=menu.addMenu(MW_SUBMENU,r,"Settings 2");          //add a submenu node to the root menu
        s2=menu.addMenu(MW_VAR,s1,"Min");                //add a terminal node in the menu tree (that is "variable");
          s2->addVar(MW_AUTO_INT,&gp,1,255,1);           //Set value
        s2=menu.addMenu(MW_VAR,s1,"Max");                //add a terminal node in the menu tree (that is "variable");
          s2->addVar(MW_AUTO_INT,&gp,1,0,1);             //Set value
    s1=menu.addMenu(MW_SUBMENU,r,"Settings 3");          //add a submenu node to the root menu
        s2=menu.addMenu(MW_VAR,s1,"Reset");              //add a terminal node in the menu tree (that is "variable");
          s2->addVar(MW_BOOLEAN,&wr);                    //Set value
        s2=menu.addMenu(MW_VAR,s1,"Calibrate");          //add a terminal node in the menu tree (that is "variable");
          s2->addVar(MW_BOOLEAN,&wr);
Logged

Never to old to learn and I learn every day

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

In your code you use some variables that does not make sense in your context (i.e. wr, gp).
You need to create your own global variables (i.e. speed, brake, mymin, mymax, ...) of the same type of the declared variable (in this case int for MW_AUTO_INT, byte for MW_AUTO_BOOLEAN) bindig them (passing by reference as an argument of addVar).
In your sketch if you initialize them with a default value, the same value will be visible in the menu. Any change in the menu will affect your global variable as well.
Logged

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

I know like I said step by step.
Code is now running outside my skecth to be, for set up and debugging.
As soon as all looks OK I paste it in the sketch I already have to keep overview.
Variables are the next step.

Paco
Logged

Never to old to learn and I learn every day

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

The splash screen should'nt blink at all during splash schreen display.... (splash or default userscreen ? The userscreen is shown afer x seconds (4 in your code) without pushing any button)
Ignore it for now. I'm going to insert the new subversion (0.3.0) of library that will help you a lot to simplify the code you wrote for default screen (and let it be displayed without any blink).
The new lib will require you only to change the character '#' in the splashscreen with more friendly '\n'.


« Last Edit: April 13, 2012, 07:09:46 am by brunialti » Logged

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

I wait  smiley-lol

Paco
Logged

Never to old to learn and I learn every day

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

You can stop to wait   smiley-cool
In github and here attached you can find MENUWIZ ver 0.3.0

The user default screen is more compact with the new function drawUsrScreen. The code should be something like this:

// user defined default screen
void msc(){
  sprintf(menu.sbuf,"SPD:%d MDL:%d\nSPDST:%d SPSV:%d\nMIN:%d SPDC:%d\nMAX:%d BRK:%d",spd,mdl,spdst,spvs,mymin,spdc,mymax,brk);
  menu.drawUsrScreen(menu.sbuf);
  }

You have to change the '#' characters in the splash string to '\n'.




* MENWIZ_0_3_0.zip (516.4 KB - downloaded 12 times.)
Logged

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

samples scream for LCD.h !
Not included?

Paco
Logged

Never to old to learn and I learn every day

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

is part of new liquidcrystal lib.
Can you send me the code? I try to let it run.
Which interface are you using ? I2C ?
Logged

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

Just some checks:
- delete existing directory LiquidCrystal and or LiquidCrystal_I2C from Arduino libraries subdir. If you have the lib inside your sketch space, delete it
- create a directory under libraries directory of Arduino 1.0 IDE the name of the directory depends from teh interface: if you use I2C call it LiquidCrystal_I2C
- expand new LiquidCrystal library inside the new directory
- include the correct .h file (for I2C is LiquidCrystal_I2C.h)

Test the Hello World example in the new LiquidCrystal library. If it works (the initialization is crucial), start with your code.
Logged

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

I use the I2C display.
Will try to check tomorrow your options.
Found the LCD.h hidden in the zip file. :-)

Paco
Logged

Never to old to learn and I learn every day

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

ok. I suggest to expand the whole new liquidcrystal library, with all the .h files
Logged

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

After putting in all new libs everything screwed up.
So I used all OLD libs and samples and got it to work again with the I2C lib.

I put this menu code in my sketch.

Then I started to add the libs from menwiz 0.3.0

Now it still screams for LCD.h where I created a new folder under libaries and put the .h and .cpp file in.
Compiling gives the LCD.h error.

Paco


* 01.jpg (126.06 KB, 1280x1024 - viewed 25 times.)

* 02.jpg (118.15 KB, 1280x1024 - viewed 21 times.)

* 03.jpg (355.67 KB, 1280x1024 - viewed 25 times.)
« Last Edit: April 14, 2012, 05:09:36 am by backbone » Logged

Never to old to learn and I learn every day

Pages: 1 2 3 [4] 5 6 ... 33   Go Up
Jump to: