menu_redraw_required
is in every code segment, but all segments are in while loop, there is no chance to update menu_redraw_required
in different part code... My code is quite big now... but, when I enter to Menu_draw_func_men()
, cursor is turned on, I can move it. I also add Serial.print();
to be sure that I enter to this void Menu_draw_func_men();
. And I have always receive in console, a confirmation.
This is how I enter to selected screen from main menu:
if (digitalRead(KEY_SELECT) == LOW)
{
in_mmenu = false;
switch(menu_current)
{
case 0:
menu_redraw_required = 1;
key_choose();
break;
case 1:
menu_redraw_required = 1;
test_auto();
break;
case 2:
menu_redraw_required = 1;
test_man();
break;
case 3:
menu_redraw_required = 1;
pot_read_menu();
break;
case 4:
menu_redraw_required = 1;
other_options(); **//previously i was function_menu**
break;
}
All screen works properly on almost the same code, only last screen on menu have problem...
See pictures how it looks. I also add code to "wybor klucza" menu. Just print part.
How I enter to void_Menu_draw... works fine in others screens. Just small part for entering methode.
if(digitalRead(KEY_NEXT) == LOW)
{unit++; if(unit >= UNIT_ITEMS + 1)
{unit = 1;}
menu_redraw_required = 1; void_Menu_draw_keyMenu(); delay(200);}
and
void void_Menu_draw_keyMenu()
{
if ( menu_redraw_required != 0 ) {
u8g.firstPage();
do {
Menu_draw_keyMenu();
} while( u8g.nextPage() );
menu_redraw_required = 0;
}
}
void Menu_draw_keyMenu()
{
u8g.setFont(u8g_font_6x13);
u8g.drawStr(30, 0, "Wybor klucza");
u8g.drawStr(15, 15, "Zespol: "); u8g.drawStr(60, 15, menu_unit_num[unit - 1]);
u8g.drawStr(15, 30, "Numer mod: "); u8g.drawStr(78, 30, menu_mod_num[module - 1]);
u8g.drawStr(8, 50, "Modul to 2 silniki!");
if(menu_pos == 0 && in == false){u8g.setCursorFont(u8g_font_cursor); u8g.setCursorStyle(144); u8g.enableCursor(); u8g.setCursorPos(10,20);}
if(menu_pos == 1 && in == false){u8g.setCursorFont(u8g_font_cursor); u8g.setCursorStyle(144); u8g.enableCursor(); u8g.setCursorPos(10,35);}
if(menu_pos == 0 && in == true){u8g.setCursorFont(u8g_font_cursor); u8g.setCursorStyle(148); u8g.enableCursor(); u8g.setCursorPos(110,20);}
if(menu_pos == 1 && in == true){u8g.setCursorFont(u8g_font_cursor); u8g.setCursorStyle(148); u8g.enableCursor(); u8g.setCursorPos(110,35);}
}
I show you 2 more codes. There are the same, this one void_Menu_draw_test_man works, this one Menu_other_options not. Notice that I change name from functions_men to other_option, just to be sure that name don't cause this issue. I aleso update u8glib to last version. I try use u8g2 library but i will have to change almost everything...
void test_man()
{
menu_redraw_required = 1; void_Menu_draw_test_man();
while(digitalRead(KEY_BACK) == HIGH)
{
if(digitalRead(KEY_PREV) == LOW){menu_pos = 1; menu_redraw_required = 1; void_Menu_draw_test_man(); delay(200);}
if(digitalRead(KEY_NEXT) == LOW){menu_pos = 0; menu_redraw_required = 1; void_Menu_draw_test_man(); delay(200);}
}
menu_redraw_required = 1;
u8g.disableCursor();
in_mmenu = true;
}
void void_Menu_draw_test_man()
{
if ( menu_redraw_required != 0 ) {
u8g.firstPage();
do {
Menu_draw_test_man();
} while( u8g.nextPage() );
menu_redraw_required = 0;
}
}
void Menu_draw_test_man()
{
u8g.setFont(u8g_font_6x13);
u8g.drawStr(40, 0, "Funkcje");
u8g.drawStr(15, 15, "Zerowanie modulu");
u8g.drawStr(15, 30, "Modul na max");
if(menu_pos == 0){u8g.setCursorFont(u8g_font_cursor); u8g.setCursorStyle(144); u8g.enableCursor(); u8g.setCursorPos(10,20);}
if(menu_pos == 1){u8g.setCursorFont(u8g_font_cursor); u8g.setCursorStyle(144); u8g.enableCursor(); u8g.setCursorPos(10,35);}
u8g.setPrintPos(5, 50); u8g.print("R: "); u8g.print(pot_R , 2); u8g.print(" L: "); u8g.print(pot_L , 2);
}
and second
void other_options()
{
menu_redraw_required = 1; void_Menu_other_options();
while(digitalRead(KEY_BACK) == HIGH)
{
if(digitalRead(KEY_PREV) == LOW){menu_pos = 1; menu_redraw_required = 1; void_Menu_other_options(); delay(200);}
if(digitalRead(KEY_NEXT) == LOW){menu_pos = 0; menu_redraw_required = 1; void_Menu_other_options(); delay(200);}
}
menu_redraw_required = 1;
u8g.disableCursor();
in_mmenu = true;
}
void void_Menu_other_options()
{
if ( menu_redraw_required != 0 ) {
u8g.firstPage();
do {
Menu_other_options();
} while( u8g.nextPage() );
menu_redraw_required = 0;
}
}
void Menu_other_options()
{
u8g.setFont(u8g_font_6x13);
u8g.drawStr(40, 0, "Funkcje");
u8g.drawStr(15, 15, "Zerowanie modulu");
u8g.drawStr(15, 30, "Modul na max");
if(menu_pos == 0){u8g.setCursorFont(u8g_font_cursor); u8g.setCursorStyle(144); u8g.enableCursor(); u8g.setCursorPos(10,20);}
if(menu_pos == 1){u8g.setCursorFont(u8g_font_cursor); u8g.setCursorStyle(144); u8g.enableCursor(); u8g.setCursorPos(10,35);}
u8g.setPrintPos(5, 50); u8g.print("R: "); u8g.print(pot_R , 2); u8g.print(" L: "); u8g.print(pot_L , 2);
}