menubackend library submenus

ok, let me start with your last question:
Within the pwm example:
In line 67 replace
M2tk m2(&top_el_pin_list, m2_es_arduino, m2_eh_4bs, m2_gh_lc);
with
M2tk m2(&top_el_pin_list, m2_es_arduino_serial, m2_eh_4bs, m2_gh_arduino_serial);

This will use serial.print and you can see the menu on the serial monitor.
(hey, thats a really cool feature, isn't it... 8) )

I will answer the remaining questions in another post.

Oliver

ok, then, here is my boy, girl,... example. Very simplified and reduced to one screen.

#include <LiquidCrystal.h>
#include "M2tk.h"
#include "m2ghlc.h"

LiquidCrystal lcd(12, 11, 5, 4, 3, 2);

uint8_t uiKeySelectPin = 10;
uint8_t uiKeyNextPin = 9;

uint8_t girl_color = 0;
uint8_t boy_color = 0;
uint8_t man_color = 0;

void fn_ok(m2_el_fnarg_p fnarg) {
  /* do something */
}

const char *fn_idx_to_color(uint8_t idx)
{
  switch(idx)
  {
    case 0: return "brown";
    case 1: return "blonde";
    case 2: return "red";
  }
  return "";
}


M2_LABEL(el_label1, NULL, "Boy:");
M2_COMBO(el_combo1, NULL, &boy_color, 3, fn_idx_to_color);

M2_LABEL(el_label2, NULL, "Girl: ");
M2_COMBO(el_combo2, NULL, &girl_color, 3, fn_idx_to_color);

M2_LABEL(el_label3, NULL, "Man: ");
M2_COMBO(el_combo3, NULL, &man_color, 3, fn_idx_to_color);

M2_BUTTON(el_ok, NULL, " ok ", fn_ok);

M2_LIST(list) = { 
    &el_label1, &el_combo1, 
    &el_label2, &el_combo2,  
    &el_label3, &el_combo3,  
    &el_ok 
};

M2_GRIDLIST(list_element, "c2",list);
M2tk m2(&list_element, m2_es_arduino, m2_eh_4bs, m2_gh_lc);

void setup() {
  m2_SetLiquidCrystal(&lcd, 16, 4);
  m2.setPin(M2_KEY_SELECT, uiKeySelectPin);
  m2.setPin(M2_KEY_NEXT, uiKeyNextPin);
}

void loop() {
  m2.checkKey();
  if ( m2.handleKey() )
    m2.draw();
  m2.checkKey();
}

The result will be stored in the three variables:

uint8_t girl_color = 0;
uint8_t boy_color = 0;
uint8_t man_color = 0;

I am not sure if i should repeat what is written in the reference manual. Maybe you should have a look at M2_GRIDLIST, which arranges the element into a matrix and M2_COMBO which does most of the work here.
So please let me know if there is something i can explain into more detail.

Remember: You can still use the serial monitor by replacing the event handler (eh) and the graphics handler (eh) as described in my last post.

Oliver

so, finally, here is the example with submenu:

#include <LiquidCrystal.h>
#include "M2tk.h"
#include "m2ghlc.h"

LiquidCrystal lcd(12, 11, 5, 4, 3, 2);

uint8_t uiKeySelectPin = 10;
uint8_t uiKeyNextPin = 9;

uint8_t girl_color = 0;
uint8_t boy_color = 0;
uint8_t man_color = 0;

M2_EXTERN_GRIDLIST(el_main_menu);
M2tk m2(&el_main_menu, m2_es_arduino, m2_eh_4bs, m2_gh_lc);

void fn_ok(m2_el_fnarg_p fnarg) {
  /* color changed, do something */
  
  /* then jump back to the main menu */
  m2.setRoot(&el_main_menu);
}

const char *fn_idx_to_color(uint8_t idx)
{
  switch(idx)
  {
    case 0: return "brown";
    case 1: return "blonde";
    case 2: return "red";
  }
  return "";
}

/* boy submenu */
M2_LABEL(el_label1, NULL, "Boy:");
M2_COMBO(el_combo1, NULL, &boy_color, 3, fn_idx_to_color);
M2_BUTTON(el_ok1, NULL, " ok ", fn_ok);
M2_LIST(list1) = { 
    &el_label1, &el_combo1, 
    &el_ok1 
};
M2_GRIDLIST(el_grid1, "c2",list1);

/* girl submenu */
M2_LABEL(el_label2, NULL, "Girl:");
M2_COMBO(el_combo2, NULL, &girl_color, 3, fn_idx_to_color);
M2_BUTTON(el_ok2, NULL, " ok ", fn_ok);
M2_LIST(list2) = { 
    &el_label2, &el_combo2, 
    &el_ok2 
};
M2_GRIDLIST(el_grid2, "c2",list2);

/* man submenu */
M2_LABEL(el_label3, NULL, "Man:");
M2_COMBO(el_combo3, NULL, &man_color, 3, fn_idx_to_color);
M2_BUTTON(el_ok3, NULL, " ok ", fn_ok);
M2_LIST(list3) = { 
    &el_label3, &el_combo3, 
    &el_ok3 
};
M2_GRIDLIST(el_grid3, "c2",list3);

/* main menu */
M2_ROOT(el_boy_button, NULL, "Boy", &el_grid1);
M2_ROOT(el_girl_button, NULL, "Girl", &el_grid2);
M2_ROOT(el_man_button, NULL, "Man", &el_grid3);
M2_LIST(list_main_menu) = { 
    &el_boy_button,  
    &el_girl_button,   
    &el_man_button,  
};
M2_GRIDLIST(el_main_menu, "c1",list_main_menu);

void setup() {
  m2_SetLiquidCrystal(&lcd, 16, 4);
  m2.setPin(M2_KEY_SELECT, uiKeySelectPin);
  m2.setPin(M2_KEY_NEXT, uiKeyNextPin);
}

void loop() {
  m2.checkKey();
  if ( m2.handleKey() )
    m2.draw();
  m2.checkKey();
}

This example defines four different menus (or dialog boxes). You can switch between these dialog boxes by using the M2_ROOT button or the m2.setRoot procedure. Calling a sub menu is nothing else than assigning a new dialog box with M2_ROOT. For the jump back to the main menu, the callback procedure of the ok button uses "m2.setRoot()".

hope this helps... again, let me know if you need more examples.

Oliver

Great Oliver, thanks I'll give that a go.
So I can change easily to serial from you lcd, however what if I want to use a different lcd to the one in your library.
I declare my lcd here:

Adafruit_PCD8544 display = Adafruit_PCD8544(52, 51, 50, 48, 49);

So I need to replace:

m2_gh_lc

but Im not sure with what... it isnt declared anywhere else in your code, and I assume

m2_es_arduino

can stay the same if I change the lcd?
And lastly:

m2_SetLiquidCrystal(&lcd, 16, 4);
[code]
?

[/code]

ooooohhhhhhh

To my knowledge menubackend only supports character lcds via LiquidCrystal, so i assumed, that your display is a character display. I mean, as far as i know, menubackend will also not work with the Adafruit PCD8455 lib for graphics lcd. So far M2tklib is the only menu lib which supports graphics lcds. However, m2tklib does not support the Adafruit PCD8455 library. The reason is simple: There are a large number of graphics libs out there and I can not write interfaces to all of them. Instead: M2tklib supports U8glib, which supports your PCD8455 display. So, to use m2tklib (again: which is probably the only Arduino menu lib for graphics displays) you probably need to download and use u8glib (Google Code Archive - Long-term storage for Google Code Project Hosting.) instead of the Adafruit PCD8455 library.
Other option is to write the interface for the Adafruit lib, but this is a little bit complicated and poorly documented.

After this, you have to modify setup() and loop() procedures of the examples:

// Arduino setup procedure (called only once)
void setup() {
  // Connect u8glib with m2tklib
  m2_SetU8g(u8g.getU8g(), m2_u8g_box_icon);

  // Assign u8g font to index 0
  m2.setFont(0, u8g_font_7x13);

  // Setup keys
  m2.setPin(M2_KEY_SELECT, uiKeySelectPin);
  m2.setPin(M2_KEY_NEXT, uiKeyDownPin);
}

// Arduino loop procedure
void loop() {
  m2.checkKey();
  if ( m2.handleKey() ) {
    u8g.firstPage();  
    do {
      draw();
    } while( u8g.nextPage() );
  }
}

See also the tutorial here:
http://code.google.com/p/m2tklib/wiki/t02u8g

And the reference page for the u8glib binding for m2tklib:
http://code.google.com/p/m2tklib/wiki/u8gref

And finally, you need to choose a font for your display from here:
http://code.google.com/p/u8glib/wiki/fontsize

well... let me conclude this:

  • you own a graphics display
  • m2tklib supports graphics libs
  • m2tklib does not support the specific Adafruit GFX lib
  • m2tklib supports PCD8455 based displays via u8glib

Oliver

Haha! Oliver you are monopolizing the graphic lcd/menu industry with your libraries!
OK so I am using the nokia 5510 display from sparkfun, and you say that your u8_glib library supports that, then I have no issue using your library if it will work with your menu system. I have used menuBackend with that adafruit library, so it does seem to support it - I was doing it like this:

void menuChangeEvent(MenuChangeEvent changed)
{
  char string[30];
  string[0] = '\0';
  strcat(string, ">");
  strcat(string, changed.to.getLeft()->getName());
  strcat(string, ">");
  strcat(string, changed.to.getName()); 
  display.clearDisplay();   // clears the screen and buffer
  display.setCursor(0,0);
  display.println(string);
  display.display();

}

However thats just for info... I thought there may have been an equivelent for your menu library, but not bothered to use yours, because yours supports using a sub menu system.
i already have u8_glib downloaded and in my set of libraries, so I will set up my lcd to work with u8_glib then and then try out your boy/girl example.
In terms of that then, if I take your girl/boy example and adjust it to your newest setup()/loop() functions then it should work for my lcd...?

To initialize the lcd with u8_glib, the only line I can see that is close is:

U8GLIB_PCD8544 u8g(13, 11, 10, 9, 8);                    // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, Reset = 8

which seems like the right one, so i just change the pin numbers, use your setup/loop and bingo, I can see how your boy/girl example works... I'll get on with that then
Cheers
A

EDIT:
I notice you use .checkKey() to see if one of the two buttons has been pressed, can I use a potentiometer/rotary encoder to go up and down, rather than a button?

To initialize the lcd with u8_glib, the only line I can see that is close is:
Code:

U8GLIB_PCD8544 u8g(13, 11, 10, 9, 8);                    // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, Reset = 8

which seems like the right one, so i just change the pin numbers, use your setup/loop and bingo, I can see how your boy/girl example works...

Yes, ... hopefully

I notice you use .checkKey() to see if one of the two buttons has been pressed, can I use a potentiometer/rotary encoder to go up and down, rather than a button?

checkKey() calls an event source, which could analyse digital pins or a rotary encoder. However, I have not yet written the event source for a rotary encoder, but i added an enhancement request on the m2tklib project.

Oliver

Edit: Ensure to use m2tklib for u8glib. Also delete any other version before installing m2tklib for u8glib.

olikraus:
Hi

to my research, the author of MenuBackend has not been aktive since 4 months. Another problem is, that there are several menu libs out there. Several weeks ago, i collected some of them:

Library Name: LCDMenu2
Download: http://arduino.cc/forum/index.php/topic,73816.0.html

Library Name: LCDMenu
Download: http://arduino.cc/forum/index.php/topic,96104.0.html

Library Name: MenuBackend
Download: http://wiring.uniandes.edu.co/source/trunk/wiring/firmware/libraries/MenuBackend/

Library Name: LCDMenu
Download: http://www.metalgecko.com/arduino/LCDMenu.zip (does not exist any more)

Library Name: Arduino_LCD_Menu
Download: GitHub - DavidAndrews/Arduino_LCD_Menu: This library creates menu systems primarily useful for 16x2 or 16x4 LCD displays.

Library Name: MENWIZ
Download: GitHub - brunialti/MENWIZ: ARDUINO LCD menu library: short user code to manage complex menu structures

Library Name: phi_prompt
Download: Phi_prompt | Liudr's Blog

Library Name: MenuSample
Download: Arduino WiFly Driver - Browse /MenuSample at SourceForge.net

Library Name: M2tklib
Download: Google Code Archive - Long-term storage for Google Code Project Hosting.

Not too many Arduino users add displays. And only some of them decide to use a menu lib.
Of course i would suggest to use "m2tklib" (as author of the lib :wink: )
"m2tklib" can call sub menues.

Oliver

Wish I had this before I started out with menubackend!

Anyway in case it's of use I have created a menu using menubackend, not without problems using menubackend getBefore() in fact all getX() option won't compile but I did create a menu like so:

CONFIGURE (0)
CONFIG HEATER (1)
HEATER ON (2)
HEATER OFF (2)
HEATER DISABLE (2)
EXIT (2)
EXIT (1)
EXIT (0)

My problem was telling it to MoveToLevel(0) when I wanted to reset the position in the menu but it resets the board so I wrote a while loop to work it's wya back testing each element for an up or left option, if left that's leaving a submenu if up cycling through the current menus options. I link the 1st to the last menu element to create a loop.

Link is: menubackend moveToLevel(lvl) resets uno - #5 by system - Programming Questions - Arduino Forum

Oliver, does this line need replacing for u8_glib?

M2tk m2(&el_main_menu, m2_es_arduino, m2_eh_4bs, m2_gh_lc);

I have my program like this, and I downloaded the latest library for m2 with u8_glib, but I get an error

#include "M2tk.h"
#include "m2ghu8g.h"
#include "U8glib.h"
U8GLIB_PCD8544 u8g(13, 11, 10, 9, 8);                    // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, Reset = 8
//Adafruit_PCD8544 display = Adafruit_PCD8544(52, 51, 50, 48, 49);

uint8_t uiKeySelectPin = 10;
uint8_t uiKeyNextPin = 9;

uint8_t girl_color = 0;
uint8_t boy_color = 0;
uint8_t man_color = 0;

M2_EXTERN_GRIDLIST(el_main_menu);
M2tk m2(&el_main_menu, m2_es_arduino, m2_eh_4bs, m2_gh_u8g_bf);

void fn_ok(m2_el_fnarg_p fnarg) {
  /* color changed, do something */
  
  /* then jump back to the main menu */
  m2.setRoot(&el_main_menu);
}

const char *fn_idx_to_color(uint8_t idx)
{
  switch(idx)
  {
    case 0: return "brown";
    case 1: return "blonde";
    case 2: return "red";
  }
  return "";
}

/* boy submenu */
M2_LABEL(el_label1, NULL, "Boy:");
M2_COMBO(el_combo1, NULL, &boy_color, 3, fn_idx_to_color);
M2_BUTTON(el_ok1, NULL, " ok ", fn_ok);
M2_LIST(list1) = { 
    &el_label1, &el_combo1, 
    &el_ok1 
};
M2_GRIDLIST(el_grid1, "c2",list1);

/* girl submenu */
M2_LABEL(el_label2, NULL, "Girl:");
M2_COMBO(el_combo2, NULL, &girl_color, 3, fn_idx_to_color);
M2_BUTTON(el_ok2, NULL, " ok ", fn_ok);
M2_LIST(list2) = { 
    &el_label2, &el_combo2, 
    &el_ok2 
};
M2_GRIDLIST(el_grid2, "c2",list2);

/* man submenu */
M2_LABEL(el_label3, NULL, "Man:");
M2_COMBO(el_combo3, NULL, &man_color, 3, fn_idx_to_color);
M2_BUTTON(el_ok3, NULL, " ok ", fn_ok);
M2_LIST(list3) = { 
    &el_label3, &el_combo3, 
    &el_ok3 
};
M2_GRIDLIST(el_grid3, "c2",list3);

/* main menu */
M2_ROOT(el_boy_button, NULL, "Boy", &el_grid1);
M2_ROOT(el_girl_button, NULL, "Girl", &el_grid2);
M2_ROOT(el_man_button, NULL, "Man", &el_grid3);
M2_LIST(list_main_menu) = { 
    &el_boy_button,  
    &el_girl_button,   
    &el_man_button,  
};
M2_GRIDLIST(el_main_menu, "c1",list_main_menu);

// Arduino setup procedure (called only once)
void setup() {
  // Connect u8glib with m2tklib
  m2_SetU8g(u8g.getU8g(), m2_u8g_box_icon);

  // Assign u8g font to index 0
  m2.setFont(0, u8g_font_7x13);

  // Setup keys
  m2.setPin(M2_KEY_SELECT, uiKeySelectPin);
  m2.setPin(M2_KEY_NEXT, uiKeyDownPin);
}

// Arduino loop procedure
void loop() {
  m2.checkKey();
  if ( m2.handleKey() ) {
    u8g.firstPage();  
    do {
      draw();
    } while( u8g.nextPage() );
  }
}

sketch_jul17a.cpp:2:21: error: m2ghu8g.h: No such file or directory
sketch_jul17a:14: error: 'm2_gh_u8g_bf' was not declared in this scope
sketch_jul17a.cpp: In function 'void setup()':
sketch_jul17a:78: error: 'm2_u8g_box_icon' was not declared in this scope
sketch_jul17a:78: error: 'm2_SetU8g' was not declared in this scope
sketch_jul17a:85: error: 'uiKeyDownPin' was not declared in this scope
sketch_jul17a.cpp: In function 'void loop()':
sketch_jul17a:94: error: 'draw' was not declared in this scope

i.e i dont think it can find the libraries?

a.mlw.walker:
Oliver, does this line need replacing for u8_glib?

M2tk m2(&el_main_menu, m2_es_arduino, m2_eh_4bs, m2_gh_lc);

Yes: Please replace m2_gh_lc with m2_gh_u8g_bf (or one of the other u8g graphics handler)

Regarding the compile problem:
The latest version of m2tklib for u8glib is here:
http://code.google.com/p/m2tklib/downloads/detail?name=m2tklib_arduino_u8g_1.08.zip
U8glib requires another download (only for AVR - none Arduino - there is a combined zip)

Usually the best is to remove the old m2tklib folder and unzip the version above.

Oliver

Ah yes, new library means everything has compiled.
nice...

Time for me to kick menubackend out of my prog. I'm not convinced it's working properly given the problems I've had with it.

Time to read up on m2tklib at Google Code Archive - Long-term storage for Google Code Project Hosting.

Time to read up on m2tklib at Google Code Archive - Long-term storage for Google Code Project Hosting.

After all the threads, i see that a menu lib is difficult to handle (also i think it has a simple concept). I did my best to add tutorial pages to the wiki, but i also see that there is still a lot of discussion required. I am not sure how to improve this. Let me know if something is missing... and do not hestitate to ask directly...

Oliver

dannix, I had the same problem, built a huge menu, couldnt get it to work, and now turning to this option. Seems like it has much more functionality just trying to learn how to use its features

olikraus:

Time to read up on m2tklib at Google Code Archive - Long-term storage for Google Code Project Hosting.

After all the threads, i see that a menu lib is difficult to handle (also i think it has a simple concept). I did my best to add tutorial pages to the wiki, but i also see that there is still a lot of discussion required. I am not sure how to improve this. Let me know if something is missing... and do not hestitate to ask directly...

Oliver

Hi, I've only tried menubackend and menu that came with the IDE I don't like the submenus on menu, menubackend I got a working menu with submenus but most of the functions don't work. What I'm after is a char LCD scrolling top to bottom menu with submenus (like your PWM pin example) But I couldn't use .....getBefore().getName() etc they don't compile so I had no way to work out what to display as the before and after items. I'm hoping your structure does what it says, it's much better documented example wise despite what you said above. There is only one example for menubackend, most of it's feature are not used or exampled.

Many thanks for the offer of assistance, It's great you release the library in the first place! I'll try myself and post if I need to :smiley:

a.mlw.walker:
dannix, I had the same problem, built a huge menu, couldnt get it to work, and now turning to this option. Seems like it has much more functionality just trying to learn how to use its features

Well, working functions is a start! reading this thread I noticed the GLCD support in m2tklib. I don't need it now, but I will sometime later :wink:

I'm glad it wasn't just me. I'm newish to this arduino and I normally program in Perl so not having dynamic memory etc I thought it could be me using menubackend wrong but there is to many posts I've seen with similar issues when it comes to anything beyond a basic list of menu items.

I'll let you know how I get on with m2tklib

Well, working functions is a start! reading this thread I noticed the GLCD support in m2tklib.

Please note that I was informed about a bug in M2tklib for GLCD recently. I have released a new version of M2tklib for GLCD today.

Oliver

olikraus:

Well, working functions is a start! reading this thread I noticed the GLCD support in m2tklib.

Please note that I was informed about a bug in M2tklib for GLCD recently. I have released a new version of M2tklib for GLCD today.

Oliver

I'm using LiquidCrystal with a shift register attached LCD. I've hit my first problem though and I suspect it is because of the shift register:

error: cannot convert 'LiquidCrystal_SR*' to 'LiquidCrystal*' for argument '1' to 'void m2_SetLiquidCrystal(LiquidCrystal*, uint8_t, uint8_t)'

Don't read too much into the code, top bit only really needed as I've edited the menubackend code I had.

Question. I have 3 buttons up, down & select , which you have no handler for, I thought no problem I can use SetKey() in my ISR? this is ok I assume?

//DEBUG
#include <MemoryFree.h> 
int tempMemCount = 0;
//

/*LCD*/
#include <LCD.h>
#include <LiquidCrystal_SR.h>      // ShiftRegister LCD
LiquidCrystal_SR iLCD(10, 11, 12); //Data,Clk,Enable.
//END LCD

//MENU SETUP
#include "M2tk.h"
#include "utility/m2ghlc.h"
//initialize menu
M2_LABEL(hello_world_label, NULL, "Hello World!");
M2tk m2(&hello_world_label, NULL, NULL, m2_gh_lc);
//initialize menuitems


unsigned long menuTimer = millis();              
byte timerEnable = 0;
//END MENU  




//INTERRUPT BUTTONS
const int pin = 13;  // test for interrupt
const int buttonPin = A0; // buttons can be read here
volatile byte buttonAct = 0; // flag, follow button press
volatile int buttonValue = 0; // button pressed analogue value 
volatile int buttonPressed = 0;  // which button was pressed
volatile byte lastButtonPressed = 0; // prev button pressed
volatile byte state = LOW; // state of led on pin13
volatile byte lastState = HIGH; // unused?




void setup(){
  //MENU SETUP
  m2_SetLiquidCrystal(&iLCD, 20, 4);      //   <<<<<<------------- ERROR this line

  //configure menu
 
  //END MENU SETUP
  Serial.begin(38400);
  Serial.println(F("STARTED"));
  pinMode(pin, OUTPUT);
  attachInterrupt(0, readButtons, RISING);

  iLCD.begin(20,4);               // initialize the lcd
  delay(400); // wait to start lcd writing
  iLCD.home ();                   // go home
  iLCD.print(F("Button Interrupt"));

  Serial.print(F("freeMemory() reports at startup "));
  Serial.println( freeMemory() );

}
void buttonStat(){ 
  Serial.print(buttonPressed); 
  Serial.print(" ");
  Serial.println(lastButtonPressed);
}
void loop(){

  if(timerEnable == 1 && millis() - menuTimer >=8000){  //in the middle of something, set menuTimer = 0 to disable and drop timerEnable
    Serial.print(F("freeMemory() reports "));
    Serial.println( freeMemory() );
    Serial.println(F("Timer Clear........."));

    /*  menu.moveToLevel(1); this resets the uno????*/

 // go back to root of menu here




    timerEnable = 0;
    iLCD.clear();                   // go home
    iLCD.print(F("Button Interrupt"));
    delay(60);
    buttonAct = 0;
  }

  if(buttonAct == 1){ //buttonAct eq 1 when interrupt received
    buttonAct = 0;
    navMenu();
  }
  //lastButtonPressed = 0;
  delay(100);

  tempMemCount++;
  if(tempMemCount > 9){ //once a sec will do
    Serial.print(F("freeMemory() reports "));
    Serial.println( freeMemory() );
   
    tempMemCount = 0;

    }
}



void readButtons(){
  state = !state;
  digitalWrite(pin, state);
  /*   511 : none | 614 : up | 768 : down | 1023 : select   */
  lastButtonPressed = buttonPressed;

  buttonValue = analogRead(buttonPin);
  if(buttonValue >= 900) {
    buttonPressed = 3;
  }
  else if(buttonValue >= 700){    
    buttonPressed = 2;
  }
  else if(buttonValue >= 600){    
    buttonPressed = 1;
  }
  buttonAct = 1;
  Serial.print(buttonPressed);
  Serial.print(" ");
  Serial.println(buttonValue);

}

void navMenu(){
  //MenuItem currentMenu=menu.getCurrent();

  switch (buttonPressed){
  case 3: //select     

   /* 
   if (menu.getCurrent().getRight() != 0){  //The current item has an element right, it's a sub menu so nav right.

      menu.moveRight();
      Serial.print(menu.getCurrent().getName());
      Serial.println(F("has menu right"));
    }
    else{  //otherwise, menu has no child and has been pressed. enter the current menu
      menu.use();
    }
    */
    break;
  case 2: //down
    //menu.moveDown();
    break;     
  case 1: //up
    //menu.moveUp();
    break;     
  }
}
m2_SetLiquidCrystal(&iLCD, 20, 4);      //   <<<<<<------------- ERROR this line

The problem is, that LiquidCrystal_SR is the same type as LiquidCrystal. The warning is correct and it will not work.
M2tklib currently only supports output to LiquidCrystal. Howver, other libs could be added also, but M2tklib needs another graphics output handler. The existing LCD output code might serve as a template: Google Code Archive - Long-term storage for Google Code Project Hosting.

Question. I have 3 buttons up, down & select , which you have no handler for, I thought no problem I can use SetKey() in my ISR? this is ok I assume?

It is no problem to have only three buttons. And yes, you probably can use setKey within an ISR (it has not been fully tested by me).

Oliver

olikraus:

m2_SetLiquidCrystal(&iLCD, 20, 4);      //   <<<<<<------------- ERROR this line

The problem is, that LiquidCrystal_SR is the same type as LiquidCrystal. The warning is correct and it will not work.
M2tklib currently only supports output to LiquidCrystal. Howver, other libs could be added also, but M2tklib needs another graphics output handler. The existing LCD output code might serve as a template: Google Code Archive - Long-term storage for Google Code Project Hosting.

Question. I have 3 buttons up, down & select , which you have no handler for, I thought no problem I can use SetKey() in my ISR? this is ok I assume?

It is no problem to have only three buttons. And yes, you probably can use setKey within an ISR (it has not been fully tested by me).

Oliver

I tired renaming LiquidCrystal to LiquidCrystal_SR Google Code Archive - Long-term storage for Google Code Project Hosting. renaming it as m2ghlc_sr but it hit another strange error "error: __c causes a section type conflict" it was flagged against my Serial.print messages that had flash strings in them like

Serial.print(F("freeMemory() reports "));

I had a look at MENWIZ which also supports LiquidCrystal, but all variations of ie shift register, I2C etc maybe there is some confusion over the names LiquidCrystal vs this "new" LiquidCrystal that I'm using?