olikraus / m2tklib

Automatically exported from code.google.com/p/m2tklib
Other
49 stars 11 forks source link

cannot compile Menux2l example with Arduino 1.6.6 #156

Open ve3sjk opened 9 years ago

ve3sjk commented 9 years ago

I am trying to compile the menu example with arduino 1.6.6 and just keep getting errors.

this is the error i get, i have u8g latest, m2tklib latest for arduino installed.

In file included from C:\Users\sysop\Documents\Arduino\MenuX2L\MenuX2L.ino:29:0:

C:\Users\sysop\Documents\Arduino\libraries\M2tklib/utility/m2ghu8g.h:30:25: fatal error: utility/u8g.h: No such file or directory

include "utility/u8g.h"

here is the code i am trying to compile

'''

MenuX2L.pde

U8glib Example

m2tklib = Mini Interative Interface Toolkit Library

Copyright (C) 2013 olikraus@gmail.com

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.

*/

include // for itoa

include "U8glib.h"

include "M2tk.h"

include "utility/m2ghu8g.h"

// setup u8g object, please remove comment from one of the following constructor calls // IMPORTANT NOTE: The complete list of supported devices is here: http://code.google.com/p/u8glib/wiki/device

U8GLIB_ST7920_128X64_4X u8g(32, 30, 31);

//================================================= // Forward declaration of the toplevel element M2_EXTERN_ALIGN(top_el_x2l_menu); //================================================= // Define three user menus, just for demonstration.

M2_ROOT(el_mnu1_sel, "t1", "Menu 1 selected", &top_el_x2l_menu); M2_ALIGN(top_el_mnu1_sel, "-1|1W64H64", &el_mnu1_sel);

M2_ROOT(el_mnu2_sel, "t1", "Menu 2 selected", &top_el_x2l_menu); M2_ALIGN(top_el_mnu2_sel, "-1|1W64H64", &el_mnu2_sel);

M2_ROOT(el_mnu3_sel, "t1", "Menu 3 selected", &top_el_x2l_menu); M2_ALIGN(top_el_mnu3_sel, "-1|1W64H64", &el_mnu3_sel);

//================================================= uint8_t value = 0; char buf[20];

// define callback procedure, which returns a menu entry with a value const char *xmenu_value(uint8_t idx, uint8_t msg) {
if ( msg == M2_STRLIST_MSG_GET_STR ) { strcpy(buf, " Value: "); itoa((int)value, buf+strlen(buf), 10); return buf; } return ""; }

// define callback procedures which increment and decrement a value const char *xmenu_inc(uint8_t idx, uint8_t msg) { if ( msg == M2_STRLIST_MSG_SELECT ) { value++; } return ""; }

const char *xmenu_dec(uint8_t idx, uint8_t msg) { if ( msg == M2_STRLIST_MSG_SELECT ) { value--; } return ""; }

//================================================= // this is the overall menu structure for the X2L Menu

m2_xmenu_entry xmenudata[] = { { "Menu 1", NULL, NULL }, /* expandable main menu entry / { ".", NULL, xmenuvalue }, / The label of this menu line is returned by the callback procedure _/ { ". Inc", NULL, xmenuinc }, / This callback increments the value _/ { ". Dec", NULL, xmenudec }, / This callback decrements the value */ { "Menu 2", NULL, NULL }, { ". Sub 2-1", &top_el_mnu1_sel, NULL }, { ". Sub 2-2", &top_el_mnu2_sel, NULL}, { ". Sub 2-3", &top_el_mnu3_sel, NULL }, { NULL, NULL, NULL }, };

//================================================= // This is the main menu dialog box

// The first visible line and the total number of visible lines. // Both values are written by M2_X2LMENU and read by M2_VSB uint8_t el_x2l_first = 0; uint8_t el_x2l_cnt = 3;

// M2_X2LMENU definition // Option l4 = four visible lines // Option e15 = first column has a width of 15 pixel // Option W43 = second column has a width of 43/64 of the display width // Option F3 = select font 3 for the extra column (icons)

M2_X2LMENU(el_x2l_strlist, "l4e15W43F3", &el_x2l_first, &el_x2l_cnt, xmenu_data, 65,102,'\0'); M2_SPACE(el_x2l_space, "W1h1"); M2_VSB(el_x2l_vsb, "l4W2r1", &el_x2l_first, &el_x2l_cnt); M2_LIST(list_x2l) = { &el_x2l_strlist, &el_x2l_space, &el_x2l_vsb }; M2_HLIST(el_x2l_hlist, NULL, list_x2l); M2_ALIGN(top_el_x2l_menu, "-1|1W64H64", &el_x2l_hlist);

//================================================= // m2 object and constructor M2tk m2(&top_el_x2l_menu, m2_es_arduino_rotary_encoder, m2_eh_4bd, m2_gh_u8g_ffs);

//================================================= // Draw procedure, Arduino Setup & Loop

void draw(void) { m2.draw(); }

void setup(void) { // Connect u8glib with m2tklib m2_SetU8g(u8g.getU8g(), m2_u8g_box_icon);

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

// Assign icon font to index 3 m2.setFont(3, u8g_font_m2icon_7);

// Encoder m2.setPin(M2_KEY_SELECT, 37); m2.setPin(M2_KEY_ROT_ENC_A, 2); m2.setPin(M2_KEY_ROT_ENC_B, 3);

}

void loop() { // menu management m2.checkKey(); if ( m2.handleKey() != 0 ) { u8g.firstPage();
do { m2.checkKey(); draw(); } while( u8g.nextPage() ); } }

'''

andyfinity commented 8 years ago

Perhaps this bug has gone long enough without a solution. I don't have a clean solution, but I do have a workaround. u8g.h in the U8glib library (U8Glib/src/clib/u8g.h) is the file it's looking for, so however you want to tell m2ghu8g.h to find it should work. I just copied u8g.h to the place m2tklib is looking for it and everybody was happy.

tl;dr: copy u8g.h from U8glib. Seems to work great.