Go Down

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

Qdeathstar

#495
Sep 14, 2014, 01:08 am Last Edit: Sep 14, 2014, 02:00 am by Qdeathstar Reason: 1
I wanted to update you and say that i got it to do what i wanted it to do (yay)

basically,

if (button is pushed) {
   menu.actNavButtons(MW_BTL);
  }

then move the actNavButtons() function from private to public.

Works since i'm only using the four navigation buttons(up, down, confirm and exit), and not left.



Seems like an easier way to get custom buttons to work too, maybe not as efficient?   Also, what is the benefit in making some things public and some things private? Is it just so that variables don't end up with the same name? (eg, x in the sketch does one thing, and x in the private section of the library does another?)

EDIT: 

I do have another problem/issue though

It seems like if the "menu" times out, it "saves" it's spot, eg if your a submenu it will return to the submenu.

I'd rather return to the index. Is this possible?

Qdeathstar

So, i've made a lot of progress on my project, but i ran into an issue with the menu library.

What i want to do, is have the menu store an integer in a variable, and then later read the variable and decide what to do based on the variable.

Code: [Select]

r=menu.addMenu(MW_ROOT,NULL,F("Make Selection"));
  s1=menu.addMenu(MW_VAR,r,F("Stop Selected Zone"));
  s1->addVar(MW_ACTION,zoneOff);
  s1=menu.addMenu(MW_SUBMENU,r,F("Solid Colors"));
  s2=menu.addMenu(MW_VAR,s1,F("White")); //will call function 'White' if that menu selection is made.
  s2->addVar(MW_AUTO_INT,&chosenFunction,0,0,0);
  s2->addVar(MW_ACTION,zoneOn);
  s2=menu.addMenu(MW_VAR,s1,F("Red")); //will call function 'White' if that menu selection is made.
  s2->addVar(MW_AUTO_INT,&chosenFunction,1,1,0);
  s2->addVar(MW_ACTION,zoneOn);
  s2=menu.addMenu(MW_VAR,s1,F("Green")); //will call function 'White' if that menu selection is made.
  s2->addVar(MW_AUTO_INT,&chosenFunction,2,2,0);
  s2->addVar(MW_ACTION,zoneOn);
  s2=menu.addMenu(MW_VAR,s1,F("Blue")); //will call function 'White' if that menu selection is made.
  s2->addVar(MW_AUTO_INT,&chosenFunction,3,3,0);
  s2->addVar(MW_ACTION,zoneOn);
 


s2=menu.addMenu(MW_VAR,s1,F("Blue")); //will call function 'White' if that menu selection is made.
  s2->addVar(MW_AUTO_INT,&chosenFunction,3,3,0);


What i want this to do is when i select "Blue", chosenFunction has a value of "3", however, it seems like it returns zero. Serial.print(chosenFunction); prints 0.


I was having difficulty understanding what you meant by, min, max, and increment?  I assume that if the min is 3, and the max is 3, the only value it can be is 3.

k4ktus

somebody who is running the lib under avr studio 6?
my blog and projects:
http://simons-holzvergaser.blogspot.com/

k4ktus

That's why I'm asking:

