Помогите разобраться с библиотекой LCDMenuLib
- Войдите на сайт для отправки комментариев
Чт, 17/08/2017 - 20:32
Помогите разобраться с библиотекой
LCDMenuLib https://github.com/Jomelo/LCDMenuLib
не могу разобраться как сделать выход из меню
Плата arduino Due
Дисплей st7920
не могу разобраться как сделать выход из меню
Это не вопрос, а утверждение и ответить на него невозможно. Вот как бы Вы сами ответили? Ну, не может человек, ну, "принято к сведению". Или Вы думаете, тут сейчас полноценные курсы пользования библиотекой откроются?
Если хотите помощи, то поступите так:
1. Опубликуйте пример, который Вы пробовали и напишите
2. Хочу сделать так, а работает эдак, подскажите как победить.
В таком виде, Вам, возможно, помогут.
Здесь проект.(пока очень сырой)
https://cloud.mail.ru/public/29TE/nieSx3dBH
Так вот, как зайти в меню разобрался. Когда выхожу из меню и пытаюсь снова зайти в меню энкодер перестает работать. При входе в меню стартует не главная страница, а вложеное подменю. И проблемма с отоброжением русских шрифтов
Сделал управление твердотопливным котлом. Было с дисплеем 2004, все работае отлично ( меню было на другой библиотеке). Сейчас хочу сделать по симпатичней, с графическим дисплеем. Завис с этой библиотекой. Кстати попутно проблема с русскими шрифтами. Если редактирую что то в скетче, то после загрузки в ардуину эти шрифты не выбодятся, но если сохранить скетч, снова открыть и тутже загрузить в ардуину, то все шрифты отображаются нормально.
Да, не, ну Вы скетч здесь публикуйте (только правильно). Ну подумйте сами, кто полезет что-то скачивать, устанавливать.
скетч состоит из пяти файлов
вот основной сетч
Вот работа подменю
функция exit должна делать выход из меню
/* ===================================================================== * * * * DISPLAY SYSTEM * * * * ===================================================================== * * every "disp menu function" needs three functions * - void LCDML_DISP_setup(func_name) * - void LCDML_DISP_loop(func_name) * - void LCDML_DISP_loop_end(func_name) * * EXAMPLE CODE: void LCDML_DISP_setup(..menu_func_name..) { // setup // is called only if it is started // starts a trigger event for the loop function every 100 millisecounds LCDML_DISP_triggerMenu(100); } void LCDML_DISP_loop(..menu_func_name..) { // loop // is called when it is triggert // - with LCDML_DISP_triggerMenu( millisecounds ) // - with every button status change // check if any button is presed (enter, up, down, left, right) if(LCDML_BUTTON_checkAny()) { LCDML_DISP_funcend(); } } void LCDML_DISP_loop_end(..menu_func_name..) { // loop end // this functions is ever called when a DISP function is quit // you can here reset some global vars or do nothing } * ===================================================================== * */ // ********************************************************************* void LCDML_DISP_setup(LCDML_FUNC_information) // ********************************************************************* { // setup function u8g.setFont(_LCDML_DISP_font); u8g.firstPage(); do { u8g.drawStr( 0, 13, F("To close this")); u8g.drawStr( 0, 26, F("function press")); u8g.drawStr( 0, 39, F("any button or use")); u8g.drawStr( 0, 52, F("back button")); } while( u8g.nextPage() ); } void LCDML_DISP_loop(LCDML_FUNC_information) { // loop function, can be run in a loop when LCDML_DISP_triggerMenu(xx) is set // the quit button works in every DISP function without any checks; it starts the loop_end function if(LCDML_BUTTON_checkAny()) { // check if any button is presed (enter, up, down, left, right) // LCDML_DISP_funcend calls the loop_end function LCDML_DISP_funcend(); } } void LCDML_DISP_loop_end(LCDML_FUNC_information) { // this functions is ever called when a DISP function is quit // you can here reset some global vars or do nothing } // ********************************************************************* uint8_t g_func_timer_info = 0; // time counter (global variable) unsigned long g_timer_1 = 0; // timer variable (globale variable) void LCDML_DISP_setup(LCDML_FUNC_timer_info) // ********************************************************************* { // setup function char buf[20]; sprintf (buf, "wait %d secounds", 10); u8g.setFont(_LCDML_DISP_font); u8g.firstPage(); do { u8g.drawStr( 0, 13, buf); u8g.drawStr( 0, 26, F("or press back button")); } while( u8g.nextPage() ); g_func_timer_info = 10; // reset and set timer LCDML_DISP_triggerMenu(100); // starts a trigger event for the loop function every 100 millisecounds } void LCDML_DISP_loop(LCDML_FUNC_timer_info) { // loop function, can be run in a loop when LCDML_DISP_triggerMenu(xx) is set // the quit button works in every DISP function without any checks; it starts the loop_end function // this function is called every 100 millisecounds // this timer checks every 1000 millisecounds if it is called if((millis() - g_timer_1) >= 1000) { g_timer_1 = millis(); g_func_timer_info--; // increment the value every secound char buf[20]; sprintf (buf, "wait %d secounds", g_func_timer_info); u8g.setFont(_LCDML_DISP_font); u8g.firstPage(); do { u8g.drawStr( 0, 13, buf); u8g.drawStr( 0, 26, F("or press back button")); } while( u8g.nextPage() ); } // reset the initscreen timer LCDML_DISP_resetIsTimer(); // this function can only be ended when quit button is pressed or the time is over // check if the function ends normaly if (g_func_timer_info <= 0) { // end function for callback LCDML_DISP_funcend(); } } void LCDML_DISP_loop_end(LCDML_FUNC_timer_info) { // this functions is ever called when a DISP function is quit // you can here reset some global vars or do nothing } // ********************************************************************* void LCDML_DISP_setup(LCDML_FUNC_to_back) // ********************************************************************* { LCDML.goRoot(); } void LCDML_DISP_loop(LCDML_FUNC_to_back) { } void LCDML_DISP_loop_end(LCDML_FUNC_to_back) { // this functions is ever called when a DISP function is quit // you can here reset some global vars or do nothing } void LCDML_DISP_setup(LCDML_FUNC_to_exit) // ********************************************************************* { //LCDML.display(); //botton=0; virtualPosition=101; var=1; attachInterrupt(digitalPinToInterrupt(PinA), isr, LOW); } void LCDML_DISP_loop(LCDML_FUNC_to_exit) { // loop(); } void LCDML_DISP_loop_end(LCDML_FUNC_to_exit) { // this functions is ever called when a DISP function is quit // you can here reset some global vars or do nothing }очень сильно сомневаюсь, что кто-то захочет копаться в 600 строках кода, когда вы сами не в состоянии ясно обьяснить, что именно не работает. Тем более что библиотека, судя по всему, написана любителем усложнять простые вещи до неузнаваемости - у нас тут тоже есть такой.
Единственная ваша надежда. что найдется человек, уже разобравшийся с этой библиотекой...
так и интересуюсь. может кто сталкивался с этой библиотекой
А Вы примеры к библиотеке пробовали? Они не из 5-ти файлов - намного компактнее. Выделите проблему в обозримом по размеру примере. (пока всё это делаете - сами и решите всё, собственно так мы и работаем :)))