Go Down

Topic: MENWIZ: yet another character lcd menu wizard library (Read 90446 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:

GnFlala

Hello.

I am trying to setup on an arduino mega 2560 with latest IDE (1.6.0) the 1.3.2 beta menwiz menu.

Everything is going smoothly with the menu.

I have some questions if someone can answer.

I am using the libraries that come with menwiz (liquidcrystal and buttons).






1.
Can i have the buttons repeatable after some time a user keeps pressing a button? according to the buttons library i should be able to do that using this.

Code: [Select]
#include <buttons.h>                                                                           // http://playground.arduino.cc/Code/Buttons . Buttons Library.
#include <MENWIZ.h>                                                                            // https://github.com/brunialti . MenWiz Library.
const byte UP_BUTTON_PIN = 25;                                                                 // Pin for the Up button.
Button UP_BUTTON;
#define ButtonTimer 1000                                                                       //After how many [ms] it is not a Push, its a Hold
#define ButtonRefresh 500                                                                      //After how many [ms] it will Refresh the Hold

void setup()
  UP_BUTTON.setMode(MemoryTimer);
  UP_BUTTON.setTimer(ButtonTimer);
  UP_BUTTON.setRefresh(ButtonRefresh);
  UP_BUTTON.assign(UP_BUTTON_PIN);

 menu.navButtons(UP_BUTTON,DOWN_BUTTON,LEFT_BUTTON,RIGHT_BUTTON,ESCAPE_BUTTON,CONFIRM_BUTTON);


for ease of reading i am only posting the settings for one button in this example. I guess this is somehow becoming custom buttons to menwiz and i cannot understand how to fix that.
The error i am getting is (i am using 6 buttons for menu navigation.
Quote
latest_mega_2560_rotary_fixed_relaystarted_gnf.ino: In function 'void setup()':
latest_mega_2560_rotary_fixed_relaystarted_gnf.ino:537:94: error: no matching function for call to 'menwiz::navButtons(Button&, Button&, Button&, Button&, Button&, Button&)'
latest_mega_2560_rotary_fixed_relaystarted_gnf.ino:537:94: note: candidates are:
In file included from latest_mega_2560_rotary_fixed_relaystarted_gnf.ino:88:0:
d:\Users\GnF\Documents\Arduino\libraries\MENWIZ-master/MENWIZ.h:228:12: note: void menwiz::navButtons(int, int, int, int, int, int)
   void     navButtons(int,int,int,int,int,int);
            ^
d:\Users\GnF\Documents\Arduino\libraries\MENWIZ-master/MENWIZ.h:228:12: note:   no known conversion for argument 1 from 'Button' to 'int'
d:\Users\GnF\Documents\Arduino\libraries\MENWIZ-master/MENWIZ.h:229:12: note: void menwiz::navButtons(int, int, int, int)
   void     navButtons(int,int,int,int);
            ^
d:\Users\GnF\Documents\Arduino\libraries\MENWIZ-master/MENWIZ.h:229:12: note:   candidate expects 4 arguments, 6 provided
Error compiling.
2.
Since i have some delay in my loop from the reading of some sensors (a constant one of 200ms and every 4 to 5 seconds goes up to 700ms) i have somehow unresponsive buttons. That is indeed been solved if the user keep repeating pressing the button, but i was wondering if someone knows a solution to this.


3.
I have temperature controled relay and i am using some sort of hysteresis. I have a starting temperature for a relay and a different stop temperature. I am adjusting the hysteresis (start and stop) from the menu but i wanted to have the  limits in the menu reading the start and stop. so lets say i have a relay that starts working at 23 celsius and stops at 26 (a heater is attached on this relay). When i go in the menu i wanted to have the min and max allowed numbers read from the floats. This is easily done by using this example.
The only problem is that if i change via the menu the TempLowStart and the TempLowStop the min and max keeps showning the numbers that are in the code and not the new and changed ones.
Code: [Select]
     
float TempLowStart=23, TempLowStop=26

void setup()
s2=menu.addMenu(MW_SUBMENU,s1,F("Temp(2,4)"));                                         //add a child (submenu) node to the root menu
          s3=menu.addMenu(MW_SUBMENU,s2,F("Minimum(2)"));                                      //add a child (submenu) node to the root menu
              s4=menu.addMenu(MW_VAR,s3,F("Start"));                                           //add a terminal node (that is "variable");
                s4->addVar(MW_AUTO_FLOAT,&TempLowStart,0.00,TempLowStop,0.5);                       //create a variable of type "float number"...
              s4=menu.addMenu(MW_VAR,s3,F("Stop"));                                            //add a terminal node (that is "variable");
                s4->addVar(MW_AUTO_FLOAT,&TempLowStop,TempLowStart,100.00,0.5);                        //create a variable of type "float number"...



Is there any way to always have the menu read the new values and not the ones stored in the code?


4.
I am using the EEPROM (load and save) and it is indeed quite handy. Is there any way to have the menu load from EEPROM the user saved settings/adjustments on every boot?
Lets say call this
Code: [Select]
s1->addVar(MW_ACTION,loadvar);                                                           //the act function as default will be called when enter button is pushed
in the setup once on every boot?




By the way great menu library.
I am really sorry for the bad use of english language, i do admit i am not very good at.

Thanks in advance

AlexLPD

Hi GnFlala....

2.- seek the blink without delay example and implement on your code... A delay stops the loop avoiding the processor make a mother thing, like read sensor. Once implemented you can read the sensors at 200ms without stop the loop.

3.-I have used the lib and at least for the main screen istn suppourted to print floats..
I use a function to convert the float to an char to be displayed latter.

4.-never done something like this, but It might be easily implemented by;
If(epprom variable =! 0)
Program variable = epprom variable.


Hope this helps.

Alex.

GnFlala

#504
Feb 27, 2015, 11:35 am Last Edit: Feb 27, 2015, 11:38 am by GnFlala
Hi GnFlala....

2.- seek the blink without delay example and implement on your code... A delay stops the loop avoiding the processor make a mother thing, like read sensor. Once implemented you can read the sensors at 200ms without stop the loop.

3.-I have used the lib and at least for the main screen istn suppourted to print floats..
I use a function to convert the float to an char to be displayed latter.

4.-never done something like this, but It might be easily implemented by;
If(epprom variable =! 0)
Program variable = epprom variable.


Hope this helps.

Alex.
2.

I am not actually using delay in my loop, but there is a delay when fetching data from DS18B20 sensor even when  sensors.setWaitForConversion(false);

every sensor adds a small pause in the loop until it gets the data. Still trying to investigate how to bypass this.


3.
i might have not understand what you mean. Really i am not a coder and i am far far far from it.
What i have is a relay that works with hysteresis like this


Code: [Select]
                                                                  /*----( Relay 2 Temperature Manual or Program with below than Temperature hysteresis to rise Temperature via turning on a heater lamp )----*/
  if (Manual_Auto_Relay_2==RELAY_Manual_OFF)
  {
    if (TempLowStop>=InsideTempC && InsideTempC<=TempLowStart && TempLowMem==1)
    {
      digitalWrite (LIGHT_HEATER_RELAY_2, RELAY_ON);
    }
    if (InsideTempC<=TempLowStart)
    {
      TempLowMem==1,
      digitalWrite (LIGHT_HEATER_RELAY_2, RELAY_ON);
    }
    if (InsideTempC>=TempLowStop)
    {
      TempLowMem==0,
      digitalWrite (LIGHT_HEATER_RELAY_2, RELAY_OFF);
    }
  }
  else
  {
    digitalWrite (LIGHT_HEATER_RELAY_2, RELAY_ON);
  }


and this

Code: [Select]
float TempLowStart=23, TempLowStop=26, TempLowMem=0;

void setup()
s2=menu.addMenu(MW_SUBMENU,s1,F("Temp(2,4)"));                                         //add a child (submenu) node to the root menu
          s3=menu.addMenu(MW_SUBMENU,s2,F("Minimum(2)"));                                      //add a child (submenu) node to the root menu
              s4=menu.addMenu(MW_VAR,s3,F("Start"));                                           //add a terminal node (that is "variable");
                s4->addVar(MW_AUTO_FLOAT,&TempLowStart,0.00,TempLowStop,0.5);                       //create a variable of type "float number"...
              s4=menu.addMenu(MW_VAR,s3,F("Stop"));                                            //add a terminal node (that is "variable");
                s4->addVar(MW_AUTO_FLOAT,&TempLowStop,TempLowStart,100.00,0.5);                        //create a variable of type "float number"...


so i have 2 floats the temp that starts a heater and the temp that the heater stops after it has started.

I have succesfully added those floats into the menu and i am able to change them. But in the menu for the floats you can issue what is the higher number you can use and the lower.
Code: [Select]
s4->addVar(MW_AUTO_FLOAT,&TempLowStart,0.00,TempLowStop,0.5);                       //create a variable of type "float number"...
so in this example i am parsing/reading the floating TempLowStart with a starting input number of 0.00, ending input number instead of 100.0 i used the other float TempLowStop and increment of 0.5 for each step.
That does work but if from the menu i change the TempLowStop then the menu does not read the change but the actual float that does not stay and is in the actual code.

So is there any way to make the menu read the changes that have been done outside the code? I am sure i am not typing this right. But the menu does not really change the code right? If it did then after a reboot the changes would still be there.

 
Code: [Select]
s4->addVar(MW_AUTO_FLOAT,&TempLowStart,0.00,TempLowStop,0.5);                       //create a variable of type "float number"...
s4->addVar(MW_AUTO_FLOAT,&TempLowStop,TempLowStart,100.00,0.5);                        //create a variable of type "float number"...


so is it possible for those menu items to read the changes they do? the first one to be able to read the changed float the second one did? and vice versa?

4.
Nice. i will try this and hopefully it works. Fully programmable on the fly. Set up and enjoy even after reboot.




Really thanks for your time and knowledge man. Really :D

 

AlexLPD

#505
Feb 27, 2015, 03:04 pm Last Edit: Feb 27, 2015, 04:35 pm by AlexLPD
Hi again.....

2.- there is not much delay on ds18.…., maybe the buttons are not debounce correctly. Try to use a lib for that. I recommend switch lib.

3.-I read you code again and It seems to me you need another float,  to the lib to work properly,  you have;

Float Temp_low_start =0;

And the lib uses two float for the same variable;

Float Them_low_start, tls =0;

As you can see the second is just the abrevattion and some were in the documentation say; the lib needs two variables for read the changue. So try to add a second var to each of your temp. 
In this same treath above is an entry on my name,  see the setup of the menu floats.
That will help you.


Quote
so it is possible to the menus read changue and viceversa?
I'm not sure Whath you are trying to do here. Each variable is indendependent.


I hope this helps.
If you upload you entire code I will try to complie to see Whath we can do.

Alex.
 

AlexLPD

Hi again.....

2.- there is not much delay on ds18.…., maybe the buttons are not debounce correctly. Try to use a lib for that. I recommend switch lib.

3.-I read you code again and It seems to me you need another float,  to the lib to work properly,  you have;

Float Temp_low_start =0;

And the lib uses two float for the same variable;

Float Them_low_start, tls =0;

As you can see the second is just the abrevattion and some were in the documentation say; the lib needs two variables for read the changue. So try to add a second var to each of your temp.  
In this same treath above is an entry on my have, see the setup of the menu floats. That will help you.


Quote
so it is possible to the menus read changue and viceversa?
I'm not sure Whath you are trying to do here. Each variable is indendependent.


I hope this helps.
If you upload you entire code I will try to complie to see Whath we can do.

Alex.

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