Code: [Select]
Error 34 ISO C++ forbids declaration of 'type name' with no type [-fpermissive] E:\Projekte\Atmel Studio\CtrlHV_Q_D1\CtrlHV_Q_D1\Lib\MENWIZ\MENWIZ.cpp 376 5 CtrlHV_Q_D1
Error 35 ISO C++ forbids declaration of 'type name' with no type [-fpermissive] E:\Projekte\Atmel Studio\CtrlHV_Q_D1\CtrlHV_Q_D1\Lib\MENWIZ\MENWIZ.cpp 376 5 CtrlHV_Q_D1
Error 36 expected primary-expression before 'const' E:\Projekte\Atmel Studio\CtrlHV_Q_D1\CtrlHV_Q_D1\Lib\MENWIZ\MENWIZ.cpp 376 5 CtrlHV_Q_D1
Error 37 expected ')' before 'const' E:\Projekte\Atmel Studio\CtrlHV_Q_D1\CtrlHV_Q_D1\Lib\MENWIZ\MENWIZ.cpp 376 5 CtrlHV_Q_D1
Error 39 ISO C++ forbids declaration of 'type name' with no type [-fpermissive] E:\Projekte\Atmel Studio\CtrlHV_Q_D1\CtrlHV_Q_D1\Lib\MENWIZ\MENWIZ.cpp 379 5 CtrlHV_Q_D1
Error 40 ISO C++ forbids declaration of 'type name' with no type [-fpermissive] E:\Projekte\Atmel Studio\CtrlHV_Q_D1\CtrlHV_Q_D1\Lib\MENWIZ\MENWIZ.cpp 379 5 CtrlHV_Q_D1
Error 41 expected primary-expression before 'const' E:\Projekte\Atmel Studio\CtrlHV_Q_D1\CtrlHV_Q_D1\Lib\MENWIZ\MENWIZ.cpp 379 5 CtrlHV_Q_D1
Error 42 expected ')' before 'const' E:\Projekte\Atmel Studio\CtrlHV_Q_D1\CtrlHV_Q_D1\Lib\MENWIZ\MENWIZ.cpp 379 5 CtrlHV_Q_D1
Error 44 ISO C++ forbids declaration of 'type name' with no type [-fpermissive] E:\Projekte\Atmel Studio\CtrlHV_Q_D1\CtrlHV_Q_D1\Lib\MENWIZ\MENWIZ.cpp 403 28 CtrlHV_Q_D1
Error 45 ISO C++ forbids declaration of 'type name' with no type [-fpermissive] E:\Projekte\Atmel Studio\CtrlHV_Q_D1\CtrlHV_Q_D1\Lib\MENWIZ\MENWIZ.cpp 403 28 CtrlHV_Q_D1
Error 46 expected primary-expression before 'const' E:\Projekte\Atmel Studio\CtrlHV_Q_D1\CtrlHV_Q_D1\Lib\MENWIZ\MENWIZ.cpp 403 22 CtrlHV_Q_D1
Error 47 expected ')' before 'const' E:\Projekte\Atmel Studio\CtrlHV_Q_D1\CtrlHV_Q_D1\Lib\MENWIZ\MENWIZ.cpp 403 22 CtrlHV_Q_D1
Error 48 ISO C++ forbids declaration of 'type name' with no type [-fpermissive] E:\Projekte\Atmel Studio\CtrlHV_Q_D1\CtrlHV_Q_D1\Lib\MENWIZ\MENWIZ.cpp 445 6 CtrlHV_Q_D1
Error 49 ISO C++ forbids declaration of 'type name' with no type [-fpermissive] E:\Projekte\Atmel Studio\CtrlHV_Q_D1\CtrlHV_Q_D1\Lib\MENWIZ\MENWIZ.cpp 445 6 CtrlHV_Q_D1
Error 50 expected primary-expression before 'const' E:\Projekte\Atmel Studio\CtrlHV_Q_D1\CtrlHV_Q_D1\Lib\MENWIZ\MENWIZ.cpp 445 6 CtrlHV_Q_D1
Error 51 expected ')' before 'const' E:\Projekte\Atmel Studio\CtrlHV_Q_D1\CtrlHV_Q_D1\Lib\MENWIZ\MENWIZ.cpp 445 6 CtrlHV_Q_D1
Error 53 ISO C++ forbids declaration of 'type name' with no type [-fpermissive] E:\Projekte\Atmel Studio\CtrlHV_Q_D1\CtrlHV_Q_D1\Lib\MENWIZ\MENWIZ.cpp 452 4 CtrlHV_Q_D1
Error 54 ISO C++ forbids declaration of 'type name' with no type [-fpermissive] E:\Projekte\Atmel Studio\CtrlHV_Q_D1\CtrlHV_Q_D1\Lib\MENWIZ\MENWIZ.cpp 452 4 CtrlHV_Q_D1
Error 55 expected primary-expression before 'const' E:\Projekte\Atmel Studio\CtrlHV_Q_D1\CtrlHV_Q_D1\Lib\MENWIZ\MENWIZ.cpp 452 4 CtrlHV_Q_D1
Error 56 expected ')' before 'const' E:\Projekte\Atmel Studio\CtrlHV_Q_D1\CtrlHV_Q_D1\Lib\MENWIZ\MENWIZ.cpp 452 4 CtrlHV_Q_D1
Error 61 ISO C++ forbids declaration of 'type name' with no type [-fpermissive] E:\Projekte\Atmel Studio\CtrlHV_Q_D1\CtrlHV_Q_D1\Lib\MENWIZ\MENWIZ.cpp 496 19 CtrlHV_Q_D1
Error 62 ISO C++ forbids declaration of 'type name' with no type [-fpermissive] E:\Projekte\Atmel Studio\CtrlHV_Q_D1\CtrlHV_Q_D1\Lib\MENWIZ\MENWIZ.cpp 496 19 CtrlHV_Q_D1
Error 63 expected primary-expression before 'const' E:\Projekte\Atmel Studio\CtrlHV_Q_D1\CtrlHV_Q_D1\Lib\MENWIZ\MENWIZ.cpp 496 19 CtrlHV_Q_D1
Error 64 expected ')' before 'const' E:\Projekte\Atmel Studio\CtrlHV_Q_D1\CtrlHV_Q_D1\Lib\MENWIZ\MENWIZ.cpp 496 19 CtrlHV_Q_D1
Error 75 ISO C++ forbids declaration of 'type name' with no type [-fpermissive] E:\Projekte\Atmel Studio\CtrlHV_Q_D1\CtrlHV_Q_D1\Lib\MENWIZ\MENWIZ.cpp 567 3 CtrlHV_Q_D1
Error 76 ISO C++ forbids declaration of 'type name' with no type [-fpermissive] E:\Projekte\Atmel Studio\CtrlHV_Q_D1\CtrlHV_Q_D1\Lib\MENWIZ\MENWIZ.cpp 567 3 CtrlHV_Q_D1
Error 77 expected primary-expression before 'const' E:\Projekte\Atmel Studio\CtrlHV_Q_D1\CtrlHV_Q_D1\Lib\MENWIZ\MENWIZ.cpp 567 3 CtrlHV_Q_D1
Error 78 expected ')' before 'const' E:\Projekte\Atmel Studio\CtrlHV_Q_D1\CtrlHV_Q_D1\Lib\MENWIZ\MENWIZ.cpp 567 3 CtrlHV_Q_D1
my blog and projects:
http://simons-holzvergaser.blogspot.com/

