Ejemplo n.º 1
0
void Menu::enter(){
	MenuItem *current = currentItem();
	if(current->children != 0){
		// has children, can enter
		_menuLevel++;
		_menuStack[_menuLevel] = current->children;
		updateLCD(0);
#if DEBUG
		char buf[128];
		snprintf(buf,128,"Enter Menu:%s",current->title);
		Serial.println(buf);
#endif
	}else{
#if DEBUG
		char buf[128];
		snprintf(buf,128,"Choosed Menu %s, level:%d, index:%d",current->title, _menuLevel,_menuIndex[_menuLevel]);
		Serial.println(buf);
#endif
		if(current->callback){
			// call the menu callbacks.
			current->callback((void*)current);
		}
	}
}