Ejemplo n.º 1
0
/* ******************************************************************** *
 * private: go in a menu item and start function
 * @param
 * @return
 * ******************************************************************** */
void	LCDMenuLib::goEnter()
/* ******************************************************************** */
{
	LCDMenu *tmp;	// declare opjects
	uint8_t name		= function;
	uint8_t j			= 0;
	
	if (function == _LCDML_NO_FUNC) { //check button lock		
		//check if element has childs
		if ((tmp = curMenu->getChild(curloc + curloc_correction())) != NULL) { // check child			
			goMenu(*tmp);					
			name = tmp->name;		

			//check if element has childs			
			if ((tmp = tmp->getChild(0)) != NULL) {			
				
				while ((tmp = tmp->getSibling(1)) != NULL)
				{
					if (bitRead(group_en, tmp->disp) || bitRead(control, _LCDML_control_disable_hidden)) {
						j++;
					}					
				}
			}

			if (j == 0) {				
				function = name;
				countChilds();
			}			
		}		
	}
}
Ejemplo n.º 2
0
/* ******************************************************************** *
 * public: display the current menu
 * @param
 * @return
 * ******************************************************************** */
void	LCDMenuLib::display()
/* ******************************************************************** */
{
	//declaration
	LCDMenu * tmp;
	uint8_t i = scroll;
	uint8_t maxi = (rows + scroll);
	char buffer[_LCDML_DISP_cfg_max_string_length];

	child_cnt = countChilds();	
	//check children
	if ((tmp = curMenu->getChild(i))) {
		if (!bitRead(control, _LCDML_control_search_display)) {
			//clear lcd
			display_clear();			
			//show menu structure
			do
			{				
				if (bitRead(group_en, tmp->disp)) {					
					strcpy_P(content[i-scroll], (char*)pgm_read_word(&(flash_table[tmp->name])));
					content_id[i-scroll] = tmp->name;
					i++;					
				}

			} while ((tmp = tmp->getSibling(1)) != NULL && i<maxi);
			bitSet(control, _LCDML_control_disp_update);			
		}
	}
	else { // no children
		goBack();
		// function can run ...		
		
	}
	setCursor();	
}
Ejemplo n.º 3
0
/* ******************************************************************** *
 * private: set cursor position
 * @param
 * @return
 * ******************************************************************** */
void	LCDMenuLib::setCursor()
/* ******************************************************************** */
{
	child_cnt = countChilds();	

	//save current cursor position
	cursor_pos = curloc - scroll;

	
	
	if (cursor_pos > child_cnt) {
		cursor_pos = child_cnt;
	}	
	
	bitSet(control, _LCDML_control_cursor_update);
}