k4ktus

looks like that there was a change in pgmspace.h. Becaus the lib is also not running with newer ide
my blog and projects:
http://simons-holzvergaser.blogspot.com/

inshuno

Hi
can someone explain me why this is not working.

// 1.0
   s1=menu.addMenu(MW_SUBMENU,r, F("Adr Menu"));
   s1->setBehaviour(MW_MENU_COLLAPSED,false);

// 1.1    
    s2=menu.addMenu(MW_VAR,s1, F("Address 1"));        
       s2->addVar(MW_AUTO_INT,&address1,0,255,1);
         s3->addVar(MW_ACTION,test1);
         
// 1.2    
    s2=menu.addMenu(MW_VAR,s1, F("Address 2"));        
       s2->addVar(MW_AUTO_INT,&address2,0,255,1);
         s3->addVar(MW_ACTION,test1);

Instead of incrementing or decrementing the variables Address 1 or 2 the Menu jumps directly to the MW_ACTION part. It also does not work with any other MW_AUTO_xxx.
Is this a Bug or what else? Would be fine to get it running as a Xmas present.
Thanx for some help

AlexLPD

Hi, first of all thanks for the great Lib!!!!!

I have  already installed and try it and seem to work properly... but as usual I get this weird errors...

I Have used the get.error function, and show me this;

ERROR 0
ERROR 0
ERROR 110
ERROR 110

