Go Down

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

jbaum81

#365
Feb 06, 2013, 05:47 am Last Edit: Feb 06, 2013, 06:04 am by jbaum81 Reason: 1
Hello, First I want to thank you for an amazingly cool library, it has enhanced my project so much.

So here is what I'm running into I wonder if you might be able to help, I am a novice, but I manage.

I have a variable I use to set the number of identical menu options that control an array of variables, below is a sniplet of working code.

Code: [Select]
s1=menu.addMenu(MW_SUBMENU,r,F("Lights"));
     for (int count = 0; count < PWMs; count++){
       Serial.println(menuname);
       String current = "PWM" + String(count);
       s2=menu.addMenu(MW_SUBMENU,s1,F("PWM"));
         s3=menu.addMenu(MW_VAR,s2,F("Mode"));
           s3->addVar(MW_LIST,&PWM_Mode[count]);
             s3->addItem(MW_LIST,F("Auto"));
             s3->addItem(MW_LIST,F("On"));
             s3->addItem(MW_LIST,F("Off"));
         s3=menu.addMenu(MW_VAR,s2,F("Level"));
           s3->addVar(MW_AUTO_BYTE,&PWM_Level[count],0,100,5);
         s3=menu.addMenu(MW_VAR,s2,F("Soft"));
           s3->addVar(MW_AUTO_BYTE,&PWM_Soft[count],0,180,5);
         s3=menu.addMenu(MW_SUBMENU,s2,F("Schedule"));
             s4=menu.addMenu(MW_SUBMENU,s3,F("Start"));
               s5=menu.addMenu(MW_VAR,s4,F("Hour"));
                 s5->addVar(MW_AUTO_BYTE,&PWM_StartHH[count],0,23,1);
               s5=menu.addMenu(MW_VAR,s4,F("Minute"));
                 s5->addVar(MW_AUTO_BYTE,&PWM_StartMM[count],0,59,1);
             s4=menu.addMenu(MW_SUBMENU,s3,F("End"));
               s5=menu.addMenu(MW_VAR,s4,F("Hour"));
                 s5->addVar(MW_AUTO_BYTE,&PWM_EndHH[count],0,23,1);
               s5=menu.addMenu(MW_VAR,s4,F("Minute"));
                 s5->addVar(MW_AUTO_BYTE,&PWM_EndMM[count],0,59,1);
     }


This works great Except I would like to name the "s2=menu.addMenu(MW_SUBMENU,s1,F("PWM"));" PWM1, PWM2, PWM3 etc etc etc.. So I tried this.

Code: [Select]
s2=menu.addMenu(MW_SUBMENU,s1,F("PWM" + String(count)));

but the error I get is

"error: initializer fails to determine size of '__c"

I've read about string buffers but I get a little lost, I've tried to dig through the .cpp and .h files but can't make much sense of it.

Any Help you can provide would be great!, Thanks!

jbaum81

#366
Feb 06, 2013, 05:59 am Last Edit: Feb 06, 2013, 06:02 am by jbaum81 Reason: 1
On a side note,

I've found a way to make the Menwiz Lib work with the Adafruit I2c backpack.

You need the following:

Adafruit LiquidTWI2 library available here https://github.com/lincomatic/LiquidTWI2

Make these changes to MENWIZ.H

//#include <LCD.h>
and
//MW_LCD*  lcd;
 LiquidTWI2*  lcd;

Make this Change to MENWIZ.CPP

//lcd=(MW_LCD*)l;
 lcd=(LiquidTWI2*)l;

Make these changes to your sketch
//#include <LCD.h>
//#include <LiquidCrystal_I2C.h>
#include <LiquidTWI2.h>
and
//LiquidCrystal_I2C lcd(0x27, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE);
LiquidTWI2 lcd(0);

and
lcd.setMCPType(LTI_TYPE_MCP23008); // add this at the top of void setup()

Hope this helps someone.

--EDIT--
I found the MENWIZ lib changes in a blog that originally made them work with the LiquidTWI library, when trying to figure out how to make the Adafruit I2c backpack work with LiquidTWI I stumbled on their fork. I do not know the name, nor can I find the blog I found the original information on. My I'd give credit if I could find it.


brunialti

Hi guys. I'm back.
I've lost all the reply notifications, without any apparent reason.
I'll try to work on menwiz in order to implement some improvement as soon as possible.

I'm also working on a completely different  slim library implementing the notion of "watchdog" on any user variable.
In this new lib it is possible to create for any user defined variable some triggers, that is an action to be fired when the trigger conditions (>,=, <,null  for now) are verified. As many sketches are nothing else than a continuous control on some variable values, this lib let the user concentrate on the actions to be performed instead of the control logic, allowing very compact user code...
stay tuned !

Khalid

Hi,
I will be the one who will use your great library...:) Thank You for sharing :)

jbaum81

:D

Is Bump, against forum rules?

I was curious because I'm still stuck on the problem I've listed in a previous post.

Go Up