This is the original menus position;
Code: [Select]
r=tree.addMenu(MW_ROOT,NULL,F("MENU"));
    s1=tree.addMenu(MW_SUBMENU,r, F("AJUSTE TERMOST"));
      s2=tree.addMenu(MW_VAR,s1, F("TEMP INICIO BODEGA"));
        s2->addVar(MW_AUTO_FLOAT,&tib,-10,10,0.5);     
      s2=tree.addMenu(MW_VAR,s1, F("TEMP FINAL BODEGA"));
        s2->addVar(MW_AUTO_FLOAT,&tfb,-10,10,0.5); 
      s2=tree.addMenu(MW_VAR,s1, F("TEMP INICIO VITRINA"));
        s2->addVar(MW_AUTO_FLOAT,&tiv,-2,10,0.5); 
      s2=tree.addMenu(MW_VAR,s1, F("TEMP FINAL VITRINA"));
        s2->addVar(MW_AUTO_FLOAT,&tfv,-2,10,0.5); 
        tree.getErrorMessage(true); 
       
   s1=tree.addMenu(MW_SUBMENU,r, F("MODO NOCTURNO"));
      s2=tree.addMenu(MW_VAR,s1, F("ACTIVAR ?"));
        s2->addVar(MW_BOOLEAN,&mn);     
      s2=tree.addMenu(MW_VAR,s1, F("HORA DE INICIO"));
        s2->addVar(MW_AUTO_INT,&himn, 0,24,1); 
      s2=tree.addMenu(MW_VAR,s1, F("MINUTO DE INICIO"));
        s2->addVar(MW_AUTO_INT,&mimn, 0,59,1); 
      s2=tree.addMenu(MW_VAR,s1, F("HORA FINAL"));
        s2->addVar(MW_AUTO_INT,&hfmn, 0,24,1); 
      s2=tree.addMenu(MW_VAR,s1, F("MINUTO FINAL"));
        s2->addVar(MW_AUTO_INT,&mfmn,0,59,1); 
        tree.getErrorMessage(true);
     
     s1=tree.addMenu(MW_SUBMENU, r, F("DESHIELO"));
      s2=tree.addMenu(MW_VAR,s1, F("ACTIVAR ?"));
        s2->addVar(MW_BOOLEAN,&dh);     
      s2=tree.addMenu(MW_VAR,s1, F("CANT. DESHIELOS"));
        s2->addVar(MW_AUTO_INT,&cd, 0,10,1); 
      s2=tree.addMenu(MW_VAR,s1, F("TIEMPO DESHIELO"));
        s2->addVar(MW_AUTO_INT,&td, 0,10,1); 
        tree.getErrorMessage(true);
     
   s1=tree.addMenu(MW_SUBMENU,r, F("ALARMA TEMP"));
      s2=tree.addMenu(MW_VAR,s1, F("ACTIVAR ?"));
        s2->addVar(MW_BOOLEAN,&axt);     
      s2=tree.addMenu(MW_VAR,s1, F("LIMITE VITRINA"));
        s2->addVar(MW_AUTO_INT,&atv, 0,10,1); 
      s2=tree.addMenu(MW_VAR,s1, F("LIMITE BODEGA"));
        s2->addVar(MW_AUTO_INT,&atb, 0,10,1);   
        tree.getErrorMessage(true);



I assume there is an error with the third and four menus... how ever... I cut the third and pasted on the second place... uploaded and again... show this;

ERROR 0
ERROR 0
ERROR 110
ERROR 110


The code;
Code: [Select]
#include <Wire.h>
#include <LCD.h>
#include <LiquidCrystal_I2C.h>
#include <buttons.h>
#include <MENWIZ.h>
#include <EEPROM.h>

// DEFINE ARDUINO PINS FOR THE NAVIGATION BUTTONS
#define UP_BOTTON_PIN       9
#define DOWN_BOTTON_PIN     10
#define LEFT_BOTTON_PIN     7
#define RIGHT_BOTTON_PIN    8
#define CONFIRM_BOTTON_PIN  12
#define ESCAPE_BOTTON_PIN   11
#define MAX_MENU 25
#define MAX_OPTXMENU 20

menwiz tree;
// create lcd obj using LiquidCrystal lib
LiquidCrystal_I2C lcd(0x27, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE);

int  list,sp=110;
float temInicioBodega,  tib=0;
float temInicioVitrina, tiv=0;
float temFinalBodega,   tfb=0;
float temFinalVitrina,  tfv=0;
boolean mn = false; //modo nocturno
int himn = 0; //hr de inicio modo nocturno  
int mimn = 0; //min de inicio modo nocturno
int hfmn = 0; //hr final modo nocturno
int mfmn = 0; //min final modo nocturno
boolean dh = false; // deshielos
int cd = 0; //candidad de deshielos
int td = 0; //tiempo de deshielo
boolean axt = false; //alarma por temperatura
int atv = 6; //limite para alam temp vitrina
int atb = 6; // limite alam temp bodega
boolean fl = true;

void setup(){
  _menu *r,*s1,*s2;

  Serial.begin(19200);    
  tree.begin(&lcd,16,2); //declare lcd object and screen size to menwiz lib

  r=tree.addMenu(MW_ROOT,NULL,F("MENU"));
    s1=tree.addMenu(MW_SUBMENU,r, F("AJUSTE TERMOST"));
      s2=tree.addMenu(MW_VAR,s1, F("TEMP INICIO BODEGA"));
        s2->addVar(MW_AUTO_FLOAT,&tib,-10,10,0.5);      
      s2=tree.addMenu(MW_VAR,s1, F("TEMP FINAL BODEGA"));
        s2->addVar(MW_AUTO_FLOAT,&tfb,-10,10,0.5);  
      s2=tree.addMenu(MW_VAR,s1, F("TEMP INICIO VITRINA"));
        s2->addVar(MW_AUTO_FLOAT,&tiv,-2,10,0.5);  
      s2=tree.addMenu(MW_VAR,s1, F("TEMP FINAL VITRINA"));
        s2->addVar(MW_AUTO_FLOAT,&tfv,-2,10,0.5);  
        tree.getErrorMessage(true);
        
   s1=tree.addMenu(MW_SUBMENU, r, F("DESHIELO"));
      s2=tree.addMenu(MW_VAR,s1, F("ACTIVAR ?"));
        s2->addVar(MW_BOOLEAN,&dh);      
      s2=tree.addMenu(MW_VAR,s1, F("CANT. DESHIELOS"));
        s2->addVar(MW_AUTO_INT,&cd, 0,10,1);  
      s2=tree.addMenu(MW_VAR,s1, F("TIEMPO DESHIELO"));
        s2->addVar(MW_AUTO_INT,&td, 0,10,1);  
        tree.getErrorMessage(true);
      
   s1=tree.addMenu(MW_SUBMENU,r, F("MODO NOCTURNO"));
      s2=tree.addMenu(MW_VAR,s1, F("ACTIVAR ?"));
        s2->addVar(MW_BOOLEAN,&mn);      
      s2=tree.addMenu(MW_VAR,s1, F("HORA DE INICIO"));
        s2->addVar(MW_AUTO_INT,&himn, 0,24,1);  
      s2=tree.addMenu(MW_VAR,s1, F("MINUTO DE INICIO"));
        s2->addVar(MW_AUTO_INT,&mimn, 0,59,1);  
      s2=tree.addMenu(MW_VAR,s1, F("HORA FINAL"));
        s2->addVar(MW_AUTO_INT,&hfmn, 0,24,1);  
      s2=tree.addMenu(MW_VAR,s1, F("MINUTO FINAL"));
        s2->addVar(MW_AUTO_INT,&mfmn,0,59,1);  
        tree.getErrorMessage(true);
    
   s1=tree.addMenu(MW_SUBMENU,r, F("ALARMA TEMP"));
      s2=tree.addMenu(MW_VAR,s1, F("ACTIVAR ?"));
        s2->addVar(MW_BOOLEAN,&axt);      
      s2=tree.addMenu(MW_VAR,s1, F("LIMITE VITRINA"));
        s2->addVar(MW_AUTO_INT,&atv, 0,10,1);  
      s2=tree.addMenu(MW_VAR,s1, F("LIMITE BODEGA"));
        s2->addVar(MW_AUTO_INT,&atb, 0,10,1);  
        tree.getErrorMessage(true);
        
    //  s1->addVar(MW_ACTION,myfunc);
 tree.navButtons(UP_BOTTON_PIN,DOWN_BOTTON_PIN,LEFT_BOTTON_PIN,RIGHT_BOTTON_PIN,ESCAPE_BOTTON_PIN,CONFIRM_BOTTON_PIN);
}

 
void loop(){
  tree.draw();
  int getErrorMessage(boolean fl);
  }

void myfunc(){
  Serial.println("ACTION FIRED");
  }


Another thing wort to mention is;
When the menus are in the original position, dont show the fourth sub-menu, and in the third
-Deshielo- only shows two of the three options... When I switch them... the same thing happens with the -Modo Nocturno-


The error shows me... I need a Error 110 "MV_VAR menu type required "

I see in the provide example and I could find a significance difference with my code...
I now most probably is gone a be something really obvious, just at the time I cant see it.

Ant toughs on this one?
Kind Regards And Happy New Year!
-Alex-  :smiley-cool:

Go Up
 


Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

Arduino
via Egeo 16
Torino, 10131
Italy